[gnome-builder] tree: add gb_tree_expand_to_node()



commit 5e73dda914c00cf6a4fddc547dcdd93d3fb1561e
Author: Christian Hergert <christian hergert me>
Date:   Wed Apr 15 21:33:08 2015 -0700

    tree: add gb_tree_expand_to_node()

 src/tree/gb-tree.c |   18 ++++++++++++++++++
 src/tree/gb-tree.h |    2 ++
 2 files changed, 20 insertions(+), 0 deletions(-)
---
diff --git a/src/tree/gb-tree.c b/src/tree/gb-tree.c
index 9fb1c0a..1a372ed 100644
--- a/src/tree/gb-tree.c
+++ b/src/tree/gb-tree.c
@@ -1326,3 +1326,21 @@ gb_tree_init (GbTree *tree)
                     G_CALLBACK (gb_tree_button_press_event),
                     NULL);
 }
+
+void
+gb_tree_expand_to_node (GbTree     *tree,
+                        GbTreeNode *node)
+{
+  g_assert (GB_IS_TREE (tree));
+  g_assert (GB_IS_TREE_NODE (node));
+
+  if (gb_tree_node_get_expanded (node))
+    {
+      gb_tree_node_expand (node, TRUE);
+    }
+  else
+    {
+      gb_tree_node_expand (node, TRUE);
+      gb_tree_node_collapse (node);
+    }
+}
diff --git a/src/tree/gb-tree.h b/src/tree/gb-tree.h
index 46f011e..33f5f58 100644
--- a/src/tree/gb-tree.h
+++ b/src/tree/gb-tree.h
@@ -85,6 +85,8 @@ GbTreeNode   *gb_tree_find_custom    (GbTree        *tree,
                                       gpointer       key);
 void          gb_tree_scroll_to_node (GbTree        *tree,
                                       GbTreeNode    *node);
+void          gb_tree_expand_to_node (GbTree        *tree,
+                                      GbTreeNode    *node);
 
 G_END_DECLS
 


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