aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChandni Verma <chandniverma2112@gmail.com>2011-11-07 07:36:34 +0800
committerChandni Verma <chandniverma2112@gmail.com>2012-01-28 14:49:08 +0800
commite758dca58b4f362d35eaaf8f333ea7f20dfd8ecd (patch)
treee492c383ab6da95ecbb23283f150ab52b8bd3dc2
parent7a6a03aff158ddc47c1f70093b1f903be2d44181 (diff)
downloadgsoc2013-empathy-e758dca58b4f362d35eaaf8f333ea7f20dfd8ecd.tar
gsoc2013-empathy-e758dca58b4f362d35eaaf8f333ea7f20dfd8ecd.tar.gz
gsoc2013-empathy-e758dca58b4f362d35eaaf8f333ea7f20dfd8ecd.tar.bz2
gsoc2013-empathy-e758dca58b4f362d35eaaf8f333ea7f20dfd8ecd.tar.lz
gsoc2013-empathy-e758dca58b4f362d35eaaf8f333ea7f20dfd8ecd.tar.xz
gsoc2013-empathy-e758dca58b4f362d35eaaf8f333ea7f20dfd8ecd.tar.zst
gsoc2013-empathy-e758dca58b4f362d35eaaf8f333ea7f20dfd8ecd.zip
Add "All" selection to service_chooser and all_active_buffer to priv
https://bugzilla.gnome.org/show_bug.cgi?id=592994
-rw-r--r--src/empathy-debug-window.c38
1 files changed, 35 insertions, 3 deletions
diff --git a/src/empathy-debug-window.c b/src/empathy-debug-window.c
index 75cb6df19..c0ef73a43 100644
--- a/src/empathy-debug-window.c
+++ b/src/empathy-debug-window.c
@@ -111,12 +111,17 @@ typedef struct
/* Service (CM, Client) chooser store */
GtkListStore *service_store;
+ /* Counters on services detected and added */
+ guint services_detected;
+ guint name_owner_cb_count;
+
/* Debug to show upon creation */
gchar *select_name;
/* Misc. */
gboolean dispose_run;
TpAccountManager *am;
+ GtkListStore *all_active_buffer;
} EmpathyDebugWindowPriv;
static const gchar *
@@ -792,6 +797,9 @@ debug_window_get_name_owner_cb (TpDBusDaemon *proxy,
FillServiceChooserData *data = (FillServiceChooserData *) user_data;
EmpathyDebugWindow *self = EMPATHY_DEBUG_WINDOW (data->debug_window);
EmpathyDebugWindowPriv *priv = GET_PRIV (data->debug_window);
+ GtkTreeIter iter;
+
+ priv->name_owner_cb_count++;
if (error != NULL)
{
@@ -801,7 +809,6 @@ debug_window_get_name_owner_cb (TpDBusDaemon *proxy,
if (!debug_window_service_is_in_model (data->debug_window, out, NULL, FALSE))
{
- GtkTreeIter iter;
char *name;
GtkListStore *active_buffer, *pause_buffer;
@@ -840,6 +847,20 @@ debug_window_get_name_owner_cb (TpDBusDaemon *proxy,
g_free (name);
}
+ if (priv->services_detected == priv->name_owner_cb_count)
+ {
+ /* Time to add "All" selection to service_store */
+ gtk_list_store_prepend (priv->service_store, &iter);
+ gtk_list_store_set (priv->service_store, &iter,
+ COL_NAME, "All",
+ COL_ACTIVE_BUFFER, NULL,
+ -1);
+
+ priv->all_active_buffer = new_list_store_for_service ();
+
+ gtk_combo_box_set_active (GTK_COMBO_BOX (priv->chooser), 0);
+ }
+
OUT:
fill_service_chooser_data_free (data);
}
@@ -854,6 +875,7 @@ debug_window_list_connection_names_cb (const gchar * const *names,
GObject *weak_object)
{
EmpathyDebugWindow *debug_window = (EmpathyDebugWindow *) user_data;
+ EmpathyDebugWindowPriv *priv = GET_PRIV (debug_window);
guint i;
TpDBusDaemon *dbus;
GError *error2 = NULL;
@@ -881,6 +903,8 @@ debug_window_list_connection_names_cb (const gchar * const *names,
tp_cli_dbus_daemon_call_get_name_owner (dbus, -1,
names[i], debug_window_get_name_owner_cb,
data, NULL, NULL);
+
+ priv->services_detected ++;
}
g_object_unref (dbus);
@@ -1018,6 +1042,8 @@ add_client (EmpathyDebugWindow *self,
tp_cli_dbus_daemon_call_get_name_owner (priv->dbus, -1,
name, debug_window_get_name_owner_cb, data, NULL, NULL);
+
+ priv->services_detected ++;
}
static void
@@ -1062,6 +1088,10 @@ debug_window_fill_service_chooser (EmpathyDebugWindow *debug_window)
return;
}
+ /* Keep a count of the services detected and added */
+ priv->services_detected = 0;
+ priv->name_owner_cb_count = 0;
+
/* Add CMs to list */
tp_list_connection_names (priv->dbus, debug_window_list_connection_names_cb,
debug_window, NULL, NULL);
@@ -1082,8 +1112,6 @@ debug_window_fill_service_chooser (EmpathyDebugWindow *debug_window)
g_object_unref (active_buffer);
g_object_unref (pause_buffer);
- gtk_combo_box_set_active (GTK_COMBO_BOX (priv->chooser), 0);
-
/* add clients */
tp_dbus_daemon_list_names (priv->dbus, 2000,
list_names_cb, NULL, NULL, G_OBJECT (debug_window));
@@ -1782,6 +1810,8 @@ am_prepared_cb (GObject *am,
priv->view_visible = FALSE;
+ priv->all_active_buffer = NULL;
+
debug_window_set_toolbar_sensitivity (EMPATHY_DEBUG_WINDOW (object), FALSE);
debug_window_fill_service_chooser (EMPATHY_DEBUG_WINDOW (object));
gtk_widget_show (GTK_WIDGET (object));
@@ -1872,6 +1902,8 @@ debug_window_dispose (GObject *object)
priv->am = NULL;
}
+ tp_clear_object (&priv->all_active_buffer);
+
(G_OBJECT_CLASS (empathy_debug_window_parent_class)->dispose) (object);
}