From 5e3f91d87bde1ca8484b4a35fc3cdc2f1ede8a85 Mon Sep 17 00:00:00 2001 From: Christopher James Lahey Date: Thu, 27 Jul 2000 01:36:20 +0000 Subject: Fixed a reference. 2000-07-26 Christopher James Lahey * e-table-click-to-add.c: Fixed a reference. * e-table-selection-model.c, e-table-selection-model.h: Added a clear function. * e-table.c, e-table.h: Made going from click to add to the main table and back work better. svn path=/trunk/; revision=4373 --- widgets/table/e-table.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'widgets/table/e-table.c') diff --git a/widgets/table/e-table.c b/widgets/table/e-table.c index ae258a5c44..8099d3de0d 100644 --- a/widgets/table/e-table.c +++ b/widgets/table/e-table.c @@ -184,6 +184,7 @@ e_table_init (GtkObject *object) e_table->drop_col = -1; e_table->selection = e_table_selection_model_new(); + e_table->cursor_loc = E_TABLE_CURSOR_LOC_NONE; } static void @@ -270,9 +271,22 @@ table_canvas_reflow (GnomeCanvas *canvas, ETable *e_table) e_table->reflow_idle_id = g_idle_add_full (400, (GSourceFunc) table_canvas_reflow_idle, e_table, NULL); } +static void +click_to_add_cursor_change (ETableClickToAdd *etcta, int row, int col, ETable *et) +{ + if (et->cursor_loc == E_TABLE_CURSOR_LOC_TABLE) { + e_table_selection_model_clear(et->selection); + } + et->cursor_loc = E_TABLE_CURSOR_LOC_ETCTA; +} + static void group_cursor_change (ETableGroup *etg, int row, ETable *et) { + if (et->cursor_loc == E_TABLE_CURSOR_LOC_ETCTA && et->click_to_add) { + e_table_click_to_add_commit(E_TABLE_CLICK_TO_ADD(et->click_to_add)); + } + et->cursor_loc = E_TABLE_CURSOR_LOC_TABLE; gtk_signal_emit (GTK_OBJECT (et), et_signals [CURSOR_CHANGE], row); @@ -441,6 +455,8 @@ e_table_setup_table (ETable *e_table, ETableHeader *full_header, ETableHeader *h NULL); e_canvas_vbox_add_item(E_CANVAS_VBOX(e_table->canvas_vbox), e_table->click_to_add); + gtk_signal_connect(GTK_OBJECT (e_table->click_to_add), "cursor_change", + GTK_SIGNAL_FUNC(click_to_add_cursor_change), e_table); } e_table->group = e_table_group_new ( -- cgit v1.2.3