status/power: Init the proxy asynchronously

Blocking the compositor is evil!

https://bugzilla.gnome.org/show_bug.cgi?id=692715
This commit is contained in:
Rui Matos 2013-01-28 16:38:45 +01:00
parent 8ca25aed8b
commit 6600d6b6d9

View File

@ -54,7 +54,16 @@ const Indicator = new Lang.Class({
_init: function() { _init: function() {
this.parent('battery-missing-symbolic', _("Battery")); this.parent('battery-missing-symbolic', _("Battery"));
this._proxy = new PowerManagerProxy(Gio.DBus.session, BUS_NAME, OBJECT_PATH); this._proxy = new PowerManagerProxy(Gio.DBus.session, BUS_NAME, OBJECT_PATH,
Lang.bind(this, function(proxy, error) {
if (error) {
log(error.message);
return;
}
this._proxy.connect('g-properties-changed',
Lang.bind(this, this._devicesChanged));
this._devicesChanged();
}));
this._deviceItems = [ ]; this._deviceItems = [ ];
this._hasPrimary = false; this._hasPrimary = false;
@ -70,10 +79,6 @@ const Indicator = new Lang.Class({
this.menu.addMenuItem(new PopupMenu.PopupSeparatorMenuItem()); this.menu.addMenuItem(new PopupMenu.PopupSeparatorMenuItem());
this.menu.addSettingsAction(_("Power Settings"), 'gnome-power-panel.desktop'); this.menu.addSettingsAction(_("Power Settings"), 'gnome-power-panel.desktop');
this._proxy.connect('g-properties-changed',
Lang.bind(this, this._devicesChanged));
this._devicesChanged();
}, },
_readPrimaryDevice: function() { _readPrimaryDevice: function() {