[gnome-contacts] app: add a Ctrl+Q keybinding for Quit



commit a46a7c398e37b322188099a453228d153de12a97
Author: Cosimo Cecchi <cosimoc gnome org>
Date:   Tue Sep 20 13:14:33 2011 -0400

    app: add a Ctrl+Q keybinding for Quit
    
    https://bugzilla.gnome.org/show_bug.cgi?id=659624

 src/contacts-app.vala |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)
---
diff --git a/src/contacts-app.vala b/src/contacts-app.vala
index 9f96dfd..d8ac39c 100644
--- a/src/contacts-app.vala
+++ b/src/contacts-app.vala
@@ -37,6 +37,17 @@ public class Contacts.App : Gtk.Application {
     return true;
   }
 
+  private bool window_key_press_event (Gdk.EventKey event) {
+    if ((event.keyval == Gdk.keyval_from_name ("q")) &&
+	((event.state & Gdk.ModifierType.CONTROL_MASK) != 0)) {
+      // Clear the contacts so any changed information is stored
+      contacts_pane.show_contact (null);
+      window.destroy ();
+    }
+
+    return false;
+  }
+
   private void selection_changed (Contact? new_selection) {
     contacts_pane.show_contact (new_selection);
   }
@@ -94,6 +105,7 @@ public class Contacts.App : Gtk.Application {
     window.set_size_request (745, 510);
     window.delete_event.connect (window_delete_event);
     window.map_event.connect (window_map_event);
+    window.key_press_event.connect (window_key_press_event);
 
     var grid = new Grid();
     window.add (grid);



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