From 76a8f160f23da54757eb3ccda5d3dfa9f3df8a2f Mon Sep 17 00:00:00 2001 From: Christian Dywan Date: Wed, 28 Sep 2011 18:01:51 +0200 Subject: [PATCH] Close inspector with Ctrl+W just like a tab Fixes: https://bugs.launchpad.net/midori/+bug/797865 --- midori/midori-view.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/midori/midori-view.c b/midori/midori-view.c index 92608720..570e329e 100644 --- a/midori/midori-view.c +++ b/midori/midori-view.c @@ -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 */ }