[gdm-list] [PATCH 1/3] Support --no-lock option in gdmflexiserver when launching new session



When launching a new login session via gdmflexiserver, the -l or
--no-lock switch can be used to suppress locking of the current session.
gdm_user_manager_goto_login_session() has been adapted to take a boolean
parameter controlling whether to call gdmflexiserver with this switch.
---
 ChangeLog                             |   12 ++++++++++++
 gui/simple-greeter/gdm-user-manager.c |   12 ++++++++----
 gui/simple-greeter/gdm-user-manager.h |    3 ++-
 gui/user-switch-applet/applet.c       |    4 ++--
 utils/gdmflexiserver.c                |    5 +++--
 5 files changed, 27 insertions(+), 9 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index fe7b000..514198d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2008-10-12  Dan Nicholson <dbn lists gmail com>
+
+	* gui/simple-greeter/gdm-user-manager.c
+	(gdm_user_manager_goto_login_session), (start_new_login_session):
+	* gui/simple-greeter/gdm-user-manager.h:
+	* gui/user-switch-applet/applet.c (do_switch):
+	Add boolean parameter to allow gdmflexiserver to be executed
+	with the --no-lock option.
+	* utils/gdmflexiserver.c (main): Support the -l/--no-lock option
+	to keep gdmflexiserver from locking the current screen before
+	launching a new login screen.
+
 2008-09-28  Mario Blättermann <mariobl svn gnome org>
 
 	* docs/de/de.po: Updated German translation
diff --git a/gui/simple-greeter/gdm-user-manager.c b/gui/simple-greeter/gdm-user-manager.c
index e9135da..7fe458c 100644
--- a/gui/simple-greeter/gdm-user-manager.c
+++ b/gui/simple-greeter/gdm-user-manager.c
@@ -148,12 +148,16 @@ gdm_user_manager_error_quark (void)
 }
 
 static gboolean
-start_new_login_session (GdmUserManager *manager)
+start_new_login_session (GdmUserManager *manager, gboolean lock)
 {
         GError  *error;
         gboolean res;
+        char flexi_command[21] = "gdmflexiserver -s";
 
-        res = g_spawn_command_line_async ("gdmflexiserver -s", &error);
+        if (!lock)
+                g_strlcat (flexi_command, " -l", sizeof (flexi_command));
+
+        res = g_spawn_command_line_async (flexi_command, &error);
         if (! res) {
                 g_warning ("Unable to start new login: %s", error->message);
                 g_error_free (error);
@@ -402,7 +406,7 @@ _get_login_window_session_id (GdmUserManager *manager)
 }
 
 gboolean
-gdm_user_manager_goto_login_session (GdmUserManager *manager)
+gdm_user_manager_goto_login_session (GdmUserManager *manager, gboolean lock)
 {
         gboolean ret;
         gboolean res;
@@ -424,7 +428,7 @@ gdm_user_manager_goto_login_session (GdmUserManager *manager)
         }
 
         if (! ret) {
-                res = start_new_login_session (manager);
+                res = start_new_login_session (manager, lock);
                 if (res) {
                         ret = TRUE;
                 }
diff --git a/gui/simple-greeter/gdm-user-manager.h b/gui/simple-greeter/gdm-user-manager.h
index 6c696e5..540f46f 100644
--- a/gui/simple-greeter/gdm-user-manager.h
+++ b/gui/simple-greeter/gdm-user-manager.h
@@ -80,7 +80,8 @@ GdmUser *           gdm_user_manager_get_user_by_uid       (GdmUserManager *mana
 gboolean            gdm_user_manager_activate_user_session (GdmUserManager *manager,
                                                             GdmUser        *user);
 
-gboolean            gdm_user_manager_goto_login_session    (GdmUserManager *manager);
+gboolean            gdm_user_manager_goto_login_session    (GdmUserManager *manager,
+                                                            gboolean lock);
 
 G_END_DECLS
 
diff --git a/gui/user-switch-applet/applet.c b/gui/user-switch-applet/applet.c
index fefbcb5..92fc6f3 100644
--- a/gui/user-switch-applet/applet.c
+++ b/gui/user-switch-applet/applet.c
@@ -818,7 +818,7 @@ do_switch (GdmAppletData *adata,
         g_debug ("Do user switch");
 
         if (user == NULL) {
-                gdm_user_manager_goto_login_session (adata->manager);
+                gdm_user_manager_goto_login_session (adata->manager, TRUE);
                 goto out;
         }
 
@@ -826,7 +826,7 @@ do_switch (GdmAppletData *adata,
         if (num_sessions > 0) {
                 switch_to_user_session (adata, user);
         } else {
-                gdm_user_manager_goto_login_session (adata->manager);
+                gdm_user_manager_goto_login_session (adata->manager, TRUE);
         }
  out:
         maybe_lock_screen (adata);
diff --git a/utils/gdmflexiserver.c b/utils/gdmflexiserver.c
index 6afa5b5..fee0ccd 100644
--- a/utils/gdmflexiserver.c
+++ b/utils/gdmflexiserver.c
@@ -59,7 +59,7 @@ static char      **args_remaining   = NULL;
 GOptionEntry options [] = {
         { "command", 'c', 0, G_OPTION_ARG_STRING, &send_command, N_("Ignored - retained for compatibility"), N_("COMMAND") },
         { "xnest", 'n', 0, G_OPTION_ARG_NONE, &use_xnest, N_("Ignored - retained for compatibility"), NULL },
-        { "no-lock", 'l', 0, G_OPTION_ARG_NONE, &no_lock, N_("Ignored - retained for compatibility"), NULL },
+        { "no-lock", 'l', 0, G_OPTION_ARG_NONE, &no_lock, N_("Do not lock current screen"), NULL },
         { "debug", 'd', 0, G_OPTION_ARG_NONE, &debug_in, N_("Debugging output"), NULL },
         { "authenticate", 'a', 0, G_OPTION_ARG_NONE, &authenticate, N_("Ignored - retained for compatibility"), NULL },
         { "startnew", 's', 0, G_OPTION_ARG_NONE, &startnew, N_("Ignored - retained for compatibility"), NULL },
@@ -770,7 +770,8 @@ main (int argc, char *argv[])
                 gtk_dialog_run (GTK_DIALOG (dialog));
                 gtk_widget_destroy (dialog);
         } else {
-                maybe_lock_screen ();
+                if (!no_lock)
+                        maybe_lock_screen ();
         }
 
         return 1;
-- 
1.5.5.1



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]