dateMenu: Try to use the default calendar application

Commit 14ceb10555 changed the "Open Calendar" item to open the
"recommended" calendar application rather than the default one to
avoid problems with MIME subclassing (namely falling back to the
default text editor when no calendar app is installed).
With this change however, the application launched does no longer
necessarily match the one configured in Settings, which is unexpected.
To avoid both problems, use the default calendar application again,
but only if it is in the list of recommended applications.

https://bugzilla.gnome.org/show_bug.cgi?id=722333
This commit is contained in:
Florian Müllner 2014-01-16 07:41:46 -05:00
parent 7c9d90b0aa
commit 3e20843d9c

View File

@ -211,10 +211,13 @@ const DateMenuButton = new Lang.Class({
return this._calendarApp; return this._calendarApp;
let apps = Gio.AppInfo.get_recommended_for_type('text/calendar'); let apps = Gio.AppInfo.get_recommended_for_type('text/calendar');
if (apps && (apps.length > 0)) if (apps && (apps.length > 0)) {
this._calendarApp = apps[0]; let app = Gio.AppInfo.get_default_for_type('text/calendar', false);
else let defaultInRecommended = apps.some(function(a) { return a.equal(app); });
this._calendarApp = defaultInRecommended ? app : apps[0];
} else {
this._calendarApp = null; this._calendarApp = null;
}
return this._calendarApp; return this._calendarApp;
}, },