summaryrefslogtreecommitdiff
path: root/gtk/gtksettings.c
diff options
context:
space:
mode:
authorBastien Nocera <hadess@hadess.net>2011-01-31 00:30:00 +0000
committerMatthias Clasen <mclasen@redhat.com>2011-01-30 21:22:12 -0500
commitb98caf938594504508dfc4546d6f606e6edeab9d (patch)
treea376466cf3ff7871938f9b22fc3bda7ca7ee923f /gtk/gtksettings.c
parent7f3aa920862bf18e23216d4bce975e805c7461e4 (diff)
downloadgtk+-b98caf938594504508dfc4546d6f606e6edeab9d.tar.gz
GtkCssProvider: Take into account variant
When loading a theme, make sure we take into account the variant so we don't use the plain version when the theme changes. Also make sure to fallback to the plain theme when loading a variant fails. https://bugzilla.gnome.org/show_bug.cgi?id=640983
Diffstat (limited to 'gtk/gtksettings.c')
-rw-r--r--gtk/gtksettings.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/gtk/gtksettings.c b/gtk/gtksettings.c
index 5008f09097..ee9c3361ab 100644
--- a/gtk/gtksettings.c
+++ b/gtk/gtksettings.c
@@ -2672,7 +2672,8 @@ settings_update_theme (GtkSettings *settings)
static GQuark quark_theme_name = 0;
GtkSettingsPrivate *priv = settings->priv;
- GtkCssProvider *provider, *new_provider = NULL;
+ GtkCssProvider *provider;
+ GtkCssProvider *new_provider;
gboolean prefer_dark_theme;
gchar *theme_name;
@@ -2686,14 +2687,15 @@ settings_update_theme (GtkSettings *settings)
"gtk-application-prefer-dark-theme", &prefer_dark_theme,
NULL);
+ new_provider = NULL;
+
if (theme_name && *theme_name)
{
- gchar *variant = NULL;
-
if (prefer_dark_theme)
- variant = "dark";
+ new_provider = gtk_css_provider_get_named (theme_name, "dark");
- new_provider = gtk_css_provider_get_named (theme_name, variant);
+ if (!new_provider)
+ new_provider = gtk_css_provider_get_named (theme_name, NULL);
}
if (new_provider != provider)