diff options
author | Larry Ewing <lewing@ximian.com> | 2004-04-30 05:21:56 +0800 |
---|---|---|
committer | Larry Ewing <lewing@src.gnome.org> | 2004-04-30 05:21:56 +0800 |
commit | fa17f1b6958bf180b23952975bc35096b4ae425c (patch) | |
tree | ed48a747b2ad3185ae1bc15be3d31159939e7f20 /calendar/gui | |
parent | c985f6888bc820df4fcb8defb78b28cc7e65db0c (diff) | |
download | gsoc2013-evolution-fa17f1b6958bf180b23952975bc35096b4ae425c.tar gsoc2013-evolution-fa17f1b6958bf180b23952975bc35096b4ae425c.tar.gz gsoc2013-evolution-fa17f1b6958bf180b23952975bc35096b4ae425c.tar.bz2 gsoc2013-evolution-fa17f1b6958bf180b23952975bc35096b4ae425c.tar.lz gsoc2013-evolution-fa17f1b6958bf180b23952975bc35096b4ae425c.tar.xz gsoc2013-evolution-fa17f1b6958bf180b23952975bc35096b4ae425c.tar.zst gsoc2013-evolution-fa17f1b6958bf180b23952975bc35096b4ae425c.zip |
use the source color if it is set. Yay for ugly colors.
2004-04-29 Larry Ewing <lewing@ximian.com>
* gui/e-cal-model.c (ecm_get_color_for_component): use the source
color if it is set. Yay for ugly colors.
* gui/e-cal-model.h: add a color holder to the ECalModelComponent
since the return value of the color stuff is const.
svn path=/trunk/; revision=25696
Diffstat (limited to 'calendar/gui')
-rw-r--r-- | calendar/gui/e-cal-model.c | 24 | ||||
-rw-r--r-- | calendar/gui/e-cal-model.h | 1 |
2 files changed, 23 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); } diff --git a/calendar/gui/e-cal-model.h b/calendar/gui/e-cal-model.h index 8437e4d1c5..aef2e3d539 100644 --- a/calendar/gui/e-cal-model.h +++ b/calendar/gui/e-cal-model.h @@ -61,6 +61,7 @@ typedef struct { ECellDateEditValue *dtend; ECellDateEditValue *due; ECellDateEditValue *completed; + gchar *color; } ECalModelComponent; typedef struct { |