[gnome-shell] status/power: Init the proxy asynchronously
- From: Rui Matos <rtcm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell] status/power: Init the proxy asynchronously
- Date: Mon, 28 Jan 2013 16:37:35 +0000 (UTC)
commit 6600d6b6d99caa363cabd9b0dbce74cc8c75eb16
Author: Rui Matos <tiagomatos gmail com>
Date: Mon Jan 28 16:38:45 2013 +0100
status/power: Init the proxy asynchronously
Blocking the compositor is evil!
https://bugzilla.gnome.org/show_bug.cgi?id=692715
js/ui/status/power.js | 15 ++++++++++-----
1 files changed, 10 insertions(+), 5 deletions(-)
---
diff --git a/js/ui/status/power.js b/js/ui/status/power.js
index 619b02b..d5b2de0 100644
--- a/js/ui/status/power.js
+++ b/js/ui/status/power.js
@@ -54,7 +54,16 @@ const Indicator = new Lang.Class({
_init: function() {
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._hasPrimary = false;
@@ -70,10 +79,6 @@ const Indicator = new Lang.Class({
this.menu.addMenuItem(new PopupMenu.PopupSeparatorMenuItem());
this.menu.addSettingsAction(_("Power Settings"), 'gnome-power-panel.desktop');
-
- this._proxy.connect('g-properties-changed',
- Lang.bind(this, this._devicesChanged));
- this._devicesChanged();
},
_readPrimaryDevice: function() {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]