aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--calendar/ChangeLog36
-rw-r--r--calendar/cal-util/cal-component.c162
-rw-r--r--calendar/cal-util/cal-component.h12
-rw-r--r--calendar/gui/calendar-model.c407
4 files changed, 537 insertions, 80 deletions
diff --git a/calendar/ChangeLog b/calendar/ChangeLog
index 9a77279239..559e0c8b9c 100644
--- a/calendar/ChangeLog
+++ b/calendar/ChangeLog
@@ -1,5 +1,41 @@
2000-08-11 Federico Mena Quintero <federico@helixcode.com>
+ * gui/calendar-model.c (get_geo): Generate a prettier string for
+ the geographical position.
+ (get_classification): New function.
+ (get_categories): New function.
+ (get_completed): New function.
+ (get_dtend): New function.
+ (get_dtstart): New function.
+ (get_due): New function.
+ (get_percent): New function.
+ (get_priority): New function.
+ (get_summary): New function.
+ (get_transparency): New function.
+ (get_url): New function.
+ (get_has_alarms): New function.
+ (get_has_recurrences): New function.
+ (get_is_complete): New function.
+ (get_is_overdue): New function.
+
+ * cal-util/cal-component.c (scan_property): Handle the GEO
+ property.
+ (free_icalcomponent): Likewise.
+ (cal_component_get_geo): Likewise.
+ (cal_component_set_geo): Likewise.
+ (cal_component_free_geo): Likewise.
+ (cal_component_set_exdate_list): Removed incorrect assertion.
+ (cal_component_set_exrule_list): Removed incorrect assertion.
+ (cal_component_get_next_alarm): Oops, this had not been
+ implemented at all.
+ (cal_component_has_rdates): New function.
+ (cal_component_has_rrules): New function.
+
+ * cal-util/cal-component.h (CalComponentField): Added the GEO
+ property.
+
+2000-08-11 Federico Mena Quintero <federico@helixcode.com>
+
* cal-util/cal-component.c (scan_property): Handle the
PERCENT-COMPLETE property.
(free_icalcomponent): Likewise.
diff --git a/calendar/cal-util/cal-component.c b/calendar/cal-util/cal-component.c
index 1fdfc5da8c..3d47e0d6dc 100644
--- a/calendar/cal-util/cal-component.c
+++ b/calendar/cal-util/cal-component.c
@@ -71,6 +71,7 @@ struct _CalComponentPrivate {
GSList *exdate_list; /* list of icalproperty objects */
GSList *exrule_list; /* list of icalproperty objects */
+ icalproperty *geo;
icalproperty *last_modified;
icalproperty *percent;
icalproperty *priority;
@@ -244,6 +245,7 @@ free_icalcomponent (CalComponent *comp)
g_slist_free (priv->exrule_list);
priv->exrule_list = NULL;
+ priv->geo = NULL;
priv->last_modified = NULL;
priv->percent = NULL;
priv->priority = NULL;
@@ -517,6 +519,10 @@ scan_property (CalComponent *comp, icalproperty *prop)
scan_recur (comp, &priv->exrule_list, prop);
break;
+ case ICAL_GEO_PROPERTY:
+ priv->geo = prop;
+ break;
+
case ICAL_LASTMODIFIED_PROPERTY:
priv->last_modified = prop;
break;
@@ -1951,7 +1957,6 @@ cal_component_set_exdate_list (CalComponent *comp, GSList *exdate_list)
g_return_if_fail (comp != NULL);
g_return_if_fail (IS_CAL_COMPONENT (comp));
- g_return_if_fail (exdate_list != NULL);
priv = comp->priv;
g_return_if_fail (priv->icalcomp != NULL);
@@ -2096,7 +2101,6 @@ cal_component_set_exrule_list (CalComponent *comp, GSList *recur_list)
g_return_if_fail (comp != NULL);
g_return_if_fail (IS_CAL_COMPONENT (comp));
- g_return_if_fail (recur_list != NULL);
priv = comp->priv;
g_return_if_fail (priv->icalcomp != NULL);
@@ -2107,6 +2111,69 @@ cal_component_set_exrule_list (CalComponent *comp, GSList *recur_list)
}
/**
+ * cal_component_get_geo:
+ * @comp: A calendar component object.
+ * @geo: Return value for the geographic position property. This should be
+ * freed using the cal_component_free_geo() function.
+ *
+ * Sets the geographic position property of a calendar component object.
+ **/
+void
+cal_component_get_geo (CalComponent *comp, struct icalgeotype **geo)
+{
+ CalComponentPrivate *priv;
+
+ g_return_if_fail (comp != NULL);
+ g_return_if_fail (IS_CAL_COMPONENT (comp));
+ g_return_if_fail (geo != NULL);
+
+ priv = comp->priv;
+ g_return_if_fail (priv->icalcomp != NULL);
+
+ if (priv->geo) {
+ *geo = g_new (struct icalgeotype, 1);
+ **geo = icalproperty_get_geo (priv->geo);
+ } else
+ *geo = NULL;
+}
+
+/**
+ * cal_component_set_geo:
+ * @comp: A calendar component object.
+ * @geo: Value for the geographic position property.
+ *
+ * Sets the geographic position property on a calendar component object.
+ **/
+void
+cal_component_set_geo (CalComponent *comp, struct icalgeotype *geo)
+{
+ CalComponentPrivate *priv;
+
+ g_return_if_fail (comp != NULL);
+ g_return_if_fail (IS_CAL_COMPONENT (comp));
+
+ priv = comp->priv;
+ g_return_if_fail (priv->icalcomp != NULL);
+
+ if (!geo) {
+ if (priv->geo) {
+ icalcomponent_remove_property (priv->icalcomp, priv->geo);
+ icalproperty_free (priv->geo);
+ priv->geo = NULL;
+ }
+
+ return;
+ }
+
+ if (priv->geo)
+ icalproperty_set_geo (priv->geo, *geo);
+ else {
+ priv->geo = icalproperty_new_geo (*geo);
+ icalcomponent_add_property (priv->icalcomp, priv->geo);
+ }
+}
+
+/**
* cal_component_get_last_modified:
* @comp: A calendar component object.
* @t: Return value for the last modified time value.
@@ -2334,6 +2401,29 @@ cal_component_set_rdate_list (CalComponent *comp, GSList *period_list)
}
/**
+ * cal_component_has_rdates:
+ * @comp: A calendar component object.
+ *
+ * Queries whether a calendar component object has any recurrence dates defined
+ * for it.
+ *
+ * Return value: TRUE if the component has recurrence dates, FALSE otherwise.
+ **/
+gboolean
+cal_component_has_rdates (CalComponent *comp)
+{
+ CalComponentPrivate *priv;
+
+ g_return_val_if_fail (comp != NULL, FALSE);
+ g_return_val_if_fail (IS_CAL_COMPONENT (comp), FALSE);
+
+ priv = comp->priv;
+ g_return_val_if_fail (priv->icalcomp != NULL, FALSE);
+
+ return (priv->rdate_list != NULL);
+}
+
+/**
* cal_component_get_rrule_list:
* @comp: A calendar component object.
* @recur_list: List of recurrence rules as struct #icalrecurrencetype
@@ -2383,6 +2473,29 @@ cal_component_set_rrule_list (CalComponent *comp, GSList *recur_list)
}
/**
+ * cal_component_has_rrules:
+ * @comp: A calendar component object.
+ *
+ * Queries whether a calendar component object has any recurrence rules defined
+ * for it.
+ *
+ * Return value: TRUE if the component has recurrence rules, FALSE otherwise.
+ **/
+gboolean
+cal_component_has_rrules (CalComponent *comp)
+{
+ CalComponentPrivate *priv;
+
+ g_return_val_if_fail (comp != NULL, FALSE);
+ g_return_val_if_fail (IS_CAL_COMPONENT (comp), FALSE);
+
+ priv = comp->priv;
+ g_return_val_if_fail (priv->icalcomp != NULL, FALSE);
+
+ return (priv->rrule_list != NULL);
+}
+
+/**
* cal_component_get_sequence:
* @comp: A calendar component object.
* @sequence: Return value for the sequence number. This should be freed using
@@ -2749,6 +2862,21 @@ cal_component_free_exdate_list (GSList *exdate_list)
}
/**
+ * cal_component_free_geo:
+ * @geo: An #icalgeotype structure.
+ *
+ * Frees a struct #icalgeotype structure as returned by the calendar component
+ * functions.
+ **/
+void
+cal_component_free_geo (struct icalgeotype *geo)
+{
+ g_return_if_fail (geo != NULL);
+
+ g_free (geo);
+}
+
+/**
* cal_component_free_icaltimetype:
* @t: An #icaltimetype structure.
*
@@ -2956,6 +3084,36 @@ cal_component_get_first_alarm (CalComponent *comp)
}
/**
+ * cal_component_get_next_alarm:
+ * @comp: A calendar component object.
+ *
+ * Gets the next alarm on a calendar component object. This should be used as
+ * an iterator function after calling cal_component_get_first_alarm().
+ *
+ * Return value: The next alarm in the component, or NULL if the component has
+ * no more alarms. This should be freed using the cal_component_alarm_free()
+ * function.
+ **/
+CalComponentAlarm *
+cal_component_get_next_alarm (CalComponent *comp)
+{
+ CalComponentPrivate *priv;
+ icalcomponent *subcomp;
+
+ g_return_val_if_fail (comp != NULL, NULL);
+ g_return_val_if_fail (IS_CAL_COMPONENT (comp), NULL);
+
+ priv = comp->priv;
+ g_return_val_if_fail (priv->icalcomp != NULL, NULL);
+
+ subcomp = icalcomponent_get_next_component (priv->icalcomp, ICAL_VALARM_COMPONENT);
+ if (!subcomp)
+ return NULL;
+
+ return make_alarm (comp, subcomp);
+}
+
+/**
* cal_component_alarm_free:
* @alarm: A calendar alarm.
*
diff --git a/calendar/cal-util/cal-component.h b/calendar/cal-util/cal-component.h
index faecd6621f..d547924b31 100644
--- a/calendar/cal-util/cal-component.h
+++ b/calendar/cal-util/cal-component.h
@@ -53,13 +53,13 @@ typedef enum {
/* Field identifiers for a calendar component */
typedef enum {
- CAL_COMPONENT_FIELD_CATEGORIES,
+ CAL_COMPONENT_FIELD_CATEGORIES, /* concatenation of the categories list */
CAL_COMPONENT_FIELD_CLASSIFICATION,
CAL_COMPONENT_FIELD_COMPLETED,
- CAL_COMPONENT_FIELD_CREATED,
CAL_COMPONENT_FIELD_DTEND,
CAL_COMPONENT_FIELD_DTSTART,
CAL_COMPONENT_FIELD_DUE,
+ CAL_COMPONENT_FIELD_GEO,
CAL_COMPONENT_FIELD_PERCENT,
CAL_COMPONENT_FIELD_PRIORITY,
CAL_COMPONENT_FIELD_SUMMARY,
@@ -71,7 +71,7 @@ typedef enum {
CAL_COMPONENT_FIELD_RECURRING, /* not a real field */
CAL_COMPONENT_FIELD_OVERDUE, /* not a real field */
CAL_COMPONENT_FIELD_COLOR, /* not a real field */
- CAL_COMPONETN_FIELD_NUM_FIELDS
+ CAL_COMPONENT_FIELD_NUM_FIELDS
} CalComponentField;
/* Structures to return properties and their parameters */
@@ -201,6 +201,9 @@ void cal_component_set_exdate_list (CalComponent *comp, GSList *exdate_list);
void cal_component_get_exrule_list (CalComponent *comp, GSList **recur_list);
void cal_component_set_exrule_list (CalComponent *comp, GSList *recur_list);
+void cal_component_get_geo (CalComponent *comp, struct icalgeotype **geo);
+void cal_component_set_geo (CalComponent *comp, struct icalgeotype *geo);
+
void cal_component_get_last_modified (CalComponent *comp, struct icaltimetype **t);
void cal_component_set_last_modified (CalComponent *comp, struct icaltimetype *t);
@@ -212,9 +215,11 @@ void cal_component_set_priority (CalComponent *comp, int *priority);
void cal_component_get_rdate_list (CalComponent *comp, GSList **period_list);
void cal_component_set_rdate_list (CalComponent *comp, GSList *period_list);
+gboolean cal_component_has_rdates (CalComponent *comp);
void cal_component_get_rrule_list (CalComponent *comp, GSList **recur_list);
void cal_component_set_rrule_list (CalComponent *comp, GSList *recur_list);
+gboolean cal_component_has_rrules (CalComponent *comp);
void cal_component_get_sequence (CalComponent *comp, int **sequence);
void cal_component_set_sequence (CalComponent *comp, int *sequence);
@@ -233,6 +238,7 @@ void cal_component_set_url (CalComponent *comp, const char *url);
void cal_component_free_categories_list (GSList *categ_list);
void cal_component_free_datetime (CalComponentDateTime *dt);
void cal_component_free_exdate_list (GSList *exdate_list);
+void cal_component_free_geo (struct icalgeotype *geo);
void cal_component_free_icaltimetype (struct icaltimetype *t);
void cal_component_free_percent (int *percent);
void cal_component_free_priority (int *priority);
diff --git a/calendar/gui/calendar-model.c b/calendar/gui/calendar-model.c
index beb1c5f78e..8988748929 100644
--- a/calendar/gui/calendar-model.c
+++ b/calendar/gui/calendar-model.c
@@ -237,7 +237,7 @@ calendar_model_destroy (GtkObject *object)
static int
calendar_model_column_count (ETableModel *etm)
{
- return ICAL_OBJECT_FIELD_NUM_FIELDS;
+ return CAL_COMPONENT_FIELD_NUM_FIELDS;
}
/* row_count handler for the calendar table model */
@@ -274,20 +274,309 @@ get_time_t (time_t *t, gboolean skip_midnight)
return buffer;
}
+/* Builds a string based on the list of CATEGORIES properties of a calendar
+ * component.
+ */
+static char *
+get_categories (CalComponent *comp)
+{
+ GSList *categories;
+ GString *str;
+ char *s;
+ GSList *l;
+
+ cal_component_get_categories_list (comp, &categories);
+
+ str = g_string_new (NULL);
+
+ for (l = categories; l; l = l->next) {
+ const char *category;
+
+ category = l->data;
+ g_string_append (str, category);
+
+ if (l->next != NULL)
+ g_string_append (str, ", ");
+ }
+
+ s = str->str;
+
+ g_string_free (s, FALSE);
+ cal_component_free_categories_list (categories);
+
+ return s;
+}
+
+/* Returns a string based on the CLASSIFICATION property of a calendar component */
+static char *
+get_classification (CalComponent *comp)
+{
+ CalComponentClassification classif;
+
+ cal_component_get_classification (comp, &classif);
+
+ switch (classif) {
+ case CAL_COMPONENT_CLASS_NONE:
+ return "";
+
+ case CAL_COMPONENT_CLASS_PUBLIC:
+ return _("Public");
+
+ case CAL_COMPONENT_CLASS_PRIVATE:
+ return _("Private");
+
+ case CAL_COMPONENT_CLASS_CONFIDENTIAL:
+ return _("Confidential");
+
+ case CAL_COMPONENT_CLASS_UNKNOWN:
+ return _("Unknown");
+
+ default:
+ g_assert_not_reached ();
+ return NULL;
+ }
+}
+
+/* Builds a string for the COMPLETED property of a calendar component */
+static char *
+get_completed (CalComponent *comp)
+{
+ struct icaltimetype *completed;
+ time_t t;
+
+ cal_component_get_completed (comp, &completed);
+
+ if (!completed)
+ t = 0;
+ else {
+ t = time_from_icaltimetype (*completed);
+ cal_component_free_icaltimetype (completed);
+ }
+
+ return get_time_t (&t, FALSE);
+}
+
+/* Builds a string for and frees a date/time value */
+static char *
+get_and_free_datetime (CalComponentDateTime dt)
+{
+ time_t t;
+
+ if (!dt.value)
+ t = 0;
+ else
+ t = time_from_icaltimetype (*t.value);
+
+ cal_component_free_datetime (comp, &dt);
+
+ return get_time_t (&t, FALSE);
+}
+
+/* Builds a string for the DTEND property of a calendar component */
+static char *
+get_dtend (CalComponent *comp)
+{
+ CalComponentDateTime dt;
+
+ cal_component_get_dtend (comp, &dt);
+ return get_and_free_datetime (dt);
+}
+
+/* Builds a string for the DTSTART property of a calendar component */
+static char *
+get_dtstart (CalComponent *comp)
+{
+ CalComponentDateTime dt;
+
+ cal_component_get_dtstart (comp, &dt);
+ return get_and_free_datetime (dt);
+}
+
+/* Builds a string for the DUE property of a calendar component */
+static char *
+get_due (CalComponent *comp)
+{
+ CalComponentDateTime dt;
+
+ cal_component_get_due (comp, &dt);
+ return get_and_free_datetime (dt);
+}
+
+/* Builds a string for the PERCENT property of a calendar component */
static char*
-get_geo (iCalGeo *geo)
+get_geo (CalComponent *comp)
{
- static gchar buffer[32];
+ struct icalgeotype *geo;
+ static gchar buf[32];
+
+ cal_component_get_geo (comp, &geo);
+
+ if (!geo)
+ buf[0] = '\0';
+ else {
+ g_snprintf (buf, sizeof (buf), "%g %s, %g %s",
+ fabs (geo->lat),
+ geo->lat >= 0.0 ? _("N") : _("S"),
+ fabs (geo->lon),
+ geo->lon >= 0.0 ? _("E") : _("W"));
+ cal_component_free_geo (geo);
+ }
- if (!geo->valid)
- buffer[0] = '\0';
+ return buf;
+}
+
+/* Builds a string for the PERCENT property of a calendar component */
+static char *
+get_percent (CalComponent *comp)
+{
+ int *percent;
+ static char buf[32];
+
+ cal_component_get_percent (comp, &percent);
+
+ if (!percent)
+ buf[0] = '\0';
+ else {
+ g_snprintf (buf, sizeof (buf), "%d%%", *percent);
+ cal_component_free_percent (percent);
+ }
+
+ return buf;
+}
+
+/* Builds a string for the PRIORITY property of a calendar component */
+static char *
+get_priority (CalComponent *comp)
+{
+ int *priority;
+ static char buf[32];
+
+ cal_component_get_priority (comp, &priority);
+
+ if (!priority)
+ buf[0] = '\0';
+ else {
+ g_snprintf (buf, sizeof (buf), "%d", *priority);
+ cal_component_free_priority (priority);
+ }
+
+ return buf;
+}
+
+/* Builds a string for the SUMMARY property of a calendar component */
+static char *
+get_summary (CalComponent *comp)
+{
+ CalComponentSummary summary;
+
+ cal_component_get_summary (comp, &summary);
+
+ if (summary.value)
+ return (char *) summary.value;
else
- g_snprintf (buffer, 32, "%g, %g", geo->latitude,
- geo->longitude);
+ return "";
+}
- return buffer;
+/* Builds a string for the TRANSPARENCY property of a calendar component */
+static char *
+get_transparency (CalComponent *comp)
+{
+ CalComponentTransparency transp;
+
+ cal_component_get_transparency (comp, &transp);
+
+ switch (transp) {
+ case CAL_COMPONENT_TRANSP_NONE:
+ return "";
+
+ case CAL_COMPONENT_TRANSP_TRANSPARENT:
+ return _("Transparent");
+
+ case CAL_COMPONENT_TRANSP_OPAQUE:
+ return _("Opaque");
+
+ case CAL_COMPONENT_TRANSP_UNKNOWN:
+ return _("Unknown");
+
+ default:
+ g_assert_not_reached ();
+ return NULL;
+ }
}
+/* Builds a string for the URL property of a calendar component */
+static char *
+get_url (CalComponent *comp)
+{
+ const char *url;
+
+ cal_component_get_url (comp, &url);
+
+ if (url)
+ return (char *) url;
+ else
+ return "";
+}
+
+/* Returns whether the component has any alarms defined for it */
+static gboolean
+get_has_alarms (CalComponent *comp)
+{
+ CalComponentAlarm *alarm;
+ gboolean retval;
+
+ alarm = cal_component_get_first_alarm (comp);
+ retval = (alarm != NULL);
+
+ cal_component_alarm_free (alarm);
+ return retval;
+}
+
+/* Returns whether the component has any recurrences defined for it */
+static gboolean
+get_has_recurrences (CalComponent *comp)
+{
+ return cal_component_has_rdates (comp) || cal_component_has_rrules (comp);
+}
+
+/* Returns whether the completion date has been set on a component */
+static gboolean
+get_is_complete (CalComponent *comp)
+{
+ struct icaltimetype *t;
+ gboolean retval;
+
+ cal_component_get_completed (comp, &t);
+ retval = (t != NULL);
+
+ cal_component_free_icaltimetype (t);
+ return retval;
+}
+
+/* Returns whether a calendar component is overdue.
+ *
+ * FIXME: This will only get called when the component is scrolled into the
+ * ETable. There should be some sort of dynamic update thingy for if a component
+ * becomes overdue while it is being viewed.
+ */
+static gboolean
+get_is_overdue (CalComponent *comp)
+{
+ CalComponentDateTime dt;
+ gboolean retval;
+
+ cal_component_get_due (comp, &dt);
+
+ if (!dt.value)
+ retval = FALSE;
+ else {
+
+ }
+
+ cal_component_free_datetime (&dt);
+
+ return retval;
+}
/* value_at handler for the calendar table model */
static void *
@@ -301,86 +590,68 @@ calendar_model_value_at (ETableModel *etm, int col, int row)
model = CALENDAR_MODEL (etm);
priv = model->priv;
- g_return_val_if_fail (col >= 0 && col < ICAL_OBJECT_FIELD_NUM_FIELDS, NULL);
+ g_return_val_if_fail (col >= 0 && col < CAL_COMPONENT_FIELD_NUM_FIELDS, NULL);
g_return_val_if_fail (row >= 0 && row < priv->objects->len, NULL);
comp = g_array_index (priv->objects, CalComponent *, row);
g_assert (comp != NULL);
switch (col) {
- case ICAL_OBJECT_FIELD_COMMENT:
- return ico->comment ? ico->comment : "";
+ case CAL_COMPONENT_FIELD_CATEGORIES:
+ return get_categories (comp);
- case ICAL_OBJECT_FIELD_COMPLETED:
- return get_time_t (&ico->completed, FALSE);
+ case CAL_COMPONENT_FIELD_CLASSIFICATION:
+ return get_classification (comp);
- case ICAL_OBJECT_FIELD_CREATED:
- return get_time_t (&ico->created, FALSE);
+ case CAL_COMPONENT_FIELD_COMPLETED:
+ return get_completed (comp);
- case ICAL_OBJECT_FIELD_DESCRIPTION:
- return ico->desc ? ico->desc : "";
+ case CAL_COMPONENT_FIELD_DTEND:
+ return get_dtend (comp);
- case ICAL_OBJECT_FIELD_DTSTAMP:
- return get_time_t (&ico->dtstamp, FALSE);
+ case CAL_COMPONENT_FIELD_DTSTART:
+ return get_dtstart (comp);
- case ICAL_OBJECT_FIELD_DTSTART:
- return get_time_t (&ico->dtstart, FALSE);
+ case CAL_COMPONENT_FIELD_DUE:
+ return get_due (comp);
- case ICAL_OBJECT_FIELD_DTEND:
- return get_time_t (&ico->dtend, FALSE);
+ case CAL_COMPONENT_FIELD_GEO:
+ return get_geo (comp);
- case ICAL_OBJECT_FIELD_GEO:
- return get_geo (&ico->geo);
+ case CAL_COMPONENT_FIELD_PERCENT:
+ return get_percent (comp);
- case ICAL_OBJECT_FIELD_LAST_MOD:
- return get_time_t (&ico->last_mod, FALSE);
+ case CAL_COMPONENT_FIELD_PRIORITY:
+ return get_priority (comp);
- case ICAL_OBJECT_FIELD_LOCATION:
- return ico->location ? ico->location : "";
+ case CAL_COMPONENT_FIELD_SUMMARY:
+ return get_summary (comp);
- case ICAL_OBJECT_FIELD_ORGANIZER:
- if (ico->organizer && ico->organizer->name)
- return ico->organizer->name;
- else
- return "";
+ case CAL_COMPONENT_FIELD_TRANSPARENCY:
+ return get_transparency (comp);
- case ICAL_OBJECT_FIELD_PERCENT:
- g_snprintf (buffer, 16, "%i", ico->percent);
- return buffer;
-
- case ICAL_OBJECT_FIELD_PRIORITY:
- g_snprintf (buffer, 16, "%i", ico->priority);
- return buffer;
-
- case ICAL_OBJECT_FIELD_SUMMARY:
- return ico->summary ? ico->summary : "";
+ case CAL_COMPONENT_FIELD_URL:
+ return get_url (comp);
- case ICAL_OBJECT_FIELD_URL:
- return ico->url ? ico->url : "";
-
- case ICAL_OBJECT_FIELD_HAS_ALARMS:
- return (gpointer) (ico->dalarm.enabled || ico->aalarm.enabled
- || ico->palarm.enabled || ico->malarm.enabled);
+ case CAL_COMPONENT_FIELD_HAS_ALARMS:
+ return GINT_TO_POINTER (get_has_alarms (comp));
- case ICAL_OBJECT_FIELD_ICON:
+ case CAL_COMPONENT_FIELD_ICON:
/* FIXME: Also support 'Assigned to me' & 'Assigned to someone
else'. */
- if (ico->recur)
+ if (get_has_recurrences (comp))
return GINT_TO_POINTER (1);
else
return GINT_TO_POINTER (0);
- case ICAL_OBJECT_FIELD_COMPLETE:
- /* FIXME: Should check if the Completed field is set? */
- return GINT_TO_POINTER (ico->completed > 0);
+ case CAL_COMPONENT_FIELD_COMPLETE:
+ return GINT_TO_POINTER (get_is_complete (comp));
- case ICAL_OBJECT_FIELD_RECURRING:
- return GINT_TO_POINTER (ico->recur != NULL);
+ case CAL_COMPONENT_FIELD_RECURRING:
+ return GINT_TO_POINTER (get_has_recurrences (comp));
- case ICAL_OBJECT_FIELD_OVERDUE:
- /* I don't think calling time() is too slow. It takes about
- 4 times as long as calling strlen() on a 20-char string
- on my machine. */
+ case CAL_COMPONENT_FIELD_OVERDUE:
+ return GINT_TO_POINTER (get_is_overdue (comp));
if (ico->percent != 100
&& ico->dtend > 0
&& ico->dtend < time (NULL))
@@ -653,10 +924,6 @@ calendar_model_set_value_at (ETableModel *etm, int col, int row, const void *val
set_time_t (&ico->completed, value);
break;
- case ICAL_OBJECT_FIELD_CREATED:
- set_time_t (&ico->created, value);
- break;
-
case ICAL_OBJECT_FIELD_DESCRIPTION:
set_string (&ico->desc, value);
break;
@@ -751,7 +1018,6 @@ calendar_model_is_cell_editable (ETableModel *etm, int col, int row)
/*g_return_val_if_fail (row >= 0 && row < priv->objects->len, FALSE);*/
switch (col) {
- case ICAL_OBJECT_FIELD_CREATED:
case ICAL_OBJECT_FIELD_DTSTAMP:
case ICAL_OBJECT_FIELD_LAST_MOD:
case ICAL_OBJECT_FIELD_GEO:
@@ -884,9 +1150,6 @@ calendar_model_duplicate_value (ETableModel *etm, int col, const void *value)
case ICAL_OBJECT_FIELD_COMPLETED:
return dup_time_t (value);
- case ICAL_OBJECT_FIELD_CREATED:
- return dup_time_t (value);
-
case ICAL_OBJECT_FIELD_DESCRIPTION:
return dup_string (value);
@@ -1036,9 +1299,6 @@ calendar_model_initialize_value (ETableModel *etm, int col)
case ICAL_OBJECT_FIELD_COMPLETED:
return init_time_t ();
- case ICAL_OBJECT_FIELD_CREATED:
- return init_time_t ();
-
case ICAL_OBJECT_FIELD_DESCRIPTION:
return init_string ();
@@ -1138,9 +1398,6 @@ calendar_model_value_is_empty (ETableModel *etm, int col, const void *value)
case ICAL_OBJECT_FIELD_COMPLETED:
return time_t_is_empty (value);
- case ICAL_OBJECT_FIELD_CREATED:
- return time_t_is_empty (value);
-
case ICAL_OBJECT_FIELD_DESCRIPTION:
return string_is_empty (value);