[california/wip/725785-create-recurring: 8/11] Generate recurring instances when they're added
- From: Jim Nelson <jnelson src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [california/wip/725785-create-recurring: 8/11] Generate recurring instances when they're added
- Date: Fri, 13 Jun 2014 23:21:01 +0000 (UTC)
commit 9b2dd003c7b3ef5781e8337c3c705a63bfb427ea
Author: Jim Nelson <jim yorba org>
Date: Fri Jun 13 14:59:31 2014 -0700
Generate recurring instances when they're added
.../backing-eds-calendar-source-subscription.vala | 27 ++++++++++++++-----
vapi/libecal-1.2.vapi | 10 ++++++-
vapi/libecal-1.2/libecal-1.2.metadata | 9 ++++++
3 files changed, 37 insertions(+), 9 deletions(-)
---
diff --git a/src/backing/eds/backing-eds-calendar-source-subscription.vala
b/src/backing/eds/backing-eds-calendar-source-subscription.vala
index f531a39..899d801 100644
--- a/src/backing/eds/backing-eds-calendar-source-subscription.vala
+++ b/src/backing/eds/backing-eds-calendar-source-subscription.vala
@@ -112,14 +112,27 @@ internal class EdsCalendarSourceSubscription : CalendarSourceSubscription {
private void on_objects_added(SList<weak iCal.icalcomponent> objects) {
foreach (weak iCal.icalcomponent ical_component in objects) {
- try {
- Component.Event? event = Component.Instance.convert(calendar, ical_component) as
Component.Event;
- if (event != null)
- notify_instance_added(event);
- } catch (Error err) {
- debug("Unable to generate added event for %s: %s", to_string(), err.message);
- }
+ // TODO: Either use the async variant or run this in a background thread
+ view.client.generate_instances_for_object_sync(
+ ical_component,
+ window.start_exact_time.to_time_t(),
+ window.end_exact_time.to_time_t(),
+ on_instance_added);
+ }
+ }
+
+ private bool on_instance_added(E.CalComponent eds_component, time_t instance_start,
+ time_t instance_end) {
+ try {
+ Component.Event? event = Component.Instance.convert(calendar, eds_component.get_icalcomponent())
+ as Component.Event;
+ if (event != null)
+ notify_instance_added(event);
+ } catch (Error err) {
+ debug("Unable to generate added event for %s: %s", to_string(), err.message);
}
+
+ return true;
}
private void on_objects_modified(SList<weak iCal.icalcomponent> objects) {
diff --git a/vapi/libecal-1.2.vapi b/vapi/libecal-1.2.vapi
index f49e3f9..1a97eff 100644
--- a/vapi/libecal-1.2.vapi
+++ b/vapi/libecal-1.2.vapi
@@ -31,8 +31,8 @@ namespace E {
public static void free_ecalcomp_slist (GLib.SList<E.CalComponent> ecalcomps);
public static void free_icalcomp_slist (GLib.SList icalcomps);
public void generate_instances (time_t start, time_t end, GLib.Cancellable? cancellable,
[CCode (delegate_target_pos = 4.9)] E.CalRecurInstanceFn cb, [CCode (delegate_target_pos = 4.9)] owned
GLib.DestroyNotify? destroy_cb_data);
- public void generate_instances_for_object (iCal.icalcomponent icalcomp, ulong start, ulong
end, GLib.Cancellable? cancellable, E.CalRecurInstanceFn cb, void* cb_data, owned GLib.DestroyNotify?
destroy_cb_data);
- public void generate_instances_for_object_sync (iCal.icalcomponent icalcomp, ulong start,
ulong end, E.CalRecurInstanceFn cb, void* cb_data);
+ public void generate_instances_for_object (iCal.icalcomponent icalcomp, time_t start, time_t
end, GLib.Cancellable? cancellable, [CCode (delegate_target_pos = 6.9)] E.CalRecurInstanceFn cb, owned
GLib.DestroyNotify? destroy_cb_data);
+ public void generate_instances_for_object_sync (iCal.icalcomponent icalcomp, time_t start,
time_t end, [CCode (delegate_target_pos = 6.9)] E.CalRecurInstanceFn cb);
public void generate_instances_sync (time_t start, time_t end, [CCode (delegate_target_pos =
3.9)] E.CalRecurInstanceFn cb);
public async bool get_attachment_uris (string uid, string rid, GLib.Cancellable? cancellable)
throws GLib.Error;
public bool get_attachment_uris_sync (string uid, string rid, GLib.SList out_attachment_uris,
GLib.Cancellable? cancellable) throws GLib.Error;
@@ -87,6 +87,7 @@ namespace E {
public unowned GLib.DBusConnection get_connection ();
public unowned string get_object_path ();
public bool is_running ();
+ public void* ref_client ();
public void set_fields_of_interest (GLib.SList? fields_of_interest) throws GLib.Error;
public void set_flags (E.CalClientViewFlags flags) throws GLib.Error;
public void start () throws GLib.Error;
@@ -300,6 +301,11 @@ namespace E {
public struct CalComponentId {
public weak string uid;
public weak string rid;
+ [CCode (has_construct_function = false)]
+ public CalComponentId (string uid, string rid);
+ public E.CalComponentId copy ();
+ public bool equal (E.CalComponentId id2);
+ public uint hash ();
}
[CCode (cheader_filename = "libecal/libecal.h")]
public struct CalComponentOrganizer {
diff --git a/vapi/libecal-1.2/libecal-1.2.metadata b/vapi/libecal-1.2/libecal-1.2.metadata
index 9756b90..b67f77e 100644
--- a/vapi/libecal-1.2/libecal-1.2.metadata
+++ b/vapi/libecal-1.2/libecal-1.2.metadata
@@ -54,9 +54,18 @@ e_cal_client_generate_instances_sync.end type_name="time_t"
e_cal_client_generate_instances_sync.cb delegate_target_pos="3.9"
e_cal_client_generate_instances_sync.cb_data hidden="1"
+e_cal_client_generate_instances_for_object.start type_name="time_t"
+e_cal_client_generate_instances_for_object.end type_name="time_t"
e_cal_client_generate_instances_for_object.cancellable nullable="1"
+e_cal_client_generate_instances_for_object.cb delegate_target_pos="6.9"
+e_cal_client_generate_instances_for_object.cb_data hidden="1"
e_cal_client_generate_instances_for_object.destroy_cb_data value_owned="1" nullable="1"
+e_cal_client_generate_instances_for_object_sync.start type_name="time_t"
+e_cal_client_generate_instances_for_object_sync.end type_name="time_t"
+e_cal_client_generate_instances_for_object_sync.cb delegate_target_pos="6.9"
+e_cal_client_generate_instances_for_object_sync.cb_data hidden="1"
+
e_cal_client_get_attachment_uris async="1"
e_cal_client_get_attachment_uris.cancellable nullable="1"
e_cal_client_get_attachment_uris_finish.attachment_uris is_out="1" value_owned="1"
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]