gnome-session r5359 - in trunk: . gnome-session



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

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

	Allow an interacting app to cancel the logout.

	* gnome-session/gsm-client.[ch]: (gsm_client_class_init): add new
	cancel argument to END_SESSION_RESPONSE signal
	(gdm_client_end_session_response): add cancel and use it
	* gnome-session/gsm-marshal.list: updated for new signature
	* gnome-session/gsm-manager.c: (on_client_end_session_response): add
	cancel paramter, and call cancel_end_session if cancel is TRUE
	* gnome-session/gsm-dbus-client.c: (handle_end_session_response): pass
	FALSE as cancel
	* gnome-session/gsm-xsmp-client.c:
	(save_yourself_phase2_request_callback): pass FALSE as cancel
	(interact_request_callback): pass FALSE as cancel
	(interact_done_callback): pass the value returned by the client as
	cancel
	(save_yourself_done_callback): pass FALSE as cancel


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

Modified: trunk/gnome-session/gsm-client.c
==============================================================================
--- trunk/gnome-session/gsm-client.c	(original)
+++ trunk/gnome-session/gsm-client.c	Tue Mar 24 23:25:01 2009
@@ -324,9 +324,9 @@
                               G_SIGNAL_RUN_LAST,
                               G_STRUCT_OFFSET (GsmClientClass, end_session_response),
                               NULL, NULL,
-                              gsm_marshal_VOID__BOOLEAN_STRING,
+                              gsm_marshal_VOID__BOOLEAN_BOOLEAN_STRING,
                               G_TYPE_NONE,
-                              2, G_TYPE_BOOLEAN, G_TYPE_STRING);
+                              3, G_TYPE_BOOLEAN, G_TYPE_BOOLEAN, G_TYPE_STRING);
 
         g_object_class_install_property (object_class,
                                          PROP_STARTUP_ID,
@@ -522,7 +522,9 @@
 void
 gdm_client_end_session_response (GsmClient  *client,
                                  gboolean    is_ok,
+                                 gboolean    cancel,
                                  const char *reason)
 {
-        g_signal_emit (client, signals[END_SESSION_RESPONSE], 0, is_ok, reason);
+        g_signal_emit (client, signals[END_SESSION_RESPONSE], 0,
+                       is_ok, cancel, reason);
 }

Modified: trunk/gnome-session/gsm-client.h
==============================================================================
--- trunk/gnome-session/gsm-client.h	(original)
+++ trunk/gnome-session/gsm-client.h	Tue Mar 24 23:25:01 2009
@@ -73,6 +73,7 @@
         void         (*disconnected)               (GsmClient  *client);
         void         (*end_session_response)       (GsmClient  *client,
                                                     gboolean    ok,
+                                                    gboolean    cancel,
                                                     const char *reason);
 
         /* virtual methods */
@@ -159,6 +160,7 @@
 
 void                  gdm_client_end_session_response       (GsmClient  *client,
                                                              gboolean    is_ok,
+                                                             gboolean    cancel,
                                                              const char *reason);
 
 G_END_DECLS

Modified: trunk/gnome-session/gsm-dbus-client.c
==============================================================================
--- trunk/gnome-session/gsm-dbus-client.c	(original)
+++ trunk/gnome-session/gsm-dbus-client.c	Tue Mar 24 23:25:01 2009
@@ -189,7 +189,8 @@
                 g_error ("No memory");
         }
 
-        gdm_client_end_session_response (GSM_CLIENT (client), is_ok, reason);
+        gdm_client_end_session_response (GSM_CLIENT (client),
+                                         is_ok, FALSE, reason);
 
 
         if (! dbus_connection_send (client->priv->connection, reply, NULL)) {

Modified: trunk/gnome-session/gsm-manager.c
==============================================================================
--- trunk/gnome-session/gsm-manager.c	(original)
+++ trunk/gnome-session/gsm-manager.c	Tue Mar 24 23:25:01 2009
@@ -1668,6 +1668,7 @@
 static void
 on_client_end_session_response (GsmClient  *client,
                                 gboolean    is_ok,
+                                gboolean    cancel,
                                 const char *reason,
                                 GsmManager *manager)
 {
@@ -1676,7 +1677,12 @@
                 return;
         }
 
-        g_debug ("GsmManager: Response from end session request: is-ok=%d reason=%s", is_ok, reason);
+        g_debug ("GsmManager: Response from end session request: is-ok=%d cancel=%d reason=%s", is_ok, cancel, reason);
+
+        if (cancel) {
+                cancel_end_session (manager);
+                return;
+        }
 
         manager->priv->query_clients = g_slist_remove (manager->priv->query_clients, client);
 

Modified: trunk/gnome-session/gsm-marshal.list
==============================================================================
--- trunk/gnome-session/gsm-marshal.list	(original)
+++ trunk/gnome-session/gsm-marshal.list	Tue Mar 24 23:25:01 2009
@@ -1,2 +1,2 @@
 BOOLEAN:POINTER
-VOID:BOOLEAN,STRING
+VOID:BOOLEAN,BOOLEAN,STRING

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:25:01 2009
@@ -1153,7 +1153,7 @@
         /* this is a valid response to SaveYourself and therefore
            may be a response to a QES or ES */
         gdm_client_end_session_response (GSM_CLIENT (client),
-                                         TRUE,
+                                         TRUE, FALSE,
                                          NULL);
 
         /* FIXME: change priority so this client runs at the end? */
@@ -1175,7 +1175,7 @@
                  dialog_type == SmDialogNormal ? "Dialog" : "Errors");
 
         gdm_client_end_session_response (GSM_CLIENT (client),
-                                         FALSE,
+                                         FALSE, FALSE,
                                          _("This program is blocking log out."));
 
 #if 0
@@ -1206,7 +1206,7 @@
                  cancel_shutdown ? "True" : "False");
 
         gdm_client_end_session_response (GSM_CLIENT (client),
-                                         TRUE,
+                                         TRUE, cancel_shutdown,
                                          NULL);
 }
 
@@ -1228,7 +1228,7 @@
          * the session manager can do about, though. FIXME: we could display a
          * dialog about this, I guess. */
         gdm_client_end_session_response (GSM_CLIENT (client),
-                                         TRUE,
+                                         TRUE, FALSE,
                                          NULL);
 
         if (client->priv->next_save_yourself) {



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