gnome-session r4962 - in trunk: . gnome-session



Author: mccann
Date: Fri Aug 15 22:15:53 2008
New Revision: 4962
URL: http://svn.gnome.org/viewvc/gnome-session?rev=4962&view=rev

Log:
2008-08-15  William Jon McCann  <jmccann redhat com>

	* gnome-session/gsm-manager.c (inhibitor_has_client_id),
	(_disconnect_client):
	Remove inhibitors for the client when it disconnects.



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

Modified: trunk/gnome-session/gsm-manager.c
==============================================================================
--- trunk/gnome-session/gsm-manager.c	(original)
+++ trunk/gnome-session/gsm-manager.c	Fri Aug 15 22:15:53 2008
@@ -1084,6 +1084,29 @@
         return app;
 }
 
+static gboolean
+inhibitor_has_client_id (gpointer      key,
+                         GsmInhibitor *inhibitor,
+                         const char   *client_id_a)
+{
+        gboolean    matches;
+        const char *client_id_b;
+
+        client_id_b = gsm_inhibitor_peek_client_id (inhibitor);
+
+        matches = FALSE;
+        if (! IS_STRING_EMPTY (client_id_a) && ! IS_STRING_EMPTY (client_id_b)) {
+                matches = (strcmp (client_id_a, client_id_b) == 0);
+                if (matches) {
+                        g_debug ("GsmManager: removing JIT inhibitor for %s for reason '%s'",
+                                 gsm_inhibitor_peek_client_id (inhibitor),
+                                 gsm_inhibitor_peek_reason (inhibitor));
+                }
+        }
+
+        return matches;
+}
+
 static void
 _disconnect_client (GsmManager *manager,
                     GsmClient  *client)
@@ -1110,6 +1133,11 @@
                 is_condition_client = TRUE;
         }
 
+        /* remove any inhibitors for this client */
+        gsm_store_foreach_remove (manager->priv->inhibitors,
+                                  (GsmStoreFunc)inhibitor_has_client_id,
+                                  (gpointer)gsm_client_peek_id (client));
+
         app_id = gsm_client_peek_app_id (client);
         if (IS_STRING_EMPTY (app_id)) {
                 g_debug ("GsmManager: no application associated with client, not restarting application");
@@ -1457,29 +1485,6 @@
         return handled;
 }
 
-static gboolean
-inhibitor_has_client_id (gpointer      key,
-                         GsmInhibitor *inhibitor,
-                         const char   *client_id_a)
-{
-        gboolean    matches;
-        const char *client_id_b;
-
-        client_id_b = gsm_inhibitor_peek_client_id (inhibitor);
-
-        matches = FALSE;
-        if (! IS_STRING_EMPTY (client_id_a) && ! IS_STRING_EMPTY (client_id_b)) {
-                matches = (strcmp (client_id_a, client_id_b) == 0);
-                if (matches) {
-                        g_debug ("GsmManager: removing JIT inhibitor for %s for reason '%s'",
-                                 gsm_inhibitor_peek_client_id (inhibitor),
-                                 gsm_inhibitor_peek_reason (inhibitor));
-                }
-        }
-
-        return matches;
-}
-
 static void
 on_client_end_session_response (GsmClient  *client,
                                 gboolean    is_ok,



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