[gnome-shell] calendar: Allow to dismiss messages with delete



commit 0023059fa3c39a749315b10bf2d0f02f75e5bea5
Author: Florian Müllner <fmuellner gnome org>
Date:   Fri Feb 27 15:10:11 2015 +0100

    calendar: Allow to dismiss messages with delete
    
    Messages can be dismissed using a pointer device by clicking the
    close button, there's no reason to not make the same action
    available via keyboard as well. Delete looks like an obvious
    choice ...
    
    https://bugzilla.gnome.org/show_bug.cgi?id=745279

 js/ui/calendar.js |   13 +++++++++++++
 1 files changed, 13 insertions(+), 0 deletions(-)
---
diff --git a/js/ui/calendar.js b/js/ui/calendar.js
index 4bb9f83..a54bb81 100644
--- a/js/ui/calendar.js
+++ b/js/ui/calendar.js
@@ -981,6 +981,8 @@ const Message = new Lang.Class({
                                      accessible_role: Atk.Role.NOTIFICATION,
                                      can_focus: true,
                                      x_expand: true, x_fill: true });
+        this.actor.connect('key-press-event',
+                           Lang.bind(this, this._onKeyPressed));
 
         let vbox = new St.BoxLayout({ vertical: true });
         this.actor.set_child(vbox);
@@ -1160,6 +1162,17 @@ const Message = new Lang.Class({
     },
 
     _onDestroy: function() {
+    },
+
+    _onKeyPressed: function(a, event) {
+        let keysym = event.get_key_symbol();
+
+        if (keysym == Clutter.KEY_Delete ||
+            keysym == Clutter.KEY_KP_Delete) {
+            this.emit('close');
+            return Clutter.EVENT_STOP;
+        }
+        return Clutter.EVENT_PROPAGATE;
     }
 });
 Signals.addSignalMethods(Message.prototype);


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