[california/wip/732671-double] Use pointers rather than UIDs to track adds/removes



commit fa261e35b7f000b6f7d95428ee722c5a116a77bd
Author: Jim Nelson <jim yorba org>
Date:   Fri Sep 5 18:24:13 2014 -0700

    Use pointers rather than UIDs to track adds/removes

 src/component/component-event.vala      |    4 ++--
 src/view/common/common-events-cell.vala |   12 ++++++------
 src/view/month/month-grid.vala          |    3 +++
 3 files changed, 11 insertions(+), 8 deletions(-)
---
diff --git a/src/component/component-event.vala b/src/component/component-event.vala
index d8693b3..1302c3c 100644
--- a/src/component/component-event.vala
+++ b/src/component/component-event.vala
@@ -407,8 +407,8 @@ public class Event : Instance, Gee.Comparable<Event> {
             else if (rid == null && other.rid == null)
                 return 0;
             
-            debug("Comparing two w/ same UID: %s\nTHIS\n%s\n\nOTHER\n%s\n", uid.to_string(),
-                source, other.source);
+            debug("Comparing two w/ same UID: %s %Xh vs. %Xh\nTHIS\n%s\n\nOTHER\n%s\n", uid.to_string(),
+                (uint) this, (uint) other, source, other.source);
         }
         
         // sort all-day events before timed events
diff --git a/src/view/common/common-events-cell.vala b/src/view/common/common-events-cell.vala
index b4df56e..3703529 100644
--- a/src/view/common/common-events-cell.vala
+++ b/src/view/common/common-events-cell.vala
@@ -224,7 +224,7 @@ internal abstract class EventsCell : Gtk.EventBox, InstanceContainer {
     
     public void add_event(Component.Event event) {
         if (!sorted_events.add(event)) {
-            debug("Unable to add event %s to cell for %s: already present", event.uid.to_string(),
+            debug("Unable to add event %Xh to cell for %s: already present", (uint) event,
                 date.to_string());
             
             return;
@@ -242,8 +242,8 @@ internal abstract class EventsCell : Gtk.EventBox, InstanceContainer {
     
     private bool internal_remove_event(Component.Event event) {
         if (!sorted_events.remove(event)) {
-            debug("Unable to remove event %s from cell for %s: not present in sorted_events",
-                event.uid.to_string(), date.to_string());
+            debug("Unable to remove event %Xh from cell for %s: not present in sorted_events",
+                (uint) event, date.to_string());
             
             return false;
         }
@@ -393,18 +393,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(),
+            debug("Removing event %Xh from cell for %s: no longer in date span", (uint) event,
                 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(),
+            debug("Re-sorting event %Xh in cell for %s: date/time changed", (uint) event,
                 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());
+            debug("Unknown event %Xh associated with cell %s", (uint) event, date.to_string());
         }
         
         queue_draw();
diff --git a/src/view/month/month-grid.vala b/src/view/month/month-grid.vala
index c5a5b46..afa625b 100644
--- a/src/view/month/month-grid.vala
+++ b/src/view/month/month-grid.vala
@@ -260,6 +260,9 @@ private class Grid : Gtk.Grid {
         // date changes it doesn't need to be removed here (Month.Call catches the change and
         // removes it itself) but it does need to be added to the new date(s) it covers
         foreach_cell_in_date_span(event.get_event_date_span(Calendar.Timezone.local), (cell) => {
+            debug("Adding new or altered event %Xh to cell for %s", (uint) event,
+                cell.date.to_string());
+            
             cell.add_event(event);
             
             return true;


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