+static void
+create_proxy_to_get_messages (EmpathyDebugWindow *debug_window,
+ GtkTreeIter *iter,
+ TpDBusDaemon *dbus)
+{
+ EmpathyDebugWindowPriv *priv = GET_PRIV (debug_window);
+ gchar *bus_name, *name = NULL;
+ TpProxy *new_proxy, *stored_proxy = NULL;
+ GtkTreeModel *pause_buffer, *active_buffer;
+ gboolean gone;
+
+ gtk_tree_model_get (GTK_TREE_MODEL (priv->service_store), iter,
+ COL_NAME, &name,
+ COL_GONE, &gone,
+ COL_ACTIVE_BUFFER, &active_buffer,
+ COL_PAUSE_BUFFER, &pause_buffer,
+ COL_PROXY, &stored_proxy,
+ -1);
+
+ /* If the stored_proxy is not NULL then messages have been obtained and
+ * new-debug-message-signal has been set on it. Also, the proxy is valid.
+ * If the service is gone, we still display the messages-cached till now. */
+ if (gone ||
+ (!gone && stored_proxy != NULL))
+ {
+ /* Nothing needs to be done. The associated active-buffer has already
+ * been set as view's model */
+ goto finally;
+ }
+
+ DEBUG ("Preparing proxy to obtain messages for service %s", name);
+
+ gtk_tree_model_get (GTK_TREE_MODEL (priv->service_store), iter,
+ COL_UNIQUE_NAME, &bus_name, -1);
+ new_proxy = g_object_new (TP_TYPE_PROXY,
+ "bus-name", bus_name,
+ "dbus-daemon", dbus,
+ "object-path", DEBUG_OBJECT_PATH,
+ NULL);
+ g_free (bus_name);
+
+ g_object_set_data (G_OBJECT (new_proxy), "active-buffer", active_buffer);
+ g_object_set_data (G_OBJECT (new_proxy), "pause-buffer", pause_buffer);
+
+ /* Now we call GetMessages with fresh proxy.
+ * The old proxy is NULL due to one of the following -
+ * * Wasn't saved as last GetMessages call failed
+ * * The service has newly arrived and no proxy has been prepared yet for it
+ * * A service with the same name has reappeared but the owner maybe new */
+ tp_proxy_add_interface_by_id (new_proxy, emp_iface_quark_debug ());
+
+ emp_cli_debug_call_get_messages (new_proxy, -1,
+ debug_window_get_messages_cb, debug_window, NULL, NULL);
+
+finally:
+ g_free (name);
+ tp_clear_object (&stored_proxy);
+ g_object_unref (active_buffer);
+ g_object_unref (pause_buffer);
+}
+
+static GtkListStore*
+new_list_store_for_service (void)
+{
+ return gtk_list_store_new (NUM_DEBUG_COLS,
+ G_TYPE_DOUBLE, /* COL_DEBUG_TIMESTAMP */
+ G_TYPE_STRING, /* COL_DEBUG_DOMAIN */
+ G_TYPE_STRING, /* COL_DEBUG_CATEGORY */
+ G_TYPE_STRING, /* COL_DEBUG_LEVEL_STRING */
+ G_TYPE_STRING, /* COL_DEBUG_MESSAGE */
+ G_TYPE_UINT); /* COL_DEBUG_LEVEL_VALUE */
+}
+