aboutsummaryrefslogtreecommitdiffstats
path: root/calendar/gui/e-cal-model.c
diff options
context:
space:
mode:
authorRadek Doulik <rodo@ximian.com>2004-01-18 07:34:46 +0800
committerRadek Doulik <rodo@src.gnome.org>2004-01-18 07:34:46 +0800
commitae353b456cb569f4beb3e16ae2cf059d9a001c23 (patch)
tree3f1a3bd4e80a3b6646bdb8ee255aa0b74de42a9b /calendar/gui/e-cal-model.c
parent17b434b57f2020a9c7bf0e459a5377e1fdef8ee4 (diff)
downloadgsoc2013-evolution-ae353b456cb569f4beb3e16ae2cf059d9a001c23.tar.gz
gsoc2013-evolution-ae353b456cb569f4beb3e16ae2cf059d9a001c23.tar.zst
gsoc2013-evolution-ae353b456cb569f4beb3e16ae2cf059d9a001c23.zip
month and week view printing works again, day view is next to fix
2004-01-18 Radek Doulik <rodo@ximian.com> * gui/print.c (print_border_with_triangles): use rgb color as fillcolor (print_week_day_event): ditto * gui/e-cal-model.c (e_cal_model_get_rgb_color_for_component): new helper function, gets component color as rgb double values * gui/print.c (print_week_summary_cb): uncommented and updated for e_cal_model_generate_instances (print_week_summary): use e_cal_model_generate_instances (print_border_with_triangles): pass rgb fillcolor (print_border_rgb): new function to print border with rgb color background * gui/e-cal-model.c (e_cal_model_generate_instances): new function, similar to e_cal_generate_instances. see comments to understand how to use cb_data svn path=/trunk/; revision=24292
Diffstat (limited to 'calendar/gui/e-cal-model.c')
-rw-r--r--calendar/gui/e-cal-model.c53
1 files changed, 53 insertions, 0 deletions
diff --git a/calendar/gui/e-cal-model.c b/calendar/gui/e-cal-model.c
index 9ac1104380..cb463deb21 100644
--- a/calendar/gui/e-cal-model.c
+++ b/calendar/gui/e-cal-model.c
@@ -1518,6 +1518,31 @@ e_cal_model_get_color_for_component (ECalModel *model, ECalModelComponent *comp_
}
/**
+ * e_cal_model_get_rgb_color_for_component
+ */
+gboolean
+e_cal_model_get_rgb_color_for_component (ECalModel *model, ECalModelComponent *comp_data, double *red, double *green, double *blue)
+{
+ GdkColor gdk_color;
+ const gchar *color;
+
+ color = e_cal_model_get_color_for_component (model, comp_data);
+ if (color && gdk_color_parse (color, &gdk_color)) {
+
+ if (red)
+ *red = ((double) gdk_color.red)/0xffff;
+ if (green)
+ *green = ((double) gdk_color.green)/0xffff;
+ if (blue)
+ *blue = ((double) gdk_color.blue)/0xffff;
+
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
+/**
* e_cal_model_get_component_at
*/
ECalModelComponent *
@@ -1595,3 +1620,31 @@ e_cal_model_free_component_data (ECalModelComponent *comp_data)
g_free (comp_data);
}
+
+/**
+ * e_cal_model_generate_instances
+ *
+ * cb function is not called with cb_data, but with ECalModelGenerateInstancesData which contains cb_data
+ */
+void
+e_cal_model_generate_instances (ECalModel *model, time_t start, time_t end,
+ ECalRecurInstanceFn cb, gpointer cb_data)
+{
+ ECalModelGenerateInstancesData mdata;
+ gint i, n;
+
+ n = e_table_model_row_count (E_TABLE_MODEL (model));
+ for (i = 0; i < n; i ++) {
+ ECalModelComponent *comp_data = e_cal_model_get_component_at (model, i);
+ ECalComponent *comp = e_cal_component_new ();
+
+ e_cal_component_set_icalcomponent (comp, icalcomponent_new_clone (comp_data->icalcomp));
+ mdata.comp_data = comp_data;
+ mdata.cb_data = cb_data;
+ e_cal_recur_generate_instances (comp, start, end,
+ cb, &mdata,
+ e_cal_resolve_tzid_cb, comp_data->client,
+ e_cal_model_get_timezone (model));
+ g_object_unref (comp);
+ }
+}