[gnome-shell] calendar: Move handling of ignored events to event source
- From: Florian Müllner <fmuellner src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell] calendar: Move handling of ignored events to event source
- Date: Fri, 8 Jul 2016 13:02:26 +0000 (UTC)
commit 82e6935281cd40b445e8a734ee0fd9e7dbbcdf1a
Author: Florian Müllner <fmuellner gnome org>
Date: Fri Jul 8 01:04:12 2016 +0200
calendar: Move handling of ignored events to event source
Ignoring events is currently implemented in the message list's
event section, which means that the calendar does not consider
ignored events when marking days with events. In order to fix
this, move the handling of ignored events to the event source,
which is shared between both components.
https://bugzilla.gnome.org/show_bug.cgi?id=768538
js/ui/calendar.js | 38 +++++++++++++++++++++++---------------
1 files changed, 23 insertions(+), 15 deletions(-)
---
diff --git a/js/ui/calendar.js b/js/ui/calendar.js
index 6e6c5f9..110ff7b 100644
--- a/js/ui/calendar.js
+++ b/js/ui/calendar.js
@@ -120,6 +120,9 @@ const EmptyEventSource = new Lang.Class({
destroy: function() {
},
+ ignoreEvent: function(event) {
+ },
+
requestRange: function(begin, end) {
},
@@ -184,6 +187,15 @@ const DBusEventSource = new Lang.Class({
this.isLoading = false;
this.isDummy = false;
+ this._ignoredEvents = new Map();
+
+ let savedState = global.get_persistent_state('as', 'ignored_events');
+ if (savedState)
+ savedState.deep_unpack().forEach(Lang.bind(this,
+ function(eventId) {
+ this._ignoredEvents.set(eventId, true);
+ }));
+
this._initialized = false;
this._dbusProxy = new CalendarServer();
this._dbusProxy.init_async(GLib.PRIORITY_DEFAULT, null, Lang.bind(this, function(object, result) {
@@ -298,6 +310,12 @@ const DBusEventSource = new Lang.Class({
}
},
+ ignoreEvent: function(event) {
+ this._ignoredEvents.set(event.id, true);
+ let savedState = new GLib.Variant('as', [...this._ignoredEvents.keys()]);
+ global.set_persistent_state('ignored_events', savedState);
+ },
+
requestRange: function(begin, end) {
if (!(_datesEqual(begin, this._lastRequestBegin) && _datesEqual(end, this._lastRequestEnd))) {
this.isLoading = true;
@@ -313,6 +331,10 @@ const DBusEventSource = new Lang.Class({
let result = [];
for(let n = 0; n < this._events.length; n++) {
let event = this._events[n];
+
+ if (this._ignoredEvents.has(event.id))
+ continue;
+
if (_dateIntervalsOverlap (event.date, event.end, begin, end)) {
result.push(event);
}
@@ -785,15 +807,6 @@ const EventsSection = new Lang.Class({
this._desktopSettings.connect('changed', Lang.bind(this, this._reloadEvents));
this._eventSource = new EmptyEventSource();
- this._ignoredEvents = new Map();
-
- let savedState = global.get_persistent_state('as', 'ignored_events');
- if (savedState)
- savedState.deep_unpack().forEach(Lang.bind(this,
- function(eventId) {
- this._ignoredEvents.set(eventId, true);
- }));
-
this.parent('');
Shell.AppSystem.get_default().connect('installed-changed',
@@ -802,9 +815,7 @@ const EventsSection = new Lang.Class({
},
_ignoreEvent: function(event) {
- this._ignoredEvents.set(event.id, true);
- let savedState = new GLib.Variant('as', [...this._ignoredEvents.keys()]);
- global.set_persistent_state('ignored_events', savedState);
+ this._eventSource.ignoreEvent(event);
},
setEventSource: function(eventSource) {
@@ -850,9 +861,6 @@ const EventsSection = new Lang.Class({
for (let i = 0; i < events.length; i++) {
let event = events[i];
- if (this._ignoredEvents.has(event.id))
- continue;
-
let message = new EventMessage(event, this._date);
message.connect('close', Lang.bind(this, function() {
this._ignoreEvent(event);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]