aboutsummaryrefslogtreecommitdiffstats
path: root/calendar/gui/e-cal-model.c
diff options
context:
space:
mode:
authorChenthill Palanisamy <pchen@src.gnome.org>2005-10-03 14:16:51 +0800
committerChenthill Palanisamy <pchen@src.gnome.org>2005-10-03 14:16:51 +0800
commit7a102381acf224110cfe32fcc0905a103268abde (patch)
tree3797369272088bdacc8706e1abff2eca92e1bdfe /calendar/gui/e-cal-model.c
parent263e728c125f4312867084d9b85b41caabec6a4f (diff)
downloadgsoc2013-evolution-7a102381acf224110cfe32fcc0905a103268abde.tar.gz
gsoc2013-evolution-7a102381acf224110cfe32fcc0905a103268abde.tar.zst
gsoc2013-evolution-7a102381acf224110cfe32fcc0905a103268abde.zip
fixes #264449.
svn path=/trunk/; revision=30467
Diffstat (limited to 'calendar/gui/e-cal-model.c')
-rw-r--r--calendar/gui/e-cal-model.c58
1 files changed, 28 insertions, 30 deletions
diff --git a/calendar/gui/e-cal-model.c b/calendar/gui/e-cal-model.c
index 792b8b2893..d20793f9ae 100644
--- a/calendar/gui/e-cal-model.c
+++ b/calendar/gui/e-cal-model.c
@@ -1259,7 +1259,7 @@ search_by_uid_and_client (ECalModelPrivate *priv, ECal *client, const char *uid)
tmp_uid = icalcomponent_get_uid (comp_data->icalcomp);
if (tmp_uid && *tmp_uid) {
- if (comp_data->client == client && !strcmp (uid, tmp_uid))
+ if ((!client || comp_data->client == client) && !strcmp (uid, tmp_uid))
return comp_data;
}
}
@@ -1268,19 +1268,6 @@ search_by_uid_and_client (ECalModelPrivate *priv, ECal *client, const char *uid)
return NULL;
}
-static gint
-get_position_in_array (GPtrArray *objects, gpointer item)
-{
- gint i;
-
- for (i = 0; i < objects->len; i++) {
- if (g_ptr_array_index (objects, i) == item)
- return i;
- }
-
- return -1;
-}
-
typedef struct {
ECal *client;
ECalView *query;
@@ -1313,21 +1300,6 @@ add_instance_cb (ECalComponent *comp, time_t instance_start, time_t instance_end
return TRUE;
}
-static void
-set_instance_times (ECalModelComponent *comp_data, icaltimezone *zone)
-{
- struct icaltimetype recur_time, start_time, end_time;
-
- recur_time = icalcomponent_get_recurrenceid (comp_data->icalcomp);
- start_time = icalcomponent_get_dtstart (comp_data->icalcomp);
- end_time = icalcomponent_get_dtend (comp_data->icalcomp);
-
- comp_data->instance_start = icaltime_as_timet (start_time);
-
- comp_data->instance_end = comp_data->instance_start +
- (icaltime_as_timet (end_time) - icaltime_as_timet (start_time));
-}
-
/* We do this check since the calendar items are downloaded from the server in the open_method,
since the default timezone might not be set there */
static void
@@ -1395,7 +1367,7 @@ e_cal_view_objects_added_cb (ECalView *query, GList *objects, gpointer user_data
comp_data = g_new0 (ECalModelComponent, 1);
comp_data->client = g_object_ref (e_cal_view_get_client (query));
comp_data->icalcomp = icalcomponent_new_clone (l->data);
- set_instance_times (comp_data, priv->zone);
+ e_cal_model_set_instance_times (comp_data, priv->zone);
comp_data->dtstart = comp_data->dtend = comp_data->due = comp_data->completed = NULL;
comp_data->color = NULL;
@@ -2095,3 +2067,29 @@ e_cal_model_generate_instances (ECalModel *model, time_t start, time_t end,
e_cal_generate_instances_for_object (comp_data->client, comp_data->icalcomp, start, end, cb, &mdata);
}
}
+
+/**
+ * e_cal_model_get_object_array
+ */
+GPtrArray *
+e_cal_model_get_object_array (ECalModel *model)
+{
+ g_return_val_if_fail (E_IS_CAL_MODEL (model), NULL);
+
+ return model->priv->objects;
+}
+
+void
+e_cal_model_set_instance_times (ECalModelComponent *comp_data, icaltimezone *zone)
+{
+ struct icaltimetype recur_time, start_time, end_time;
+
+ recur_time = icalcomponent_get_recurrenceid (comp_data->icalcomp);
+ start_time = icalcomponent_get_dtstart (comp_data->icalcomp);
+ end_time = icalcomponent_get_dtend (comp_data->icalcomp);
+
+ comp_data->instance_start = icaltime_as_timet (start_time);
+
+ comp_data->instance_end = comp_data->instance_start +
+ (icaltime_as_timet (end_time) - icaltime_as_timet (start_time));
+}