[california/wip/732671-double] Added debug for logging modification changes



commit 67906202739ab78855dbedc62899c83ae1684550
Author: Jim Nelson <jim yorba org>
Date:   Thu Sep 4 15:16:08 2014 -0700

    Added debug for logging modification changes

 .../backing-calendar-source-subscription.vala      |    3 +-
 .../backing-eds-calendar-source-subscription.vala  |   25 ++++++++++++++++----
 src/view/common/common-events-cell.vala            |    8 ++++++
 3 files changed, 30 insertions(+), 6 deletions(-)
---
diff --git a/src/backing/backing-calendar-source-subscription.vala 
b/src/backing/backing-calendar-source-subscription.vala
index 9286dca..978bb01 100644
--- a/src/backing/backing-calendar-source-subscription.vala
+++ b/src/backing/backing-calendar-source-subscription.vala
@@ -360,7 +360,8 @@ public abstract class CalendarSourceSubscription : BaseObject {
     }
     
     public override string to_string() {
-        return "%s::%s".printf(calendar.to_string(), window.to_string());
+        return "%s:%s::%s".printf(calendar.to_string(), window.start_date.to_string(),
+            window.end_date.to_string());
     }
 }
 
diff --git a/src/backing/eds/backing-eds-calendar-source-subscription.vala 
b/src/backing/eds/backing-eds-calendar-source-subscription.vala
index 963f9c8..e6a0af3 100644
--- a/src/backing/eds/backing-eds-calendar-source-subscription.vala
+++ b/src/backing/eds/backing-eds-calendar-source-subscription.vala
@@ -102,7 +102,7 @@ internal class EdsCalendarSourceSubscription : CalendarSourceSubscription {
         }
         
         // process all known objects within the sexp range
-        on_objects_discovered_added(ical_components, notify_instance_discovered);
+        on_objects_discovered_added(true, ical_components, notify_instance_discovered);
         
         // only set when generation (start) is finished
         active = true;
@@ -110,12 +110,19 @@ internal class EdsCalendarSourceSubscription : CalendarSourceSubscription {
     
     private void on_objects_added(SList<unowned iCal.icalcomponent> ical_components) {
         // process all added objects
-        on_objects_discovered_added(ical_components, notify_instance_added);
+        on_objects_discovered_added(false, ical_components, notify_instance_added);
     }
     
-    private void on_objects_discovered_added(SList<unowned iCal.icalcomponent> ical_components,
+    private void on_objects_discovered_added(bool is_discovered, SList<unowned iCal.icalcomponent> 
ical_components,
         InstanceNotifier notifier) {
         foreach (unowned iCal.icalcomponent ical_component in ical_components) {
+            if (!is_discovered) {
+                debug("%s component added: %s is_instance=%s has_recurrences=%s", to_string(),
+                    ical_component.get_uid(),
+                    E.Util.component_is_instance(ical_component).to_string(),
+                    E.Util.component_has_recurrences(ical_component).to_string());
+            }
+            
             if (String.is_empty(ical_component.get_uid()))
                 continue;
             
@@ -159,7 +166,7 @@ internal class EdsCalendarSourceSubscription : CalendarSourceSubscription {
                 // assign the master (if this isn't the master already)
                 added_event.master = master;
                 
-                // notify of didscovery/addition
+                // notify of discovery/addition
                 notifier(added_event);
             }
         } catch (Error err) {
@@ -172,6 +179,11 @@ internal class EdsCalendarSourceSubscription : CalendarSourceSubscription {
     private void on_objects_modified(SList<unowned iCal.icalcomponent> ical_components) {
         SList<unowned iCal.icalcomponent> add_list = new SList<unowned iCal.icalcomponent>();
         foreach (unowned iCal.icalcomponent ical_component in ical_components) {
+            debug("%s component modified: %s is_instance=%s has_recurrences=%s", to_string(),
+                ical_component.get_uid(),
+                E.Util.component_is_instance(ical_component).to_string(),
+                E.Util.component_has_recurrences(ical_component).to_string());
+            
             // if not a generated instance and has recurring, treat as an add (which removes and
             // adds generated instances)
             if (!E.Util.component_is_instance(ical_component) && 
E.Util.component_has_recurrences(ical_component)) {
@@ -188,8 +200,11 @@ internal class EdsCalendarSourceSubscription : CalendarSourceSubscription {
             // if no known instances (master or generated) of this UID, then signalled for something
             // never seen before
             Gee.Collection<Component.Instance>? instances = for_uid(uid);
-            if (Collection.size(instances) == 0)
+            if (Collection.is_empty(instances)) {
+                debug("modified component %s has no known instances", uid.to_string());
+                
                 continue;
+            }
             
             // if a generated instance has been updated, get its RID (fall through if unavailable)
             Component.DateTime? rid = null;
diff --git a/src/view/common/common-events-cell.vala b/src/view/common/common-events-cell.vala
index 0e4ec52..e3931a8 100644
--- a/src/view/common/common-events-cell.vala
+++ b/src/view/common/common-events-cell.vala
@@ -385,10 +385,18 @@ internal abstract class EventsCell : Gtk.EventBox, InstanceContainer {
         // remove from cell if no longer in this day, otherwise remove and add again to sorted_events
         // to re-sort
         if (!(date in event.get_event_date_span(Calendar.Timezone.local))) {
+            debug("Removing event %s from cell for %s: no longer in date span", event.uid.to_string(),
+                date.to_string());
+            
             remove_event(event);
         } else if (sorted_events.remove(event)) {
+            debug("Re-sorting event %s in cell for %s: date/time changed", event.uid.to_string(),
+                date.to_string());
+            
             sorted_events.add(event);
             assign_line_numbers();
+        } else {
+            debug("Unknown event %s associated with cell %s", event.uid.to_string(), date.to_string());
         }
         
         queue_draw();


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