Blame SOURCES/0001-dateMenu-Try-to-use-the-default-calendar-application.patch

13bb5b
From 3d27dda8915fee31fa25c992649b01ab9dd02e7b Mon Sep 17 00:00:00 2001
13bb5b
From: =?UTF-8?q?Florian=20M=C3=BCllner?= <fmuellner@gnome.org>
13bb5b
Date: Thu, 16 Jan 2014 07:41:46 -0500
13bb5b
Subject: [PATCH] dateMenu: Try to use the default calendar application
13bb5b
13bb5b
Commit 14ceb10555699 changed the "Open Calendar" item to open the
13bb5b
"recommended" calendar application rather than the default one to
13bb5b
avoid problems with MIME subclassing (namely falling back to the
13bb5b
default text editor when no calendar app is installed).
13bb5b
With this change however, the application launched does no longer
13bb5b
necessarily match the one configured in Settings, which is unexpected.
13bb5b
To avoid both problems, use the default calendar application again,
13bb5b
but only if it is in the list of recommended applications.
13bb5b
13bb5b
https://bugzilla.gnome.org/show_bug.cgi?id=722333
13bb5b
---
13bb5b
 js/ui/dateMenu.js | 9 ++++++---
13bb5b
 1 file changed, 6 insertions(+), 3 deletions(-)
13bb5b
13bb5b
diff --git a/js/ui/dateMenu.js b/js/ui/dateMenu.js
13bb5b
index 32fdd59..232af27 100644
13bb5b
--- a/js/ui/dateMenu.js
13bb5b
+++ b/js/ui/dateMenu.js
13bb5b
@@ -223,10 +223,13 @@ const DateMenuButton = new Lang.Class({
13bb5b
             return this._calendarApp;
13bb5b
 
13bb5b
         let apps = Gio.AppInfo.get_recommended_for_type('text/calendar');
13bb5b
-        if (apps && (apps.length > 0))
13bb5b
-            this._calendarApp = apps[0];
13bb5b
-        else
13bb5b
+        if (apps && (apps.length > 0)) {
13bb5b
+            let app = Gio.AppInfo.get_default_for_type('text/calendar', false);
13bb5b
+            let defaultInRecommended = apps.some(function(a) { return a.equal(app); });
13bb5b
+            this._calendarApp = defaultInRecommended ? app : apps[0];
13bb5b
+        } else {
13bb5b
             this._calendarApp = null;
13bb5b
+        }
13bb5b
         return this._calendarApp;
13bb5b
     },
13bb5b
 
13bb5b
-- 
13bb5b
2.1.0
13bb5b