calendar: Rebuild the calendar when the time zone changes
A time zone change can cause the date to change so we need to clear SpiderMonkey's time zone cache and rebuild the calendar. https://bugzilla.gnome.org/show_bug.cgi?id=678507
This commit is contained in:
parent
9822c4c1d6
commit
59fc26f821
@ -428,6 +428,13 @@ var Calendar = new Lang.Class({
|
|||||||
this.emit('selected-date-changed', new Date(this._selectedDate));
|
this.emit('selected-date-changed', new Date(this._selectedDate));
|
||||||
},
|
},
|
||||||
|
|
||||||
|
updateTimeZone: function() {
|
||||||
|
// The calendar need to be rebuilt after a time zone update because
|
||||||
|
// the date might have changed.
|
||||||
|
this._rebuildCalendar();
|
||||||
|
this._update();
|
||||||
|
},
|
||||||
|
|
||||||
_buildHeader: function() {
|
_buildHeader: function() {
|
||||||
let layout = this.actor.layout_manager;
|
let layout = this.actor.layout_manager;
|
||||||
let offsetCols = this._useWeekdate ? 1 : 0;
|
let offsetCols = this._useWeekdate ? 1 : 0;
|
||||||
|
@ -22,6 +22,7 @@ const PanelMenu = imports.ui.panelMenu;
|
|||||||
const PopupMenu = imports.ui.popupMenu;
|
const PopupMenu = imports.ui.popupMenu;
|
||||||
const Calendar = imports.ui.calendar;
|
const Calendar = imports.ui.calendar;
|
||||||
const Weather = imports.misc.weather;
|
const Weather = imports.misc.weather;
|
||||||
|
const System = imports.system;
|
||||||
|
|
||||||
function _isToday(date) {
|
function _isToday(date) {
|
||||||
let now = new Date();
|
let now = new Date();
|
||||||
@ -545,6 +546,7 @@ var DateMenuButton = new Lang.Class({
|
|||||||
|
|
||||||
this._clock = new GnomeDesktop.WallClock();
|
this._clock = new GnomeDesktop.WallClock();
|
||||||
this._clock.bind_property('clock', this._clockDisplay, 'text', GObject.BindingFlags.SYNC_CREATE);
|
this._clock.bind_property('clock', this._clockDisplay, 'text', GObject.BindingFlags.SYNC_CREATE);
|
||||||
|
this._clock.connect('notify::timezone', Lang.bind(this, this._updateTimeZone));
|
||||||
|
|
||||||
Main.sessionMode.connect('updated', Lang.bind(this, this._sessionUpdated));
|
Main.sessionMode.connect('updated', Lang.bind(this, this._sessionUpdated));
|
||||||
this._sessionUpdated();
|
this._sessionUpdated();
|
||||||
@ -564,6 +566,15 @@ var DateMenuButton = new Lang.Class({
|
|||||||
this._eventSource = eventSource;
|
this._eventSource = eventSource;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
_updateTimeZone: function() {
|
||||||
|
// SpiderMonkey caches the time zone so we must explicitly clear it
|
||||||
|
// before we can update the calendar, see
|
||||||
|
// https://bugzilla.gnome.org/show_bug.cgi?id=678507
|
||||||
|
System.clearDateCaches();
|
||||||
|
|
||||||
|
this._calendar.updateTimeZone();
|
||||||
|
},
|
||||||
|
|
||||||
_sessionUpdated: function() {
|
_sessionUpdated: function() {
|
||||||
let eventSource;
|
let eventSource;
|
||||||
let showEvents = Main.sessionMode.showCalendarEvents;
|
let showEvents = Main.sessionMode.showCalendarEvents;
|
||||||
|
Loading…
Reference in New Issue
Block a user