objectManager: handle proxies coming and going
Ever since commit b8e29ae8c7
(I think), start up is littered with this message:
Gjs-WARNING **: JS ERROR: could not get remote objects for service
org.gnome.SettingsDaemon.Smartcard path
since gnome-shell is now started before gnome-settings-daemon.
This commit addresses the problem by making the object manager code
not try to autostart its proxy, and instead wait for it to appear.
https://bugzilla.gnome.org/show_bug.cgi?id=772589
This commit is contained in:
parent
9c4e875de4
commit
9c8a470934
@ -46,7 +46,7 @@ const ObjectManager = new Lang.Class({
|
|||||||
g_interface_info: ObjectManagerInfo,
|
g_interface_info: ObjectManagerInfo,
|
||||||
g_name: this._serviceName,
|
g_name: this._serviceName,
|
||||||
g_object_path: this._managerPath,
|
g_object_path: this._managerPath,
|
||||||
g_flags: Gio.DBusProxyFlags.NONE });
|
g_flags: Gio.DBusProxyFlags.DO_NOT_AUTO_START });
|
||||||
|
|
||||||
this._interfaceInfos = {};
|
this._interfaceInfos = {};
|
||||||
this._objects = {};
|
this._objects = {};
|
||||||
@ -65,6 +65,9 @@ const ObjectManager = new Lang.Class({
|
|||||||
},
|
},
|
||||||
|
|
||||||
_tryToCompleteLoad: function() {
|
_tryToCompleteLoad: function() {
|
||||||
|
if (this._numLoadInhibitors == 0)
|
||||||
|
return;
|
||||||
|
|
||||||
this._numLoadInhibitors--;
|
this._numLoadInhibitors--;
|
||||||
if (this._numLoadInhibitors == 0) {
|
if (this._numLoadInhibitors == 0) {
|
||||||
if (this._onLoaded)
|
if (this._onLoaded)
|
||||||
@ -86,7 +89,7 @@ const ObjectManager = new Lang.Class({
|
|||||||
g_object_path: objectPath,
|
g_object_path: objectPath,
|
||||||
g_interface_name: interfaceName,
|
g_interface_name: interfaceName,
|
||||||
g_interface_info: info,
|
g_interface_info: info,
|
||||||
g_flags: Gio.DBusProxyFlags.NONE });
|
g_flags: Gio.DBusProxyFlags.DO_NOT_AUTO_START });
|
||||||
|
|
||||||
proxy.init_async(GLib.PRIORITY_DEFAULT,
|
proxy.init_async(GLib.PRIORITY_DEFAULT,
|
||||||
this._cancellable,
|
this._cancellable,
|
||||||
@ -181,6 +184,18 @@ const ObjectManager = new Lang.Class({
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this._managerProxy.connect('notify::g-name-owner', Lang.bind(this, function() {
|
||||||
|
if (this._managerProxy.g_name_owner)
|
||||||
|
this._onNameAppeared();
|
||||||
|
else
|
||||||
|
this._onNameVanished();
|
||||||
|
}));
|
||||||
|
|
||||||
|
if (this._managerProxy.g_name_owner)
|
||||||
|
this._onNameAppeared();
|
||||||
|
},
|
||||||
|
|
||||||
|
_onNameAppeared: function() {
|
||||||
this._managerProxy.GetManagedObjectsRemote(Lang.bind(this, function(result, error) {
|
this._managerProxy.GetManagedObjectsRemote(Lang.bind(this, function(result, error) {
|
||||||
if (!result) {
|
if (!result) {
|
||||||
if (error) {
|
if (error) {
|
||||||
@ -218,6 +233,21 @@ const ObjectManager = new Lang.Class({
|
|||||||
}));
|
}));
|
||||||
},
|
},
|
||||||
|
|
||||||
|
_onNameVanished: function() {
|
||||||
|
let objectPaths = Object.keys(this._objects);
|
||||||
|
for (let i = 0; i < objectPaths.length; i++) {
|
||||||
|
let object = this._objects[objectPaths];
|
||||||
|
|
||||||
|
let interfaceNames = Object.keys(object);
|
||||||
|
for (let j = 0; i < interfaceNames.length; i++) {
|
||||||
|
let interfaceName = interfaceNames[i];
|
||||||
|
|
||||||
|
if (object[interfaceName])
|
||||||
|
this._removeInterface(objectPath, interfaceName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
_registerInterfaces: function(interfaces) {
|
_registerInterfaces: function(interfaces) {
|
||||||
for (let i = 0; i < interfaces.length; i++) {
|
for (let i = 0; i < interfaces.length; i++) {
|
||||||
let info = Gio.DBusInterfaceInfo.new_for_xml(interfaces[i]);
|
let info = Gio.DBusInterfaceInfo.new_for_xml(interfaces[i]);
|
||||||
|
Loading…
Reference in New Issue
Block a user