summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2006-01-11 06:30:38 +0000
committerMatthias Clasen <matthiasc@src.gnome.org>2006-01-11 06:30:38 +0000
commit98179253dbdc74266687aec0a85c2e746b7ce51f (patch)
tree25eb6d4479f7d90ead722ce994e57f49f43fb4b9
parent1583ef9c2118649f1f6638964a172b44ea5674f1 (diff)
downloadgdk-pixbuf-98179253dbdc74266687aec0a85c2e746b7ce51f.tar.gz
Allow falling back to another icon theme before hicolor. (#325546, Rodney
2006-01-11 Matthias Clasen <mclasen@redhat.com> Allow falling back to another icon theme before hicolor. (#325546, Rodney Dawes) * gtk/gtksettings.c: Add a gtk-fallback-icon-theme setting. * gdk/x11/gdkevents-x11.c: Map it to the XSetting Net/FallbackIconTheme. * gtk/gtkicontheme.c: Consult the fallback icon theme before looking in hicolor.
-rw-r--r--ChangeLog12
-rw-r--r--ChangeLog.pre-2-1012
-rw-r--r--gdk/x11/gdkevents-x11.c1
-rw-r--r--gtk/gtkicontheme.c33
-rw-r--r--gtk/gtksettings.c11
5 files changed, 65 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index a95dc3cb3..fc13c7bcd 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2006-01-11 Matthias Clasen <mclasen@redhat.com>
+
+ Allow falling back to another icon theme before
+ hicolor. (#325546, Rodney Dawes)
+
+ * gtk/gtksettings.c: Add a gtk-fallback-icon-theme setting.
+
+ * gdk/x11/gdkevents-x11.c: Map it to the XSetting Net/FallbackIconTheme.
+
+ * gtk/gtkicontheme.c: Consult the fallback icon theme before
+ looking in hicolor.
+
2006-01-10 Matthias Clasen <mclasen@redhat.com>
* gtk/gtkcalendar.c (gtk_calendar_focus_out): Queue a draw
diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10
index a95dc3cb3..fc13c7bcd 100644
--- a/ChangeLog.pre-2-10
+++ b/ChangeLog.pre-2-10
@@ -1,3 +1,15 @@
+2006-01-11 Matthias Clasen <mclasen@redhat.com>
+
+ Allow falling back to another icon theme before
+ hicolor. (#325546, Rodney Dawes)
+
+ * gtk/gtksettings.c: Add a gtk-fallback-icon-theme setting.
+
+ * gdk/x11/gdkevents-x11.c: Map it to the XSetting Net/FallbackIconTheme.
+
+ * gtk/gtkicontheme.c: Consult the fallback icon theme before
+ looking in hicolor.
+
2006-01-10 Matthias Clasen <mclasen@redhat.com>
* gtk/gtkcalendar.c (gtk_calendar_focus_out): Queue a draw
diff --git a/gdk/x11/gdkevents-x11.c b/gdk/x11/gdkevents-x11.c
index 0a273a4b6..250c13f55 100644
--- a/gdk/x11/gdkevents-x11.c
+++ b/gdk/x11/gdkevents-x11.c
@@ -2807,6 +2807,7 @@ static const struct
{ "Xft/HintStyle", "gtk-xft-hintstyle" },
{ "Xft/RGBA", "gtk-xft-rgba" },
{ "Xft/DPI", "gtk-xft-dpi" },
+ { "Net/FallbackIconTheme", "gtk-fallback-icon-theme" }
};
static void
diff --git a/gtk/gtkicontheme.c b/gtk/gtkicontheme.c
index 7a0628b03..b35ae2e39 100644
--- a/gtk/gtkicontheme.c
+++ b/gtk/gtkicontheme.c
@@ -72,6 +72,7 @@ struct _GtkIconThemePrivate
guint pixbuf_supports_svg : 1;
char *current_theme;
+ char *fallback_theme;
char **search_path;
int search_path_len;
@@ -409,11 +410,15 @@ update_current_theme (GtkIconTheme *icon_theme)
if (!priv->custom_theme)
{
gchar *theme = NULL;
+ gchar *fallback_theme = NULL;
+ gboolean changed = FALSE;
if (priv->screen)
{
GtkSettings *settings = gtk_settings_get_for_screen (priv->screen);
- g_object_get (settings, "gtk-icon-theme-name", &theme, NULL);
+ g_object_get (settings,
+ "gtk-icon-theme-name", &theme,
+ "gtk-fallback-icon-theme", &fallback_theme, NULL);
}
if (!theme)
@@ -424,10 +429,26 @@ update_current_theme (GtkIconTheme *icon_theme)
g_free (priv->current_theme);
priv->current_theme = theme;
- do_theme_change (icon_theme);
+ changed = TRUE;
}
else
g_free (theme);
+
+ if ((priv->fallback_theme && !fallback_theme) ||
+ (!priv->fallback_theme && fallback_theme) ||
+ (priv->fallback_theme && fallback_theme &&
+ strcmp (priv->fallback_theme, fallback_theme) != 0))
+ {
+ g_free (priv->fallback_theme);
+ priv->fallback_theme = fallback_theme;
+
+ changed = TRUE;
+ }
+ else
+ g_free (fallback_theme);
+
+ if (changed)
+ do_theme_change (icon_theme);
}
}
@@ -501,6 +522,8 @@ gtk_icon_theme_set_screen (GtkIconTheme *icon_theme,
G_CALLBACK (display_closed), icon_theme);
g_signal_connect (settings, "notify::gtk-icon-theme-name",
G_CALLBACK (theme_changed), icon_theme);
+ g_signal_connect (settings, "notify::gtk-fallback-icon-theme-name",
+ G_CALLBACK (theme_changed), icon_theme);
}
update_current_theme (icon_theme);
@@ -1025,8 +1048,10 @@ load_themes (GtkIconTheme *icon_theme)
priv->all_icons = g_hash_table_new (g_str_hash, g_str_equal);
insert_theme (icon_theme, priv->current_theme);
-
- /* Always look in the "default" icon theme */
+
+ /* Always look in the "default" icon theme, and in a fallback theme */
+ if (priv->fallback_theme)
+ insert_theme (icon_theme, priv->fallback_theme);
insert_theme (icon_theme, DEFAULT_THEME_NAME);
priv->themes = g_list_reverse (priv->themes);
diff --git a/gtk/gtksettings.c b/gtk/gtksettings.c
index 363123c82..9f3c11925 100644
--- a/gtk/gtksettings.c
+++ b/gtk/gtksettings.c
@@ -62,6 +62,7 @@ enum {
PROP_SPLIT_CURSOR,
PROP_THEME_NAME,
PROP_ICON_THEME_NAME,
+ PROP_FALLBACK_ICON_THEME,
PROP_KEY_THEME_NAME,
PROP_MENU_BAR_ACCEL,
PROP_DND_DRAG_THRESHOLD,
@@ -243,6 +244,7 @@ gtk_settings_class_init (GtkSettingsClass *class)
GTK_PARAM_READWRITE),
NULL);
g_assert (result == PROP_THEME_NAME);
+
result = settings_install_property_parser (class,
g_param_spec_string ("gtk-icon-theme-name",
P_("Icon Theme Name"),
@@ -251,6 +253,15 @@ gtk_settings_class_init (GtkSettingsClass *class)
GTK_PARAM_READWRITE),
NULL);
g_assert (result == PROP_ICON_THEME_NAME);
+
+ result = settings_install_property_parser (class,
+ g_param_spec_string ("gtk-fallback-icon-theme",
+ P_("Fallback Icon Theme Name"),
+ P_("Name of a icon theme to fall back to"),
+ NULL,
+ GTK_PARAM_READWRITE),
+ NULL);
+ g_assert (result == PROP_FALLBACK_ICON_THEME);
result = settings_install_property_parser (class,
g_param_spec_string ("gtk-key-theme-name",