Calendar: clean up code by always having an event source
Instead of sometimes having an event source and sometimes not, use the empty event source when the session mode says the calendar is disabled. This way, the code can assume an event source object and avoid checks. https://bugzilla.gnome.org/show_bug.cgi?id=641383
This commit is contained in:
@ -177,8 +177,13 @@ const DateMenuButton = new Lang.Class({
|
||||
},
|
||||
|
||||
_setEventSource: function(eventSource) {
|
||||
if (this._eventSource)
|
||||
this._eventSource.destroy();
|
||||
|
||||
this._calendar.setEventSource(eventSource);
|
||||
this._eventList.setEventSource(eventSource);
|
||||
|
||||
this._eventSource = eventSource;
|
||||
},
|
||||
|
||||
_sessionUpdated: function() {
|
||||
@ -187,7 +192,7 @@ const DateMenuButton = new Lang.Class({
|
||||
if (showEvents) {
|
||||
eventSource = new Calendar.DBusEventSource();
|
||||
} else {
|
||||
eventSource = null;
|
||||
eventSource = new Calendar.EmptyEventSource();
|
||||
}
|
||||
this._setEventSource(eventSource);
|
||||
this._setEventsVisibility(showEvents);
|
||||
|
Reference in New Issue
Block a user