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 = NULL); |
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-151
static gboolean verify_running(const cha
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( proc_dm != NULL ) |
148 |
return TRUE; |
148 |
{ |
|
|
149 |
if (strstr(buffer, proc_dm) != NULL) |
150 |
return TRUE; |
151 |
} else { |
152 |
if (strstr(buffer, display_manager) != NULL) |
153 |
return TRUE; |
154 |
} |
149 |
} |
155 |
} |
150 |
} |
156 |
} |
151 |
} |
157 |
} |
Lines 450-456
int main(int argc, char * argv[])
Link Here
|
450 |
} |
456 |
} |
451 |
|
457 |
|
452 |
/* If we are under KDM, its "Switch User" is available. */ |
458 |
/* If we are under KDM, its "Switch User" is available. */ |
453 |
if (verify_running("kdm", "kdmctl")) |
459 |
if (verify_running("xdm", "kdmctl", "kdm")) |
454 |
{ |
460 |
{ |
455 |
handler_context.switch_user_available = TRUE; |
461 |
handler_context.switch_user_available = TRUE; |
456 |
handler_context.switch_user_KDM = TRUE; |
462 |
handler_context.switch_user_KDM = TRUE; |