[gimp] app: fix the test that an icon theme folder actually contains a theme



commit d1e5d719de5724b79b1a5aa1af9bb8142e913372
Author: Michael Natterer <mitch gimp org>
Date:   Fri Dec 11 21:30:44 2015 +0100

    app: fix the test that an icon theme folder actually contains a theme
    
    and don't leak the GFile if it doesn't.

 app/gui/icon-themes.c |   17 +++++++++++------
 1 files changed, 11 insertions(+), 6 deletions(-)
---
diff --git a/app/gui/icon-themes.c b/app/gui/icon-themes.c
index c148b52..481e7a0 100644
--- a/app/gui/icon-themes.c
+++ b/app/gui/icon-themes.c
@@ -101,20 +101,20 @@ icon_themes_init (Gimp *gimp)
                       g_file_info_get_file_type (info) == G_FILE_TYPE_DIRECTORY)
                     {
                       GFile *file;
+                      GFile *hicolor;
                       GFile *index_theme;
 
                       file = g_file_enumerator_get_child (enumerator, info);
 
-                      /* make sure there is a index.theme file */
-                      index_theme = g_file_get_child (file, "index.theme");
+                      /* make sure there is a hicolor/index.theme file */
+                      hicolor = g_file_get_child (file, "hicolor");
+                      index_theme = g_file_get_child (hicolor, "index.theme");
 
-                      if (index_theme)
+                      if (g_file_query_exists (index_theme, NULL))
                         {
                           const gchar *name;
                           gchar       *basename;
 
-                          g_object_unref (index_theme);
-
                           name     = gimp_file_get_utf8_name (file);
                           basename = g_path_get_basename (name);
 
@@ -122,8 +122,13 @@ icon_themes_init (Gimp *gimp)
                             g_print ("Adding icon theme '%s' (%s)\n",
                                      basename, name);
 
-                          g_hash_table_insert (icon_themes_hash, basename, file);
+                          g_hash_table_insert (icon_themes_hash, basename,
+                                               g_object_ref (file));
                         }
+
+                      g_object_unref (index_theme);
+                      g_object_unref (hicolor);
+                      g_object_unref (file);
                     }
 
                   g_object_unref (info);


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