[gimp] Bug 759904: Some icons can't be set from the icon theme
- From: Massimo Valentini <mvalentini src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] Bug 759904: Some icons can't be set from the icon theme
- Date: Fri, 2 Sep 2016 10:37:38 +0000 (UTC)
commit 3cc77b03bfc99c15183e867734fb30ea1cecc3d0
Author: Massimo Valentini <mvalentini src gnome org>
Date: Fri Sep 2 12:30:49 2016 +0200
Bug 759904: Some icons can't be set from the icon theme
make it possible to use themed standard named icons
so to have also gtk dialogs show icons in the same style
as GIMP ui.
app/dialogs/preferences-dialog.c | 6 +-
app/gui/icon-themes.c | 24 ++--
icons/Color/Makefile.am | 2 +-
icons/Legacy/Makefile.am | 30 +++---
icons/Legacy/index.theme | 1 +
icons/Makefile.am | 8 ++
icons/Symbolic-Inverted/Makefile.am | 2 +-
icons/Symbolic/Makefile.am | 2 +-
icons/index.theme | 6 +
libgimpwidgets/gimpicons.c | 226 +++++++++++++++++++++++------------
themes/Small/gtkrc | 8 +-
themes/System/gtkrc | 8 +-
12 files changed, 210 insertions(+), 113 deletions(-)
---
diff --git a/app/dialogs/preferences-dialog.c b/app/dialogs/preferences-dialog.c
index 66de5f9..d062ffd 100644
--- a/app/dialogs/preferences-dialog.c
+++ b/app/dialogs/preferences-dialog.c
@@ -1945,12 +1945,16 @@ prefs_dialog_new (Gimp *gimp,
{
GtkTreeIter iter;
GFile *icon_theme_dir = icon_themes_get_theme_dir (gimp, icon_themes[i]);
+ GFile *icon_theme_search_path = g_file_get_parent (icon_theme_dir);
GtkIconTheme *theme;
gchar *example;
GdkPixbuf *pixbuf;
theme = gtk_icon_theme_new ();
- gtk_icon_theme_prepend_search_path (theme, gimp_file_get_utf8_name(icon_theme_dir));
+ gtk_icon_theme_prepend_search_path (theme, gimp_file_get_utf8_name(icon_theme_search_path));
+ g_object_unref (icon_theme_search_path);
+ gtk_icon_theme_set_custom_theme (theme, icon_themes[i]);
+
example = gtk_icon_theme_get_example_icon_name (theme);
if (! example)
{
diff --git a/app/gui/icon-themes.c b/app/gui/icon-themes.c
index 00d7ed2..0401a11 100644
--- a/app/gui/icon-themes.c
+++ b/app/gui/icon-themes.c
@@ -101,14 +101,12 @@ 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 hicolor/index.theme file */
- hicolor = g_file_get_child (file, "hicolor");
- index_theme = g_file_get_child (hicolor, "index.theme");
+ index_theme = g_file_get_child (file, "index.theme");
if (g_file_query_exists (index_theme, NULL))
{
@@ -118,16 +116,22 @@ icon_themes_init (Gimp *gimp)
name = gimp_file_get_utf8_name (file);
basename = g_path_get_basename (name);
- if (gimp->be_verbose)
- g_print ("Adding icon theme '%s' (%s)\n",
- basename, name);
-
- g_hash_table_insert (icon_themes_hash, basename,
- g_object_ref (file));
+ if (strcmp ("hicolor", basename))
+ {
+ if (gimp->be_verbose)
+ g_print ("Adding icon theme '%s' (%s)\n",
+ basename, name);
+
+ g_hash_table_insert (icon_themes_hash, basename,
+ g_object_ref (file));
+ }
+ else
+ {
+ g_free (basename);
+ }
}
g_object_unref (index_theme);
- g_object_unref (hicolor);
g_object_unref (file);
}
diff --git a/icons/Color/Makefile.am b/icons/Color/Makefile.am
index 18359bb..b2fccc7 100644
--- a/icons/Color/Makefile.am
+++ b/icons/Color/Makefile.am
@@ -1,6 +1,6 @@
## Process this file with automake to produce Makefile.in
-iconsdir = $(gimpdatadir)/icons/Color/hicolor
+iconsdir = $(gimpdatadir)/icons/Color
icons_DATA = \
index.theme
diff --git a/icons/Legacy/Makefile.am b/icons/Legacy/Makefile.am
index 59ebac1..4d7c750 100644
--- a/icons/Legacy/Makefile.am
+++ b/icons/Legacy/Makefile.am
@@ -1,24 +1,24 @@
## Process this file with automake to produce Makefile.in
-iconsdir = $(gimpdatadir)/icons/Legacy/hicolor
-icons12dir = $(gimpdatadir)/icons/Legacy/hicolor/12x12/apps
-icons16dir = $(gimpdatadir)/icons/Legacy/hicolor/16x16/apps
-icons18dir = $(gimpdatadir)/icons/Legacy/hicolor/18x18/apps
-icons20dir = $(gimpdatadir)/icons/Legacy/hicolor/20x20/apps
-icons22dir = $(gimpdatadir)/icons/Legacy/hicolor/22x22/apps
+iconsdir = $(gimpdatadir)/icons/Legacy/
+icons12dir = $(gimpdatadir)/icons/Legacy/12x12/apps
+icons16dir = $(gimpdatadir)/icons/Legacy/16x16/apps
+icons18dir = $(gimpdatadir)/icons/Legacy/18x18/apps
+icons20dir = $(gimpdatadir)/icons/Legacy/20x20/apps
+icons22dir = $(gimpdatadir)/icons/Legacy/22x22/apps
# 22x22 tool icons will go in their own directory and we tell GTK+
# that this directory contains icons for 24x24 requests.
# This is a special trick to let the theme override the default
# 24x24 size request.
-tools22dir = $(gimpdatadir)/icons/Legacy/hicolor/22x22/tools
-icons24dir = $(gimpdatadir)/icons/Legacy/hicolor/24x24/apps
-icons32dir = $(gimpdatadir)/icons/Legacy/hicolor/32x32/apps
-icons48dir = $(gimpdatadir)/icons/Legacy/hicolor/48x48/apps
-icons64dir = $(gimpdatadir)/icons/Legacy/hicolor/64x64/apps
-icons96dir = $(gimpdatadir)/icons/Legacy/hicolor/96x96/apps
-icons128dir = $(gimpdatadir)/icons/Legacy/hicolor/128x128/apps
-icons192dir = $(gimpdatadir)/icons/Legacy/hicolor/192x192/apps
-icons256dir = $(gimpdatadir)/icons/Legacy/hicolor/256x256/apps
+tools22dir = $(gimpdatadir)/icons/Legacy/22x22/tools
+icons24dir = $(gimpdatadir)/icons/Legacy/24x24/apps
+icons32dir = $(gimpdatadir)/icons/Legacy/32x32/apps
+icons48dir = $(gimpdatadir)/icons/Legacy/48x48/apps
+icons64dir = $(gimpdatadir)/icons/Legacy/64x64/apps
+icons96dir = $(gimpdatadir)/icons/Legacy/96x96/apps
+icons128dir = $(gimpdatadir)/icons/Legacy/128x128/apps
+icons192dir = $(gimpdatadir)/icons/Legacy/192x192/apps
+icons256dir = $(gimpdatadir)/icons/Legacy/256x256/apps
## The icon theme images
diff --git a/icons/Legacy/index.theme b/icons/Legacy/index.theme
index 7b3ae37..ad61337 100644
--- a/icons/Legacy/index.theme
+++ b/icons/Legacy/index.theme
@@ -3,6 +3,7 @@ Name=Hicolor
Comment=Legacy icon theme (GIMP 2.8)
Example=gimp-wilber
Hidden=true
+Inherits=Color
Directories=12x12/apps,18x18/apps,20x20/apps,16x16/actions,16x16/animations,16x16/apps,16x16/categories,16x16/devices,16x16/emblems,16x16/emotes,16x16/filesystems,16x16/intl,16x16/mimetypes,16x16/places,16x16/status,16x16/stock/chart,16x16/stock/code,16x16/stock/data,16x16/stock/form,16x16/stock/image,16x16/stock/io,16x16/stock/media,16x16/stock/navigation,16x16/stock/net,16x16/stock/object,16x16/stock/table,16x16/stock/text,22x22/actions,22x22/animations,22x22/apps,22x22/categories,22x22/devices,22x22/emblems,22x22/emotes,22x22/filesystems,22x22/intl,22x22/mimetypes,22x22/places,22x22/status,22x22/stock/chart,22x22/stock/code,22x22/stock/data,22x22/stock/form,22x22/stock/image,22x22/stock/io,22x22/stock/media,22x22/stock/navigation,22x22/stock/net,22x22/stock/object,22x22/stock/table,22x22/stock/text,22x22/tools,24x24/actions,24x24/animations,24x24/apps,24x24/categories,24x24/devices,24x24/emblems,24x24/emotes,24x24/filesystems,24x24/intl,24x24/mimetypes,24x24/places,24x24/
status,24x24/stock/chart,24x24/stock/code,24x24/stock/data,24x24/stock/form,24x24/stock/image,24x24/stock/io,24x24/stock/media,24x24/stock/navigation,24x24/stock/net,24x24/stock/object,24x24/stock/table,24x24/stock/text,32x32/actions,32x32/animations,32x32/apps,32x32/categories,32x32/devices,32x32/emblems,32x32/emotes,32x32/filesystems,32x32/intl,32x32/mimetypes,32x32/places,32x32/status,32x32/stock/chart,32x32/stock/code,32x32/stock/data,32x32/stock/form,32x32/stock/image,32x32/stock/io,32x32/stock/media,32x32/stock/navigation,32x32/stock/net,32x32/stock/object,32x32/stock/table,32x32/stock/text,36x36/actions,36x36/animations,36x36/apps,36x36/categories,36x36/devices,36x36/emblems,36x36/emotes,36x36/filesystems,36x36/intl,36x36/mimetypes,36x36/places,36x36/status,36x36/stock/chart,36x36/stock/code,36x36/stock/data,36x36/stock/form,36x36/stock/image,36x36/stock/io,36x36/stock/media,36x36/stock/navigation,36x36/stock/net,36x36/stock/object,36x36/stock/table,36x36/stock/text,4
8x48/actions,48x48/animations,48x48/apps,48x48/categories,48x48/devices,48x48/emblems,48x48/emotes,48x48/filesystems,48x48/intl,48x48/mimetypes,48x48/places,48x48/status,48x48/stock/chart,48x48/stock/code,48x48/stock/data,48x48/stock/form,48x48/stock/image,48x48/stock/io,48x48/stock/media,48x48/stock/navigation,48x48/stock/net,48x48/stock/object,48x48/stock/table,48x48/stock/text,64x64/actions,64x64/animations,64x64/apps,64x64/categories,64x64/devices,64x64/emblems,64x64/emotes,64x64/filesystems,64x64/intl,64x64/mimetypes,64x64/places,64x64/status,64x64/stock/chart,64x64/stock/code,64x64/stock/data,64x64/stock/form,64x64/stock/image,64x64/stock/io,64x64/stock/media,64x64/stock/navigation,64x64/stock/net,64x64/stock/object,64x64/stock/table,64x64/stock/text,72x72/actions,72x72/animations,72x72/apps,72x72/categories,72x72/devices,72x72/emblems,72x72/emotes,72x72/filesystems,72x72/intl,72x72/mimetypes,72x72/places,72x72/status,72x72/stock/chart,72x72/stock/code,72x72/stock/data
,72x72/stock/form,72x72/stock/image,72x72/stock/io,72x72/stock/media,72x72/stock/navigation,72x72/stock/net,72x72/stock/object,72x72/stock/table,72x72/stock/text,96x96/actions,96x96/animations,96x96/apps,96x96/categories,96x96/devices,96x96/emblems,96x96/emotes,96x96/filesystems,96x96/intl,96x96/mimetypes,96x96/places,96x96/status,96x96/stock/chart,96x96/stock/code,96x96/stock/data,96x96/stock/form,96x96/stock/image,96x96/stock/io,96x96/stock/media,96x96/stock/navigation,96x96/stock/net,96x96/stock/object,96x96/stock/table,96x96/stock/text,128x128/actions,128x128/animations,128x128/apps,128x128/categories,128x128/devices,128x128/emblems,128x128/emotes,128x128/filesystems,128x128/intl,128x128/mimetypes,128x128/places,128x128/status,128x128/stock/chart,128x128/stock/code,128x128/stock/data,128x128/stock/form,128x128/stock/image,128x128/stock/io,128x128/stock/media,128x128/stock/navigation,128x128/stock/net,128x128/stock/object,128x128/stock/table,128x128/stock/text,192x192/act
ions,192x192/animations,192x192/apps,192x192/categories,192x192/devices,192x192/emblems,192x192/emotes,192x192/filesystems,192x192/intl,192x192/mimetypes,192x192/places,192x192/status,192x192/stock/chart,192x192/stock/code,192x192/stock/data,192x192/stock/form,192x192/stock/image,192x192/stock/io,192x192/stock/media,192x192/stock/navigation,192x192/stock/net,192x192/stock/object,192x192/stock/table,192x192/stock/text,256x256/actions,256x256/animations,256x256/apps,256x256/categories,256x256/devices,256x256/emblems,256x256/emotes,256x256/filesystems,256x256/intl,256x256/mimetypes,256x256/places,256x256/status,256x256/stock/chart,256x256/stock/code,256x256/stock/data,256x256/stock/form,256x256/stock/image,256x256/stock/io,256x256/stock/media,256x256/stock/navigation,256x256/stock/net,256x256/stock/object,256x256/stock/table,256x256/stock/text,512x512/actions,512x512/animations,512x512/apps,512x512/categories,512x512/devices,512x512/emblems,512x512/emotes,512x512/filesystems,51
2x512/intl,512x512/mimetypes,512x512/places,512x512/status,512x512/stock/chart,512x512/stock/code,512x512/stock/data,512x512/stock/form,512x512/stock/image,512x512/stock/io,512x512/stock/media,512x512/stock/navigation,512x512/stock/net,512x512/stock/object,512x512/stock/table,512x512/stock/text,scalable/actions,scalable/animations,scalable/apps,scalable/categories,scalable/devices,scalable/emblems,scalable/emotes,scalable/filesystems,scalable/intl,scalable/mimetypes,scalable/places,scalable/status,scalable/stock/chart,scalable/stock/code,scalable/stock/data,scalable/stock/form,scalable/stock/image,scalable/stock/io,scalable/stock/media,scalable/stock/navigation,scalable/stock/net,scalable/stock/object,scalable/stock/table,scalable/stock/text
diff --git a/icons/Makefile.am b/icons/Makefile.am
index d0f4e6f..22a97b8 100644
--- a/icons/Makefile.am
+++ b/icons/Makefile.am
@@ -3,3 +3,11 @@ SUBDIRS = \
Legacy \
Symbolic \
Symbolic-Inverted
+
+iconsdir = $(gimpdatadir)/icons/hicolor
+
+icons_DATA = \
+ index.theme
+
+EXTRA_DIST = \
+ $(icons_DATA)
diff --git a/icons/Symbolic-Inverted/Makefile.am b/icons/Symbolic-Inverted/Makefile.am
index f3fe6a5..36a20e5 100644
--- a/icons/Symbolic-Inverted/Makefile.am
+++ b/icons/Symbolic-Inverted/Makefile.am
@@ -1,6 +1,6 @@
## Process this file with automake to produce Makefile.in
-iconsdir = $(gimpdatadir)/icons/Symbolic-Inverted/hicolor
+iconsdir = $(gimpdatadir)/icons/Symbolic-Inverted
icons_DATA = \
index.theme
diff --git a/icons/Symbolic/Makefile.am b/icons/Symbolic/Makefile.am
index 62952ec..7706039 100644
--- a/icons/Symbolic/Makefile.am
+++ b/icons/Symbolic/Makefile.am
@@ -1,6 +1,6 @@
## Process this file with automake to produce Makefile.in
-iconsdir = $(gimpdatadir)/icons/Symbolic/hicolor
+iconsdir = $(gimpdatadir)/icons/Symbolic
icons_DATA = \
index.theme
diff --git a/icons/index.theme b/icons/index.theme
new file mode 100644
index 0000000..9188371
--- /dev/null
+++ b/icons/index.theme
@@ -0,0 +1,6 @@
+[Icon Theme]
+Name=Hicolor
+Comment=Fallback icon theme
+Hidden=true
+
+Directories=
diff --git a/libgimpwidgets/gimpicons.c b/libgimpwidgets/gimpicons.c
index 708d195..9f78f3c 100644
--- a/libgimpwidgets/gimpicons.c
+++ b/libgimpwidgets/gimpicons.c
@@ -382,47 +382,47 @@ register_bidi_stock_icon (GtkIconFactory *factory,
}
-static GFile *icon_theme_path = NULL;
-static GFile *default_icon_theme_path = NULL;
+static GFile *icon_theme_path = NULL;
+static GFile *default_search_path = NULL;
static void
-gimp_icons_change_icon_theme (GFile *path)
+gimp_icons_change_icon_theme (GFile *new_search_path)
{
- if (! default_icon_theme_path)
- default_icon_theme_path = gimp_data_directory_file ("icons",
- GIMP_DEFAULT_ICON_THEME,
- NULL);
+ GFile *old_search_path = g_file_get_parent (icon_theme_path);
- if (! g_file_equal (path, icon_theme_path))
+ if (! default_search_path)
+ default_search_path = gimp_data_directory_file ("icons", NULL);
+
+ if (! g_file_equal (new_search_path, old_search_path))
{
GtkIconTheme *icon_theme = gtk_icon_theme_get_default ();
- if (g_file_equal (icon_theme_path, default_icon_theme_path))
+ if (g_file_equal (old_search_path, default_search_path))
{
- /* if the current icon theme is the default theme, simply
- * prepend the new theme's path
+ /* if the old icon theme is in the default search path,
+ * simply prepend the new theme's path
*/
- gchar *path_str = g_file_get_path (path);
+ gchar *path_str = g_file_get_path (new_search_path);
gtk_icon_theme_prepend_search_path (icon_theme, path_str);
g_free (path_str);
}
else
{
- /* if the current theme is not the default theme, we need
- * to deal with the search path's first element
+ /* if the old theme is not in the default search path,
+ * we need to deal with the search path's first element
*/
gchar **paths;
gint n_paths;
gtk_icon_theme_get_search_path (icon_theme, &paths, &n_paths);
- if (g_file_equal (path, default_icon_theme_path))
+ if (g_file_equal (new_search_path, default_search_path))
{
- /* when switching to the default theme, remove the
- * first search path element, the default theme will
- * still be in the search path as fallback
+ /* when switching to a theme in the default path, remove
+ * the first search path element, the default search path
+ * is still in the search path
*/
gtk_icon_theme_set_search_path (icon_theme,
(const gchar **) paths + 1,
@@ -430,12 +430,12 @@ gimp_icons_change_icon_theme (GFile *path)
}
else
{
- /* when switching between two non-default themes, replace
+ /* when switching between two non-default search paths, replace
* the first element of the search path with the new
* theme's path
*/
g_free (paths[0]);
- paths[0] = g_file_get_path (path);
+ paths[0] = g_file_get_path (new_search_path);
gtk_icon_theme_set_search_path (icon_theme,
(const gchar **) paths, n_paths);
@@ -443,69 +443,115 @@ gimp_icons_change_icon_theme (GFile *path)
g_strfreev (paths);
}
+ }
+
+ g_object_unref (old_search_path);
+}
+
+static void
+gimp_icons_notify_system_icon_theme (GObject *settings,
+ GParamSpec *param,
+ gpointer unused)
+{
+ GdkScreen *screen = gdk_screen_get_default ();
+ GValue value = G_VALUE_INIT;
+
+ g_value_init (&value, G_TYPE_STRING);
+
+ if (gdk_screen_get_setting (screen, "gtk-icon-theme-name", &value))
+ {
+ const gchar *new_system_icon_theme = g_value_get_string (&value);
+ gchar *cur_system_icon_theme = NULL;
+
+ g_object_get (settings,
+ "gtk-fallback-icon-theme", &cur_system_icon_theme,
+ NULL);
+ if (g_strcmp0 (cur_system_icon_theme, new_system_icon_theme))
+ {
+ g_object_set (settings,
+ "gtk-fallback-icon-theme", new_system_icon_theme,
+ NULL);
+
+ g_object_notify (settings, "gtk-icon-theme-name");
+ }
- g_object_unref (icon_theme_path);
- icon_theme_path = g_object_ref (path);
+ g_free (cur_system_icon_theme);
}
+
+ g_value_unset (&value);
+}
+
+static gboolean
+gimp_icons_sanity_check (GFile *path,
+ const gchar *theme_name)
+{
+ gboolean exists = FALSE;
+ GFile *child = g_file_get_child (path, theme_name);
+
+ if (g_file_query_exists (child, NULL))
+ {
+ GFile *index = g_file_get_child (child, "index.theme");
+
+ if (g_file_query_exists (index, NULL))
+ exists = TRUE;
+ else
+ g_printerr ("%s: Icon theme path has no '%s/index.theme': %s\n",
+ G_STRFUNC, theme_name, gimp_file_get_utf8_name (path));
+
+ g_object_unref (index);
+ }
+ else
+ g_printerr ("%s: Icon theme path has no '%s' subdirectory: %s\n",
+ G_STRFUNC, theme_name, gimp_file_get_utf8_name (path));
+
+ g_object_unref (child);
+
+ return exists;
}
void
gimp_icons_set_icon_theme (GFile *path)
{
+ gchar *icon_theme_name;
+ GFile *search_path;
+
g_return_if_fail (path == NULL || G_IS_FILE (path));
if (path)
path = g_object_ref (path);
else
- path = gimp_data_directory_file (gimp_data_directory (),
- "icons", GIMP_DEFAULT_ICON_THEME,
- NULL);
+ path = gimp_data_directory_file ("icons", GIMP_DEFAULT_ICON_THEME, NULL);
- if (! g_file_query_exists (path, NULL))
- {
- g_printerr ("%s: Icon theme path does not exist: %s\n",
- G_STRFUNC, gimp_file_get_utf8_name (path));
- }
- else
- {
- GFile *hicolor = g_file_get_child (path, "hicolor");
+ search_path = g_file_get_parent (path);
+ icon_theme_name = g_file_get_basename (path);
- if (! g_file_query_exists (hicolor, NULL))
- {
- g_printerr ("%s: Icon theme path has no 'hicolor' subdirectory: %s\n",
- G_STRFUNC, gimp_file_get_utf8_name (path));
- }
- else
+ if (gimp_icons_sanity_check (search_path, "hicolor") &&
+ gimp_icons_sanity_check (search_path, icon_theme_name))
+ {
+ if (icon_theme_path)
{
- GFile *index = g_file_get_child (hicolor, "index.theme");
+ /* this is an icon theme change */
+ gimp_icons_change_icon_theme (search_path);
- if (! g_file_query_exists (index, NULL))
- {
- g_printerr ("%s: Icon theme path has no 'hicolor/index.theme': %s\n",
- G_STRFUNC, gimp_file_get_utf8_name (path));
- }
- else
+ if (! g_file_equal (icon_theme_path, path))
{
- /* the path points to what looks like a valid icon theme */
-
- if (icon_theme_path)
- {
- /* this is an icon theme change */
- gimp_icons_change_icon_theme (path);
- }
- else
- {
- /* this is the first call upon initialization */
- icon_theme_path = g_object_ref (path);
- }
+ g_object_unref (icon_theme_path);
+ icon_theme_path = g_object_ref (path);
}
- g_object_unref (index);
+ g_object_set (gtk_settings_get_for_screen (gdk_screen_get_default ()),
+ "gtk-icon-theme-name", icon_theme_name,
+ NULL);
+ }
+ else
+ {
+ /* this is the first call upon initialization */
+ icon_theme_path = g_object_ref (path);
}
-
- g_object_unref (hicolor);
}
+ g_free (icon_theme_name);
+ g_object_unref (search_path);
g_object_unref (path);
}
@@ -538,10 +584,13 @@ gimp_icons_init (void)
{
static gboolean initialized = FALSE;
- GdkPixbuf *pixbuf;
- GError *error = NULL;
- gchar *icons_dir;
- gint i;
+ GtkSettings *settings;
+ GdkPixbuf *pixbuf;
+ GError *error = NULL;
+ gchar *icons_dir;
+ gchar *system_icon_theme;
+ gchar *gimp_icon_theme;
+ gint i;
if (initialized)
return;
@@ -580,26 +629,51 @@ gimp_icons_init (void)
* the path again and acts as fallback for missing icons in other
* themes.
*/
- if (! default_icon_theme_path)
- default_icon_theme_path = gimp_data_directory_file ("icons",
- GIMP_DEFAULT_ICON_THEME,
- NULL);
+ if (! default_search_path)
+ default_search_path = gimp_data_directory_file ("icons",
+ NULL);
- icons_dir = g_file_get_path (default_icon_theme_path);
+ icons_dir = g_file_get_path (default_search_path);
gtk_icon_theme_prepend_search_path (gtk_icon_theme_get_default (),
icons_dir);
g_free (icons_dir);
/* if an icon theme was chosen before init(), change to it */
- if (icon_theme_path &&
- ! g_file_equal (icon_theme_path, default_icon_theme_path))
+ if (icon_theme_path)
{
- icons_dir = g_file_get_path (icon_theme_path);
- gtk_icon_theme_prepend_search_path (gtk_icon_theme_get_default (),
- icons_dir);
- g_free (icons_dir);
+ GFile *search_path = g_file_get_parent (icon_theme_path);
+
+ if (!g_file_equal (search_path, default_search_path))
+ {
+ gchar *icon_dir = g_file_get_path (search_path);
+
+ gtk_icon_theme_prepend_search_path (gtk_icon_theme_get_default (),
+ icon_dir);
+ g_free (icon_dir);
+ }
+ g_object_unref (search_path);
+
+ gimp_icon_theme = g_file_get_basename (icon_theme_path);
}
+ else
+ {
+ gimp_icon_theme = g_strdup (GIMP_DEFAULT_ICON_THEME);
+ }
+
+ settings = gtk_settings_get_for_screen (gdk_screen_get_default ());
+
+ g_object_get (settings, "gtk-icon-theme-name", &system_icon_theme, NULL);
+
+ g_object_set (settings,
+ "gtk-fallback-icon-theme", system_icon_theme,
+ "gtk-icon-theme-name", gimp_icon_theme,
+ NULL);
+
+ g_free (gimp_icon_theme);
+ g_free (system_icon_theme);
+ g_signal_connect (settings, "notify::gtk-icon-theme-name",
+ G_CALLBACK (gimp_icons_notify_system_icon_theme), NULL);
pixbuf = gdk_pixbuf_new_from_resource ("/org/gimp/icons/64/gimp-wilber-eek.png",
&error);
diff --git a/themes/Small/gtkrc b/themes/Small/gtkrc
index 37a553f..7ec3abc 100644
--- a/themes/Small/gtkrc
+++ b/themes/Small/gtkrc
@@ -15,19 +15,19 @@ style "gimp-default-style"
{
stock["gtk-dialog-error"] =
{
- { "../../icons/Color/hicolor/64x64/apps/gimp-error.png", *, *, "gtk-dialog" }
+ { "../../icons/Color/64x64/apps/gimp-error.png", *, *, "gtk-dialog" }
}
stock["gtk-dialog-info"] =
{
- { "../../icons/Color/hicolor/64x64/apps/gimp-info.png", *, *, "gtk-dialog" }
+ { "../../icons/Color/64x64/apps/gimp-info.png", *, *, "gtk-dialog" }
}
stock["gtk-dialog-question"] =
{
- { "../../icons/Color/hicolor/64x64/apps/gimp-question.png", *, *, "gtk-dialog" }
+ { "../../icons/Color/64x64/apps/gimp-question.png", *, *, "gtk-dialog" }
}
stock["gtk-dialog-warning"] =
{
- { "../../icons/Color/hicolor/64x64/apps/gimp-warning.png", *, *, "gtk-dialog" }
+ { "../../icons/Color/64x64/apps/gimp-warning.png", *, *, "gtk-dialog" }
}
# Uncommenting this line allows to set a different (smaller) font for GIMP.
diff --git a/themes/System/gtkrc b/themes/System/gtkrc
index dd30636..dae779c 100644
--- a/themes/System/gtkrc
+++ b/themes/System/gtkrc
@@ -21,19 +21,19 @@ style "gimp-default-style"
{
stock["gtk-dialog-error"] =
{
- { "../../icons/Color/hicolor/64x64/apps/gimp-error.png", *, *, "gtk-dialog" }
+ { "../../icons/Color/64x64/apps/gimp-error.png", *, *, "gtk-dialog" }
}
stock["gtk-dialog-info"] =
{
- { "../../icons/Color/hicolor/64x64/apps/gimp-info.png", *, *, "gtk-dialog" }
+ { "../../icons/Color/64x64/apps/gimp-info.png", *, *, "gtk-dialog" }
}
stock["gtk-dialog-question"] =
{
- { "../../icons/Color/hicolor/64x64/apps/gimp-question.png", *, *, "gtk-dialog" }
+ { "../../icons/Color/64x64/apps/gimp-question.png", *, *, "gtk-dialog" }
}
stock["gtk-dialog-warning"] =
{
- { "../../icons/Color/hicolor/64x64/apps/gimp-warning.png", *, *, "gtk-dialog" }
+ { "../../icons/Color/64x64/apps/gimp-warning.png", *, *, "gtk-dialog" }
}
GtkPaned::handle-size = 6
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]