[evolution] e-util: Port to thread-safe ECategories API



commit 61b4bacf9a16bf69c26999dd9acac99695d23242
Author: Philip Withnall <philip withnall collabora co uk>
Date:   Fri Mar 28 09:14:23 2014 +0000

    e-util: Port to thread-safe ECategories API
    
    This ports the following two function calls throughout Evolution:
     • e_categories_get_list() to e_categories_dup_list()
     • e_categories_get_icon_file_for() to e_categories_dup_icon_file_for()
    
    It necessarily changes some internal e-util API:
     • e_util_get_searchable_categories() to
       e_util_dup_searchable_categories()
    
    This bumps the EDS requirement to 3.13.1.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=727221

 calendar/gui/e-cal-component-preview.c             |    6 ++-
 calendar/gui/e-day-view-top-item.c                 |    5 ++-
 .../evolution-util/evolution-util-sections.txt     |    2 +-
 e-util/e-categories-config.c                       |    5 ++-
 e-util/e-categories-selector.c                     |    9 +++--
 e-util/e-category-completion.c                     |    9 ++++--
 e-util/e-category-editor.c                         |    5 ++-
 e-util/e-misc-utils.c                              |   31 ++++++++++++-------
 e-util/e-misc-utils.h                              |    2 +-
 e-util/e-name-selector-dialog.c                    |    4 +-
 modules/addressbook/e-book-shell-view-actions.c    |   10 ++++--
 modules/addressbook/e-book-shell-view.c            |    4 +-
 modules/calendar/e-cal-shell-view-actions.c        |   10 ++++--
 modules/calendar/e-cal-shell-view.c                |    4 +-
 modules/calendar/e-memo-shell-view-actions.c       |   10 ++++--
 modules/calendar/e-memo-shell-view.c               |    4 +-
 modules/calendar/e-task-shell-view-actions.c       |   10 ++++--
 modules/calendar/e-task-shell-view.c               |    4 +-
 shell/main.c                                       |    5 ++-
 19 files changed, 82 insertions(+), 57 deletions(-)
