gnome-session r4881 - in branches/dbus_based: . gnome-session



Author: mccann
Date: Tue Jul 29 20:14:33 2008
New Revision: 4881
URL: http://svn.gnome.org/viewvc/gnome-session?rev=4881&view=rev

Log:
2008-07-29  William Jon McCann  <jmccann redhat com>

	* gnome-session/gsm-client.c (gsm_client_dispose),
	(gsm_client_class_init):
	* gnome-session/gsm-dbus-client.c (gsm_dbus_client_dispose),
	(gsm_dbus_client_class_init):
	* gnome-session/gsm-inhibit-dialog.c (on_response),
	(model_has_one_entry), (on_store_inhibitor_removed),
	(gsm_inhibit_dialog_dispose), (gsm_inhibit_dialog_finalize):
	* gnome-session/gsm-inhibitor.c (gsm_inhibitor_class_init):
	* gnome-session/gsm-manager.c (bus_name_owner_changed),
	(gsm_manager_register_client):
	* gnome-session/gsm-store.c (gsm_store_foreach_remove):
	* gnome-session/gsm-xsmp-server.c (accept_ice_connection):
	Add introspection info to Inhibitor.  Fix a few
	refcounting problems.



Modified:
   branches/dbus_based/ChangeLog
   branches/dbus_based/gnome-session/gsm-client.c
   branches/dbus_based/gnome-session/gsm-dbus-client.c
   branches/dbus_based/gnome-session/gsm-inhibit-dialog.c
   branches/dbus_based/gnome-session/gsm-inhibitor.c
   branches/dbus_based/gnome-session/gsm-manager.c
   branches/dbus_based/gnome-session/gsm-store.c
   branches/dbus_based/gnome-session/gsm-xsmp-server.c

Modified: branches/dbus_based/gnome-session/gsm-client.c
==============================================================================
--- branches/dbus_based/gnome-session/gsm-client.c	(original)
+++ branches/dbus_based/gnome-session/gsm-client.c	Tue Jul 29 20:14:33 2008
@@ -237,6 +237,21 @@
 }
 
 static void
+gsm_client_dispose (GObject *object)
+{
+        GsmClient *client;
+
+        g_return_if_fail (object != NULL);
+        g_return_if_fail (GSM_IS_CLIENT (object));
+
+        client = GSM_CLIENT (object);
+
+        g_debug ("GsmClient: disposing %s", client->priv->id);
+
+        G_OBJECT_CLASS (gsm_client_parent_class)->dispose (object);
+}
+
+static void
 gsm_client_class_init (GsmClientClass *klass)
 {
         GObjectClass *object_class = G_OBJECT_CLASS (klass);
@@ -245,6 +260,7 @@
         object_class->set_property = gsm_client_set_property;
         object_class->constructor = gsm_client_constructor;
         object_class->finalize = gsm_client_finalize;
+        object_class->dispose = gsm_client_dispose;
 
         klass->impl_stop = default_stop;
 

Modified: branches/dbus_based/gnome-session/gsm-dbus-client.c
==============================================================================
--- branches/dbus_based/gnome-session/gsm-dbus-client.c	(original)
+++ branches/dbus_based/gnome-session/gsm-dbus-client.c	Tue Jul 29 20:14:33 2008
@@ -56,15 +56,6 @@
         PROP_0,
         PROP_BUS_NAME,
 };
-enum {
-        STOP,
-        CANCEL_END_SESSION,
-        QUERY_END_SESSION,
-        END_SESSION,
-        LAST_SIGNAL
-};
-
-static guint signals [LAST_SIGNAL] = { 0, };
 
 G_DEFINE_TYPE (GsmDBusClient, gsm_dbus_client, GSM_TYPE_CLIENT)
 
@@ -472,6 +463,21 @@
 }
 
 static void
