[gtk+] GtkIconTheme: Include legacy stock icons from resources



commit 49bcaf844c315f88f5853c1f082ec0801e197090
Author: Matthias Clasen <mclasen redhat com>
Date:   Fri Jun 20 01:04:16 2014 -0400

    GtkIconTheme: Include legacy stock icons from resources
    
    Add /org/gtk/libgtk/icons as a resource path, and ensure
    that we always parse an index.theme file for hicolor which
    makes the builtin icons available as part of the hicolor theme.

 gtk/gtkicontheme.c |   26 ++++++++++++++++++++++++++
 1 files changed, 26 insertions(+), 0 deletions(-)
---
diff --git a/gtk/gtkicontheme.c b/gtk/gtkicontheme.c
index e183122..d0c1d08 100644
--- a/gtk/gtkicontheme.c
+++ b/gtk/gtkicontheme.c
@@ -735,6 +735,8 @@ gtk_icon_theme_init (GtkIconTheme *icon_theme)
   for (j = 0; xdg_data_dirs[j]; j++) 
     priv->search_path[i++] = g_build_filename (xdg_data_dirs[j], "pixmaps", NULL);
 
+  priv->resource_paths = g_list_append (NULL, g_strdup ("/org/gtk/libgtk/icons"));
+
   priv->themes_valid = FALSE;
   priv->themes = NULL;
   priv->unthemed_icons = NULL;
@@ -1058,6 +1060,24 @@ gtk_icon_theme_set_custom_theme (GtkIconTheme *icon_theme,
     }
 }
 
+static const gchar builtin_hicolor_index[] =
+"[Icon Theme]\n"
+"Name=Hicolor\n"
+"Hidden=True\n"
+"Directories=16x16/actions,22x22/actions,24x24/actions,32x32/actions\n"
+"[16x16/actions]\n"
+"Size=16\n"
+"Type=Threshold\n"
+"[22x22/actions]\n"
+"Size=22\n"
+"Type=Threshold\n"
+"[24x24/actions]\n"
+"Size=24\n"
+"Type=Threshold\n"
+"[32x32/actions]\n"
+"Size=32\n"
+"Type=Threshold\n";
+
 static void
 insert_theme (GtkIconTheme *icon_theme,
               const gchar  *theme_name)
@@ -1129,6 +1149,12 @@ insert_theme (GtkIconTheme *icon_theme,
       theme = g_new0 (IconTheme, 1);
       theme->name = g_strdup (theme_name);
       priv->themes = g_list_prepend (priv->themes, theme);
+      if (!theme_file)
+        {
+          theme_file = g_key_file_new ();
+          g_key_file_set_list_separator (theme_file, ',');
+          g_key_file_load_from_data (theme_file, builtin_hicolor_index, -1, 0, NULL);
+        }
     }
 
   if (theme_file == NULL)


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