[empathy/gnome-2-28] debug-window: add C-w keybinding to close the window



commit e5111de77de889a6b6db36ca7c6babe1ac110f59
Author: Jonny Lamb <jonnylamb gnome org>
Date:   Sat Oct 17 13:13:54 2009 +0100

    debug-window: add C-w keybinding to close the window
    
    Signed-off-by: Jonny Lamb <jonnylamb gnome org>

 src/empathy-debug-window.c |   18 ++++++++++++++++++
 1 files changed, 18 insertions(+), 0 deletions(-)
---
diff --git a/src/empathy-debug-window.c b/src/empathy-debug-window.c
index e2f7202..b2eeefe 100644
--- a/src/empathy-debug-window.c
+++ b/src/empathy-debug-window.c
@@ -23,6 +23,7 @@
 #include <glib/gi18n.h>
 #include <gtk/gtk.h>
 #include <gio/gio.h>
+#include <gdk/gdkkeysyms.h>
 
 #define DEBUG_FLAG EMPATHY_DEBUG_OTHER
 #include <libempathy/empathy-debug.h>
@@ -921,6 +922,20 @@ debug_window_copy_clicked_cb (GtkToolButton *tool_button,
   g_free (text);
 }
 
+static gboolean
+debug_window_key_press_event_cb (GtkWidget *widget,
+    GdkEventKey *event,
+    gpointer user_data)
+{
+  if (event->state & GDK_CONTROL_MASK && event->keyval == GDK_w)
+    {
+      gtk_widget_destroy (widget);
+      return TRUE;
+    }
+
+  return FALSE;
+}
+
 static GObject *
 debug_window_constructor (GType type,
     guint n_construct_params,
@@ -944,6 +959,9 @@ debug_window_constructor (GType type,
   gtk_window_set_title (GTK_WINDOW (object), _("Debug Window"));
   gtk_window_set_default_size (GTK_WINDOW (object), 800, 400);
 
+  g_signal_connect (object, "key-press-event",
+      G_CALLBACK (debug_window_key_press_event_cb), NULL);
+
   vbox = gtk_vbox_new (FALSE, 0);
   gtk_container_add (GTK_CONTAINER (object), vbox);
   gtk_widget_show (vbox);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]