Skip to content

Commit

Permalink
fileManager1API: Use async init for DBus proxy
Browse files Browse the repository at this point in the history
It appears that sometimes, initialisation of the DBus proxy can
either take a long time or fail after a timeout. Let's avoid
stalling gnome-shell by using the async form of initialisation.

This isn't complex as we can attach signal handlers without
waiting for init to complete.
  • Loading branch information
philipl committed Mar 21, 2018
1 parent fa3bfbc commit 9b885cc
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions fileManager1API.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,18 @@ var FileManager1Client = new Lang.Class({
_init: function() {
this._signalsHandler = new Utils.GlobalSignalsHandler();

this._locationMap = new Map();
this._proxy = new FileManager1Proxy(Gio.DBus.session,
"org.freedesktop.FileManager1",
"/org/freedesktop/FileManager1");
"/org/freedesktop/FileManager1",
Lang.bind(this, function(initable, error) {
// Use async construction to avoid blocking on errors.
if (error) {
global.log(error);
} else {
this._updateLocationMap();
}
}));

this._signalsHandler.add([
this._proxy,
Expand All @@ -53,8 +62,6 @@ var FileManager1Client = new Lang.Class({
'window-left-monitor',
Lang.bind(this, this._updateLocationMap)
]);

this._updateLocationMap();
},

destroy: function() {
Expand Down

0 comments on commit 9b885cc

Please sign in to comment.