aboutsummaryrefslogtreecommitdiffstats
path: root/widgets/table
diff options
context:
space:
mode:
authorChristopher James Lahey <clahey@ximian.com>2001-10-23 10:09:42 +0800
committerChris Lahey <clahey@src.gnome.org>2001-10-23 10:09:42 +0800
commitda49f32d5cf46f3995233e5cda353c67368da596 (patch)
tree61709cc1bccb775931407a0104593377608f0f5c /widgets/table
parent183cd7e571a0d8fe66d3b82abafbf5041ed5b910 (diff)
downloadgsoc2013-evolution-da49f32d5cf46f3995233e5cda353c67368da596.tar.gz
gsoc2013-evolution-da49f32d5cf46f3995233e5cda353c67368da596.tar.zst
gsoc2013-evolution-da49f32d5cf46f3995233e5cda353c67368da596.zip
Cancel the drag or maybe drag if you have the mouse button down when the
2001-10-22 Christopher James Lahey <clahey@ximian.com> * e-table-item.c (eti_cancel_drag_due_to_model_change): Cancel the drag or maybe drag if you have the mouse button down when the pre_change signal comes in. Fixes Ximian bug #11309. * e-table-without.c (add_row, remove_row, e_table_without_show_all): Call e_table_model_pre_change where appropriate here. svn path=/trunk/; revision=13927
Diffstat (limited to 'widgets/table')
-rw-r--r--widgets/table/e-table-item.c28
-rw-r--r--widgets/table/e-table-without.c5
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);