[california] Fix Month.Cell.clear()



commit dd030541059251d3b1db6d506672ce747e00347d
Author: Jim Nelson <jim yorba org>
Date:   Mon Apr 28 18:09:41 2014 -0700

    Fix Month.Cell.clear()

 src/view/month/month-cell.vala |   17 ++++++++++++++---
 1 files changed, 14 insertions(+), 3 deletions(-)
---
diff --git a/src/view/month/month-cell.vala b/src/view/month/month-cell.vala
index 1381fa6..b05c4d7 100644
--- a/src/view/month/month-cell.vala
+++ b/src/view/month/month-cell.vala
@@ -173,8 +173,12 @@ private class Cell : Gtk.EventBox {
     
     public void clear() {
         date = null;
-        sorted_events.clear();
         line_to_event.clear();
+        
+        foreach (Component.Event event in sorted_events.to_array())
+            internal_remove_event(event);
+        
+        queue_draw();
     }
     
     public void add_event(Component.Event event) {
@@ -191,14 +195,21 @@ private class Cell : Gtk.EventBox {
         queue_draw();
     }
     
-    public void remove_event(Component.Event event) {
+    private bool internal_remove_event(Component.Event event) {
         if (!sorted_events.remove(event))
-            return;
+            return false;
         
         event.notify[Component.Event.PROP_SUMMARY].disconnect(queue_draw);
         event.notify[Component.Event.PROP_DATE_SPAN].disconnect(on_span_updated);
         event.notify[Component.Event.PROP_EXACT_TIME_SPAN].disconnect(on_span_updated);
         
+        return true;
+    }
+    
+    public void remove_event(Component.Event event) {
+        if (!internal_remove_event(event))
+            return;
+        
         assign_line_numbers();
         
         queue_draw();


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