[gnome-documents] window: quit on Ctrl+Q



commit c5f4b6f14795bf0e80c879ce73a5ba508e46ade0
Author: Cosimo Cecchi <cosimoc gnome org>
Date:   Tue Aug 30 20:19:51 2011 -0400

    window: quit on Ctrl+Q

 src/mainWindow.js |   16 ++++++++++++++++
 1 files changed, 16 insertions(+), 0 deletions(-)
---
diff --git a/src/mainWindow.js b/src/mainWindow.js
index ceb36f2..1ecc1c4 100644
--- a/src/mainWindow.js
+++ b/src/mainWindow.js
@@ -21,6 +21,7 @@
 
 const EvView = imports.gi.EvinceView;
 const Gd = imports.gi.Gd;
+const Gdk = imports.gi.Gdk;
 const Gio = imports.gi.Gio;
 const GLib = imports.gi.GLib;
 const GObject = imports.gi.GObject;
@@ -67,6 +68,8 @@ MainWindow.prototype = {
         this.window.maximize();
         this.window.connect('delete-event',
                             Lang.bind(this, this._onDeleteEvent));
+        this.window.connect('key-press-event',
+                            Lang.bind(this, this._onKeyPressEvent));
 
         Global.settings.connect('changed::list-view',
                                 Lang.bind(this, this._refreshViewSettings));
@@ -105,6 +108,19 @@ MainWindow.prototype = {
         this._prepareForOverview();
     },
 
+    _onKeyPressEvent: function(widget, event) {
+        let keyval = event.get_keyval()[1];
+        let state = event.get_state()[1];
+
+        if ((keyval == Gdk.KEY_q) &&
+            ((state & Gdk.ModifierType.CONTROL_MASK) != 0)) {
+            Global.application.quit();
+            return true;
+        }
+
+        return false;
+    },
+
     _onAdjustmentChange: function(adjustment) {
         let end = (adjustment.value == (adjustment.upper - adjustment.get_page_size()));
 



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