[gnome-builder] tree: make append/prepend tree operations private



commit 7e599bdaa8896f764cdbba96b42f29398331f8fa
Author: Christian Hergert <christian hergert me>
Date:   Sun Jun 14 20:10:13 2015 -0700

    tree: make append/prepend tree operations private

 src/tree/gb-tree-node.c    |   13 ++-----------
 src/tree/gb-tree-private.h |    6 ++++++
 src/tree/gb-tree.c         |   28 ++++++----------------------
 src/tree/gb-tree.h         |    6 ------
 4 files changed, 14 insertions(+), 39 deletions(-)
---
diff --git a/src/tree/gb-tree-node.c b/src/tree/gb-tree-node.c
index 1148c2e..6bd202f 100644
--- a/src/tree/gb-tree-node.c
+++ b/src/tree/gb-tree-node.c
@@ -129,14 +129,9 @@ void
 gb_tree_node_append (GbTreeNode *node,
                      GbTreeNode *child)
 {
-  GbTree *tree = NULL;
-
   g_return_if_fail (GB_IS_TREE_NODE (node));
 
-  g_object_get (node, "tree", &tree, NULL);
-  g_assert (tree);
-  gb_tree_append (tree, node, child);
-  g_clear_object (&tree);
+  _gb_tree_append (node->tree, node, child);
 }
 
 /**
@@ -149,13 +144,9 @@ void
 gb_tree_node_prepend (GbTreeNode *node,
                       GbTreeNode *child)
 {
-  GbTree *tree = NULL;
-
   g_return_if_fail (GB_IS_TREE_NODE (node));
 
-  g_object_get (node, "tree", &tree, NULL);
-  gb_tree_prepend (tree, node, child);
-  g_clear_object (&tree);
+  _gb_tree_prepend (node->tree, node, child);
 }
 
 /**
diff --git a/src/tree/gb-tree-private.h b/src/tree/gb-tree-private.h
index d9d20a6..d0f9a99 100644
--- a/src/tree/gb-tree-private.h
+++ b/src/tree/gb-tree-private.h
@@ -27,6 +27,12 @@ void         _gb_tree_invalidate              (GbTree        *tree,
                                                GbTreeNode    *node);
 GtkTreePath *_gb_tree_get_path                (GbTree        *tree,
                                                GList         *list);
+void         _gb_tree_append                  (GbTree        *self,
+                                               GbTreeNode    *node,
+                                               GbTreeNode    *child);
+void         _gb_tree_prepend                 (GbTree        *self,
+                                               GbTreeNode    *node,
+                                               GbTreeNode    *child);
 
 void         _gb_tree_node_set_tree           (GbTreeNode    *node,
                                                GbTree        *tree);
diff --git a/src/tree/gb-tree.c b/src/tree/gb-tree.c
index 98ef9b6..1746b4e 100644
--- a/src/tree/gb-tree.c
+++ b/src/tree/gb-tree.c
@@ -1367,18 +1367,10 @@ gb_tree_find_item (GbTree  *self,
   return lookup.result;
 }
 
-/**
- * gb_tree_append:
- * @tree: (in): A #GbTree.
- * @node: (in): A #GbTreeNode.
- * @child: (in): A #GbTreeNode.
- *
- * Appends @child to @node within the #GbTree.
- */
 void
-gb_tree_append (GbTree     *self,
-                GbTreeNode *node,
-                GbTreeNode *child)
+_gb_tree_append (GbTree     *self,
+                 GbTreeNode *node,
+                 GbTreeNode *child)
 {
   g_return_if_fail (GB_IS_TREE (self));
   g_return_if_fail (GB_IS_TREE_NODE (node));
@@ -1387,18 +1379,10 @@ gb_tree_append (GbTree     *self,
   gb_tree_add (self, node, child, FALSE);
 }
 
-/**
- * gb_tree_prepend:
- * @tree: (in): A #GbTree.
- * @node: (in): A #GbTreeNode.
- * @child: (in): A #GbTreeNode.
- *
- * Appends @child to @node within the #GbTree.
- */
 void
-gb_tree_prepend (GbTree     *self,
-                 GbTreeNode *node,
-                 GbTreeNode *child)
+_gb_tree_prepend (GbTree     *self,
+                  GbTreeNode *node,
+                  GbTreeNode *child)
 {
   g_return_if_fail (GB_IS_TREE (self));
   g_return_if_fail (GB_IS_TREE_NODE (node));
diff --git a/src/tree/gb-tree.h b/src/tree/gb-tree.h
index ec39e2c..69eb1a0 100644
--- a/src/tree/gb-tree.h
+++ b/src/tree/gb-tree.h
@@ -63,12 +63,6 @@ GbTreeNode   *gb_tree_find_custom    (GbTree        *self,
                                       gpointer       key);
 GbTreeNode   *gb_tree_get_selected   (GbTree        *self);
 void          gb_tree_rebuild        (GbTree        *self);
-void          gb_tree_append         (GbTree        *self,
-                                      GbTreeNode    *node,
-                                      GbTreeNode    *child);
-void          gb_tree_prepend        (GbTree        *self,
-                                      GbTreeNode    *node,
-                                      GbTreeNode    *child);
 void          gb_tree_set_root       (GbTree        *self,
                                       GbTreeNode    *node);
 GbTreeNode   *gb_tree_get_root       (GbTree        *self);


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