Calendar: use text/calendar preferred app as the calendar app
That's what the info panel in g-c-c defines as the preferred calendar application. https://bugzilla.gnome.org/show_bug.cgi?id=690767
This commit is contained in:
parent
d525d02348
commit
724a2bd72f
@ -113,11 +113,6 @@ const DateMenuButton = new Lang.Class({
|
|||||||
this._openCalendarItem.actor.can_focus = false;
|
this._openCalendarItem.actor.can_focus = false;
|
||||||
vbox.add(this._openCalendarItem.actor, {y_align: St.Align.END, expand: true, y_fill: false});
|
vbox.add(this._openCalendarItem.actor, {y_align: St.Align.END, expand: true, y_fill: false});
|
||||||
|
|
||||||
this._calendarSettings = new Gio.Settings({ schema: 'org.gnome.desktop.default-applications.office.calendar' });
|
|
||||||
this._calendarSettings.connect('changed::exec',
|
|
||||||
Lang.bind(this, this._calendarSettingsChanged));
|
|
||||||
this._calendarSettingsChanged();
|
|
||||||
|
|
||||||
// Whenever the menu is opened, select today
|
// Whenever the menu is opened, select today
|
||||||
this.menu.connect('open-state-changed', Lang.bind(this, function(menu, isOpen) {
|
this.menu.connect('open-state-changed', Lang.bind(this, function(menu, isOpen) {
|
||||||
if (isOpen) {
|
if (isOpen) {
|
||||||
@ -151,12 +146,6 @@ const DateMenuButton = new Lang.Class({
|
|||||||
this._sessionUpdated();
|
this._sessionUpdated();
|
||||||
},
|
},
|
||||||
|
|
||||||
_calendarSettingsChanged: function() {
|
|
||||||
let exec = this._calendarSettings.get_string('exec');
|
|
||||||
let fullExec = GLib.find_program_in_path(exec);
|
|
||||||
this._openCalendarItem.actor.visible = fullExec != null;
|
|
||||||
},
|
|
||||||
|
|
||||||
_setEventsVisibility: function(visible) {
|
_setEventsVisibility: function(visible) {
|
||||||
this._openCalendarItem.actor.visible = visible;
|
this._openCalendarItem.actor.visible = visible;
|
||||||
this._separator.visible = visible;
|
this._separator.visible = visible;
|
||||||
@ -205,24 +194,8 @@ const DateMenuButton = new Lang.Class({
|
|||||||
|
|
||||||
_onOpenCalendarActivate: function() {
|
_onOpenCalendarActivate: function() {
|
||||||
this.menu.close();
|
this.menu.close();
|
||||||
let tool = this._calendarSettings.get_string('exec');
|
|
||||||
if (tool.length == 0 || tool.substr(0, 9) == 'evolution') {
|
let app = Gio.AppInfo.get_default_for_type('text/calendar', false);
|
||||||
// TODO: pass the selected day
|
app.launch([], global.create_app_launch_context());
|
||||||
let app = Shell.AppSystem.get_default().lookup_app('evolution-calendar.desktop');
|
|
||||||
app.activate();
|
|
||||||
} else {
|
|
||||||
let needTerm = this._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)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user