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
This commit is contained in:
Jasper St. Pierre 2012-03-16 22:13:37 -04:00
parent 0aad74a670
commit 09607787cc
2 changed files with 10 additions and 9 deletions

View File

@ -31,12 +31,12 @@ function Presence(initCallback, cancellable) {
// change at runtime (changes always come in the form // change at runtime (changes always come in the form
// of new inhibitors) // of new inhibitors)
const InhibitorIface = <interface name="org.gnome.SessionManager.Inhibitor"> const InhibitorIface = <interface name="org.gnome.SessionManager.Inhibitor">
<property name="app_id" type="s" access="read" /> <method name="GetAppId">
<property name="client_id" type="s" access="read" /> <arg type="s" direction="out" />
<property name="reason" type="s" access="read" /> </method>
<property name="flags" type="u" access="read" /> <method name="GetReason">
<property name="toplevel_xid" type="u" access="read" /> <arg type="s" direction="out" />
<property name="cookie" type="u" access="read" /> </method>
</interface>; </interface>;
var InhibitorProxy = Gio.DBusProxy.makeProxyWrapper(InhibitorIface); var InhibitorProxy = Gio.DBusProxy.makeProxyWrapper(InhibitorIface);

View File

@ -116,7 +116,7 @@ const DialogContent = {
}; };
function findAppFromInhibitor(inhibitor) { function findAppFromInhibitor(inhibitor) {
let desktopFile = inhibitor.app_id; let [desktopFile] = inhibitor.GetAppIdSync();
if (!GLib.str_has_suffix(desktopFile, '.desktop')) if (!GLib.str_has_suffix(desktopFile, '.desktop'))
desktopFile += '.desktop'; desktopFile += '.desktop';
@ -482,7 +482,8 @@ const EndSessionDialog = new Lang.Class({
let app = findAppFromInhibitor(inhibitor); let app = findAppFromInhibitor(inhibitor);
if (app) { if (app) {
let item = new ListItem(app, inhibitor.reason); let [reason] = inhibitor.GetReasonSync();
let item = new ListItem(app, reason);
item.connect('activate', item.connect('activate',
Lang.bind(this, function() { Lang.bind(this, function() {
this.close(global.get_current_time()); this.close(global.get_current_time());