diff options
author | Christopher James Lahey <clahey@helixcode.com> | 2000-02-25 12:08:59 +0800 |
---|---|---|
committer | Chris Lahey <clahey@src.gnome.org> | 2000-02-25 12:08:59 +0800 |
commit | 14bfde56c8c54c7ad947dcf96be38f8b4e71e53e (patch) | |
tree | 68a453e6dfaebe6fbd92cd03c9a2dc797fa6bc85 /widgets/e-table/test-table.c | |
parent | 675d1c25dbedaccbb135dc8ccd784e6706aa4aaa (diff) | |
download | gsoc2013-evolution-14bfde56c8c54c7ad947dcf96be38f8b4e71e53e.tar.gz gsoc2013-evolution-14bfde56c8c54c7ad947dcf96be38f8b4e71e53e.tar.zst gsoc2013-evolution-14bfde56c8c54c7ad947dcf96be38f8b4e71e53e.zip |
Added duplicate_value and add_value. Use the new compare functions. Made
2000-02-24 Christopher James Lahey <clahey@helixcode.com>
* test-table.c: Added duplicate_value and add_value. Use the new
compare functions. Made it so we only create one model to better
test model view stuff. Changed the test to not have as many
extra, useless, columns.
* test-cols.c, test-check.c: Added duplicate_value and add_value. Use the new
compare functions.
* e-table.c, e-table.h: Use all the new features of e-table-groups
(sorting and grouping). Handle on the fly reorganization of
groups in an idle loop. Compare functions now are to return -1 if
the first item is greater, 0 if they are equal, or 1 if the second
item is greater.
* e-table-subset.c, e-table-subset.h: Made e-table-subset
disconnect properly from its signals when it dies.
* e-table-subset-variable.c, e-table-subset-variable.h:
Virtualized the add and remove commands so that
e_table_sorted_variable could override the add command to do sorting.
* e-table-sorted.c: Fixed this to inherit properly from
ETableSubset.
* e-table-simple.h, e-table-simple.c: Added handling of
duplicate_value and free_value;
* e-table-model.c, e-table-model.h: Added duplicate_value and
free_value for memory allocation of table elements outside the
table.
* e-table-item.c: Fixed a crashing bug.
* e-table-group.c: Added sorting. Fixed destruction to delete the
right things.
* e-table-group-leaf.c, e-table-group-leaf.h: Pass column and sort
order information into the e_table_sorted_variable. Properly
destroy things when deleted.
* e-table-group-container.c, e-table-group-container.h: Properly
handle the list of subgroups. Handle proper sorting and grouping
of subgroups.
* e-table-sorted-variable.c, e-table-sorted-variable.h: Files to
do a sorted model that stays sorted as you add and remove rows.
* Makefile.am: Added e-table-sorted-variable.c and
e-table-sorted-variable.h.
svn path=/trunk/; revision=1930
Diffstat (limited to 'widgets/e-table/test-table.c')
-rw-r--r-- | widgets/e-table/test-table.c | 39 |
1 files changed, 28 insertions, 11 deletions
diff --git a/widgets/e-table/test-table.c b/widgets/e-table/test-table.c index 1bd50e1479..0fdf32fcbe 100644 --- a/widgets/e-table/test-table.c +++ b/widgets/e-table/test-table.c @@ -176,6 +176,18 @@ 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) +{ + return g_strdup(value); +} + +static void +free_value (ETableModel *etc, int col, void *value, void *data) +{ + g_free(value); +} + static void thaw (ETableModel *etc, void *data) { @@ -205,7 +217,8 @@ table_browser_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 @@ -217,7 +230,7 @@ table_browser_test (void) ETableCol *ecol = e_table_col_new ( i, column_labels [i], 80, 20, cell_left_just, - g_str_equal, TRUE); + g_str_compare, TRUE); e_table_header_add_column (e_table_header, ecol, i); } @@ -263,7 +276,6 @@ static void do_e_table_demo (const char *spec) { GtkWidget *e_table, *window, *frame; - ETableModel *e_table_model; ECell *cell_left_just; ETableHeader *full_header; int i; @@ -271,9 +283,14 @@ do_e_table_demo (const char *spec) /* * Data model */ - e_table_model = e_table_simple_new ( - col_count, row_count, value_at, - set_value_at, is_cell_editable, thaw, NULL); + static ETableModel *e_table_model = NULL; + + if ( e_table_model == NULL ) + 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); full_header = e_table_header_new (); cell_left_just = e_cell_text_new (e_table_model, NULL, GTK_JUSTIFY_LEFT, TRUE); @@ -282,7 +299,7 @@ do_e_table_demo (const char *spec) ETableCol *ecol = e_table_col_new ( i, column_labels [i], 80, 20, cell_left_just, - g_str_equal, TRUE); + g_str_compare, TRUE); e_table_header_add_column (full_header, ecol, i); } @@ -306,9 +323,9 @@ e_table_test (void) load_data (); if (1){/*getenv ("DO")){*/ - do_e_table_demo ("<ETableSpecification> <columns-shown> <column> 0 </column> <column> 1 </column> <column> 2 </column> <column> 3 </column> <column> 4 </column> </columns-shown> <grouping> <leaf/> </grouping> </ETableSpecification>"); - do_e_table_demo ("<ETableSpecification> <columns-shown> <column> 0 </column> <column> 0 </column> <column> 0 </column> <column> 0 </column> <column> 0 </column> <column> 1 </column> <column> 2 </column> <column> 3 </column> <column> 4 </column> </columns-shown> <grouping> <group column=\"3\"> <group column=\"4\"> <leaf/> </group> </group> </grouping> </ETableSpecification>"); + do_e_table_demo ("<ETableSpecification> <columns-shown> <column> 0 </column> <column> 1 </column> <column> 2 </column> <column> 3 </column> <column> 4 </column> </columns-shown> <grouping> <leaf column=\"3\" ascending=\"1\"/> </grouping> </ETableSpecification>"); + do_e_table_demo ("<ETableSpecification> <columns-shown> <column> 0 </column> <column> 0 </column> <column> 1 </column> <column> 2 </column> <column> 3 </column> <column> 4 </column> </columns-shown> <grouping> <group column=\"3\" ascending=\"1\"> <group column=\"4\" ascending=\"0\"> <leaf column=\"2\" ascending=\"1\"/> </group> </group> </grouping> </ETableSpecification>"); } - do_e_table_demo ("<ETableSpecification> <columns-shown> <column> 0 </column> <column> 1 </column> <column> 2 </column> <column> 3 </column> <column> 4 </column> </columns-shown> <grouping> <group column=\"4\"> <leaf/> </group> </grouping> </ETableSpecification>"); - do_e_table_demo ("<ETableSpecification> <columns-shown> <column> 0 </column> <column> 1 </column> <column> 2 </column> <column> 3 </column> <column> 4 </column> </columns-shown> <grouping> <group column=\"3\"> <leaf/> </group> </grouping> </ETableSpecification>"); + do_e_table_demo ("<ETableSpecification> <columns-shown> <column> 0 </column> <column> 1 </column> <column> 2 </column> <column> 3 </column> <column> 4 </column> </columns-shown> <grouping> <group column=\"4\" ascending=\"1\"> <leaf column=\"2\" ascending=\"1\"/> </group> </grouping> </ETableSpecification>"); + do_e_table_demo ("<ETableSpecification> <columns-shown> <column> 0 </column> <column> 1 </column> <column> 2 </column> <column> 3 </column> <column> 4 </column> </columns-shown> <grouping> <group column=\"3\" ascending=\"1\"> <leaf column=\"2\" ascending=\"1\"/> </group> </grouping> </ETableSpecification>"); } |