[california/wip/725787-remove-recurring] No more "remove this and prior" recurring events



commit ff32351ddda447be11ee133491b3fb38b075b968
Author: Jim Nelson <jim yorba org>
Date:   Thu Jul 3 14:18:01 2014 -0700

    No more "remove this and prior" recurring events
    
    Getting this right is trickier than it looks.  If really desired,
    will ticket for later

 src/backing/backing-calendar-source.vala         |    4 --
 src/backing/eds/backing-eds-calendar-source.vala |   35 +--------------------
 src/host/host-show-event.vala                    |    9 -----
 3 files changed, 2 insertions(+), 46 deletions(-)
---
diff --git a/src/backing/backing-calendar-source.vala b/src/backing/backing-calendar-source.vala
index 44ae06a..4e6589b 100644
--- a/src/backing/backing-calendar-source.vala
+++ b/src/backing/backing-calendar-source.vala
@@ -30,10 +30,6 @@ public abstract class CalendarSource : Source {
          */
         THIS = 0,
         /**
-         * Include all prior { link Component.Instance}s in the affected instances.
-         */
-        THIS_AND_PRIOR,
-        /**
          * Include all future { link Component.Instance}s in the affected instances.
          */
         THIS_AND_FUTURE,
diff --git a/src/backing/eds/backing-eds-calendar-source.vala 
b/src/backing/eds/backing-eds-calendar-source.vala
index f68da03..440327e 100644
--- a/src/backing/eds/backing-eds-calendar-source.vala
+++ b/src/backing/eds/backing-eds-calendar-source.vala
@@ -178,11 +178,7 @@ internal class EdsCalendarSource : CalendarSource {
             break;
             
             case CalendarSource.AffectedInstances.THIS_AND_FUTURE:
-                yield remove_future_async(uid, rid, cancellable);
-            break;
-            
-            case CalendarSource.AffectedInstances.THIS_AND_PRIOR:
-                yield remove_prior_async(uid, rid, cancellable);
+                yield remove_this_and_future_async(uid, rid, cancellable);
             break;
             
             case CalendarSource.AffectedInstances.ALL:
@@ -194,7 +190,7 @@ internal class EdsCalendarSource : CalendarSource {
         }
     }
     
-    private async void remove_future_async(Component.UID uid, Component.DateTime rid,
+    private async void remove_this_and_future_async(Component.UID uid, Component.DateTime rid,
         Cancellable? cancellable) throws Error {
         // get the master instance ... remember that the Backing.CalendarSource only stores generated
         // instances
@@ -230,33 +226,6 @@ internal class EdsCalendarSource : CalendarSource {
         yield client.modify_object(ical_component, E.CalObjModType.THIS, cancellable);
     }
     
-    private async void remove_prior_async(Component.UID uid, Component.DateTime rid,
-        Cancellable? cancellable) throws Error {
-        // get the master instance ... remember that the Backing.CalendarSource only stores generated
-        // instances
-        iCal.icalcomponent ical_component;
-        yield client.get_object(uid.value, null, cancellable, out ical_component);
-        
-        // like remove_future_async(), need to set DTSTART one tick forward to ensure the supplied
-        // RID is now excluded
-        //
-        // TODO: DTSTART needs to be synchronized with recurrences, so this is a no-go
-        iCal.icaltimetype dtstart = {};
-        if (rid.is_date) {
-            Component.date_to_ical(rid.to_date().next(), &dtstart);
-        } else {
-            Component.exact_time_to_ical(rid.to_exact_time().adjust_time(1, Calendar.TimeUnit.SECOND),
-                &dtstart);
-        }
-        
-        // change the DTSTART indicating the start of the recurring set (which is, handily enough,
-        // the RID)
-        ical_component.set_dtstart(dtstart);
-        
-        // write it out ... essentially, this style of remove is actually an update
-        yield client.modify_object(ical_component, E.CalObjModType.THIS, cancellable);
-    }
-    
     public override async void import_icalendar_async(Component.iCalendar ical, Cancellable? cancellable = 
null)
         throws Error {
         check_open();
diff --git a/src/host/host-show-event.vala b/src/host/host-show-event.vala
index deced98..11ff31d 100644
--- a/src/host/host-show-event.vala
+++ b/src/host/host-show-event.vala
@@ -100,11 +100,6 @@ public class ShowEvent : Gtk.Grid, Toolkit.Card {
                 _("Remove This and All _Following Events"));
             remove_following.activate.connect(on_remove_recurring_this_and_following);
             remove_recurring_menu.append(remove_following);
-            
-            Gtk.MenuItem remove_prior = new Gtk.MenuItem.with_mnemonic(
-                _("Remove This and All _Prior Events"));
-            remove_prior.activate.connect(on_remove_recurring_this_and_prior);
-            remove_recurring_menu.append(remove_prior);
         }
         
         // don't current support updating or removing recurring events properly; see
@@ -215,10 +210,6 @@ public class ShowEvent : Gtk.Grid, Toolkit.Card {
     private void on_remove_recurring_this_and_following() {
         remove_events_async.begin(event.rid, Backing.CalendarSource.AffectedInstances.THIS_AND_FUTURE);
     }
-    
-    private void on_remove_recurring_this_and_prior() {
-        remove_events_async.begin(event.rid, Backing.CalendarSource.AffectedInstances.THIS_AND_PRIOR);
-    }
 }
 
 }


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