]> spindle.queued.net Git - midori/commitdiff
Handle Delete key for the selected item in the Cookie Manager
authorEnrico Tröger <enrico.troeger@uvena.de>
Wed, 30 Dec 2009 21:52:43 +0000 (22:52 +0100)
committerChristian Dywan <christian@twotoasts.de>
Wed, 30 Dec 2009 22:52:20 +0000 (23:52 +0100)
extensions/cookie-manager/cookie-manager-page.c

index 71df49df2e7afdb70c5d5ad82ec979ec2b50ceea..b5e40e6772f527518d35e24e26c0eabbf46b7872 100644 (file)
@@ -10,6 +10,7 @@
 */
 
 #include <gtk/gtk.h>
+#include <gdk/gdkkeysyms.h>
 
 #include <midori/midori.h>
 #include <midori/gtkiconentry.h>
@@ -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);