aboutsummaryrefslogtreecommitdiffstats
path: root/widgets/table/e-tree-example-1.c
diff options
context:
space:
mode:
authorChris Toshok <toshok@helixcode.com>2000-06-23 15:47:37 +0800
committerChris Toshok <toshok@src.gnome.org>2000-06-23 15:47:37 +0800
commit422046cc58a534f6916205f282cc6b50a98eeb95 (patch)
tree3c5ab189a7edaa7adb10dac1031249ae1ec4f6f7 /widgets/table/e-tree-example-1.c
parent29a313c41efa7844952000a88d772af11fbb6f37 (diff)
downloadgsoc2013-evolution-422046cc58a534f6916205f282cc6b50a98eeb95.tar
gsoc2013-evolution-422046cc58a534f6916205f282cc6b50a98eeb95.tar.gz
gsoc2013-evolution-422046cc58a534f6916205f282cc6b50a98eeb95.tar.bz2
gsoc2013-evolution-422046cc58a534f6916205f282cc6b50a98eeb95.tar.lz
gsoc2013-evolution-422046cc58a534f6916205f282cc6b50a98eeb95.tar.xz
gsoc2013-evolution-422046cc58a534f6916205f282cc6b50a98eeb95.tar.zst
gsoc2013-evolution-422046cc58a534f6916205f282cc6b50a98eeb95.zip
add icon_at virtual function - it was stupid to make the insert call take
2000-06-23 Chris Toshok <toshok@helixcode.com> * e-tree-model.h, e-tree-model.c: add icon_at virtual function - it was stupid to make the insert call take 2 pixbufs. the model should give this information. * e-cell-tree.c: get rid of the opened/closed pixbuf stuff. call e_tree_model_icon_of_node. * e-tree-example-1.c: add my_icon_at. * e-tree-simple.c (simple_icon_at): new function (e_tree_simple_new): add icon_at parameter. * e-tree-simple.h: add SimpleIconAtFn. svn path=/trunk/; revision=3707
Diffstat (limited to 'widgets/table/e-tree-example-1.c')
-rw-r--r--widgets/table/e-tree-example-1.c19
1 files changed, 13 insertions, 6 deletions
diff --git a/widgets/table/e-tree-example-1.c b/widgets/table/e-tree-example-1.c
index c506faebd5..c98e53c7af 100644
--- a/widgets/table/e-tree-example-1.c
+++ b/widgets/table/e-tree-example-1.c
@@ -83,6 +83,15 @@ my_value_at (ETreeModel *etm, ETreePath *path, int col, void *model_data)
}
}
+static GdkPixbuf *
+my_icon_at (ETreeModel *etm, ETreePath *path, void *model_data)
+{
+ if (e_tree_model_node_is_expanded (etm, path))
+ return tree_expanded_pixbuf;
+ else
+ return tree_unexpanded_pixbuf;
+}
+
/* This function sets the value at a particular point in our ETreeModel. */
static void
my_set_value_at (ETreeModel *etm, ETreePath *path, int col, const void *val, void *model_data)
@@ -130,7 +139,6 @@ add_sibling (GtkButton *button, gpointer data)
e_tree_model_node_insert_before (e_tree_model, parent_node,
selected_node,
- NULL, NULL,
g_strdup("User added sibling"));
}
@@ -150,7 +158,7 @@ add_child (GtkButton *button, gpointer data)
g_assert (selected_node);
e_tree_model_node_insert (e_tree_model, selected_node,
- 0, NULL, NULL,
+ 0,
g_strdup("User added child"));
}
@@ -238,25 +246,24 @@ create_tree (void)
/* here we create our model. This uses the functions we defined
earlier. */
- e_tree_model = e_tree_simple_new (my_value_at,
+ e_tree_model = e_tree_simple_new (my_icon_at,
+ my_value_at,
my_set_value_at,
my_is_editable,
NULL);
/* create a root node with 5 children */
root_node = e_tree_model_node_insert (e_tree_model, NULL,
- 0, NULL, NULL,
+ 0,
g_strdup("Root Node"));
for (i = 0; i < 5; i++){
ETreePath *n = e_tree_model_node_insert (e_tree_model,
root_node, 0,
- tree_expanded_pixbuf, tree_unexpanded_pixbuf,
g_strdup("First level of children"));
for (j = 0; j < 5; j ++) {
e_tree_model_node_insert (e_tree_model,
n, 0,
- NULL, NULL,
g_strdup("Second level of children"));
}
}