Cancel renaming of a page when GDK_Escape is pressed. Fixes #343226.

git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@14286 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
Andreas Köhler 2006-06-01 08:56:38 +00:00
parent 9f74b5a44c
commit 122e4456d3
2 changed files with 34 additions and 0 deletions

View File

@ -1,3 +1,8 @@
2006-06-01 Andreas Köhler <andi5.py@gmx.net>
* src/gnome-utils/gnc-main-window.c: Cancel renaming of a page
when GDK_Escape is pressed. Fixes #343226.
2006-05-31 Andreas Köhler <andi5.py@gmx.net>
* src/gnome-utils/gnc-tree-model-account.c: Replace

View File

@ -1592,6 +1592,32 @@ gnc_main_window_tab_entry_focus_out_event (GtkWidget *entry,
return FALSE;
}
static gboolean
gnc_main_window_tab_entry_key_press_event (GtkWidget *entry,
GdkEventKey *event,
GncPluginPage *page)
{
if (event->keyval == GDK_Escape) {
GtkWidget *label, *entry2;
g_return_val_if_fail(GTK_IS_ENTRY(entry), FALSE);
g_return_val_if_fail(GNC_IS_PLUGIN_PAGE(page), FALSE);
ENTER("");
if (!main_window_find_tab_items(GNC_MAIN_WINDOW(page->window),
page, &label, &entry2)) {
LEAVE("can't find required widgets");
return FALSE;
}
gtk_entry_set_text(GTK_ENTRY(entry), gtk_label_get_text(GTK_LABEL(label)));
gtk_widget_hide(entry);
gtk_widget_show(label);
LEAVE("");
}
return FALSE;
}
/************************************************************
* Widget Implementation *
************************************************************/
@ -2056,6 +2082,9 @@ gnc_main_window_open_page (GncMainWindow *window,
g_signal_connect(G_OBJECT(entry), "focus-out-event",
G_CALLBACK(gnc_main_window_tab_entry_focus_out_event),
page);
g_signal_connect(G_OBJECT(entry), "key-press-event",
G_CALLBACK(gnc_main_window_tab_entry_key_press_event),
page);
g_signal_connect(G_OBJECT(entry), "editing-done",
G_CALLBACK(gnc_main_window_tab_entry_editing_done),
page);