gnome-session r5303 - in trunk: . gnome-session



Author: lucasr
Date: Sun Mar  1 20:50:06 2009
New Revision: 5303
URL: http://svn.gnome.org/viewvc/gnome-session?rev=5303&view=rev

Log:
2009-03-01  Lucas Rocha  <lucasr gnome org>

	* gnome-session/gsm-consolekit.c: add constant holding login window
	session type value to be used in different places of the code.
	* gnome-session/gsm-logout-dialog.c: use new consolekit constant for
	login window session type.
	* gnome-session/gsm-manager.c: don't save session if session type is
	login window.
	* gnome-session/main.c: don't load saved session if session type is
	login window.

Modified:
   trunk/ChangeLog
   trunk/gnome-session/gsm-consolekit.h
   trunk/gnome-session/gsm-logout-dialog.c
   trunk/gnome-session/gsm-manager.c
   trunk/gnome-session/main.c

Modified: trunk/gnome-session/gsm-consolekit.h
==============================================================================
--- trunk/gnome-session/gsm-consolekit.h	(original)
+++ trunk/gnome-session/gsm-consolekit.h	Sun Mar  1 20:50:06 2009
@@ -62,6 +62,8 @@
         GSM_CONSOLEKIT_ERROR_STOPPING
 };
 
+#define GSM_CONSOLEKIT_SESSION_TYPE_LOGIN_WINDOW "LoginWindow"
+
 GType            gsm_consolekit_get_type        (void);
 
 GQuark           gsm_consolekit_error_quark     (void);

Modified: trunk/gnome-session/gsm-logout-dialog.c
==============================================================================
--- trunk/gnome-session/gsm-logout-dialog.c	(original)
+++ trunk/gnome-session/gsm-logout-dialog.c	Sun Mar  1 20:50:06 2009
@@ -308,7 +308,7 @@
                 g_object_unref (consolekit);
         }
 
-        if (g_strcmp0 (session_type, "LoginWindow") != 0) {
+        if (g_strcmp0 (session_type, GSM_CONSOLEKIT_SESSION_TYPE_LOGIN_WINDOW) != 0) {
                 char *name, *tmp;
 
                 name = g_locale_to_utf8 (g_get_real_name (), -1, NULL, NULL, NULL);

Modified: trunk/gnome-session/gsm-manager.c
==============================================================================
--- trunk/gnome-session/gsm-manager.c	(original)
+++ trunk/gnome-session/gsm-manager.c	Sun Mar  1 20:50:06 2009
@@ -1559,13 +1559,22 @@
 static void
 maybe_save_session (GsmManager *manager)
 {
+        GsmConsolekit *consolekit;
+        char *session_type;
         GError *error;
 
+        consolekit = gsm_get_consolekit ();
+        session_type = gsm_consolekit_get_current_session_type (consolekit);
+
+        if (g_strcmp0 (session_type, GSM_CONSOLEKIT_SESSION_TYPE_LOGIN_WINDOW) == 0) {
+                goto out;
+        }
+
         /* We only allow session saving when session is running or when
          * logging out */
         if (manager->priv->phase != GSM_MANAGER_PHASE_RUNNING &&
             manager->priv->phase != GSM_MANAGER_PHASE_END_SESSION) {
-                return;
+                goto out;
         }
 
         error = NULL;
@@ -1575,6 +1584,10 @@
                 g_warning ("Error saving session: %s", error->message);
                 g_error_free (error);
         }
+
+out:
+        g_object_unref (consolekit);
+        g_free (session_type);
 }
 
 static void

Modified: trunk/gnome-session/main.c
==============================================================================
--- trunk/gnome-session/main.c	(original)
+++ trunk/gnome-session/main.c	Sun Mar  1 20:50:06 2009
@@ -40,6 +40,7 @@
 #include "gdm-signal-handler.h"
 #include "gdm-log.h"
 
+#include "gsm-consolekit.h"
 #include "gsm-gconf.h"
 #include "gsm-util.h"
 #include "gsm-manager.h"
@@ -56,7 +57,7 @@
 
 static gboolean failsafe = FALSE;
 static gboolean show_version = FALSE;
-static gboolean debug = FALSE;
+static gboolean debug = TRUE;
 
 static void
 on_bus_name_lost (DBusGProxy *bus_proxy,
@@ -265,6 +266,23 @@
 }
 
 static void
+maybe_load_saved_session_apps (GsmManager *manager)
+{
+        GsmConsolekit *consolekit;
+        char *session_type;
+
+        consolekit = gsm_get_consolekit ();
+        session_type = gsm_consolekit_get_current_session_type (consolekit);
+
+        if (g_strcmp0 (session_type, GSM_CONSOLEKIT_SESSION_TYPE_LOGIN_WINDOW) != 0) {
+                gsm_manager_add_autostart_apps_from_dir (manager, gsm_util_get_saved_session_dir ());
+        }
+
+        g_object_unref (consolekit);
+        g_free (session_type);
+}
+
+static void
 load_standard_apps (GsmManager *manager,
                     const char *default_session_key)
 {
@@ -279,7 +297,7 @@
                 goto out;
         }
 
-        gsm_manager_add_autostart_apps_from_dir (manager, gsm_util_get_saved_session_dir ());
+        maybe_load_saved_session_apps (manager);
 
         for (i = 0; autostart_dirs[i]; i++) {
                 gsm_manager_add_autostart_apps_from_dir (manager, autostart_dirs[i]);



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