NotificationDaemon: create the application proxy asynchronously

Clicking on calendar notifications might block till the DBus request times
out if the application being poked happens to be non-responsive. Perform
this asynchronously so we don't block if that is the case.
This commit is contained in:
Carlos Garnacho 2016-11-26 14:59:48 +01:00
parent f14f238150
commit e1e321d3a7

View File

@ -702,22 +702,28 @@ const GtkNotificationDaemonAppSource = new Lang.Class({
return new MessageTray.NotificationApplicationPolicy(this._appId); return new MessageTray.NotificationApplicationPolicy(this._appId);
}, },
_createApp: function() { _createApp: function(callback) {
return new FdoApplicationProxy(Gio.DBus.session, this._appId, this._objectPath); return new FdoApplicationProxy(Gio.DBus.session, this._appId, this._objectPath, callback);
}, },
activateAction: function(actionId, target) { activateAction: function(actionId, target) {
let app = this._createApp(); this._createApp(function (app, error) {
app.ActivateActionRemote(actionId, target ? [target] : [], getPlatformData()); if (error == null)
app.ActivateActionRemote(actionId, target ? [target] : [], getPlatformData());
else
logError(error, 'Failed to activate application proxy');
});
Main.overview.hide(); Main.overview.hide();
Main.panel.closeCalendar(); Main.panel.closeCalendar();
}, },
open: function() { open: function() {
let app = this._createApp(); this._createApp(function (app, error) {
app.ActivateRemote(getPlatformData()); if (error == null)
app.ActivateRemote(getPlatformData());
else
logError(error, 'Failed to open application proxy');
});
Main.overview.hide(); Main.overview.hide();
Main.panel.closeCalendar(); Main.panel.closeCalendar();
}, },