]> spindle.queued.net Git - midori/commitdiff
Close inspector with Ctrl+W just like a tab
authorChristian Dywan <christian@twotoasts.de>
Wed, 28 Sep 2011 16:01:51 +0000 (18:01 +0200)
committerChristian Dywan <christian@twotoasts.de>
Wed, 28 Sep 2011 16:01:51 +0000 (18:01 +0200)
Fixes: https://bugs.launchpad.net/midori/+bug/797865
midori/midori-view.c

index 92608720f83a3e3e8dddab2d4ac6ff5478cb5950..570e329ecf47aed157123fb7d43729826eca8cb1 100644 (file)
@@ -1821,6 +1821,18 @@ gtk_widget_button_press_event_cb (WebKitWebView*  web_view,
     return FALSE;
 }
 
+static gboolean
+midori_view_inspector_window_key_press_event_cb (GtkWidget*   window,
+                                                 GdkEventKey* event,
+                                                 gpointer     user_data)
+{
+    /* Close window on Ctrl+W */
+    if (event->keyval == 'w' && (event->state & GDK_CONTROL_MASK))
+        gtk_widget_destroy (window);
+
+    return FALSE;
+}
+
 static gboolean
 gtk_widget_key_press_event_cb (WebKitWebView* web_view,
                                GdkEventKey*   event,
@@ -3422,6 +3434,9 @@ midori_view_web_inspector_construct_window (gpointer       inspector,
     gtk_container_add (GTK_CONTAINER (window), inspector_view);
     gtk_widget_show_all (window);
 
+    g_signal_connect (window, "key-press-event",
+        G_CALLBACK (midori_view_inspector_window_key_press_event_cb), NULL);
+
     /* FIXME: Update window title with URI */
 }