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
This commit is contained in:
Florian Müllner 2012-09-15 18:56:01 +02:00
parent 809cbf58c6
commit 906368d916

View File

@ -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();