+gsm_dbus_client_dispose (GObject *object)
+{
+        GsmDBusClient *client;
+
+        g_return_if_fail (object != NULL);
+        g_return_if_fail (GSM_IS_DBUS_CLIENT (object));
+
+        client = GSM_DBUS_CLIENT (object);
+
+        dbus_connection_remove_filter (client->priv->connection, client_dbus_filter_function, client);
+
+        G_OBJECT_CLASS (gsm_dbus_client_parent_class)->dispose (object);
+}
+
+static void
 gsm_dbus_client_class_init (GsmDBusClientClass *klass)
 {
         GObjectClass   *object_class = G_OBJECT_CLASS (klass);
@@ -481,6 +487,7 @@
         object_class->constructor          = gsm_dbus_client_constructor;
         object_class->get_property         = gsm_dbus_client_get_property;
         object_class->set_property         = gsm_dbus_client_set_property;
+        object_class->dispose              = gsm_dbus_client_dispose;
 
         client_class->impl_stop                   = dbus_client_stop;
         client_class->impl_query_end_session      = dbus_client_query_end_session;

Modified: branches/dbus_based/gnome-session/gsm-inhibit-dialog.c
==============================================================================
--- branches/dbus_based/gnome-session/gsm-inhibit-dialog.c	(original)
+++ branches/dbus_based/gnome-session/gsm-inhibit-dialog.c	Tue Jul 29 20:14:33 2008
@@ -62,6 +62,7 @@
 {
         GladeXML          *xml;
         int                action;
+        gboolean           is_done;
         GsmStore          *inhibitors;
         GtkListStore      *list_store;
         gboolean           have_xrender;
@@ -104,13 +105,20 @@
 static void
 on_response (GsmInhibitDialog *dialog,
              gint              response_id)
+
 {
+        if (dialog->priv->is_done) {
+                g_signal_stop_emission_by_name (dialog, "response");
+                return;
+        }
+
         switch (response_id) {
         case DIALOG_RESPONSE_LOCK_SCREEN:
                 g_signal_stop_emission_by_name (dialog, "response");
                 lock_screen (dialog);
                 break;
         default:
+                dialog->priv->is_done = TRUE;
                 break;
         }
 }
@@ -582,7 +590,7 @@
         n_rows = gtk_tree_model_iter_n_children (model, NULL);
         g_debug ("Model has %d rows", n_rows);
 
-        return (n_rows < 2);
+        return (n_rows > 0 && n_rows < 2);
 }
 
 static void
@@ -652,7 +660,8 @@
         }
 
         /* if there are no inhibitors left then trigger response */
-        if (! gtk_tree_model_get_iter_first (GTK_TREE_MODEL (dialog->priv->list_store), &iter)) {
+        if (! gtk_tree_model_get_iter_first (GTK_TREE_MODEL (dialog->priv->list_store), &iter)
+            && ! dialog->priv->is_done) {
                 gtk_dialog_response (GTK_DIALOG (dialog), GTK_RESPONSE_ACCEPT);
         }
 }
@@ -907,6 +916,33 @@
 static void
 gsm_inhibit_dialog_dispose (GObject *object)
 {
+        GsmInhibitDialog *dialog;
+
+        g_return_if_fail (object != NULL);
+        g_return_if_fail (GSM_IS_INHIBIT_DIALOG (object));
+
+        dialog = GSM_INHIBIT_DIALOG (object);
+
+        g_debug ("GsmInhibitDialog: dispose called");
+
+        g_signal_handlers_disconnect_by_func (dialog->priv->inhibitors,
+                                              on_store_inhibitor_added,
+                                              dialog);
+        g_signal_handlers_disconnect_by_func (dialog->priv->inhibitors,
+                                              on_store_inhibitor_removed,
+                                              dialog);
+
+        if (dialog->priv->list_store != NULL) {
+                g_object_unref (dialog->priv->list_store);
+                dialog->priv->list_store = NULL;
+        }
+
+
+        if (dialog->priv->inhibitors != NULL) {
+                g_object_unref (dialog->priv->inhibitors);
+                dialog->priv->inhibitors = NULL;
+        }
+
         G_OBJECT_CLASS (gsm_inhibit_dialog_parent_class)->dispose (object);
 }
 
