aboutsummaryrefslogtreecommitdiffstats
path: root/e-util
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2013-06-16 01:11:49 +0800
committerMatthew Barnes <mbarnes@redhat.com>2013-06-16 01:14:41 +0800
commitb58e9944529a890c5b9672cf6e5eb4f930112b63 (patch)
tree26c8eb8d719583d95eef1a6b1811f0ab74d13de8 /e-util
parent275030595e58421288ba98a4abf67ba9e5a5e761 (diff)
downloadgsoc2013-evolution-b58e9944529a890c5b9672cf6e5eb4f930112b63.tar
gsoc2013-evolution-b58e9944529a890c5b9672cf6e5eb4f930112b63.tar.gz
gsoc2013-evolution-b58e9944529a890c5b9672cf6e5eb4f930112b63.tar.bz2
gsoc2013-evolution-b58e9944529a890c5b9672cf6e5eb4f930112b63.tar.lz
gsoc2013-evolution-b58e9944529a890c5b9672cf6e5eb4f930112b63.tar.xz
gsoc2013-evolution-b58e9944529a890c5b9672cf6e5eb4f930112b63.tar.zst
gsoc2013-evolution-b58e9944529a890c5b9672cf6e5eb4f930112b63.zip
Add e_tree_memory_get_n_children().
Replaces e_tree_memory_get_children(). The "paths" output parameter was unused, and was a bad idea anyway.
Diffstat (limited to 'e-util')
-rw-r--r--e-util/e-cell-tree.c2
-rw-r--r--e-util/e-tree-memory.c26
-rw-r--r--e-util/e-tree-model.c9
-rw-r--r--e-util/e-tree-model.h11
4 files changed, 14 insertions, 34 deletions
diff --git a/e-util/e-cell-tree.c b/e-util/e-cell-tree.c
index 085fb0cabe..ba5779c720 100644
--- a/e-util/e-cell-tree.c
+++ b/e-util/e-cell-tree.c
@@ -701,7 +701,7 @@ ect_print (ECellView *ecell_view,
gint depth;
if (!e_tree_model_node_is_root (tree_model, node)
- || e_tree_model_node_get_children (tree_model, node, NULL) > 0) {
+ || e_tree_model_node_get_n_children (tree_model, node) > 0) {
cairo_move_to (
cr,
offset - INDENT_AMOUNT / 2,
diff --git a/e-util/e-tree-memory.c b/e-util/e-tree-memory.c
index b3aadd87c8..743aab010d 100644
--- a/e-util/e-tree-memory.c
+++ b/e-util/e-tree-memory.c
@@ -111,28 +111,10 @@ tree_memory_is_expandable (ETreeModel *etm,
}
static guint
-tree_memory_get_children (ETreeModel *etm,
- ETreePath path,
- ETreePath **nodes)
+tree_memory_get_n_children (ETreeModel *etm,
+ ETreePath path)
{
- guint n_children;
-
- n_children = g_node_n_children ((GNode *) path);
-
- if (nodes != NULL) {
- GNode *child;
- gint ii = 0;
-
- (*nodes) = g_new (ETreePath, n_children);
-
- child = g_node_first_child ((GNode *) path);
- while (child != NULL) {
- (*nodes)[ii++] = child;
- child = g_node_next_sibling (child);
- }
- }
-
- return n_children;
+ return g_node_n_children ((GNode *) path);
}
static guint
@@ -169,7 +151,7 @@ e_tree_memory_class_init (ETreeMemoryClass *class)
tree_model_class->is_root = tree_memory_is_root;
tree_model_class->is_expandable = tree_memory_is_expandable;
- tree_model_class->get_children = tree_memory_get_children;
+ tree_model_class->get_n_children = tree_memory_get_n_children;
tree_model_class->depth = tree_memory_depth;
tree_model_class->get_expanded_default = tree_memory_get_expanded_default;
}
diff --git a/e-util/e-tree-model.c b/e-util/e-tree-model.c
index d866da8adc..d469d23da4 100644
--- a/e-util/e-tree-model.c
+++ b/e-util/e-tree-model.c
@@ -399,18 +399,17 @@ e_tree_model_node_is_expandable (ETreeModel *tree_model,
}
guint
-e_tree_model_node_get_children (ETreeModel *tree_model,
- ETreePath path,
- ETreePath **paths)
+e_tree_model_node_get_n_children (ETreeModel *tree_model,
+ ETreePath path)
{
ETreeModelClass *class;
g_return_val_if_fail (E_IS_TREE_MODEL (tree_model), 0);
class = E_TREE_MODEL_GET_CLASS (tree_model);
- g_return_val_if_fail (class->get_children != NULL, 0);
+ g_return_val_if_fail (class->get_n_children != NULL, 0);
- return class->get_children (tree_model, path, paths);
+ return class->get_n_children (tree_model, path);
}
/**
diff --git a/e-util/e-tree-model.h b/e-util/e-tree-model.h
index 330bcd9258..431f93e2a2 100644
--- a/e-util/e-tree-model.h
+++ b/e-util/e-tree-model.h
@@ -84,9 +84,8 @@ struct _ETreeModelClass {
ETreePath path);
gboolean (*is_expandable) (ETreeModel *tree_model,
ETreePath path);
- guint (*get_children) (ETreeModel *tree_model,
- ETreePath path,
- ETreePath **paths);
+ guint (*get_n_children) (ETreeModel *tree_model,
+ ETreePath path);
guint (*depth) (ETreeModel *tree_model,
ETreePath path);
@@ -179,9 +178,9 @@ gboolean e_tree_model_node_is_root (ETreeModel *tree_model,
ETreePath path);
gboolean e_tree_model_node_is_expandable (ETreeModel *tree_model,
ETreePath path);
-guint e_tree_model_node_get_children (ETreeModel *tree_model,
- ETreePath path,
- ETreePath **paths);
+guint e_tree_model_node_get_n_children
+ (ETreeModel *tree_model,
+ ETreePath path);
guint e_tree_model_node_depth (ETreeModel *tree_model,
ETreePath path);
GdkPixbuf * e_tree_model_icon_at (ETreeModel *tree_model,