automountManager: Make sure sessionActive is initialized

Since the port to GDBus, sessionActive is only set on DBus name
owner changes; this means that it may end up not being initialized
at all, and therefore always evaluate to false.
Make sure that the property is always initialized on startup.

https://bugzilla.gnome.org/show_bug.cgi?id=668020
This commit is contained in:
Florian Müllner 2012-01-29 22:38:29 +01:00
parent 8bcbf3030f
commit 3d0dd38045

View File

@ -43,7 +43,7 @@ function ConsoleKitManager() {
g_flags: (Gio.DBusProxyFlags.DO_NOT_AUTO_START | g_flags: (Gio.DBusProxyFlags.DO_NOT_AUTO_START |
Gio.DBusProxyFlags.DO_NOT_LOAD_PROPERTIES) }); Gio.DBusProxyFlags.DO_NOT_LOAD_PROPERTIES) });
self.connect('notify::g-name-owner', function() { self._updateSessionActive = function() {
if (self.g_name_owner) { if (self.g_name_owner) {
self.GetCurrentSessionRemote(function([session]) { self.GetCurrentSessionRemote(function([session]) {
self._ckSession = new ConsoleKitSessionProxy(Gio.DBus.system, 'org.freedesktop.ConsoleKit', session); self._ckSession = new ConsoleKitSessionProxy(Gio.DBus.system, 'org.freedesktop.ConsoleKit', session);
@ -58,8 +58,11 @@ function ConsoleKitManager() {
} else { } else {
self.sessionActive = true; self.sessionActive = true;
} }
}); };
self.connect('notify::g-name-owner',
Lang.bind(self, self._updateSessionActive));
self._updateSessionActive();
self.init(null); self.init(null);
return self; return self;
} }