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
This commit is contained in:
parent
86aa4fe0a9
commit
8adc193d73
@ -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);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user