[gnome-shell] powerMenu: Use LoginManager for suspend
- From: Florian MÃllner <fmuellner src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell] powerMenu: Use LoginManager for suspend
- Date: Tue, 23 Oct 2012 19:19:18 +0000 (UTC)
commit 990443465f0fad68b885fe3b77cdc6764c05dd24
Author: Florian MÃllner <fmuellner gnome org>
Date: Fri Oct 19 17:40:55 2012 +0200
powerMenu: Use LoginManager for suspend
https://bugzilla.gnome.org/show_bug.cgi?id=686482
js/gdm/powerMenu.js | 22 +++++++++++-----------
1 files changed, 11 insertions(+), 11 deletions(-)
---
diff --git a/js/gdm/powerMenu.js b/js/gdm/powerMenu.js
index bf545c1..a341619 100644
--- a/js/gdm/powerMenu.js
+++ b/js/gdm/powerMenu.js
@@ -20,7 +20,6 @@
const Gio = imports.gi.Gio;
const Lang = imports.lang;
-const UPowerGlib = imports.gi.UPowerGlib;
const LoginManager = imports.misc.loginManager;
@@ -35,7 +34,6 @@ const PowerMenuButton = new Lang.Class({
_init: function() {
/* Translators: accessible name of the power menu in the login screen */
this.parent('system-shutdown-symbolic', _("Power"));
- this._upClient = new UPowerGlib.Client();
this._loginManager = LoginManager.getLoginManager();
@@ -45,10 +43,6 @@ const PowerMenuButton = new Lang.Class({
this._createSubMenu();
- this._upClient.connect('notify::can-suspend',
- Lang.bind(this, this._updateHaveSuspend));
- this._updateHaveSuspend();
-
// ConsoleKit doesn't send notifications when shutdown/reboot
// are disabled, so we update the menu item each time the menu opens
this.menu.connect('open-state-changed', Lang.bind(this,
@@ -56,10 +50,12 @@ const PowerMenuButton = new Lang.Class({
if (open) {
this._updateHaveShutdown();
this._updateHaveRestart();
+ this._updateHaveSuspend();
}
}));
this._updateHaveShutdown();
this._updateHaveRestart();
+ this._updateHaveSuspend();
},
_updateVisibility: function() {
@@ -84,9 +80,11 @@ const PowerMenuButton = new Lang.Class({
},
_updateHaveSuspend: function() {
- this._haveSuspend = this._upClient.get_can_suspend();
- this._suspendItem.actor.visible = this._haveSuspend;
- this._updateVisibility();
+ this._loginManager.canSuspend(Lang.bind(this, function(result) {
+ this._haveSuspend = result;
+ this._suspendItem.actor.visible = this._haveSuspend;
+ this._updateVisibility();
+ }));
},
_createSubMenu: function() {
@@ -109,8 +107,10 @@ const PowerMenuButton = new Lang.Class({
},
_onActivateSuspend: function() {
- if (this._haveSuspend)
- this._upClient.suspend_sync(null);
+ if (!this._haveSuspend)
+ return;
+
+ this._loginManager.suspend();
},
_onActivateRestart: function() {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]