aboutsummaryrefslogtreecommitdiffstats
path: root/widgets/table/e-tree-example-1.c
diff options
context:
space:
mode:
authorChristopher James Lahey <clahey@helixcode.com>2000-09-09 00:51:21 +0800
committerChris Lahey <clahey@src.gnome.org>2000-09-09 00:51:21 +0800
commit7816388a7ab06deb31f269c0f716eea5a62c9666 (patch)
tree4a243e55764d7666b279f10c78fbdb0f28783081 /widgets/table/e-tree-example-1.c
parenta0ab37d85aeb661516a1afa1e1cf699e194f4a8d (diff)
downloadgsoc2013-evolution-7816388a7ab06deb31f269c0f716eea5a62c9666.tar.gz
gsoc2013-evolution-7816388a7ab06deb31f269c0f716eea5a62c9666.tar.zst
gsoc2013-evolution-7816388a7ab06deb31f269c0f716eea5a62c9666.zip
Added base ETableModel functions.
2000-09-08 Christopher James Lahey <clahey@helixcode.com> * e-tree-example-1.c: Added base ETableModel functions. * e-tree-example-2.c: Added base ETableModel functions. Made it never return NULL as a string, instead return "". * e-tree-simple.c, e-tree-simple.h: Require base ETableModel functions. svn path=/trunk/; revision=5266
Diffstat (limited to 'widgets/table/e-tree-example-1.c')
-rw-r--r--widgets/table/e-tree-example-1.c50
1 files changed, 49 insertions, 1 deletions
diff --git a/widgets/table/e-tree-example-1.c b/widgets/table/e-tree-example-1.c
index 71b3f7ca5d..abc40a0449 100644
--- a/widgets/table/e-tree-example-1.c
+++ b/widgets/table/e-tree-example-1.c
@@ -70,6 +70,48 @@ GtkWidget *e_table;
* These are the callbacks that define the behavior of our custom model.
*/
+/* This function returns the number of columns in our ETableModel. */
+static int
+my_col_count (ETableModel *etc, void *data)
+{
+ return COLS;
+}
+
+/* This function duplicates the value passed to it. */
+static void *
+my_duplicate_value (ETableModel *etc, int col, const void *value, void *data)
+{
+ return g_strdup (value);
+}
+
+/* This function frees the value passed to it. */
+static void
+my_free_value (ETableModel *etc, int col, void *value, void *data)
+{
+ g_free (value);
+}
+
+/* This function creates an empty value. */
+static void *
+my_initialize_value (ETableModel *etc, int col, void *data)
+{
+ return g_strdup ("");
+}
+
+/* This function reports if a value is empty. */
+static gboolean
+my_value_is_empty (ETableModel *etc, int col, const void *value, void *data)
+{
+ return !(value && *(char *)value);
+}
+
+/* This function reports if a value is empty. */
+static char *
+my_value_to_string (ETableModel *etc, int col, const void *value, void *data)
+{
+ return g_strdup(value);
+}
+
/* This function returns the value at a particular point in our ETreeModel. */
static void *
my_value_at (ETreeModel *etm, ETreePath *path, int col, void *model_data)
@@ -241,7 +283,13 @@ create_tree (void)
/* here we create our model. This uses the functions we defined
earlier. */
- e_tree_model = e_tree_simple_new (my_icon_at,
+ e_tree_model = e_tree_simple_new (my_col_count,
+ my_duplicate_value,
+ my_free_value,
+ my_initialize_value,
+ my_value_is_empty,
+ my_value_to_string,
+ my_icon_at,
my_value_at,
my_set_value_at,
my_is_editable,