dateMenu: Allow extensions to add custom calendar sources

Splits instantiation of the event source into a separate method,
allowing extensions to subclass the DateMenuButton and provide its
own calendar source.

https://bugzilla.gnome.org/show_bug.cgi?id=672500
This commit is contained in:
Eskild Hustvedt 2012-03-21 08:59:39 +01:00 committed by Bastien Nocera
parent 084f7a36b1
commit 35fcd16992

View File

@ -173,6 +173,10 @@ const DateMenuButton = new Lang.Class({
}
},
_getEventSource: function() {
return new Calendar.DBusEventSource();
},
_setEventSource: function(eventSource) {
if (this._eventSource)
this._eventSource.destroy();
@ -190,7 +194,7 @@ const DateMenuButton = new Lang.Class({
let eventSource;
let showEvents = Main.sessionMode.showCalendarEvents;
if (showEvents) {
eventSource = new Calendar.DBusEventSource();
eventSource = this._getEventSource();
} else {
eventSource = new Calendar.EmptyEventSource();
}