[evolution-patches] EDS: calendar-contacts-backend
- From: "Thomas 'Dent' Mirlacher" <dent cosy sbg ac at>
- To: <evolution-patches lists ximian com>
- Subject: [evolution-patches] EDS: calendar-contacts-backend
- Date: Mon, 8 Mar 2004 18:23:17 +0100 (MET)
hi list,
his patch is 3 patches in one (i was to lazy to pick them apart),
but they are really easy to separate:
1) since there are some issues with time_t functions,
appointments which are starting before 19700101
will get messed up
-> DIRTY fix: let them start 1970
2) a whole day entry needs to have end dtend set
(the next day)
3) remove the Birthday: and Anniversaries: prefixes
... since this is really annoying when you
sync with e.g. your cellphone
-> give Anniversaries their own category
(there needs to be an icon and an entry in
gconf also for this)
cheers,
++dent
--
this signature is mostly RFC 1855 compliant.
Index: e-cal-backend-contacts.c
===================================================================
RCS file: /cvs/gnome/evolution-data-server/calendar/backends/contacts/e-cal-backend-contacts.c,v
retrieving revision 1.5
diff -u -r1.5 e-cal-backend-contacts.c
--- e-cal-backend-contacts.c 1 Mar 2004 15:45:54 -0000 1.5
+++ e-cal-backend-contacts.c 8 Mar 2004 17:15:38 -0000
@@ -360,7 +360,14 @@
{
struct icaltimetype ret;
+#if 1
+//FIXME: this is a really ugly hack, but since several parts are depending on the epoch
+// we can only start with out entries on 19700101
+// - so take care of that
+ ret.year = cdate->year >= 1970 ? cdate->year : 1970;
+#else
ret.year = cdate->year;
+#endif
ret.month = cdate->month;
ret.day = cdate->day;
ret.is_date = TRUE;
@@ -373,13 +380,15 @@
/* Contact -> Event creator */
static ECalComponent *
-create_component (ECalBackendContacts *cbc, EContactDate *cdate, char *summary)
+create_component (ECalBackendContacts *cbc, EContactDate *cdate, const char *summary)
{
ECalComponent *cal_comp;
ECalComponentText comp_summary;
icalcomponent *ical_comp;
struct icaltimetype itt;
+ struct icaltimetype end_itt;
ECalComponentDateTime dt;
+ ECalComponentDateTime end_dt;
struct icalrecurrencetype r;
GSList recur_list;
@@ -400,7 +409,14 @@
dt.value = &itt;
dt.tzid = 0;
e_cal_component_set_dtstart (cal_comp, &dt);
-
+
+ end_itt = cdate_to_icaltime (cdate);
+ icaltime_adjust (&end_itt, 1, 0, 0, 0);
+ end_dt.value = &end_itt;
+ end_dt.tzid = 0;
+ /* We have to add 1 day to DTEND, as it is not inclusive. */
+ e_cal_component_set_dtend (cal_comp, &end_dt);
+
/* Create yearly recurrence */
icalrecurrencetype_clear (&r);
r.freq = ICAL_YEARLY_RECURRENCE;
@@ -415,7 +431,7 @@
e_cal_component_set_summary (cal_comp, &comp_summary);
/* Set category and visibility */
- e_cal_component_set_categories (cal_comp, _("Birthday"));
+ //e_cal_component_set_categories (cal_comp, _("Birthday"));
e_cal_component_set_classification (cal_comp, E_CAL_COMPONENT_CLASS_PRIVATE);
/* Birthdays/anniversaries are shown as free time */
@@ -432,17 +448,14 @@
{
EContactDate *cdate;
ECalComponent *cal_comp;
- char *summary;
const char *name;
cdate = e_contact_get (contact, E_CONTACT_BIRTH_DATE);
name = e_contact_get_const (contact, E_CONTACT_FILE_AS);
- summary = g_strdup_printf (_("Birthday: %s"), name);
- cal_comp = create_component (cbc, cdate, summary);
+ cal_comp = create_component (cbc, cdate, name);
+ e_cal_component_set_categories (cal_comp, _("Birthday"));
- g_free (summary);
-
return cal_comp;
}
@@ -451,16 +464,13 @@
{
EContactDate *cdate;
ECalComponent *cal_comp;
- char *summary;
const char *name;
cdate = e_contact_get (contact, E_CONTACT_ANNIVERSARY);
name = e_contact_get_const (contact, E_CONTACT_FILE_AS);
- summary = g_strdup_printf (_("Anniversary: %s"), name);
-
- cal_comp = create_component (cbc, cdate, summary);
- g_free (summary);
+ cal_comp = create_component (cbc, cdate, name);
+ e_cal_component_set_categories (cal_comp, _("Anniversary"));
return cal_comp;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]