gnome-session r5357 - in trunk: . gnome-session



Author: vuntz
Date: Tue Mar 24 23:07:22 2009
New Revision: 5357
URL: http://svn.gnome.org/viewvc/gnome-session?rev=5357&view=rev

Log:
2009-03-25  Vincent Untz  <vuntz gnome org>

	Make session saving works a bit better by telling client to not just
	save the global state, but also the local state when relevant.

	* gnome-session/gsm-client.h: add new GSM_CLIENT_END_SESSION_FLAG_SAVE
	* gnome-session/gsm-manager.c: (do_phase_end_session): if the session
	should be autosaved, then pass the GSM_CLIENT_END_SESSION_FLAG_SAVE
	flag
	(do_phase_query_end_session): add a comment explaining why we don't use
	the GSM_CLIENT_END_SESSION_FLAG_SAVE flag
	* gnome-session/gsm-xsmp-client.c: (xsmp_query_end_session),
	(xsmp_end_session): depending on the presence of the
	GSM_CLIENT_END_SESSION_FLAG_SAVE flag, use SmSaveBoth or SmSaveGlobal


Modified:
   trunk/ChangeLog
   trunk/gnome-session/gsm-client.h
   trunk/gnome-session/gsm-manager.c
   trunk/gnome-session/gsm-xsmp-client.c

Modified: trunk/gnome-session/gsm-client.h
==============================================================================
--- trunk/gnome-session/gsm-client.h	(original)
+++ trunk/gnome-session/gsm-client.h	Tue Mar 24 23:07:22 2009
@@ -55,7 +55,8 @@
 } GsmClientRestartStyle;
 
 typedef enum {
-        GSM_CLIENT_END_SESSION_FLAG_FORCEFUL = 1 << 0
+        GSM_CLIENT_END_SESSION_FLAG_FORCEFUL = 1 << 0,
+        GSM_CLIENT_END_SESSION_FLAG_SAVE     = 1 << 1
 } GsmClientEndSessionFlag;
 
 struct _GsmClient

Modified: trunk/gnome-session/gsm-manager.c
==============================================================================
--- trunk/gnome-session/gsm-manager.c	(original)
+++ trunk/gnome-session/gsm-manager.c	Tue Mar 24 23:07:22 2009
@@ -137,6 +137,8 @@
 static void     gsm_manager_init        (GsmManager      *manager);
 static void     gsm_manager_finalize    (GObject         *object);
 
+static gboolean auto_save_is_enabled (GsmManager *manager);
+
 static gpointer manager_object = NULL;
 
 G_DEFINE_TYPE (GsmManager, gsm_manager, G_TYPE_OBJECT)
@@ -561,6 +563,10 @@
         if (manager->priv->forceful_logout) {
                 data.flags |= GSM_CLIENT_END_SESSION_FLAG_FORCEFUL;
         }
+        if (auto_save_is_enabled (manager)) {
+                data.flags |= GSM_CLIENT_END_SESSION_FLAG_SAVE;
+        }
+
 
         if (manager->priv->phase_timeout_id > 0) {
                 g_source_remove (manager->priv->phase_timeout_id);
@@ -1044,6 +1050,9 @@
         if (manager->priv->forceful_logout) {
                 data.flags |= GSM_CLIENT_END_SESSION_FLAG_FORCEFUL;
         }
+        /* We only query if an app is ready to log out, so we don't use
+         * GSM_CLIENT_END_SESSION_FLAG_SAVE here.
+         */
 
         debug_clients (manager);
         g_debug ("GsmManager: sending query-end-session to clients forceful:%d", manager->priv->forceful_logout);

Modified: trunk/gnome-session/gsm-xsmp-client.c
==============================================================================
--- trunk/gnome-session/gsm-xsmp-client.c	(original)
+++ trunk/gnome-session/gsm-xsmp-client.c	Tue Mar 24 23:07:22 2009
@@ -708,6 +708,7 @@
                         GError   **error)
 {
         gboolean forceful;
+        int      save_type;
 
         if (GSM_XSMP_CLIENT (client)->priv->conn == NULL) {
                 g_set_error (error,
@@ -718,7 +719,14 @@
         }
 
         forceful = (flags & GSM_CLIENT_END_SESSION_FLAG_FORCEFUL);
-        do_save_yourself (GSM_XSMP_CLIENT (client), SmSaveGlobal, forceful);
+
+        if (flags & GSM_CLIENT_END_SESSION_FLAG_SAVE) {
+                save_type = SmSaveBoth;
+        } else {
+                save_type = SmSaveGlobal;
+        }
+
+        do_save_yourself (GSM_XSMP_CLIENT (client), save_type, forceful);
         return TRUE;
 }
 
@@ -728,6 +736,7 @@
                   GError   **error)
 {
         gboolean forceful;
+        int      save_type;
 
         if (GSM_XSMP_CLIENT (client)->priv->conn == NULL) {
                 g_set_error (error,
@@ -738,7 +747,14 @@
         }
 
         forceful = (flags & GSM_CLIENT_END_SESSION_FLAG_FORCEFUL);
-        do_save_yourself (GSM_XSMP_CLIENT (client), SmSaveGlobal, forceful);
+
+        if (flags & GSM_CLIENT_END_SESSION_FLAG_SAVE) {
+                save_type = SmSaveBoth;
+        } else {
+                save_type = SmSaveGlobal;
+        }
+
+        do_save_yourself (GSM_XSMP_CLIENT (client), save_type, forceful);
         return TRUE;
 }
 



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