[california/wip/725786-edit-recurring] Final final touches
- From: Jim Nelson <jnelson src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [california/wip/725786-edit-recurring] Final final touches
- Date: Thu, 17 Jul 2014 02:00:53 +0000 (UTC)
commit 0099ceaddbfcc5a9f32e63abe188486f42931ef0
Author: Jim Nelson <jim yorba org>
Date: Wed Jul 16 19:00:45 2014 -0700
Final final touches
po/POTFILES.in | 2 +
src/backing/backing-calendar-source.vala | 14 ----------
src/backing/eds/backing-eds-calendar-source.vala | 16 ------------
src/component/component-event.vala | 29 ++++++++++++++++++++++
src/host/host-create-update-event.vala | 18 ++++----------
src/host/host-show-event.vala | 4 ---
6 files changed, 36 insertions(+), 47 deletions(-)
---
diff --git a/po/POTFILES.in b/po/POTFILES.in
index d6deb65..e3a056f 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -11,6 +11,7 @@ src/calendar/calendar-date.vala
src/calendar/calendar.vala
src/component/component.vala
src/host/host-create-update-event.vala
+src/host/host-create-update-recurring.vala
src/host/host-import-calendar.vala
src/host/host-main-window.vala
src/host/host-show-event.vala
@@ -22,6 +23,7 @@ src/view/week/week-controller.vala
[type: gettext/glade]src/rc/calendar-manager-list-item.ui
[type: gettext/glade]src/rc/calendar-manager-list.ui
[type: gettext/glade]src/rc/create-update-event.ui
+[type: gettext/glade]src/rc/create-update-recurring.ui
[type: gettext/glade]src/rc/google-authenticating.ui
[type: gettext/glade]src/rc/google-calendar-list.ui
[type: gettext/glade]src/rc/google-login.ui
diff --git a/src/backing/backing-calendar-source.vala b/src/backing/backing-calendar-source.vala
index 2e85e24..fbfb6dd 100644
--- a/src/backing/backing-calendar-source.vala
+++ b/src/backing/backing-calendar-source.vala
@@ -99,20 +99,6 @@ public abstract class CalendarSource : Source {
AffectedInstances affected, Cancellable? cancellable = null) throws Error;
/**
- * Fetches the master component of an { link Component.Instance} by its { link Component.UID}.
- *
- * Unlike master instances generated by a { link CalendarSourceSubscription}, there instance
- * is not tracked by the { link CalendarSource} and will not be updated as it is update
- * elsewhere, either locally or remotely.
- *
- * @see Component.Instance.is_recurring_instance
- * @throws An Error if the { link Component.UID} is unknown to the CalendarSource,
- * as well as for the sundry I/O errors and such.
- */
- public abstract async Component.Instance fetch_master_component_async(Component.UID uid,
- Cancellable? cancellable = null) throws Error;
-
- /**
* Imports a { link Component.iCalendar} into the { link CalendarSource}.
*/
public abstract async void import_icalendar_async(Component.iCalendar ical, Cancellable? cancellable =
null)
diff --git a/src/backing/eds/backing-eds-calendar-source.vala
b/src/backing/eds/backing-eds-calendar-source.vala
index d6945d2..3533c8d 100644
--- a/src/backing/eds/backing-eds-calendar-source.vala
+++ b/src/backing/eds/backing-eds-calendar-source.vala
@@ -229,22 +229,6 @@ internal class EdsCalendarSource : CalendarSource {
yield client.modify_object(ical_component, E.CalObjModType.THIS, cancellable);
}
- public override async Component.Instance fetch_master_component_async(Component.UID uid,
- Cancellable? cancellable = null) throws Error {
- // get the master instance for this UID
- iCal.icalcomponent ical_component;
- yield client.get_object(uid.value, null, cancellable, out ical_component);
-
- // convert into an Instance and return
- Component.Instance? instance = Component.Instance.convert(this, ical_component);
- if (instance == null) {
- throw new BackingError.UNKNOWN("UID %s is unknown to calendar %s", uid.to_string(),
- to_string());
- }
-
- return instance;
- }
-
public override async void import_icalendar_async(Component.iCalendar ical, Cancellable? cancellable =
null)
throws Error {
check_open();
diff --git a/src/component/component-event.vala b/src/component/component-event.vala
index b09aca1..b4c2d34 100644
--- a/src/component/component-event.vala
+++ b/src/component/component-event.vala
@@ -316,6 +316,35 @@ public class Event : Instance, Gee.Comparable<Event> {
}
/**
+ * Convert an { link Event} from an all-day to a timed event by only adding the time.
+ *
+ * Returns with no changes if { link is_all_day} is false.
+ */
+ public void all_day_to_timed_event(Calendar.WallTime start_time, Calendar.WallTime end_time,
+ Calendar.Timezone timezone) {
+ if (!is_all_day)
+ return;
+
+ // create exact time span using these parameters
+ set_event_exact_time_span(
+ new Calendar.ExactTimeSpan(
+ new Calendar.ExactTime(timezone, date_span.start_date, start_time),
+ new Calendar.ExactTime(timezone, date_span.end_date, end_time)
+ )
+ );
+ }
+
+ /**
+ * Convert an { link Event} from a timed event to an all-day event by removing the time.
+ *
+ * Returns with no changes if { link is_all_day} is true.
+ */
+ public void timed_to_all_day_event() {
+ if (!is_all_day)
+ set_event_date_span(get_event_date_span(null));
+ }
+
+ /**
* Returns a prettified string describing the { link Event}'s time span in as concise and
* economical manner possible.
*
diff --git a/src/host/host-create-update-event.vala b/src/host/host-create-update-event.vala
index 8f0b45f..f8a755d 100644
--- a/src/host/host-create-update-event.vala
+++ b/src/host/host-create-update-event.vala
@@ -317,20 +317,12 @@ public class CreateUpdateEvent : Gtk.Grid, Toolkit.Card {
if (!replace_dtstart) {
if (target.is_all_day != all_day_toggle.active) {
if (all_day_toggle.active) {
- target.set_event_date_span(target.get_event_date_span(null));
+ target.timed_to_all_day_event();
} else {
- // use existing timezone unless not specified in original event
- Calendar.DateSpan target_date_span = target.get_event_date_span(null);
- Calendar.Timezone tz = (target.exact_time_span != null)
- ? target.exact_time_span.start_exact_time.tz
- : Calendar.Timezone.local;
- target.set_event_exact_time_span(
- new Calendar.ExactTimeSpan(
- new Calendar.ExactTime(tz, target_date_span.start_date,
- time_map.get(dtstart_time_combo.get_active_text())),
- new Calendar.ExactTime(tz, target_date_span.end_date,
- time_map.get(dtend_time_combo.get_active_text()))
- )
+ target.all_day_to_timed_event(
+ time_map.get(dtstart_time_combo.get_active_text()),
+ time_map.get(dtend_time_combo.get_active_text()),
+ Calendar.Timezone.local
);
}
}
diff --git a/src/host/host-show-event.vala b/src/host/host-show-event.vala
index bcf151a..21c5db0 100644
--- a/src/host/host-show-event.vala
+++ b/src/host/host-show-event.vala
@@ -79,10 +79,6 @@ public class ShowEvent : Gtk.Grid, Toolkit.Card {
}
private void build_display() {
- debug("VEVENT:\n%s\n", event.source);
- if (event.master != null)
- debug("VEVENT MASTER:\n%s\n", event.master.source);
-
// summary
set_label(null, summary_text, event.summary);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]