[gnome-shell] statusMenu: Use the screensaver's dbus interface directly
- From: Adel Gadllah <agadllah src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell] statusMenu: Use the screensaver's dbus interface directly
- Date: Wed, 9 Mar 2011 20:59:59 +0000 (UTC)
commit 7f3920dbb7d1eaa2a921453a52b43cdc54539fe9
Author: Adel Gadllah <adel gadllah gmail com>
Date: Wed Mar 9 21:59:26 2011 +0100
statusMenu: Use the screensaver's dbus interface directly
Use the dbus interface instead of calling gnome-screensaver-command.
https://bugzilla.gnome.org/show_bug.cgi?id=643357
js/ui/statusMenu.js | 15 +++++++++++++--
1 files changed, 13 insertions(+), 2 deletions(-)
---
diff --git a/js/ui/statusMenu.js b/js/ui/statusMenu.js
index 60643e3..adf5491 100644
--- a/js/ui/statusMenu.js
+++ b/js/ui/statusMenu.js
@@ -1,6 +1,7 @@
/* -*- mode: js2; js2-basic-offset: 4; indent-tabs-mode: nil -*- */
const Gdm = imports.gi.Gdm;
+const DBus = imports.dbus;
const GLib = imports.gi.GLib;
const Lang = imports.lang;
const Shell = imports.gi.Shell;
@@ -16,6 +17,16 @@ const PanelMenu = imports.ui.panelMenu;
const PopupMenu = imports.ui.popupMenu;
const Util = imports.misc.util;
+const BUS_NAME = 'org.gnome.ScreenSaver';
+const OBJECT_PATH = '/org/gnome/ScreenSaver';
+
+const ScreenSaverInterface = {
+ name: BUS_NAME,
+ methods: [ { name: 'Lock', inSignature: '' } ]
+};
+
+let ScreenSaverProxy = DBus.makeProxyClass(ScreenSaverInterface);
+
// Adapted from gdm/gui/user-switch-applet/applet.c
//
// Copyright (C) 2004-2005 James M. Cape <jcape ignore-your tv>.
@@ -43,7 +54,7 @@ StatusMenuButton.prototype = {
this._account_mgr = Tp.AccountManager.dup()
this._upClient = new UPowerGlib.Client();
-
+ this._screenSaverProxy = new ScreenSaverProxy(DBus.session, BUS_NAME, OBJECT_PATH);
this.actor.connect('destroy', Lang.bind(this, this._onDestroy));
this._iconBox = new St.Bin();
@@ -188,7 +199,7 @@ StatusMenuButton.prototype = {
_onLockScreenActivate: function() {
Main.overview.hide();
- Util.spawn(['gnome-screensaver-command', '--lock']);
+ this._screenSaverProxy.LockRemote();
},
_onLoginScreenActivate: function() {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]