userMenu: Make presence chooser insensitive when offline

Setting an IM presence only makes sense when connected to the
network, reflect this by making the presence chooser insensitive
when no network is available.

https://bugzilla.gnome.org/show_bug.cgi?id=677982
This commit is contained in:
Florian Müllner 2012-06-13 00:44:29 +02:00
parent 0f065ebce6
commit cd43c4983b

View File

@ -216,6 +216,8 @@ const IMStatusChooserItem = new Lang.Class({
this._networkMonitor = Gio.NetworkMonitor.get_default();
this._networkMonitor.connect('network-changed',
Lang.bind(this, function(monitor, available) {
this._IMAccountsChanged(this._accountMgr);
if (available && !this._imPresenceRestored)
this._restorePresence();
}));
@ -303,7 +305,8 @@ const IMStatusChooserItem = new Lang.Class({
let accounts = mgr.get_valid_accounts().filter(function(account) {
return account.enabled;
});
this._combo.setSensitive(accounts.length > 0);
let sensitive = accounts.length > 0 && this._networkMonitor.network_available;
this._combo.setSensitive(sensitive);
},
_IMStatusChanged: function(accountMgr, presence, status, message) {