debug-window: disable Debug on all proxies when exiting
authorGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>
Mon, 3 Feb 2014 18:16:51 +0000 (19:16 +0100)
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>
Wed, 5 Feb 2014 12:54:06 +0000 (13:54 +0100)
https://bugzilla.gnome.org/show_bug.cgi?id=692793

src/empathy-debug-window.c

index 39d9f3e..7af66fe 100644 (file)
@@ -2136,6 +2136,35 @@ debug_window_finalize (GObject *object)
   (G_OBJECT_CLASS (empathy_debug_window_parent_class)->finalize) (object);
 }
 
+static void
+disable_all_debug_clients (EmpathyDebugWindow *self)
+{
+  GtkTreeIter iter;
+  gboolean valid_iter;
+  GtkTreeModel *model;
+
+  if (self->priv->service_store == NULL)
+    return;
+  model = GTK_TREE_MODEL (self->priv->service_store);
+
+  /* Skipping the first service store iter which is reserved for "All" */
+  gtk_tree_model_get_iter_first (model, &iter);
+  for (valid_iter = gtk_tree_model_iter_next (model, &iter);
+       valid_iter;
+       valid_iter = gtk_tree_model_iter_next (model, &iter))
+    {
+      TpDebugClient *debug;
+
+      gtk_tree_model_get (model, &iter,
+          COL_PROXY, &debug,
+          -1);
+
+      debug_window_set_enabled (debug, FALSE);
+
+      g_object_unref (debug);
+    }
+}
+
 static void
 debug_window_dispose (GObject *object)
 {
@@ -2145,6 +2174,9 @@ debug_window_dispose (GObject *object)
     tp_proxy_signal_connection_disconnect (
         self->priv->name_owner_changed_signal);
 
+  /* Disable Debug on all proxies */
+  disable_all_debug_clients (self);
+
   g_clear_object (&self->priv->service_store);
   g_clear_object (&self->priv->dbus);
   g_clear_object (&self->priv->am);