[gnome-photos] main-window: Quit on Ctrl+Q



commit 1009f5ab4713df53682af3e1766ed7e04a7ee91f
Author: Debarshi Ray <debarshir gnome org>
Date:   Mon Apr 23 14:20:37 2012 +0200

    main-window: Quit on Ctrl+Q

 src/photos-main-window.c |   15 +++++++++++++++
 1 files changed, 15 insertions(+), 0 deletions(-)
---
diff --git a/src/photos-main-window.c b/src/photos-main-window.c
index 779603f..321a5a4 100644
--- a/src/photos-main-window.c
+++ b/src/photos-main-window.c
@@ -37,6 +37,17 @@ struct _PhotosMainWindowPrivate
 G_DEFINE_TYPE (PhotosMainWindow, photos_main_window, GTK_TYPE_APPLICATION_WINDOW)
 
 
+static gboolean
+photos_main_window_key_press_event (GtkWidget *widget, GdkEventKey *event)
+{
+  if ((event->keyval == GDK_KEY_q) && ((event->state & GDK_CONTROL_MASK) != 0))
+    {
+      gtk_widget_destroy (widget);
+      return TRUE;
+    }
+}
+
+
 static void
 photos_main_window_init (PhotosMainWindow *self)
 {
@@ -56,6 +67,10 @@ photos_main_window_init (PhotosMainWindow *self)
 static void
 photos_main_window_class_init (PhotosMainWindowClass *class)
 {
+  GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (class);
+
+  widget_class->key_press_event = photos_main_window_key_press_event;
+
   g_type_class_add_private (class, sizeof (PhotosMainWindowPrivate));
 }
 



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