diff options
Diffstat (limited to 'widgets/table')
-rw-r--r-- | widgets/table/e-table-item.c | 28 | ||||
-rw-r--r-- | widgets/table/e-table-without.c | 5 |
2 files changed, 27 insertions, 6 deletions
diff --git a/widgets/table/e-table-item.c b/widgets/table/e-table-item.c index 067a5fc60b..ff8dd64292 100644 --- a/widgets/table/e-table-item.c +++ b/widgets/table/e-table-item.c @@ -4,7 +4,7 @@ * * Author: * Christopher James Lahey <clahey@ximian.com> - * Miguel de Icaza (miguel@gnu.org) + * Miguel de Icaza <miguel@gnu.org> * * Copyright 1999, 2000, 2001, Ximian, Inc. * @@ -881,12 +881,26 @@ eti_idle_maybe_show_cursor(ETableItem *eti) g_idle_add (eti_idle_maybe_show_cursor_cb, eti); } +static void +eti_cancel_drag_due_to_model_change (ETableItem *eti) +{ + if (eti->maybe_in_drag) { + eti->maybe_in_drag = FALSE; + if (!eti->maybe_did_something) + e_selection_model_do_something(E_SELECTION_MODEL (eti->selection), eti->drag_row, eti->drag_col, eti->drag_state); + } + if (eti->in_drag) { + eti->in_drag = FALSE; + } +} + /* * Callback routine: invoked before the ETableModel has suffers a change */ static void eti_table_model_pre_change (ETableModel *table_model, ETableItem *eti) { + eti_cancel_drag_due_to_model_change (eti); eti_check_cursor_bounds (eti); if (eti_editing (eti)) e_table_item_leave_edit (eti); @@ -895,6 +909,7 @@ eti_table_model_pre_change (ETableModel *table_model, ETableItem *eti) /* * Callback routine: invoked when the ETableModel has suffered a change */ + static void eti_table_model_changed (ETableModel *table_model, ETableItem *eti) { @@ -2065,12 +2080,13 @@ eti_event (GnomeCanvasItem *item, GdkEvent *e) int col, row; gint cursor_row, cursor_col; - if (e->button.button == 1) { - if (eti->grabbed) { - gtk_grab_remove (GTK_WIDGET (item->canvas)); - gnome_canvas_item_ungrab(item, e->button.time); - } + if (eti->grabbed) { + gtk_grab_remove (GTK_WIDGET (item->canvas)); + gnome_canvas_item_ungrab(item, e->button.time); eti->grabbed = FALSE; + } + + if (e->button.button == 1) { if (eti->maybe_in_drag) { eti->maybe_in_drag = FALSE; if (!eti->maybe_did_something) diff --git a/widgets/table/e-table-without.c b/widgets/table/e-table-without.c index 1045906de2..2f6fb77733 100644 --- a/widgets/table/e-table-without.c +++ b/widgets/table/e-table-without.c @@ -85,6 +85,8 @@ add_row (ETableWithout *etw, int model_row) { ETableSubset *etss = E_TABLE_SUBSET (etw); + e_table_model_pre_change (E_TABLE_MODEL (etw)); + etss->map_table = g_renew (int, etss->map_table, etss->n_map + 1); etss->map_table[etss->n_map++] = model_row; @@ -97,6 +99,7 @@ remove_row (ETableWithout *etw, int view_row) { ETableSubset *etss = E_TABLE_SUBSET (etw); + e_table_model_pre_change (E_TABLE_MODEL (etw)); memmove (etss->map_table + view_row, etss->map_table + view_row + 1, (etss->n_map - view_row - 1) * sizeof (int)); etss->n_map --; e_table_model_row_deleted (E_TABLE_MODEL (etw), view_row); @@ -341,6 +344,8 @@ e_table_without_show_all (ETableWithout *etw) int row_count; ETableSubset *etss = E_TABLE_SUBSET (etw); + e_table_model_pre_change (E_TABLE_MODEL (etw)); + if (etw->priv->hash) { g_hash_table_foreach (etw->priv->hash, delete_hash_element, etw); g_hash_table_destroy (etw->priv->hash); |