[california/wip/732930-explain] Deal with complicated RRULEs



commit 1f0250cf895f174d1c8f8d9152f73ec510506a11
Author: Jim Nelson <jim yorba org>
Date:   Fri Sep 5 15:40:09 2014 -0700

    Deal with complicated RRULEs

 src/host/host-create-update-event.vala |   12 +++++++++---
 src/rc/create-update-event.ui          |    2 +-
 2 files changed, 10 insertions(+), 4 deletions(-)
---
diff --git a/src/host/host-create-update-event.vala b/src/host/host-create-update-event.vala
index b2056f6..94c5cb1 100644
--- a/src/host/host-create-update-event.vala
+++ b/src/host/host-create-update-event.vala
@@ -158,9 +158,15 @@ public class CreateUpdateEvent : Gtk.Grid, Toolkit.Card {
         location_entry.text = event.location ?? "";
         description_textview.buffer.text = event.description ?? "";
         
-        string? explanation = (event.rrule != null)
-            ? event.rrule.explain(event.get_event_date_span(Calendar.Timezone.local).start_date)
-            : null;
+        // if RecurrenceRule.explain() returns null, means it cannot express the RRULE, which
+        // should be made clear here
+        string? explanation = null;
+        if (event.rrule != null) {
+            explanation = event.rrule.explain(event.get_event_date_span(Calendar.Timezone.local).start_date);
+            if (explanation == null)
+                explanation = _("It's complicated…");
+        }
+        
         recurring_explanation_label.label = explanation ?? _("Never");
         
         accept_button.label = is_update ? _("_Save") : _("C_reate");
diff --git a/src/rc/create-update-event.ui b/src/rc/create-update-event.ui
index 34959e7..4ab1f58 100644
--- a/src/rc/create-update-event.ui
+++ b/src/rc/create-update-event.ui
@@ -248,7 +248,7 @@
         <property name="visible">True</property>
         <property name="can_focus">False</property>
         <property name="xalign">1</property>
-        <property name="label" translatable="yes">Repeats</property>
+        <property name="label" translatable="yes">Recurrence</property>
         <style>
           <class name="dim-label"/>
         </style>


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