diff options
author | Jonny Lamb <jonny.lamb@collabora.co.uk> | 2009-04-21 03:13:30 +0800 |
---|---|---|
committer | Jonny Lamb <jonny.lamb@collabora.co.uk> | 2009-04-24 08:52:48 +0800 |
commit | 67fc33120047dc2e0eea93fb255ee21674d5d8c5 (patch) | |
tree | f577b127eaedc5549fcef1ef1f90b90a5b711ede | |
parent | 94214398a27d10a9bc55716856ae2303e9d6f6d6 (diff) | |
download | gsoc2013-empathy-67fc33120047dc2e0eea93fb255ee21674d5d8c5.tar gsoc2013-empathy-67fc33120047dc2e0eea93fb255ee21674d5d8c5.tar.gz gsoc2013-empathy-67fc33120047dc2e0eea93fb255ee21674d5d8c5.tar.bz2 gsoc2013-empathy-67fc33120047dc2e0eea93fb255ee21674d5d8c5.tar.lz gsoc2013-empathy-67fc33120047dc2e0eea93fb255ee21674d5d8c5.tar.xz gsoc2013-empathy-67fc33120047dc2e0eea93fb255ee21674d5d8c5.tar.zst gsoc2013-empathy-67fc33120047dc2e0eea93fb255ee21674d5d8c5.zip |
Define the debug object path in the header and keep CM bus names from tp_list_connection_names around.
Signed-off-by: Jonny Lamb <jonny.lamb@collabora.co.uk>
-rw-r--r-- | src/empathy-debug-dialog.c | 30 | ||||
-rw-r--r-- | src/empathy-debug-dialog.h | 2 |
2 files changed, 17 insertions, 15 deletions
diff --git a/src/empathy-debug-dialog.c b/src/empathy-debug-dialog.c index 6219f36de..b633eccaf 100644 --- a/src/empathy-debug-dialog.c +++ b/src/empathy-debug-dialog.c @@ -67,6 +67,7 @@ typedef struct TpProxy *proxy; TpProxySignalConnection *signal_connection; gboolean paused; + GList *bus_names; gboolean dispose_run; } EmpathyDebugDialogPriv; @@ -208,39 +209,29 @@ debug_dialog_cm_chooser_changed_cb (GtkComboBox *cm_chooser, EmpathyDebugDialog *debug_dialog) { EmpathyDebugDialogPriv *priv = GET_PRIV (debug_dialog); - gchar *cm; MissionControl *mc; TpDBusDaemon *dbus; GError *error = NULL; - gchar *bus_name; + const gchar *bus_name; TpConnection *connection; - mc = empathy_mission_control_dup_singleton (); - cm = gtk_combo_box_get_active_text (cm_chooser); - - if (cm == NULL) + if (gtk_combo_box_get_active (cm_chooser) == -1) { DEBUG ("No CM is selected"); - g_object_unref (mc); return; } + mc = empathy_mission_control_dup_singleton (); dbus = tp_dbus_daemon_dup (&error); if (error != NULL) { DEBUG ("Failed at duping the dbus daemon: %s", error->message); - g_free (cm); g_object_unref (mc); } - /* TODO: Fix this. */ - bus_name = g_strdup_printf ("org.freedesktop.Telepathy.ConnectionManager.%s", cm); - g_free (cm); - - connection = tp_connection_new (dbus, bus_name, - "/org/freedesktop/Telepathy/debug", &error); - g_free (bus_name); + bus_name = g_list_nth_data (priv->bus_names, gtk_combo_box_get_active (cm_chooser)); + connection = tp_connection_new (dbus, bus_name, DEBUG_OBJECT_PATH, &error); if (error != NULL) { @@ -298,6 +289,9 @@ debug_dialog_list_connection_names_cb (const gchar * const *names, for (i = 0; cms[i] != NULL; i++) gtk_combo_box_append_text (GTK_COMBO_BOX (priv->cm_chooser), cms[i]); + for (i = 0; names[i] != NULL; i++) + priv->bus_names = g_list_append (priv->bus_names, g_strdup (names[i])); + gtk_combo_box_set_active (GTK_COMBO_BOX (priv->cm_chooser), 0); /* Fill treeview */ @@ -560,6 +554,12 @@ debug_dialog_dispose (GObject *object) if (priv->signal_connection) tp_proxy_signal_connection_disconnect (priv->signal_connection); + if (priv->bus_names) + { + g_list_foreach (priv->bus_names, (GFunc) g_free, NULL); + g_list_free (priv->bus_names); + } + (G_OBJECT_CLASS (empathy_debug_dialog_parent_class)->dispose) (object); } diff --git a/src/empathy-debug-dialog.h b/src/empathy-debug-dialog.h index ad41bfc95..5d98fa0a4 100644 --- a/src/empathy-debug-dialog.h +++ b/src/empathy-debug-dialog.h @@ -38,6 +38,8 @@ G_BEGIN_DECLS #define EMPATHY_DEBUG_DIALOG_GET_CLASS(object) (G_TYPE_INSTANCE_GET_CLASS \ ((object), EMPATHY_TYPE_DEBUG_DIALOG, EmpathyDebugDialogClass)) +#define DEBUG_OBJECT_PATH "/org/freedesktop/Telepathy/debug" + typedef struct _EmpathyDebugDialog EmpathyDebugDialog; typedef struct _EmpathyDebugDialogClass EmpathyDebugDialogClass; |