From 02ffaef8e15338007818af8687433527a37517e3 Mon Sep 17 00:00:00 2001 From: Christopher James Lahey Date: Tue, 30 Oct 2001 22:09:46 +0000 Subject: Leave edit if commit is called. 2001-10-30 Christopher James Lahey * e-table.c (e_table_commit_click_to_add): Leave edit if commit is called. svn path=/trunk/; revision=14487 --- widgets/table/e-table.c | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) (limited to 'widgets') diff --git a/widgets/table/e-table.c b/widgets/table/e-table.c index ad0bc54855..8724e15dd5 100644 --- a/widgets/table/e-table.c +++ b/widgets/table/e-table.c @@ -722,6 +722,19 @@ et_canvas_realize (GtkWidget *canvas, ETable *e_table) NULL); } +static void +et_eti_leave_edit (ETable *et) +{ + GnomeCanvas *canvas = et->table_canvas; + if (GTK_WIDGET_HAS_FOCUS(canvas)) { + GnomeCanvasItem *item = GNOME_CANVAS(canvas)->focused_item; + + if (E_IS_TABLE_ITEM(item)) { + e_table_item_leave_edit_(E_TABLE_ITEM(item)); + } + } +} + static gint et_canvas_root_event (GnomeCanvasItem *root, GdkEvent *event, ETable *e_table) { @@ -730,14 +743,8 @@ et_canvas_root_event (GnomeCanvasItem *root, GdkEvent *event, ETable *e_table) case GDK_2BUTTON_PRESS: case GDK_BUTTON_RELEASE: if (event->button.button != 4 && event->button.button != 5) { - if (GTK_WIDGET_HAS_FOCUS(root->canvas)) { - GnomeCanvasItem *item = GNOME_CANVAS(root->canvas)->focused_item; - - if (E_IS_TABLE_ITEM(item)) { - e_table_item_leave_edit_(E_TABLE_ITEM(item)); - return TRUE; - } - } + et_eti_leave_edit (e_table); + return TRUE; } break; default: @@ -1503,6 +1510,7 @@ e_table_right_click_up (ETable *table) void e_table_commit_click_to_add (ETable *table) { + et_eti_leave_edit (table); if (table->click_to_add) e_table_click_to_add_commit(E_TABLE_CLICK_TO_ADD(table->click_to_add)); } -- cgit v1.2.3