summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefano Karapetsas <[email protected]>2012-05-25 14:49:24 +0200
committerStefano Karapetsas <[email protected]>2012-05-25 14:49:24 +0200
commitf51cc7168688b39495a55fa37a38d3a1a1fdce6b (patch)
tree0923dd7a40f1280c0e8d8a18a26d1449a719595e
parent7147ea499581b17738a31207bc0e3af36f675574 (diff)
downloadmate-screensaver-f51cc7168688b39495a55fa37a38d3a1a1fdce6b.tar.bz2
mate-screensaver-f51cc7168688b39495a55fa37a38d3a1a1fdce6b.tar.xz
add GDM support for user switch
-rw-r--r--src/gs-lock-plug.c77
1 files changed, 63 insertions, 14 deletions
diff --git a/src/gs-lock-plug.c b/src/gs-lock-plug.c
index 81bea13..daf2632 100644
--- a/src/gs-lock-plug.c
+++ b/src/gs-lock-plug.c
@@ -52,9 +52,13 @@
#include "gs-debug.h"
#define KEY_LOCK_DIALOG_THEME "/apps/mate-screensaver/lock_dialog_theme"
+
#define MDM_FLEXISERVER_COMMAND "mdmflexiserver"
#define MDM_FLEXISERVER_ARGS "--startnew Standard"
+#define GDM_FLEXISERVER_COMMAND "gdmflexiserver"
+#define GDM_FLEXISERVER_ARGS "--startnew Standard"
+
/* same as SMS ;) */
#define NOTE_BUFFER_MAX_CHARS 160
@@ -175,21 +179,56 @@ do_user_switch (GSLockPlug *plug)
gboolean res;
char *command;
- command = g_strdup_printf ("%s %s",
- MDM_FLEXISERVER_COMMAND,
- MDM_FLEXISERVER_ARGS);
+ gboolean found;
+ found = is_program_in_path (MDM_FLEXISERVER_COMMAND);
- error = NULL;
- res = gdk_spawn_command_line_on_screen (gdk_screen_get_default (),
- command,
- &error);
+ if (found)
+ {
- g_free (command);
+ command = g_strdup_printf ("%s %s",
+ MDM_FLEXISERVER_COMMAND,
+ MDM_FLEXISERVER_ARGS);
- if (! res)
- {
- gs_debug ("Unable to start MDM greeter: %s", error->message);
- g_error_free (error);
+ error = NULL;
+ res = gdk_spawn_command_line_on_screen (gdk_screen_get_default (),
+ command,
+ &error);
+
+ g_free (command);
+
+ if (! res)
+ {
+ gs_debug ("Unable to start MDM greeter: %s", error->message);
+ g_error_free (error);
+ }
+ }
+ else {
+
+ /* MDM not found, so we try to use gdmflexiserver from GDM */
+
+ found = is_program_in_path (GDM_FLEXISERVER_COMMAND);
+
+ if (found)
+ {
+
+ char *gdm_command;
+
+ gdm_command = g_strdup_printf ("%s %s",
+ GDM_FLEXISERVER_COMMAND,
+ GDM_FLEXISERVER_ARGS);
+
+ error = NULL;
+ res = gdk_spawn_command_line_on_screen (gdk_screen_get_default (),
+ gdm_command,
+ &error);
+
+ g_free (gdm_command);
+
+ if (! res) {
+ gs_debug ("Unable to start MDM greeter: %s", error->message);
+ g_error_free (error);
+ }
+ }
}
}
@@ -976,8 +1015,18 @@ gs_lock_plug_set_switch_enabled (GSLockPlug *plug,
}
else
{
- gs_debug ("Waring: MDM flexiserver command not found: %s", MDM_FLEXISERVER_COMMAND);
- gtk_widget_hide (plug->priv->auth_switch_button);
+ gs_debug ("Warning: MDM flexiserver command not found: %s", MDM_FLEXISERVER_COMMAND);
+
+ /* MDM not found, so we try to use gdmflexiserver from GDM */
+ found = is_program_in_path (GDM_FLEXISERVER_COMMAND);
+ if (found)
+ {
+ gtk_widget_show (plug->priv->auth_switch_button);
+ }
+ else {
+ gs_debug ("Warning: GDM flexiserver command not found: %s", GDM_FLEXISERVER_COMMAND);
+ gtk_widget_hide (plug->priv->auth_switch_button);
+ }
}
}
else