diff options
author | Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> | 2010-06-29 20:56:19 +0800 |
---|---|---|
committer | Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> | 2010-07-09 19:38:39 +0800 |
commit | 405a6c07d0579285dc4d35cb9cfee795fff0f744 (patch) | |
tree | cac05f1d652e76bc4bda0871b35b647a503c347e | |
parent | f598e0acbf7c981d5adaf7bf52a30d2a61d04aba (diff) | |
download | gsoc2013-empathy-405a6c07d0579285dc4d35cb9cfee795fff0f744.tar gsoc2013-empathy-405a6c07d0579285dc4d35cb9cfee795fff0f744.tar.gz gsoc2013-empathy-405a6c07d0579285dc4d35cb9cfee795fff0f744.tar.bz2 gsoc2013-empathy-405a6c07d0579285dc4d35cb9cfee795fff0f744.tar.lz gsoc2013-empathy-405a6c07d0579285dc4d35cb9cfee795fff0f744.tar.xz gsoc2013-empathy-405a6c07d0579285dc4d35cb9cfee795fff0f744.tar.zst gsoc2013-empathy-405a6c07d0579285dc4d35cb9cfee795fff0f744.zip |
debug-window: add Telepathy clients
-rw-r--r-- | src/empathy-debug-window.c | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/src/empathy-debug-window.c b/src/empathy-debug-window.c index 0894d9453..11d56a473 100644 --- a/src/empathy-debug-window.c +++ b/src/empathy-debug-window.c @@ -812,6 +812,54 @@ debug_window_name_owner_changed_cb (TpDBusDaemon *proxy, } static void +add_client (EmpathyDebugWindow *self, + const gchar *name) +{ + EmpathyDebugWindowPriv *priv = GET_PRIV (self); + const gchar *suffix; + GtkTreeIter iter; + + suffix = name + strlen (TP_CLIENT_BUS_NAME_BASE); + + gtk_list_store_append (priv->cms, &iter); + gtk_list_store_set (priv->cms, &iter, + COL_CM_NAME, suffix, + COL_CM_UNIQUE_NAME, name, + -1); + + /* Select Empathy by default */ + if (!tp_strdiff (suffix, "Empathy")) + { + gtk_combo_box_set_active_iter (GTK_COMBO_BOX (priv->cm_chooser), &iter); + } +} + +static void +list_names_cb (TpDBusDaemon *bus_daemon, + const gchar * const *names, + const GError *error, + gpointer user_data, + GObject *weak_object) +{ + EmpathyDebugWindow *self = EMPATHY_DEBUG_WINDOW (weak_object); + guint i; + + if (error != NULL) + { + DEBUG ("Failed to list names: %s", error->message); + return; + } + + for (i = 0; names[i] != NULL; i++) + { + if (g_str_has_prefix (names[i], TP_CLIENT_BUS_NAME_BASE)) + { + add_client (self, names[i]); + } + } +} + +static void debug_window_fill_cm_chooser (EmpathyDebugWindow *debug_window) { EmpathyDebugWindowPriv *priv = GET_PRIV (debug_window); @@ -838,6 +886,12 @@ debug_window_fill_cm_chooser (EmpathyDebugWindow *debug_window) COL_CM_UNIQUE_NAME, "org.freedesktop.Telepathy.MissionControl5", -1); + gtk_combo_box_set_active (GTK_COMBO_BOX (priv->cm_chooser), 0); + + /* add clients */ + tp_dbus_daemon_list_names (priv->dbus, 2000, + list_names_cb, NULL, NULL, G_OBJECT (debug_window)); + priv->name_owner_changed_signal = tp_cli_dbus_daemon_connect_to_name_owner_changed (priv->dbus, debug_window_name_owner_changed_cb, debug_window, NULL, NULL, NULL); |