[gnome-shell] endSessionDialog: Fix inhibitor list



commit 09607787cc7eace019bb8851e37db6c6b348b1fd
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Fri Mar 16 22:13:37 2012 -0400

    endSessionDialog: Fix inhibitor list
    
    gnome-session moved away from using properties over DBus in 2008, which
    means that the code in GNOME 3.0 never should have worked -- but it did,
    which makes me suspect that it was a quirk of the GJS DBus implementation.
    
    Switch over to the proper inhibitor API, which is based on methods. If
    gnome-session eventually gets ported to GDBus, then we can switch back
    to properties.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=672270

 js/misc/gnomeSession.js   |   12 ++++++------
 js/ui/endSessionDialog.js |    7 ++++---
 2 files changed, 10 insertions(+), 9 deletions(-)
---
diff --git a/js/misc/gnomeSession.js b/js/misc/gnomeSession.js
index dc58abd..3428aab 100644
--- a/js/misc/gnomeSession.js
+++ b/js/misc/gnomeSession.js
@@ -31,12 +31,12 @@ function Presence(initCallback, cancellable) {
 // change at runtime (changes always come in the form
 // of new inhibitors)
 const InhibitorIface = <interface name="org.gnome.SessionManager.Inhibitor">
-<property name="app_id" type="s" access="read" />
-<property name="client_id" type="s" access="read" />
-<property name="reason" type="s" access="read" />
-<property name="flags" type="u" access="read" />
-<property name="toplevel_xid" type="u" access="read" />
-<property name="cookie" type="u" access="read" />
+<method name="GetAppId">
+    <arg type="s" direction="out" />
+</method>
+<method name="GetReason">
+    <arg type="s" direction="out" />
+</method>
 </interface>;
 
 var InhibitorProxy = Gio.DBusProxy.makeProxyWrapper(InhibitorIface);
diff --git a/js/ui/endSessionDialog.js b/js/ui/endSessionDialog.js
index 198d31b..06f2f4a 100644
--- a/js/ui/endSessionDialog.js
+++ b/js/ui/endSessionDialog.js
@@ -116,10 +116,10 @@ const DialogContent = {
 };
 
 function findAppFromInhibitor(inhibitor) {
-    let desktopFile = inhibitor.app_id;
+    let [desktopFile] = inhibitor.GetAppIdSync();
 
     if (!GLib.str_has_suffix(desktopFile, '.desktop'))
-      desktopFile += '.desktop';
+        desktopFile += '.desktop';
 
     let candidateDesktopFiles = [];
 
@@ -482,7 +482,8 @@ const EndSessionDialog = new Lang.Class({
         let app = findAppFromInhibitor(inhibitor);
 
         if (app) {
-            let item = new ListItem(app, inhibitor.reason);
+            let [reason] = inhibitor.GetReasonSync();
+            let item = new ListItem(app, reason);
             item.connect('activate',
                          Lang.bind(this, function() {
                              this.close(global.get_current_time());



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]