---
diff --git a/calendar/gui/e-cal-component-preview.c b/calendar/gui/e-cal-component-preview.c
index cdfaeea..fa1aca0 100644
--- a/calendar/gui/e-cal-component-preview.c
+++ b/calendar/gui/e-cal-component-preview.c
@@ -230,9 +230,9 @@ cal_component_preview_write_html (ECalComponentPreview *preview,
                g_string_append_printf (buffer, "<tr><th>%s</th><td>", _("Categories:"));
        for (iter = list; iter != NULL; iter = iter->next) {
                const gchar *category = iter->data;
-               const gchar *icon_file;
+               gchar *icon_file;
 
-               icon_file = e_categories_get_icon_file_for (category);
+               icon_file = e_categories_dup_icon_file_for (category);
                if (icon_file && g_file_test (icon_file, G_FILE_TEST_EXISTS)) {
                        gchar *uri;
 
@@ -246,6 +246,8 @@ cal_component_preview_write_html (ECalComponentPreview *preview,
                                g_string_append_len (string, ", ", 2);
                        g_string_append (string, category);
                }
+
+               g_free (icon_file);
        }
        if (string->len > 0)
                g_string_append_printf (buffer, "%s", string->str);
diff --git a/calendar/gui/e-day-view-top-item.c b/calendar/gui/e-day-view-top-item.c
index 6e836c6..300170b 100644
--- a/calendar/gui/e-day-view-top-item.c
+++ b/calendar/gui/e-day-view-top-item.c
@@ -452,15 +452,16 @@ day_view_top_item_draw_long_event (EDayViewTopItem *top_item,
        e_cal_component_get_categories_list (comp, &categories_list);
        for (elem = categories_list; elem; elem = elem->next) {
                gchar *category;
-               const gchar *file;
+               gchar *file;
                GdkPixbuf *pixbuf;
 
                category = (gchar *) elem->data;
-               file = e_categories_get_icon_file_for (category);
+               file = e_categories_dup_icon_file_for (category);
                if (!file)
                        continue;
 
                pixbuf = gdk_pixbuf_new_from_file (file, NULL);
+               g_free (file);
                if (pixbuf == NULL)
                        continue;
 
diff --git a/doc/reference/evolution-util/evolution-util-sections.txt 
b/doc/reference/evolution-util/evolution-util-sections.txt
index a4eae51..5f7497c 100644
--- a/doc/reference/evolution-util/evolution-util-sections.txt
+++ b/doc/reference/evolution-util/evolution-util-sections.txt
@@ -2292,7 +2292,7 @@ e_file_lock_destroy
 e_file_lock_exists
 e_util_guess_mime_type
 e_util_get_category_filter_options
-e_util_get_searchable_categories
+e_util_dup_searchable_categories
 e_binding_transform_color_to_string
 e_binding_transform_string_to_color
 e_binding_transform_source_to_uid
diff --git a/e-util/e-categories-config.c b/e-util/e-categories-config.c
index 7f65645..226f653 100644
--- a/e-util/e-categories-config.c
+++ b/e-util/e-categories-config.c
@@ -64,7 +64,7 @@ gboolean
 e_categories_config_get_icon_for (const gchar *category,
                                   GdkPixbuf **pixbuf)
 {
-       const gchar *icon_file;
+       gchar *icon_file;
 
        g_return_val_if_fail (pixbuf != NULL, FALSE);
        g_return_val_if_fail (category != NULL, FALSE);
@@ -84,13 +84,14 @@ e_categories_config_get_icon_for (const gchar *category,
                }
        }
 
-       icon_file = e_categories_get_icon_file_for (category);
+       icon_file = e_categories_dup_icon_file_for (category);
        if (!icon_file) {
                *pixbuf = NULL;
        } else {
                /* load the icon in our list */
                *pixbuf = gdk_pixbuf_new_from_file (icon_file, NULL);
        }
+       g_free (icon_file);
 
        g_hash_table_insert (pixbufs_cache, g_strdup (category), *pixbuf == NULL ? NULL : g_object_ref 
(*pixbuf));
 
diff --git a/e-util/e-categories-selector.c b/e-util/e-categories-selector.c
index 454421c..e014e7d 100644
--- a/e-util/e-categories-selector.c
+++ b/e-util/e-categories-selector.c
@@ -71,10 +71,10 @@ categories_selector_build_model (ECategoriesSelector *selector)
                GTK_TREE_SORTABLE (store),
                COLUMN_CATEGORY, GTK_SORT_ASCENDING);
 
-       list = e_categories_get_list ();
+       list = e_categories_dup_list ();
        for (iter = list; iter != NULL; iter = iter->next) {
                const gchar *category_name = iter->data;
-               const gchar *filename;
+               gchar *filename;
                GdkPixbuf *pixbuf = NULL;
                GtkTreeIter iter;
                gboolean active;
@@ -87,9 +87,10 @@ categories_selector_build_model (ECategoriesSelector *selector)
                                selector->priv->selected_categories,
                                category_name) != NULL);
 
-               filename = e_categories_get_icon_file_for (category_name);
+               filename = e_categories_dup_icon_file_for (category_name);
                if (filename != NULL)
                        pixbuf = gdk_pixbuf_new_from_file (filename, NULL);
+               g_free (filename);
 
                gtk_list_store_append (store, &iter);
 
@@ -111,7 +112,7 @@ categories_selector_build_model (ECategoriesSelector *selector)
        gtk_tree_view_set_search_column (
                GTK_TREE_VIEW (selector), COLUMN_CATEGORY);
 
-       g_list_free (list);
+       g_list_free_full (list, g_free);
        g_object_unref (store);
 }
 
diff --git a/e-util/e-category-completion.c b/e-util/e-category-completion.c
index ac69383..cc8ed89 100644
--- a/e-util/e-category-completion.c
+++ b/e-util/e-category-completion.c
@@ -61,10 +61,10 @@ category_completion_build_model (GtkEntryCompletion *completion)
        store = gtk_list_store_new (
                NUM_COLUMNS, GDK_TYPE_PIXBUF, G_TYPE_STRING, G_TYPE_STRING);
 
-       list = e_categories_get_list ();
+       list = e_categories_dup_list ();
        while (list != NULL) {
                const gchar *category = list->data;
-               const gchar *filename;
+               gchar *filename;
                gchar *normalized;
                gchar *casefolded;
                GdkPixbuf *pixbuf = NULL;
@@ -72,13 +72,15 @@ category_completion_build_model (GtkEntryCompletion *completion)
 
                /* Only add user-visible categories. */
                if (!e_categories_is_searchable (category)) {
+                       g_free (list->data);
                        list = g_list_delete_link (list, list);
                        continue;
                }
 
-               filename = e_categories_get_icon_file_for (category);
+               filename = e_categories_dup_icon_file_for (category);
                if (filename != NULL && *filename != '\0')
                        pixbuf = gdk_pixbuf_new_from_file (filename, NULL);
+               g_free (filename);
 
                normalized = g_utf8_normalize (
                        category, -1, G_NORMALIZE_DEFAULT);
@@ -97,6 +99,7 @@ category_completion_build_model (GtkEntryCompletion *completion)
                if (pixbuf != NULL)
                        g_object_unref (pixbuf);
 
+               g_free (list->data);
                list = g_list_delete_link (list, list);
        }
 
diff --git a/e-util/e-category-editor.c b/e-util/e-category-editor.c
index 7d4223d..708ba5c 100644
--- a/e-util/e-category-editor.c
+++ b/e-util/e-category-editor.c
@@ -304,7 +304,7 @@ e_category_editor_edit_category (ECategoryEditor *editor,
                                  const gchar *category)
 {
        GtkFileChooser *file_chooser;
-       const gchar *icon_file;
+       gchar *icon_file;
 
        g_return_val_if_fail (E_IS_CATEGORY_EDITOR (editor), FALSE);
        g_return_val_if_fail (category != NULL, FALSE);
@@ -314,11 +314,12 @@ e_category_editor_edit_category (ECategoryEditor *editor,
        gtk_entry_set_text (GTK_ENTRY (editor->priv->category_name), category);
        gtk_widget_set_sensitive (editor->priv->category_name, FALSE);
 
-       icon_file = e_categories_get_icon_file_for (category);
+       icon_file = e_categories_dup_icon_file_for (category);
        if (icon_file) {
                gtk_file_chooser_set_filename (file_chooser, icon_file);
                update_preview (file_chooser, NULL);
        }
+       g_free (icon_file);
 
        if (gtk_dialog_run (GTK_DIALOG (editor)) == GTK_RESPONSE_OK) {
                gchar *category_icon;
diff --git a/e-util/e-misc-utils.c b/e-util/e-misc-utils.c
index cf6425f..f47dc19 100644
--- a/e-util/e-misc-utils.c
+++ b/e-util/e-misc-utils.c
@@ -1910,7 +1910,7 @@ e_util_get_category_filter_options (void)
        GSList *res = NULL;
        GList *clist, *l;
 
-       clist = e_categories_get_list ();
+       clist = e_categories_dup_list ();
        for (l = clist; l; l = l->next) {
                const gchar *cname = l->data;
                struct _filter_option *fo;
@@ -1925,33 +1925,40 @@ e_util_get_category_filter_options (void)
                res = g_slist_prepend (res, fo);
        }
 
-       g_list_free (clist);
+       g_list_free_full (clist, g_free);
 
        return g_slist_reverse (res);
 }
 
 /**
- * e_util_get_searchable_categories:
+ * e_util_dup_searchable_categories:
  *
- * Returns list of searchable categories only. The list should
- * be freed with g_list_free() when done with it, but the items
- * are internal strings, names of categories, which should not
- * be touched in other than read-only way, in other words the same
- * restrictions as for e_categories_get_list() applies here too.
- **/
+ * Returns a list of the searchable categories, with each item being a UTF-8
+ * category name. The list should be freed with g_list_free() when done with it,
+ * and the items should be freed with g_free(). Everything can be freed at once
+ * using g_list_free_full().
+ *
+ * Returns: (transfer full) (element-type utf8): a list of searchable category
+ * names; free with g_list_free_full()
+ */
 GList *
-e_util_get_searchable_categories (void)
+e_util_dup_searchable_categories (void)
 {
        GList *res = NULL, *all_categories, *l;
 
-       all_categories = e_categories_get_list ();
+       all_categories = e_categories_dup_list ();
        for (l = all_categories; l; l = l->next) {
-               const gchar *cname = l->data;
+               gchar *cname = l->data;
 
+               /* Steal the string from e_categories_dup_list(). */
                if (e_categories_is_searchable (cname))
                        res = g_list_prepend (res, (gpointer) cname);
+               else
+                       g_free (cname);
        }
 
+       /* NOTE: Do *not* free the items. They have been freed or stolen
+        * above. */
        g_list_free (all_categories);
 
        return g_list_reverse (res);
diff --git a/e-util/e-misc-utils.h b/e-util/e-misc-utils.h
index cb262c7..1a0e734 100644
--- a/e-util/e-misc-utils.h
+++ b/e-util/e-misc-utils.h
@@ -160,7 +160,7 @@ gchar *             e_util_guess_mime_type          (const gchar *filename,
 
 GSList *       e_util_get_category_filter_options
                                                (void);
-GList *                e_util_get_searchable_categories (void);
+GList *                e_util_dup_searchable_categories (void);
 
 /* Useful GBinding transform functions */
 gboolean       e_binding_transform_color_to_string
diff --git a/e-util/e-name-selector-dialog.c b/e-util/e-name-selector-dialog.c
index 8bc9131..c900d21 100644
--- a/e-util/e-name-selector-dialog.c
+++ b/e-util/e-name-selector-dialog.c
@@ -128,7 +128,7 @@ name_selector_dialog_populate_categories (ENameSelectorDialog *name_selector_dia
                gtk_combo_box_set_active (GTK_COMBO_BOX (combo_box), 0);
 
        /* Categories are already sorted. */
-       category_list = e_categories_get_list ();
+       category_list = e_categories_dup_list ();
        for (iter = category_list; iter != NULL; iter = iter->next) {
                /* Only add user-visible categories. */
                if (!e_categories_is_searchable (iter->data))
@@ -138,7 +138,7 @@ name_selector_dialog_populate_categories (ENameSelectorDialog *name_selector_dia
                        GTK_COMBO_BOX_TEXT (combo_box), iter->data);
        }
 
-       g_list_free (category_list);
+       g_list_free_full (category_list, g_free);
 
        g_signal_connect_swapped (
                combo_box, "changed",
diff --git a/modules/addressbook/e-book-shell-view-actions.c b/modules/addressbook/e-book-shell-view-actions.c
index 491bb19..ba935c3 100644
--- a/modules/addressbook/e-book-shell-view-actions.c
+++ b/modules/addressbook/e-book-shell-view-actions.c
@@ -1366,10 +1366,10 @@ e_book_shell_view_update_search_filter (EBookShellView *book_shell_view)
 
        /* Build the category actions. */
 
-       list = e_util_get_searchable_categories ();
+       list = e_util_dup_searchable_categories ();
        for (iter = list, ii = 0; iter != NULL; iter = iter->next, ii++) {
                const gchar *category_name = iter->data;
-               const gchar *filename;
+               gchar *filename;
                GtkAction *action;
                gchar *action_name;
 
@@ -1380,7 +1380,7 @@ e_book_shell_view_update_search_filter (EBookShellView *book_shell_view)
                g_free (action_name);
 
                /* Convert the category icon file to a themed icon name. */
-               filename = e_categories_get_icon_file_for (category_name);
+               filename = e_categories_dup_icon_file_for (category_name);
                if (filename != NULL && *filename != '\0') {
                        gchar *basename;
                        gchar *cp;
@@ -1397,6 +1397,8 @@ e_book_shell_view_update_search_filter (EBookShellView *book_shell_view)
                        g_free (basename);
                }
 
+               g_free (filename);
+
                gtk_radio_action_set_group (radio_action, group);
                group = gtk_radio_action_get_group (radio_action);
 
@@ -1405,7 +1407,7 @@ e_book_shell_view_update_search_filter (EBookShellView *book_shell_view)
                gtk_action_group_add_action (action_group, action);
                g_object_unref (radio_action);
        }
-       g_list_free (list);
+       g_list_free_full (list, g_free);
 
        book_shell_content = book_shell_view->priv->book_shell_content;
        searchbar = e_book_shell_content_get_searchbar (book_shell_content);
diff --git a/modules/addressbook/e-book-shell-view.c b/modules/addressbook/e-book-shell-view.c
index 238d8fe..85c87bd 100644
--- a/modules/addressbook/e-book-shell-view.c
+++ b/modules/addressbook/e-book-shell-view.c
@@ -167,9 +167,9 @@ book_shell_view_execute_search (EShellView *shell_view)
                        GList *categories;
                        const gchar *category_name;
 
-                       categories = e_util_get_searchable_categories ();
+                       categories = e_util_dup_searchable_categories ();
                        category_name = g_list_nth_data (categories, filter_id);
-                       g_list_free (categories);
+                       g_list_free_full (categories, g_free);
 
                        temp = g_strdup_printf (
                                "(and (is \"category_list\" \"%s\") %s)",
diff --git a/modules/calendar/e-cal-shell-view-actions.c b/modules/calendar/e-cal-shell-view-actions.c
index 62a5dc2..660be9c 100644
--- a/modules/calendar/e-cal-shell-view-actions.c
+++ b/modules/calendar/e-cal-shell-view-actions.c
@@ -1957,10 +1957,10 @@ e_cal_shell_view_update_search_filter (ECalShellView *cal_shell_view)
 
        /* Build the category actions. */
 
-       list = e_util_get_searchable_categories ();
+       list = e_util_dup_searchable_categories ();
        for (iter = list, ii = 0; iter != NULL; iter = iter->next, ii++) {
                const gchar *category_name = iter->data;
-               const gchar *filename;
+               gchar *filename;
                GtkAction *action;
                gchar *action_name;
 
@@ -1971,7 +1971,7 @@ e_cal_shell_view_update_search_filter (ECalShellView *cal_shell_view)
                g_free (action_name);
 
                /* Convert the category icon file to a themed icon name. */
-               filename = e_categories_get_icon_file_for (category_name);
+               filename = e_categories_dup_icon_file_for (category_name);
                if (filename != NULL && *filename != '\0') {
                        gchar *basename;
                        gchar *cp;
@@ -1988,6 +1988,8 @@ e_cal_shell_view_update_search_filter (ECalShellView *cal_shell_view)
                        g_free (basename);
                }
 
+               g_free (filename);
+
                gtk_radio_action_set_group (radio_action, group);
                group = gtk_radio_action_get_group (radio_action);
 
@@ -1996,7 +1998,7 @@ e_cal_shell_view_update_search_filter (ECalShellView *cal_shell_view)
                gtk_action_group_add_action (action_group, action);
                g_object_unref (radio_action);
        }
-       g_list_free (list);
+       g_list_free_full (list, g_free);
 
        cal_shell_content = cal_shell_view->priv->cal_shell_content;
        searchbar = e_cal_shell_content_get_searchbar (cal_shell_content);
diff --git a/modules/calendar/e-cal-shell-view.c b/modules/calendar/e-cal-shell-view.c
index 716f87e..a703cbc 100644
--- a/modules/calendar/e-cal-shell-view.c
+++ b/modules/calendar/e-cal-shell-view.c
@@ -296,9 +296,9 @@ cal_shell_view_execute_search (EShellView *shell_view)
                        GList *categories;
                        const gchar *category_name;
 
-                       categories = e_util_get_searchable_categories ();
+                       categories = e_util_dup_searchable_categories ();
                        category_name = g_list_nth_data (categories, value);
-                       g_list_free (categories);
+                       g_list_free_full (categories, g_free);
 
                        temp = g_strdup_printf (
                                "(and (has-categories? \"%s\") %s)",
diff --git a/modules/calendar/e-memo-shell-view-actions.c b/modules/calendar/e-memo-shell-view-actions.c
index 21a1b5b..cea084e 100644
--- a/modules/calendar/e-memo-shell-view-actions.c
+++ b/modules/calendar/e-memo-shell-view-actions.c
@@ -991,10 +991,10 @@ e_memo_shell_view_update_search_filter (EMemoShellView *memo_shell_view)
 
        /* Build the category actions. */
 
-       list = e_util_get_searchable_categories ();
+       list = e_util_dup_searchable_categories ();
        for (iter = list, ii = 0; iter != NULL; iter = iter->next, ii++) {
                const gchar *category_name = iter->data;
-               const gchar *filename;
+               gchar *filename;
                GtkAction *action;
                gchar *action_name;
 
@@ -1005,7 +1005,7 @@ e_memo_shell_view_update_search_filter (EMemoShellView *memo_shell_view)
                g_free (action_name);
 
                /* Convert the category icon file to a themed icon name. */
-               filename = e_categories_get_icon_file_for (category_name);
+               filename = e_categories_dup_icon_file_for (category_name);
                if (filename != NULL && *filename != '\0') {
                        gchar *basename;
                        gchar *cp;
@@ -1022,6 +1022,8 @@ e_memo_shell_view_update_search_filter (EMemoShellView *memo_shell_view)
                        g_free (basename);
                }
 
+               g_free (filename);
+
                gtk_radio_action_set_group (radio_action, group);
                group = gtk_radio_action_get_group (radio_action);
 
@@ -1030,7 +1032,7 @@ e_memo_shell_view_update_search_filter (EMemoShellView *memo_shell_view)
                gtk_action_group_add_action (action_group, action);
                g_object_unref (radio_action);
        }
-       g_list_free (list);
+       g_list_free_full (list, g_free);
 
        memo_shell_content = memo_shell_view->priv->memo_shell_content;
        searchbar = e_memo_shell_content_get_searchbar (memo_shell_content);
diff --git a/modules/calendar/e-memo-shell-view.c b/modules/calendar/e-memo-shell-view.c
index 8bd49fc..8f8522c 100644
--- a/modules/calendar/e-memo-shell-view.c
+++ b/modules/calendar/e-memo-shell-view.c
@@ -144,9 +144,9 @@ memo_shell_view_execute_search (EShellView *shell_view)
                        GList *categories;
                        const gchar *category_name;
 
-                       categories = e_util_get_searchable_categories ();
+                       categories = e_util_dup_searchable_categories ();
                        category_name = g_list_nth_data (categories, value);
-                       g_list_free (categories);
+                       g_list_free_full (categories, g_free);
 
                        temp = g_strdup_printf (
                                "(and (has-categories? \"%s\") %s)",
diff --git a/modules/calendar/e-task-shell-view-actions.c b/modules/calendar/e-task-shell-view-actions.c
index 10c1d1e..9975457 100644
--- a/modules/calendar/e-task-shell-view-actions.c
+++ b/modules/calendar/e-task-shell-view-actions.c
@@ -1190,10 +1190,10 @@ e_task_shell_view_update_search_filter (ETaskShellView *task_shell_view)
 
        /* Build the category actions. */
 
-       list = e_util_get_searchable_categories ();
+       list = e_util_dup_searchable_categories ();
        for (iter = list, ii = 0; iter != NULL; iter = iter->next, ii++) {
                const gchar *category_name = iter->data;
-               const gchar *filename;
+               gchar *filename;
                GtkAction *action;
                gchar *action_name;
 
@@ -1204,7 +1204,7 @@ e_task_shell_view_update_search_filter (ETaskShellView *task_shell_view)
                g_free (action_name);
 
                /* Convert the category icon file to a themed icon name. */
-               filename = e_categories_get_icon_file_for (category_name);
+               filename = e_categories_dup_icon_file_for (category_name);
                if (filename != NULL && *filename != '\0') {
                        gchar *basename;
                        gchar *cp;
@@ -1221,6 +1221,8 @@ e_task_shell_view_update_search_filter (ETaskShellView *task_shell_view)
                        g_free (basename);
                }
 
+               g_free (filename);
+
                gtk_radio_action_set_group (radio_action, group);
                group = gtk_radio_action_get_group (radio_action);
 
@@ -1229,7 +1231,7 @@ e_task_shell_view_update_search_filter (ETaskShellView *task_shell_view)
                gtk_action_group_add_action (action_group, action);
                g_object_unref (radio_action);
        }
-       g_list_free (list);
+       g_list_free_full (list, g_free);
 
        task_shell_content = task_shell_view->priv->task_shell_content;
        searchbar = e_task_shell_content_get_searchbar (task_shell_content);
diff --git a/modules/calendar/e-task-shell-view.c b/modules/calendar/e-task-shell-view.c
index 7996e82..8153869 100644
--- a/modules/calendar/e-task-shell-view.c
+++ b/modules/calendar/e-task-shell-view.c
@@ -254,9 +254,9 @@ task_shell_view_execute_search (EShellView *shell_view)
                        GList *categories;
                        const gchar *category_name;
 
-                       categories = e_util_get_searchable_categories ();
+                       categories = e_util_dup_searchable_categories ();
                        category_name = g_list_nth_data (categories, value);
-                       g_list_free (categories);
+                       g_list_free_full (categories, g_free);
 
                        temp = g_strdup_printf (
                                "(and (has-categories? \"%s\") %s)",
diff --git a/shell/main.c b/shell/main.c
index 29a7364..3125cd5 100644
--- a/shell/main.c
+++ b/shell/main.c
@@ -115,7 +115,7 @@ categories_icon_theme_hack (void)
 {
        GtkIconTheme *icon_theme;
        const gchar *category_name;
-       const gchar *filename;
+       gchar *filename;
        gchar *dirname;
 
        /* XXX Allow the category icons to be referenced as named
@@ -125,11 +125,12 @@ categories_icon_theme_hack (void)
         * which, so long as it has an icon.  We're just interested in
         * the directory components. */
        category_name = _("Birthday");
-       filename = e_categories_get_icon_file_for (category_name);
+       filename = e_categories_dup_icon_file_for (category_name);
        g_return_if_fail (filename != NULL && *filename != '\0');
 
        /* Extract the directory components. */
        dirname = g_path_get_dirname (filename);
+       g_free (filename);
 
        /* Add it to the icon theme's search path.  This relies on
         * GtkIconTheme's legacy feature of using image files found


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]