From 35fcd1699200b6f5033dbc1fc32ea5732610e2bc Mon Sep 17 00:00:00 2001 From: Eskild Hustvedt Date: Wed, 21 Mar 2012 08:59:39 +0100 Subject: [PATCH] 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 --- js/ui/dateMenu.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/js/ui/dateMenu.js b/js/ui/dateMenu.js index 4bf22b46e..c46938a28 100644 --- a/js/ui/dateMenu.js +++ b/js/ui/dateMenu.js @@ -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(); }