diff options
author | Hiroyuki Ikezoe <poincare@ikezoe.net> | 2007-10-07 09:26:26 +0800 |
---|---|---|
committer | Hiroyuki Ikezoe <hiikezoe@src.gnome.org> | 2007-10-07 09:26:26 +0800 |
commit | f1b6fa21b9bfb030ad838f36abf2107ae190036c (patch) | |
tree | 8f0f95bdf136865d444cbad7fdf799ab228fe159 /calendar/gui/comp-util.c | |
parent | e093117ef673e80c54e603ee0ed1dbd487a4bcb6 (diff) | |
download | gsoc2013-evolution-f1b6fa21b9bfb030ad838f36abf2107ae190036c.tar.gz gsoc2013-evolution-f1b6fa21b9bfb030ad838f36abf2107ae190036c.tar.zst gsoc2013-evolution-f1b6fa21b9bfb030ad838f36abf2107ae190036c.zip |
** Fix for bug #455862 Plugged memory leaks.
2007-10-07 Hiroyuki Ikezoe <poincare@ikezoe.net>
** Fix for bug #455862
Plugged memory leaks.
* gui/comp-util.c:
* gui/comp-util.h:(cal_comp_util_get_n_icons): A new function to
get the number of icons owned by ECalComponent.
* gui/e-day-view-main-item.c:
* gui/e-day-view.c:
* gui/e-week-view-event-item.c:
* gui/e-week-view.c: Use cal_comp_util_get_n_icons.
svn path=/trunk/; revision=34359
Diffstat (limited to 'calendar/gui/comp-util.c')
-rw-r--r-- | calendar/gui/comp-util.c | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/calendar/gui/comp-util.c b/calendar/gui/comp-util.c index 61f2260949..6919302b73 100644 --- a/calendar/gui/comp-util.c +++ b/calendar/gui/comp-util.c @@ -28,6 +28,8 @@ #include "calendar-config.h" #include "comp-util.h" #include "dialogs/delete-comp.h" +#include <libecal/e-cal-component.h> +#include "e-util/e-categories-config.h" @@ -394,3 +396,39 @@ cal_comp_memo_new_with_defaults (ECal *client) return comp; } + +/** + * cal_comp_util_get_n_icons: + * @comp: A calendar component object. + * + * Get the number of icons owned by the component. + * + * Returns: the number of icons owned by the component. + **/ +gint +cal_comp_util_get_n_icons (ECalComponent *comp) +{ + GSList *categories_list, *elem; + gint num_icons = 0; + + g_return_val_if_fail (comp != NULL, 0); + g_return_val_if_fail (E_IS_CAL_COMPONENT (comp), 0); + + e_cal_component_get_categories_list (comp, &categories_list); + for (elem = categories_list; elem; elem = elem->next) { + char *category; + GdkPixmap *pixmap = NULL; + GdkBitmap *mask = NULL; + + category = (char *) elem->data; + if (e_categories_config_get_icon_for (category, &pixmap, &mask)) { + num_icons++; + g_object_unref (pixmap); + if (mask) + g_object_unref (mask); + } + } + e_cal_component_free_categories_list (categories_list); + + return num_icons; +} |