aboutsummaryrefslogtreecommitdiffstats
path: root/calendar/gui/comp-util.c
diff options
context:
space:
mode:
authorChenthill Palanisamy <pchenthill@novell.com>2009-04-13 17:03:38 +0800
committerChenthill Palanisamy <pchen@src.gnome.org>2009-04-13 17:03:38 +0800
commit9896e4f7db7817087b7c18793682a4ab5f7c63e2 (patch)
tree54f2dc155338cba91fa82500cbb619f4024e7b46 /calendar/gui/comp-util.c
parent064ff85b3b8e06a5347b62e5c80c1273875e719a (diff)
downloadgsoc2013-evolution-9896e4f7db7817087b7c18793682a4ab5f7c63e2.tar.gz
gsoc2013-evolution-9896e4f7db7817087b7c18793682a4ab5f7c63e2.tar.zst
gsoc2013-evolution-9896e4f7db7817087b7c18793682a4ab5f7c63e2.zip
Fixes #561312
2009-04-13 Chenthill Palanisamy <pchenthill@novell.com> Fixes #561312 * calendar/gui/comp-util.c: * calendar/gui/comp-util.h: Added a new function to sanitize master recurrence event before modifying all instances. * calendar/gui/dialogs/comp-editor.c: * calendar/gui/e-day-view.c: * calendar/gui/e-week-view.c: Used the new util api. Do not invoke recurrence dialog while modifying detached instances. svn path=/trunk/; revision=37518
Diffstat (limited to 'calendar/gui/comp-util.c')
-rw-r--r--calendar/gui/comp-util.c59
1 files changed, 59 insertions, 0 deletions
diff --git a/calendar/gui/comp-util.c b/calendar/gui/comp-util.c
index 9a58a8cf6b..57704da0f2 100644
--- a/calendar/gui/comp-util.c
+++ b/calendar/gui/comp-util.c
@@ -796,3 +796,62 @@ cal_comp_process_source_list_drop (ECal *destination, icalcomponent *comp, GdkDr
return success;
}
+
+void
+comp_util_sanitize_recurrence_master (ECalComponent *comp, ECal *client)
+{
+ ECalComponent *master = NULL;
+ icalcomponent *icalcomp = NULL;
+ ECalComponentRange rid;
+ ECalComponentDateTime sdt;
+ const char *uid;
+
+ /* Get the master component */
+ e_cal_component_get_uid (comp, &uid);
+ if (!e_cal_get_object (client, uid, NULL, &icalcomp, NULL)) {
+ g_warning ("Unable to get the master component \n");
+ return;
+ }
+
+ master = e_cal_component_new ();
+ e_cal_component_set_icalcomponent (master, icalcomp);
+
+ /* Compare recur id and start date */
+ e_cal_component_get_recurid (comp, &rid);
+ e_cal_component_get_dtstart (comp, &sdt);
+
+ if (icaltime_compare_date_only (*rid.datetime.value, *sdt.value) == 0)
+ {
+ ECalComponentDateTime msdt, medt, edt;
+ int *sequence;
+
+ e_cal_component_get_dtstart (master, &msdt);
+ e_cal_component_get_dtend (master, &medt);
+
+ e_cal_component_get_dtend (comp, &edt);
+
+ sdt.value->year = msdt.value->year;
+ sdt.value->month = msdt.value->month;
+ sdt.value->day = msdt.value->day;
+
+ edt.value->year = medt.value->year;
+ edt.value->month = medt.value->month;
+ edt.value->day = medt.value->day;
+
+ e_cal_component_set_dtstart (comp, &sdt);
+ e_cal_component_set_dtend (comp, &edt);
+
+ e_cal_component_get_sequence (master, &sequence);
+ e_cal_component_set_sequence (comp, sequence);
+
+ e_cal_component_free_datetime (&msdt);
+ e_cal_component_free_datetime (&medt);
+ e_cal_component_free_datetime (&edt);
+ }
+
+ e_cal_component_free_datetime (&sdt);
+ e_cal_component_free_range (&rid);
+ e_cal_component_set_recurid (comp, NULL);
+
+ g_object_unref (master);
+}