[gnome-shell] MessageTray: don't close the tray when interacting with the right click menu



commit 961dba7faad79666d7d4317f71e0fa2c9725d889
Author: Giovanni Campagna <gcampagna src gnome org>
Date:   Fri Nov 30 16:14:50 2012 +0100

    MessageTray: don't close the tray when interacting with the right click menu
    
    If the chosen action is not open, the tray should not be closed, to
    let the user further interact with it (for example to mute or remove
    more sources)
    
    https://bugzilla.gnome.org/show_bug.cgi?id=689296

 js/ui/components/telepathyClient.js |    2 +-
 js/ui/messageTray.js                |   17 +++++++++++++----
 2 files changed, 14 insertions(+), 5 deletions(-)
---
diff --git a/js/ui/components/telepathyClient.js b/js/ui/components/telepathyClient.js
index ddceb34..b3a303a 100644
--- a/js/ui/components/telepathyClient.js
+++ b/js/ui/components/telepathyClient.js
@@ -478,7 +478,7 @@ const ChatSource = new Lang.Class({
         }));
         item.connect('activate', Lang.bind(this, function() {
             this.setMuted(!this.isMuted);
-            this.emit('done-displaying-content');
+            this.emit('done-displaying-content', false);
         }));
         rightClickMenu.add(item.actor);
         return rightClickMenu;
diff --git a/js/ui/messageTray.js b/js/ui/messageTray.js
index 35665bd..6fba5dd 100644
--- a/js/ui/messageTray.js
+++ b/js/ui/messageTray.js
@@ -1088,14 +1088,14 @@ const Source = new Lang.Class({
         item = new PopupMenu.PopupMenuItem(_("Open"));
         item.connect('activate', Lang.bind(this, function() {
             this.open();
-            this.emit('done-displaying-content');
+            this.emit('done-displaying-content', true);
         }));
         rightClickMenu.add(item.actor);
 
         item = new PopupMenu.PopupMenuItem(_("Remove"));
         item.connect('activate', Lang.bind(this, function() {
             this.destroy();
-            this.emit('done-displaying-content');
+            this.emit('done-displaying-content', false);
         }));
         rightClickMenu.add(item.actor);
         return rightClickMenu;
@@ -1341,7 +1341,7 @@ const SummaryItem = new Lang.Class({
     },
 
     _notificationDoneDisplaying: function() {
-        this.source.emit('done-displaying-content');
+        this.source.emit('done-displaying-content', true);
     },
 
     _notificationDestroyed: function(notification) {
@@ -2454,12 +2454,21 @@ const MessageTray = new Lang.Class({
                     });
     },
 
+    _onSourceDoneDisplayingContent: function(source, closeTray) {
+        if (closeTray) {
+            this._escapeTray();
+        } else {
+            this._setClickedSummaryItem(null);
+            this._updateState();
+        }
+    },
+
     _showSummaryBoxPointer: function() {
         this._summaryBoxPointerItem = this._clickedSummaryItem;
         this._summaryBoxPointerContentUpdatedId = this._summaryBoxPointerItem.connect('content-updated',
                                                                                       Lang.bind(this, this._onSummaryBoxPointerContentUpdated));
         this._sourceDoneDisplayingId = this._summaryBoxPointerItem.source.connect('done-displaying-content',
-                                                                                  Lang.bind(this, this._escapeTray));
+                                                                                  Lang.bind(this, this._onSourceDoneDisplayingContent));
 
         let hasRightClickMenu = this._summaryBoxPointerItem.rightClickMenu != null;
         if (this._clickedSummaryItemMouseButton == 1 || !hasRightClickMenu) {



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