aboutsummaryrefslogtreecommitdiffstats
path: root/calendar/gui/e-cal-model.c
diff options
context:
space:
mode:
Diffstat (limited to 'calendar/gui/e-cal-model.c')
-rw-r--r--calendar/gui/e-cal-model.c24
1 files changed, 22 insertions, 2 deletions
diff --git a/calendar/gui/e-cal-model.c b/calendar/gui/e-cal-model.c
index 3d3d8b3c3a..25a866db3a 100644
--- a/calendar/gui/e-cal-model.c
+++ b/calendar/gui/e-cal-model.c
@@ -191,6 +191,11 @@ free_comp_data (ECalModelComponent *comp_data)
comp_data->completed = NULL;
}
+ if (comp_data->color) {
+ g_free (comp_data->color);
+ comp_data->color = NULL;
+ }
+
g_free (comp_data);
}
@@ -892,6 +897,8 @@ typedef struct {
static const char *
ecm_get_color_for_component (ECalModel *model, ECalModelComponent *comp_data)
{
+ ESource *source;
+ guint32 source_color;
ECalModelPrivate *priv;
gint i, first_empty = 0;
static AssignedColorData assigned_colors[] = {
@@ -910,7 +917,14 @@ ecm_get_color_for_component (ECalModel *model, ECalModelComponent *comp_data)
g_return_val_if_fail (E_IS_CAL_MODEL (model), NULL);
priv = model->priv;
-
+
+ source = e_cal_get_source (comp_data->client);
+ if (e_source_get_color (source, &source_color)) {
+ g_free (comp_data->color);
+ comp_data->color = g_strdup_printf ("#%06x", source_color & 0xffffff);
+ return comp_data->color;
+ }
+
for (i = 0; i < G_N_ELEMENTS (assigned_colors); i++) {
GList *l;
@@ -1236,6 +1250,10 @@ e_cal_view_objects_modified_cb (ECalView *query, GList *objects, gpointer user_d
g_free (comp_data->completed);
comp_data->completed = NULL;
}
+ if (comp_data->color) {
+ g_free (comp_data->color);
+ comp_data->color = NULL;
+ }
comp_data->icalcomp = icalcomponent_new_clone (l->data);
@@ -1776,7 +1794,7 @@ copy_ecdv (ECellDateEditValue *ecdv)
}
/**
- * e_cal_model_free_component_data
+ * e_cal_model_copy_component_data
*/
ECalModelComponent *
e_cal_model_copy_component_data (ECalModelComponent *comp_data)
@@ -1823,6 +1841,8 @@ e_cal_model_free_component_data (ECalModelComponent *comp_data)
g_free (comp_data->due);
if (comp_data->completed)
g_free (comp_data->completed);
+ if (comp_data->color)
+ g_free (comp_data->color);
g_free (comp_data);
}