From b98064d0b69f133bd140fb5e52ab7dc81cacc94a Mon Sep 17 00:00:00 2001 From: =?utf8?q?Enrico=20Tr=C3=B6ger?= Date: Wed, 30 Dec 2009 22:52:43 +0100 Subject: [PATCH] Handle Delete key for the selected item in the Cookie Manager --- extensions/cookie-manager/cookie-manager-page.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/extensions/cookie-manager/cookie-manager-page.c b/extensions/cookie-manager/cookie-manager-page.c index 71df49df..b5e40e67 100644 --- a/extensions/cookie-manager/cookie-manager-page.c +++ b/extensions/cookie-manager/cookie-manager-page.c @@ -10,6 +10,7 @@ */ #include +#include #include #include @@ -760,6 +761,18 @@ static gboolean cm_tree_button_release_event_cb(GtkWidget *widget, GdkEventButto } +static gboolean cm_tree_key_press_cb(GtkWidget *widget, GdkEventKey *event, CookieManagerPage *cmp) +{ + if (event->keyval == GDK_Delete && ! + (event->state & (GDK_SHIFT_MASK | GDK_CONTROL_MASK | GDK_MOD1_MASK))) + { + cm_button_delete_clicked_cb(NULL, cmp); + return TRUE; + } + return FALSE; +} + + static gboolean cm_tree_button_press_event_cb(GtkWidget *widget, GdkEventButton *ev, CookieManagerPage *cmp) { @@ -824,6 +837,7 @@ static GtkWidget *cm_tree_prepare(CookieManagerPage *cmp) /* signals */ g_signal_connect(sel, "changed", G_CALLBACK(cm_tree_selection_changed_cb), cmp); + g_signal_connect(treeview, "key-press-event", G_CALLBACK(cm_tree_key_press_cb), cmp); g_signal_connect(treeview, "button-press-event", G_CALLBACK(cm_tree_button_press_event_cb), cmp); g_signal_connect(treeview, "button-release-event", G_CALLBACK(cm_tree_button_release_event_cb), cmp); g_signal_connect(treeview, "popup-menu", G_CALLBACK(cm_tree_popup_menu_cb), cmp); -- 2.39.5