[gnome-shell] Use user-defined calendar application for the date menu calendar button



commit d80b7be6caa9bfe32112aada4d4123a9ee26f75f
Author: Tassilo Horn <tassilo member fsf org>
Date:   Thu Aug 11 11:30:47 2011 +0200

    Use user-defined calendar application for the date menu calendar button
    
    Use the existing setting
    
      org.gnome.desktop.default-applications.office.calendar.exec
    
    as calendar application instead of the hard-coded evolution.  Evolution
    is still the fallback if that setting is cleared (it defaults to
    evolution).
    
    https://bugzilla.gnome.org/show_bug.cgi?id=651190

 js/ui/dateMenu.js |   21 +++++++++++++++++++--
 1 files changed, 19 insertions(+), 2 deletions(-)
---
diff --git a/js/ui/dateMenu.js b/js/ui/dateMenu.js
index d288947..a48fde7 100644
--- a/js/ui/dateMenu.js
+++ b/js/ui/dateMenu.js
@@ -205,7 +205,24 @@ DateMenuButton.prototype = {
 
     _onOpenCalendarActivate: function() {
         this.menu.close();
-        // TODO: pass the selected day
-        Util.spawn(['evolution', '-c', 'calendar']);
+        let calendarSettings = new Gio.Settings({ schema: 'org.gnome.desktop.default-applications.office.calendar' });
+        let tool = calendarSettings.get_string('exec');
+        if (tool.length == 0 || tool == 'evolution') {
+            // TODO: pass the selected day
+            Util.spawn(['evolution', '-c', 'calendar']);
+        } else {
+            let needTerm = calendarSettings.get_boolean('needs-term');
+            if (needTerm) {
+                let terminalSettings = new Gio.Settings({ schema: 'org.gnome.desktop.default-applications.terminal' });
+                let term = terminalSettings.get_string('exec');
+                let arg = terminalSettings.get_string('exec-arg');
+                if (arg != '')
+                    Util.spawn([term, arg, tool]);
+                else
+                    Util.spawn([term, tool]);
+            } else {
+                Util.spawnCommandLine(tool)
+            }
+        }
     }
 };



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]