[gnome-builder/gnome-builder-3-18] symbol-tree: expand toplevel items by default



commit dc8d2165639c1b7311ccd687f098bcf43e74165e
Author: Christian Hergert <christian hergert me>
Date:   Mon Sep 28 07:45:41 2015 -0700

    symbol-tree: expand toplevel items by default

 plugins/symbol-tree/symbol-tree.c |   17 +++++++++++++++++
 1 files changed, 17 insertions(+), 0 deletions(-)
---
diff --git a/plugins/symbol-tree/symbol-tree.c b/plugins/symbol-tree/symbol-tree.c
index 7326c06..3b2a63a 100644
--- a/plugins/symbol-tree/symbol-tree.c
+++ b/plugins/symbol-tree/symbol-tree.c
@@ -65,6 +65,8 @@ get_cached_symbol_tree_cb (GObject      *object,
   g_autoptr(IdeSymbolTree) symbol_tree = NULL;
   g_autoptr(GError) error = NULL;
   GbTreeNode *root;
+  GtkTreeIter iter;
+  GtkTreeModel *model;
 
   g_assert (EGG_IS_TASK_CACHE (cache));
   g_assert (G_IS_ASYNC_RESULT (result));
@@ -84,6 +86,21 @@ get_cached_symbol_tree_cb (GObject      *object,
                        "item", symbol_tree,
                        NULL);
   gb_tree_set_root (self->tree, root);
+
+  model = gtk_tree_view_get_model (GTK_TREE_VIEW (self->tree));
+
+  if (gtk_tree_model_get_iter_first (model, &iter))
+    {
+      do
+        {
+          g_autoptr(GbTreeNode) node = NULL;
+
+          gtk_tree_model_get (model, &iter, 0, &node, -1);
+          if (node != NULL)
+            gb_tree_node_expand (node, FALSE);
+        }
+      while (gtk_tree_model_iter_next (model, &iter));
+    }
 }
 
 static void


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