|
Lines 75-81
typedef struct {
Link Here
|
| 75 |
} HandlerContext; |
75 |
} HandlerContext; |
| 76 |
|
76 |
|
| 77 |
static gboolean lock_screen(void); |
77 |
static gboolean lock_screen(void); |
| 78 |
static gboolean verify_running(const char * display_manager, const char * executable); |
78 |
static gboolean verify_running(const char * display_manager, const char * executable, const char * proc_dm); |
| 79 |
static void logout_clicked(GtkButton * button, HandlerContext * handler_context); |
79 |
static void logout_clicked(GtkButton * button, HandlerContext * handler_context); |
| 80 |
static void change_root_property(GtkWidget* w, const char* prop_name, const char* value); |
80 |
static void change_root_property(GtkWidget* w, const char* prop_name, const char* value); |
| 81 |
static void shutdown_clicked(GtkButton * button, HandlerContext * handler_context); |
81 |
static void shutdown_clicked(GtkButton * button, HandlerContext * handler_context); |
|
Lines 101-107
static gboolean lock_screen(void)
Link Here
|
| 101 |
} |
101 |
} |
| 102 |
|
102 |
|
| 103 |
/* Verify that a program is running and that an executable is available. */ |
103 |
/* Verify that a program is running and that an executable is available. */ |
| 104 |
static gboolean verify_running(const char * display_manager, const char * executable) |
104 |
static gboolean verify_running(const char * display_manager, const char * executable, const char * proc_dm) |
| 105 |
{ |
105 |
{ |
| 106 |
/* See if the executable we need to run is in the path. */ |
106 |
/* See if the executable we need to run is in the path. */ |
| 107 |
gchar * full_path = g_find_program_in_path(executable); |
107 |
gchar * full_path = g_find_program_in_path(executable); |
|
Lines 144-150
static gboolean verify_running(const char * display_manager, const char * execut
Link Here
|
| 144 |
/* Null terminate the buffer and look for the display manager name in the command. |
144 |
/* Null terminate the buffer and look for the display manager name in the command. |
| 145 |
* If found, return success. */ |
145 |
* If found, return success. */ |
| 146 |
buffer[length] = '\0'; |
146 |
buffer[length] = '\0'; |
| 147 |
if (strstr(buffer, display_manager) != NULL) |
147 |
if (strstr(buffer, proc_dm) != NULL) |
| 148 |
return TRUE; |
148 |
return TRUE; |
| 149 |
} |
149 |
} |
| 150 |
} |
150 |
} |
|
Lines 436-456
int main(int argc, char * argv[])
Link Here
|
| 436 |
} |
436 |
} |
| 437 |
|
437 |
|
| 438 |
/* If we are under GDM, its "Switch User" is available. */ |
438 |
/* If we are under GDM, its "Switch User" is available. */ |
| 439 |
if (verify_running("gdm", "gdmflexiserver")) |
439 |
if (verify_running("gdm", "gdmflexiserver", "gdm")) |
| 440 |
{ |
440 |
{ |
| 441 |
handler_context.switch_user_available = TRUE; |
441 |
handler_context.switch_user_available = TRUE; |
| 442 |
handler_context.switch_user_GDM = TRUE; |
442 |
handler_context.switch_user_GDM = TRUE; |
| 443 |
} |
443 |
} |
| 444 |
|
444 |
|
| 445 |
/* If we are under GDM3, its "Switch User" is available. */ |
445 |
/* If we are under GDM3, its "Switch User" is available. */ |
| 446 |
if (verify_running("gdm3", "gdmflexiserver")) |
446 |
if (verify_running("gdm3", "gdmflexiserver", "gdm3")) |
| 447 |
{ |
447 |
{ |
| 448 |
handler_context.switch_user_available = TRUE; |
448 |
handler_context.switch_user_available = TRUE; |
| 449 |
handler_context.switch_user_GDM = TRUE; |
449 |
handler_context.switch_user_GDM = TRUE; |
| 450 |
} |
450 |
} |
| 451 |
|
451 |
|
| 452 |
/* If we are under KDM, its "Switch User" is available. */ |
452 |
/* If we are under KDM, its "Switch User" is available. */ |
| 453 |
if (verify_running("kdm", "kdmctl")) |
453 |
if (verify_running("xdm", "kdmctl", "kdm")) |
| 454 |
{ |
454 |
{ |
| 455 |
handler_context.switch_user_available = TRUE; |
455 |
handler_context.switch_user_available = TRUE; |
| 456 |
handler_context.switch_user_KDM = TRUE; |
456 |
handler_context.switch_user_KDM = TRUE; |