From 46f211579d1dfd60147099942b40c9697796e7c8 Mon Sep 17 00:00:00 2001 From: Christopher James Lahey Date: Fri, 19 May 2000 18:47:16 +0000 Subject: Added initialize_value and value_is_empty callbacks. 2000-05-19 Christopher James Lahey * e-table-example-1.c, e-table-example-2.c, e-table-simple.c, e-table-simple.h, e-table-size-test.c, test-check.c, test-cols.c, test-table.c: Added initialize_value and value_is_empty callbacks. * e-table-model.c, e-table-model.h: Added initialize_value and value_is_callback virtual functions to the ETableModel class. * e-table-subset.c: Perpetuate the initialize_value and value_is_empty methods. svn path=/trunk/; revision=3138 --- widgets/table/e-table-size-test.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'widgets/table/e-table-size-test.c') diff --git a/widgets/table/e-table-size-test.c b/widgets/table/e-table-size-test.c index d12a57fbbb..058429ca64 100644 --- a/widgets/table/e-table-size-test.c +++ b/widgets/table/e-table-size-test.c @@ -157,6 +157,20 @@ 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 is for when the model is unfrozen. This can mostly be ignored for simple models. */ static void @@ -179,7 +193,9 @@ create_table (void) e_table_model = e_table_simple_new ( my_col_count, my_row_count, my_value_at, my_set_value_at, my_is_cell_editable, - my_duplicate_value, my_free_value, my_thaw, NULL); + my_duplicate_value, my_free_value, + my_initialize_value, my_value_is_empty, + my_thaw, NULL); /* * Next we create a header. The ETableHeader is used in two * different way. The first is the full_header. This is the -- cgit v1.2.3