Adding a search path for icons
- From: Albert Chin <gtk-devel-list mlists thewrittenword com>
- To: gtk-devel-list gnome org
- Subject: Adding a search path for icons
- Date: Mon, 26 Jul 2004 18:11:15 -0500
At the moment, GTK+ is restricted to search for icons in one
directory. This doesn't work for us. We install GTK+ in a *totally*
separate directory from all other applications. In the process of
building GNOME in a *totally* separate directory, we run into runtime
issues with GNOME icons not being found. The GTK+ default icons are
stored to /opt/TWWfsw/libgtk+24/share/icons and the GNOME icons to
/opt/TWWfsw/gnome26/share/icons.
So, we created the patch below. Is this something that would be
suitable for inclusion? I picked GTK_PATH_ICONS as the environment
variable holding the list of pathnames.
The code is kinda ripped from get_module_path() in gtk/gtkmain.c
--
albert chin (china thewrittenword com)
-- snip snip
--- gtk/gtkicontheme.c.orig 2004-07-09 23:02:10.000000000 -0500
+++ gtk/gtkicontheme.c 2004-07-26 18:02:25.000000000 -0500
@@ -34,6 +34,8 @@
#endif
#endif /* G_OS_WIN32 */
+#include <pango/pango-utils.h> /* For pango_split_file_list */
+
#include "gtkicontheme.h"
#include "gtkiconthemeparser.h"
#include "gtkintl.h"
@@ -520,25 +522,58 @@
static void
gtk_icon_theme_init (GtkIconTheme *icon_theme)
{
+ const gchar *path_icons_env;
GtkIconThemePrivate *priv;
+ path_icons_env = g_getenv ("GTK_PATH_ICONS");
+
priv = g_type_instance_get_private ((GTypeInstance *)icon_theme,
GTK_TYPE_ICON_THEME);
icon_theme->priv = priv;
priv->custom_theme = FALSE;
priv->current_theme = g_strdup (DEFAULT_THEME_NAME);
- priv->search_path = g_new (char *, 5);
+
+ if (path_icons_env)
+ {
+ gchar *icon_path;
+ int i;
+
+ icon_path = g_build_path (G_SEARCHPATH_SEPARATOR_S,
+ path_icons_env,
+ g_build_filename (g_get_home_dir (),
+ ".icons",
+ NULL),
+ g_build_filename (GTK_DATADIR,
+ "pixmaps", NULL),
+ g_build_filename (GTK_DATADIR,
+ "icons", NULL),
+ g_strdup ("/usr/share/icons"),
+ g_strdup ("/usr/share/pixmaps"),
+ NULL);
+
+ priv->search_path = pango_split_file_list (icon_path);
+
+ for (i = 0; priv->search_path[i] != NULL; i++)
+ ;
+ priv->search_path_len = i;
+
+ g_free (icon_path);
+ }
+ else
+ {
+ priv->search_path = g_new (char *, 5);
- priv->search_path[0] = g_build_filename (g_get_home_dir (),
- ".icons",
- NULL);
- priv->search_path[1] = g_build_filename (GTK_DATADIR, "pixmaps", NULL);
- priv->search_path[2] = g_build_filename (GTK_DATADIR, "icons", NULL);
- priv->search_path[3] = g_strdup ("/usr/share/icons");
- priv->search_path[4] = g_strdup ("/usr/share/pixmaps");
- priv->search_path_len = 5;
+ priv->search_path[0] = g_build_filename (g_get_home_dir (),
+ ".icons",
+ NULL);
+ priv->search_path[1] = g_build_filename (GTK_DATADIR, "pixmaps", NULL);
+ priv->search_path[2] = g_build_filename (GTK_DATADIR, "icons", NULL);
+ priv->search_path[3] = g_strdup ("/usr/share/icons");
+ priv->search_path[4] = g_strdup ("/usr/share/pixmaps");
+ priv->search_path_len = 5;
+ }
priv->themes_valid = FALSE;
priv->themes = NULL;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]