[gnome-shell] messageTray: Add shortcuts to summary boxpointer



commit 906368d9163e7cbce3a859a249aa972ff2b55a03
Author: Florian MÃllner <fmuellner gnome org>
Date:   Sat Sep 15 18:56:01 2012 +0200

    messageTray: Add shortcuts to summary boxpointer
    
    Currently opening the summary boxpointer acts as a stop gap for
    keynav - the only shortcut still working is "Escape" to hide the
    tray altogether.
    Change the handling of Escape to only close the summary boxpointer
    and allow to use the down arrow as alternative (unless the boxpointer
    already processes the key press itself of course, like the chat
    entry does). Also add a Delete shortcut to dismiss the open summary
    item.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=682243

 js/ui/messageTray.js |   18 +++++++++++++++++-
 1 files changed, 17 insertions(+), 1 deletions(-)
---
diff --git a/js/ui/messageTray.js b/js/ui/messageTray.js
index a977295..ff045e2 100644
--- a/js/ui/messageTray.js
+++ b/js/ui/messageTray.js
@@ -1427,6 +1427,8 @@ const MessageTray = new Lang.Class({
         this._summaryBoxPointer = new BoxPointer.BoxPointer(St.Side.BOTTOM,
                                                             { reactive: true,
                                                               track_hover: true });
+        this._summaryBoxPointer.actor.connect('key-press-event',
+                                              Lang.bind(this, this._onSummaryBoxPointerKeyPress));
         this._summaryBoxPointer.actor.style_class = 'summary-boxpointer';
         this._summaryBoxPointer.actor.hide();
         Main.layoutManager.addChrome(this._summaryBoxPointer.actor);
@@ -2372,7 +2374,6 @@ const MessageTray = new Lang.Class({
         }
 
         this._grabHelper.grab({ actor: this._summaryBoxPointer.bin.child,
-                                untracked: true,
                                 grabFocus: true,
                                 onUngrab: Lang.bind(this, this._onSummaryBoxPointerUngrabbed) });
         this._lock();
@@ -2435,6 +2436,21 @@ const MessageTray = new Lang.Class({
         return true;
     },
 
+   _onSummaryBoxPointerKeyPress: function(actor, event) {
+       switch (event.get_key_symbol()) {
+           case Clutter.KEY_Down:
+           case Clutter.KEY_Escape:
+               this._setClickedSummaryItem(null);
+               this._updateState();
+               return true;
+           case Clutter.KEY_Delete:
+               this._clickedSummaryItem.source.destroy();
+               this._escapeTray();
+               return true;
+       }
+       return false;
+   },
+
     _onSummaryBoxPointerUngrabbed: function() {
         this._summaryBoxPointerState = State.HIDING;
         this._unlock();



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