From: Enrico Tröger Date: Wed, 30 Dec 2009 21:52:43 +0000 (+0100) Subject: Handle Delete key for the selected item in the Cookie Manager X-Git-Url: https://spindle.queued.net/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b98064d0b69f133bd140fb5e52ab7dc81cacc94a;p=midori Handle Delete key for the selected item in the Cookie Manager --- 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);