diff options
Diffstat (limited to 'widgets/e-table/test-check.c')
-rw-r--r-- | widgets/e-table/test-check.c | 41 |
1 files changed, 31 insertions, 10 deletions
diff --git a/widgets/e-table/test-check.c b/widgets/e-table/test-check.c index 3a32098245..300ebf7a7e 100644 --- a/widgets/e-table/test-check.c +++ b/widgets/e-table/test-check.c @@ -1,3 +1,4 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ /* * Test code for the ETable package * @@ -66,7 +67,7 @@ set_value_at (ETableModel *etc, int col, int row, const void *val, void *data) g_assert (col < 2); g_assert (row < LINES); - if (col == 0){ + if (col == 0) { my_table [row].value = GPOINTER_TO_INT (val); printf ("Value at %d,%d set to %d\n", col, row, GPOINTER_TO_INT (val)); } else { @@ -84,19 +85,37 @@ is_cell_editable (ETableModel *etc, int col, int row, void *data) static void * duplicate_value (ETableModel *etc, int col, const void *value, void *data) { - if (col == 0){ - return (void *) value; - } else { - return g_strdup (value); - } + if (col == 0) { + return (void *) value; + } else { + return g_strdup (value); + } } static void free_value (ETableModel *etc, int col, void *value, void *data) { - if (col != 0){ - g_free (value); - } + if (col != 0) { + g_free (value); + } +} + +static void * +initialize_value (ETableModel *etc, int col, void *data) +{ + if (col == 0) + return NULL; + else + return g_strdup (""); +} + +static gboolean +value_is_empty (ETableModel *etc, int col, const void *value, void *data) +{ + if (col == 0) + return value == NULL; + else + return !(value && *(char *)value); } static void @@ -128,7 +147,9 @@ check_test (void) e_table_model = e_table_simple_new ( col_count, row_count, value_at, set_value_at, is_cell_editable, - duplicate_value, free_value, thaw, NULL); + duplicate_value, free_value, + initialize_value, value_is_empty, + thaw, NULL); /* * Header |