]> git.0d.be Git - empathy.git/commitdiff
Add incoming messages to All's buffer
authorChandni Verma <chandniverma2112@gmail.com>
Fri, 2 Dec 2011 11:04:29 +0000 (16:34 +0530)
committerChandni Verma <chandniverma2112@gmail.com>
Sat, 28 Jan 2012 06:49:16 +0000 (12:19 +0530)
https://bugzilla.gnome.org/show_bug.cgi?id=592994

src/empathy-debug-window.c

index beab6616074666a896bacf3d9da754e7097e39e1..9cb32a34bb65742f38e884c1c430522932fa1d52 100644 (file)
@@ -207,6 +207,26 @@ copy_buffered_messages (GtkTreeModel *buffer,
   return FALSE;
 }
 
+static void
+insert_values_in_buffer (GtkListStore *store,
+        gdouble timestamp,
+        const gchar *domain,
+        const gchar *category,
+        guint level,
+        const gchar *string)
+{
+  GtkTreeIter iter;
+
+  gtk_list_store_insert_with_values (store, &iter, -1,
+      COL_DEBUG_TIMESTAMP, timestamp,
+      COL_DEBUG_DOMAIN, domain,
+      COL_DEBUG_CATEGORY, category,
+      COL_DEBUG_LEVEL_STRING, log_level_to_string (level),
+      COL_DEBUG_MESSAGE, string,
+      COL_DEBUG_LEVEL_VALUE, level,
+      -1); 
+}
+
 static void
 debug_window_add_message (EmpathyDebugWindow *debug_window,
     TpProxy *proxy,
@@ -217,7 +237,6 @@ debug_window_add_message (EmpathyDebugWindow *debug_window,
 {
   EmpathyDebugWindowPriv *priv = GET_PRIV (debug_window);
   gchar *domain, *category;
-  GtkTreeIter iter;
   gchar *string;
   GtkListStore *active_buffer, *pause_buffer;
 
@@ -242,16 +261,23 @@ debug_window_add_message (EmpathyDebugWindow *debug_window,
   pause_buffer = g_object_get_data (G_OBJECT (proxy), "pause-buffer");
   active_buffer = g_object_get_data (G_OBJECT (proxy), "active-buffer");
 
-  gtk_list_store_append (priv->paused ? pause_buffer : active_buffer,
-      &iter);
-  gtk_list_store_set (priv->paused ? pause_buffer : active_buffer, &iter,
-      COL_DEBUG_TIMESTAMP, timestamp,
-      COL_DEBUG_DOMAIN, domain,
-      COL_DEBUG_CATEGORY, category,
-      COL_DEBUG_LEVEL_STRING, log_level_to_string (level),
-      COL_DEBUG_MESSAGE, string,
-      COL_DEBUG_LEVEL_VALUE, level,
-      -1);
+  if (priv->paused)
+    {
+      insert_values_in_buffer (pause_buffer, timestamp,
+          domain, category, level,
+          string);
+    }
+  else
+    {
+      /* Append 'this' message to this service's and All's active-buffers */
+      insert_values_in_buffer (active_buffer, timestamp,
+          domain, category, level,
+          string);
+
+      insert_values_in_buffer (priv->all_active_buffer, timestamp,
+          domain, category, level,
+          string);
+    }
 
   g_free (string);
   g_free (domain);