[empathy: 11/28] Reimplement log_window_maybe_expand_events()



commit daae637bdf6ea311c306eefe298e5760e2af22dc
Author: Danielle Madeley <danielle madeley collabora co uk>
Date:   Mon Aug 8 11:15:06 2011 +1000

    Reimplement log_window_maybe_expand_events()

 data/empathy-log-window.html        |   19 +++++++++++++++++++
 libempathy-gtk/empathy-log-window.c |   15 ++++++---------
 2 files changed, 25 insertions(+), 9 deletions(-)
---
diff --git a/data/empathy-log-window.html b/data/empathy-log-window.html
index 839ddee..7947177 100644
--- a/data/empathy-log-window.html
+++ b/data/empathy-log-window.html
@@ -80,6 +80,25 @@ function toggleExpander(node, open)
     nodes[i].style.display = display;
 }
 
+function expandAll()
+{
+  function expandAllRecurse(node)
+    {
+      var nodes = getNodes(node);
+
+      for (var i = 0; i < nodes.length; i++)
+        {
+          toggleExpander(nodes[i], true);
+
+          expandAllRecurse(nodes[i]);
+        }
+    }
+
+  var treeview = document.getElementById('treeview');
+
+  expandAllRecurse(treeview);
+}
+
 function insertRow (path, text)
 {
   var treeview = document.getElementById('treeview');
diff --git a/libempathy-gtk/empathy-log-window.c b/libempathy-gtk/empathy-log-window.c
index cd1daac..bb8b1ce 100644
--- a/libempathy-gtk/empathy-log-window.c
+++ b/libempathy-gtk/empathy-log-window.c
@@ -2982,16 +2982,13 @@ log_window_what_setup (EmpathyLogWindow *self)
 static void
 log_window_maybe_expand_events (void)
 {
-  // GtkTreeView       *view;
-  // GtkTreeModel      *model;
+  GtkTreeModel      *model = GTK_TREE_MODEL (log_window->priv->store_events);
 
-  // FIXME: reimplement
-  // view = GTK_TREE_VIEW (log_window->priv->treeview_events);
-  // model = gtk_tree_view_get_model (view);
-
-  // /* If there's only one result, expand it */
-  // if (gtk_tree_model_iter_n_children (model, NULL) == 1)
-  //   gtk_tree_view_expand_all (view);
+  /* If there's only one result, expand it */
+  if (gtk_tree_model_iter_n_children (model, NULL) == 1)
+    webkit_web_view_execute_script (
+        WEBKIT_WEB_VIEW (log_window->priv->webview),
+        "javascript:expandAll()");
 }
 
 static gboolean



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]