[gnome-shell] user-menu: Keep track of current presence



commit 8adc193d73de613d8f7bf7a2bf9213d17e40fabd
Author: Florian MÃllner <fmuellner gnome org>
Date:   Fri Sep 2 14:15:31 2011 +0200

    user-menu: Keep track of current presence
    
    We keep track of presence changes by connecting to the
    Tp.AccountManager:most-available-presence-changed signal.
    However, if multiple accounts are in use, telepathy may
    lie to us and emit the signal even when the most available
    presence is unchanged.
    Work around this by keeping track of the current presence
    ourselves.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=657703

 js/ui/userMenu.js |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)
---
diff --git a/js/ui/userMenu.js b/js/ui/userMenu.js
index 115bcf7..d5349ba 100644
--- a/js/ui/userMenu.js
+++ b/js/ui/userMenu.js
@@ -170,6 +170,7 @@ IMStatusChooserItem.prototype = {
         this._presence.connect('StatusChanged',
                                Lang.bind(this, this._sessionStatusChanged));
 
+        this._currentPresence = undefined;
         this._previousPresence = undefined;
 
         this._accountMgr = Tp.AccountManager.dup()
@@ -267,6 +268,11 @@ IMStatusChooserItem.prototype = {
     },
 
     _IMStatusChanged: function(accountMgr, presence, status, message) {
+        if (presence == this._currentPresence)
+            return;
+
+        this._currentPresence = presence;
+
         if (presence == Tp.ConnectionPresenceType.AVAILABLE)
             this._presence.setStatus(GnomeSession.PresenceStatus.AVAILABLE);
 



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