aboutsummaryrefslogtreecommitdiffstats
path: root/calendar/gui/comp-util.c
diff options
context:
space:
mode:
authorMilan Crha <mcrha@redhat.com>2009-07-30 17:22:59 +0800
committerMatthew Barnes <mbarnes@redhat.com>2009-08-11 04:31:35 +0800
commitaa8a700dd924a83e1dcd8eb374df777fb0a83b66 (patch)
treea6571a43052aafb50ddc927c3c7d03b092d4fabd /calendar/gui/comp-util.c
parent7eee013e97aa3d1d28112f5b25744035941ec23c (diff)
downloadgsoc2013-evolution-aa8a700dd924a83e1dcd8eb374df777fb0a83b66.tar
gsoc2013-evolution-aa8a700dd924a83e1dcd8eb374df777fb0a83b66.tar.gz
gsoc2013-evolution-aa8a700dd924a83e1dcd8eb374df777fb0a83b66.tar.bz2
gsoc2013-evolution-aa8a700dd924a83e1dcd8eb374df777fb0a83b66.tar.lz
gsoc2013-evolution-aa8a700dd924a83e1dcd8eb374df777fb0a83b66.tar.xz
gsoc2013-evolution-aa8a700dd924a83e1dcd8eb374df777fb0a83b66.tar.zst
gsoc2013-evolution-aa8a700dd924a83e1dcd8eb374df777fb0a83b66.zip
Bug #300567 - Calendar drawing optimizations
Diffstat (limited to 'calendar/gui/comp-util.c')
-rw-r--r--calendar/gui/comp-util.c26
1 files changed, 17 insertions, 9 deletions
diff --git a/calendar/gui/comp-util.c b/calendar/gui/comp-util.c
index 30af43fd6d..a745b61e12 100644
--- a/calendar/gui/comp-util.c
+++ b/calendar/gui/comp-util.c
@@ -428,13 +428,16 @@ cal_comp_memo_new_with_defaults (ECal *client)
/**
* cal_comp_util_get_n_icons:
* @comp: A calendar component object.
+ * @pixbufs: List of pixbufs to use. Can be NULL.
*
* Get the number of icons owned by the component.
+ * Each member of pixmaps should be freed with g_object_unref
+ * and the list itself should be freed too.
*
* Returns: the number of icons owned by the component.
**/
gint
-cal_comp_util_get_n_icons (ECalComponent *comp)
+cal_comp_util_get_n_icons (ECalComponent *comp, GSList **pixbufs)
{
GSList *categories_list, *elem;
gint num_icons = 0;
@@ -444,16 +447,21 @@ cal_comp_util_get_n_icons (ECalComponent *comp)
e_cal_component_get_categories_list (comp, &categories_list);
for (elem = categories_list; elem; elem = elem->next) {
- gchar *category;
- GdkPixmap *pixmap = NULL;
- GdkBitmap *mask = NULL;
+ const gchar *category;
+ GdkPixbuf *pixbuf = NULL;
+
+ category = elem->data;
+ if (e_categories_config_get_icon_for (category, &pixbuf)) {
+ if (!pixbuf)
+ continue;
- category = (gchar *) elem->data;
- if (e_categories_config_get_icon_for (category, &pixmap, &mask)) {
num_icons++;
- g_object_unref (pixmap);
- if (mask)
- g_object_unref (mask);
+
+ if (pixbufs) {
+ *pixbufs = g_slist_append (*pixbufs, pixbuf);
+ } else {
+ g_object_unref (pixbuf);
+ }
}
}
e_cal_component_free_categories_list (categories_list);