@@ -981,16 +1017,6 @@
 
         g_debug ("GsmInhibitDialog: finalizing");
 
-        g_signal_handlers_disconnect_by_func (dialog->priv->inhibitors,
-                                              on_store_inhibitor_added,
-                                              dialog);
-        g_signal_handlers_disconnect_by_func (dialog->priv->inhibitors,
-                                              on_store_inhibitor_removed,
-                                              dialog);
-        if (dialog->priv->inhibitors != NULL) {
-                g_object_unref (dialog->priv->inhibitors);
-        }
-
         G_OBJECT_CLASS (gsm_inhibit_dialog_parent_class)->finalize (object);
 }
 

Modified: branches/dbus_based/gnome-session/gsm-inhibitor.c
==============================================================================
--- branches/dbus_based/gnome-session/gsm-inhibitor.c	(original)
+++ branches/dbus_based/gnome-session/gsm-inhibitor.c	Tue Jul 29 20:14:33 2008
@@ -487,6 +487,7 @@
                                                             0,
                                                             G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
 
+	dbus_g_object_type_install_info (GSM_TYPE_INHIBITOR, &dbus_glib_gsm_inhibitor_object_info);
         g_type_class_add_private (klass, sizeof (GsmInhibitorPrivate));
 }
 

Modified: branches/dbus_based/gnome-session/gsm-manager.c
==============================================================================
--- branches/dbus_based/gnome-session/gsm-manager.c	(original)
+++ branches/dbus_based/gnome-session/gsm-manager.c	Tue Jul 29 20:14:33 2008
@@ -1203,8 +1203,8 @@
         if (strlen (new_service_name) == 0
             && strlen (old_service_name) > 0) {
                 /* service removed */
-                remove_clients_for_connection (manager, old_service_name);
                 remove_inhibitors_for_connection (manager, old_service_name);
+                remove_clients_for_connection (manager, old_service_name);
         } else if (strlen (old_service_name) == 0
                    && strlen (new_service_name) > 0) {
                 /* service added */
@@ -2541,6 +2541,8 @@
         }
 
         gsm_store_add (manager->priv->clients, gsm_client_peek_id (client), G_OBJECT (client));
+        /* the store will own the ref */
+        g_object_unref (client);
 
         if (app != NULL) {
                 gsm_client_set_app_id (client, gsm_app_get_id (app));

Modified: branches/dbus_based/gnome-session/gsm-store.c
==============================================================================
--- branches/dbus_based/gnome-session/gsm-store.c	(original)
+++ branches/dbus_based/gnome-session/gsm-store.c	Tue Jul 29 20:14:33 2008
@@ -192,8 +192,10 @@
         while (data.removed != NULL) {
                 char *id;
                 id = data.removed->data;
+                g_debug ("GsmStore: emitting removed for %s", id);
                 g_signal_emit (store, signals [REMOVED], 0, id);
-                g_free (id);
+                g_free (data.removed->data);
+                data.removed->data = NULL;
                 data.removed = g_list_delete_link (data.removed, data.removed);
         }
 

Modified: branches/dbus_based/gnome-session/gsm-xsmp-server.c
==============================================================================
--- branches/dbus_based/gnome-session/gsm-xsmp-server.c	(original)
+++ branches/dbus_based/gnome-session/gsm-xsmp-server.c	Tue Jul 29 20:14:33 2008
@@ -127,6 +127,8 @@
         ice_conn->context = client;
 
         gsm_store_add (server->priv->client_store, gsm_client_peek_id (client), G_OBJECT (client));
+        /* the store will own the ref */
+        g_object_unref (client);
 
         return TRUE;
 }



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