diff options
Diffstat (limited to 'widgets/table/test-check.c')
-rw-r--r-- | widgets/table/test-check.c | 26 |
1 files changed, 23 insertions, 3 deletions
diff --git a/widgets/table/test-check.c b/widgets/table/test-check.c index a6a59788ad..7894898255 100644 --- a/widgets/table/test-check.c +++ b/widgets/table/test-check.c @@ -14,6 +14,7 @@ #include "e-table-item.h" #include "e-util/e-cursors.h" #include "e-util/e-canvas-utils.h" +#include "e-util/e-util.h" #include "e-cell-text.h" #include "e-cell-checkbox.h" @@ -79,6 +80,24 @@ is_cell_editable (ETableModel *etc, int col, int row, void *data) return TRUE; } +static void * +duplicate_value (ETableModel *etc, int col, const void *value, void *data) +{ + 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); + } +} + static void thaw (ETableModel *etc, void *data) { @@ -107,7 +126,8 @@ check_test (void) e_table_model = e_table_simple_new ( col_count, row_count, value_at, - set_value_at, is_cell_editable, thaw, NULL); + set_value_at, is_cell_editable, + duplicate_value, free_value, thaw, NULL); /* * Header @@ -118,11 +138,11 @@ check_test (void) cell_image_check = e_cell_checkbox_new (); pixbuf = gdk_pixbuf_new_from_file("clip.png"); - col_0 = e_table_col_new_with_pixbuf (0, pixbuf, 18, 18, cell_image_check, g_int_equal, TRUE); + col_0 = e_table_col_new_with_pixbuf (0, pixbuf, 18, 18, cell_image_check, g_int_compare, TRUE); gdk_pixbuf_unref(pixbuf); e_table_header_add_column (e_table_header, col_0, 0); - col_1 = e_table_col_new (1, "Item Name", 180, 20, cell_left_just, g_str_equal, TRUE); + col_1 = e_table_col_new (1, "Item Name", 180, 20, cell_left_just, g_str_compare, TRUE); e_table_header_add_column (e_table_header, col_1, 1); e_table_col_set_arrow ( col_1, E_TABLE_COL_ARROW_DOWN ); |