[gnome-calendar/gnome-3-36] timeline, calendar-monitor: Remove useless event range checks



commit a4ef69430075d71251a7d272f6305e59fce65491
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date:   Tue Apr 14 15:16:34 2020 -0300

    timeline, calendar-monitor: Remove useless event range checks
    
    GcalRange is now smart enough to compare correctly with other ranges.

 src/core/gcal-calendar-monitor.c |  9 ---------
 src/core/gcal-timeline.c         | 26 --------------------------
 2 files changed, 35 deletions(-)
---
diff --git a/src/core/gcal-calendar-monitor.c b/src/core/gcal-calendar-monitor.c
index 7586417e..2699cdca 100644
--- a/src/core/gcal-calendar-monitor.c
+++ b/src/core/gcal-calendar-monitor.c
@@ -357,9 +357,6 @@ on_client_view_objects_added_cb (ECalClientView      *view,
           continue;
         }
 
-      if (!gcal_event_is_within_range (event, range))
-        continue;
-
       event_id = g_strdup (gcal_event_get_uid (event));
 
       if (!self->monitor_thread.populated)
@@ -446,9 +443,6 @@ on_client_view_objects_added_cb (ECalClientView      *view,
           if (g_cancellable_is_cancelled (self->cancellable))
             return;
 
-          if (!gcal_event_is_within_range (event, range))
-            continue;
-
           event_id = g_strdup (gcal_event_get_uid (event));
 
           if (!self->monitor_thread.populated)
@@ -836,9 +830,6 @@ remove_events_outside_range (GcalCalendarMonitor *self,
   g_hash_table_iter_init (&iter, self->events);
   while (g_hash_table_iter_next (&iter, NULL, (gpointer*) &event))
     {
-      if (range && gcal_event_is_within_range (event, range))
-        continue;
-
       g_object_ref (event);
 
       g_hash_table_iter_remove (&iter);
diff --git a/src/core/gcal-timeline.c b/src/core/gcal-timeline.c
index 0501e839..ec85cdfb 100644
--- a/src/core/gcal-timeline.c
+++ b/src/core/gcal-timeline.c
@@ -192,17 +192,6 @@ remove_event_from_subscriber (GcalTimelineSubscriber *subscriber,
   GCAL_TIMELINE_SUBSCRIBER_GET_IFACE (subscriber)->remove_event (subscriber, event);
 }
 
-static gboolean
-subscriber_contains_event (GcalTimelineSubscriber *subscriber,
-                           GcalEvent              *event)
-{
-  g_autoptr (GcalRange) subscriber_range = NULL;
-
-  subscriber_range = gcal_timeline_subscriber_get_range (subscriber);
-
-  return gcal_event_is_within_range (event, subscriber_range);
-}
-
 static void
 update_range (GcalTimeline *self)
 {
@@ -350,9 +339,6 @@ calculate_changed_events (GcalTimeline            *self,
     {
       GcalEvent *event = g_ptr_array_index (events_to_remove, i);
 
-      if (!gcal_event_is_within_range (event, old_range))
-        continue;
-
       GCAL_TRACE_MSG ("Removing event from subscriber %s due to time range change (event: '%s' (%s))",
                       G_OBJECT_TYPE_NAME (subscriber),
                       gcal_event_get_summary (event),
@@ -366,9 +352,6 @@ calculate_changed_events (GcalTimeline            *self,
     {
       GcalEvent *event = g_ptr_array_index (events_to_add, i);
 
-      if (!gcal_event_is_within_range (event, new_range))
-        continue;
-
       GCAL_TRACE_MSG ("Queueing event addition for subscriber %s (event: '%s' (%s))",
                       G_OBJECT_TYPE_NAME (subscriber),
                       gcal_event_get_summary (event),
@@ -400,9 +383,6 @@ add_cached_events_to_subscriber (GcalTimeline           *self,
     {
       GcalEvent *event = g_ptr_array_index (events_to_add, i);
 
-      if (!gcal_event_is_within_range (event, subscriber_range))
-        continue;
-
       GCAL_TRACE_MSG ("Queueing event addition for subscriber %s (event: '%s' (%s))",
                       G_OBJECT_TYPE_NAME (subscriber),
                       gcal_event_get_summary (event),
@@ -617,9 +597,6 @@ timeline_source_dispatch (GSource     *source,
             {
               GcalTimelineSubscriber *subscriber = g_ptr_array_index (queue_data->subscribers, i);
 
-              if (!subscriber_contains_event (subscriber, event))
-                continue;
-
               add_event_to_subscriber (subscriber, event);
             }
           break;
@@ -645,9 +622,6 @@ timeline_source_dispatch (GSource     *source,
               {
                 GcalTimelineSubscriber *subscriber = g_ptr_array_index (queue_data->subscribers, i);
 
-                if (!subscriber_contains_event (subscriber, event))
-                  continue;
-
                 update_subscriber_event (subscriber, event);
               }
           }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]