aboutsummaryrefslogtreecommitdiffstats
path: root/calendar/conduits
diff options
context:
space:
mode:
Diffstat (limited to 'calendar/conduits')
-rw-r--r--calendar/conduits/calendar/calendar-conduit.c33
-rw-r--r--calendar/conduits/todo/todo-conduit.c33
2 files changed, 40 insertions, 26 deletions
diff --git a/calendar/conduits/calendar/calendar-conduit.c b/calendar/conduits/calendar/calendar-conduit.c
index cff1e6fe36..af514c9ada 100644
--- a/calendar/conduits/calendar/calendar-conduit.c
+++ b/calendar/conduits/calendar/calendar-conduit.c
@@ -53,7 +53,7 @@
GnomePilotConduit * conduit_get_gpilot_conduit (guint32);
void conduit_destroy_gpilot_conduit (GnomePilotConduit*);
-#define CONDUIT_VERSION "0.1.2"
+#define CONDUIT_VERSION "0.1.3"
#ifdef G_LOG_DOMAIN
#undef G_LOG_DOMAIN
#endif
@@ -254,6 +254,17 @@ get_pilot_day (icalrecurrencetype_weekday wd)
}
}
+/* FIX ME Is there a better way to see if no start time set? */
+static gboolean
+is_empty_time (struct tm time)
+{
+ if (time.tm_sec || time.tm_min || time.tm_hour
+ || time.tm_mday || time.tm_mon || time.tm_year)
+ return FALSE;
+
+ return TRUE;
+}
+
static short
nth_weekday (int pos, icalrecurrencetype_weekday weekday)
{
@@ -391,7 +402,7 @@ local_record_from_comp (ECalLocalRecord *local, CalComponent *comp, ECalConduitC
/* Recurrence Rules */
local->appt->repeatType = repeatNone;
-
+
if (cal_component_has_rrules (comp)) {
GSList *list;
struct icalrecurrencetype *recur;
@@ -451,6 +462,14 @@ local_record_from_comp (ECalLocalRecord *local, CalComponent *comp, ECalConduitC
local->appt->repeatFrequency = recur->interval;
}
+ if (icaltime_is_null_time (recur->until)) {
+ local->appt->repeatForever = 1;
+ } else {
+ local->appt->repeatForever = 0;
+ dt_time = icaltime_as_timet (recur->until);
+ local->appt->repeatEnd = *localtime (&dt_time);
+ }
+
cal_component_free_recur_list (list);
}
@@ -534,9 +553,7 @@ comp_from_remote_record (GnomePilotConduitSyncAbs *conduit,
cal_component_set_description_list (comp, &l);
}
- /* FIX ME Is there a better way to see if no start time set? */
- if (appt.begin.tm_sec || appt.begin.tm_min || appt.begin.tm_hour
- || appt.begin.tm_mday || appt.begin.tm_mon || appt.begin.tm_year) {
+ if (!is_empty_time (appt.begin)) {
it = icaltime_from_timet (mktime (&appt.begin), FALSE, FALSE);
dt.value = ⁢
cal_component_set_dtstart (comp, &dt);
@@ -549,8 +566,7 @@ comp_from_remote_record (GnomePilotConduitSyncAbs *conduit,
it = icaltime_from_timet (t, FALSE, FALSE);
dt.value = ⁢
cal_component_set_dtend (comp, &dt);
- } else if (appt.end.tm_sec || appt.end.tm_min || appt.end.tm_hour
- || appt.end.tm_mday || appt.end.tm_mon || appt.end.tm_year) {
+ } else if (!is_empty_time (appt.end)) {
it = icaltime_from_timet (mktime (&appt.end), FALSE, FALSE);
dt.value = ⁢
cal_component_set_dtend (comp, &dt);
@@ -608,8 +624,7 @@ comp_from_remote_record (GnomePilotConduitSyncAbs *conduit,
/* recurrence start of week */
recur.week_start = get_ical_day (appt.repeatWeekstart);
- if (appt.repeatEnd.tm_sec || appt.repeatEnd.tm_min || appt.repeatEnd.tm_hour
- || appt.repeatEnd.tm_mday || appt.repeatEnd.tm_mon || appt.repeatEnd.tm_year) {
+ if (!appt.repeatForever) {
time_t t = mktime (&appt.repeatEnd);
t = time_add_day (t, 1);
recur.until = icaltime_from_timet (t, FALSE, FALSE);
diff --git a/calendar/conduits/todo/todo-conduit.c b/calendar/conduits/todo/todo-conduit.c
index df0d6bfb8e..9eb0dfef61 100644
--- a/calendar/conduits/todo/todo-conduit.c
+++ b/calendar/conduits/todo/todo-conduit.c
@@ -53,7 +53,7 @@
GnomePilotConduit * conduit_get_gpilot_conduit (guint32);
void conduit_destroy_gpilot_conduit (GnomePilotConduit*);
-#define CONDUIT_VERSION "0.1.1"
+#define CONDUIT_VERSION "0.1.2"
#ifdef G_LOG_DOMAIN
#undef G_LOG_DOMAIN
#endif
@@ -71,7 +71,7 @@ void conduit_destroy_gpilot_conduit (GnomePilotConduit*);
#define WARN(e...) g_log (G_LOG_DOMAIN, G_LOG_LEVEL_WARNING, e)
#define INFO(e...) g_log (G_LOG_DOMAIN, G_LOG_LEVEL_MESSAGE, e)
-/* debug spew DELETE ME */
+/* Debug routines */
static char *
print_local (EToDoLocalRecord *local)
{
@@ -96,8 +96,6 @@ print_local (EToDoLocalRecord *local)
return "";
}
-
-/* debug spew DELETE ME */
static char *print_remote (GnomePilotRecord *remote)
{
static char buff[ 4096 ];
@@ -396,10 +394,8 @@ comp_from_remote_record (GnomePilotConduitSyncAbs *conduit,
struct ToDo todo;
struct icaltimetype now = icaltime_from_timet (time (NULL), FALSE, FALSE);
CalComponentText summary = {NULL, NULL};
- CalComponentText description = {NULL, NULL};
CalComponentDateTime dt = {NULL, NULL};
struct icaltimetype due;
- GSList *d_list;
g_return_val_if_fail (remote != NULL, NULL);
@@ -414,19 +410,25 @@ comp_from_remote_record (GnomePilotConduitSyncAbs *conduit,
comp = cal_component_clone (in_comp);
}
- LOG (" comp_from_remote_record: "
- "creating from remote %s and comp %s\n",
- print_remote (remote), cal_component_get_as_string (comp));
-
cal_component_set_last_modified (comp, &now);
summary.value = todo.description;
cal_component_set_summary (comp, &summary);
- description.value = todo.note;
- d_list = g_slist_append (NULL, &description);
- cal_component_set_comment_list (comp, d_list);
- g_slist_free (d_list);
+ /* The iCal description field */
+ if (!todo.note) {
+ cal_component_set_comment_list (comp, NULL);
+ } else {
+ GSList l;
+ CalComponentText text;
+
+ text.value = todo.note;
+ text.altrep = NULL;
+ l.data = &text;
+ l.next = NULL;
+
+ cal_component_set_description_list (comp, &l);
+ }
if (todo.complete) {
int percent = 100;
@@ -468,9 +470,6 @@ update_comp (GnomePilotConduitSyncAbs *conduit, CalComponent *comp,
g_return_if_fail (conduit != NULL);
g_return_if_fail (comp != NULL);
- LOG ("update_comp: saving to desktop\n%s\n",
- cal_component_get_as_string (comp));
-
success = cal_client_update_object (ctxt->client, comp);
if (!success)