summaryrefslogtreecommitdiff
path: root/gtk/gtkcssprovider.c
diff options
context:
space:
mode:
authorBenjamin Otte <otte@redhat.com>2012-09-19 16:30:27 +0200
committerBenjamin Otte <otte@redhat.com>2012-10-31 11:09:09 +0100
commitb41215bdeaff963a4ad8be9cda8d841feb612b2b (patch)
treee78c8dd9b1f98b273d6a5789689f65b1248e5798 /gtk/gtkcssprovider.c
parent738b453c66b0135c665289b9ffe2b26181cf77dc (diff)
downloadgtk+-b41215bdeaff963a4ad8be9cda8d841feb612b2b.tar.gz
cssprovider: Move fallback code into _gtk_css_provider_load_named()
This makes sure the full theme loading logic resides in one function and isn't scattered around. As a side-effect, the hash table kept by gtk_css_provider_get_named() will now be populated with fallback themes. This will not be a problem after the next commit though.
Diffstat (limited to 'gtk/gtkcssprovider.c')
-rw-r--r--gtk/gtkcssprovider.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/gtk/gtkcssprovider.c b/gtk/gtkcssprovider.c
index 92506ee6d2..6f9e758f0d 100644
--- a/gtk/gtkcssprovider.c
+++ b/gtk/gtkcssprovider.c
@@ -2792,6 +2792,22 @@ _gtk_css_provider_load_named (GtkCssProvider *provider,
g_free (path);
g_free (dir);
}
+ else
+ {
+ /* Things failed! Fall back! Fall back! */
+
+ if (variant)
+ {
+ /* If there was a variant, try without */
+ _gtk_css_provider_load_named (provider, name, NULL);
+ }
+ else
+ {
+ /* Worst case, fall back to Raleigh */
+ g_return_if_fail (!g_str_equal (name, "Raleigh")); /* infloop protection */
+ _gtk_css_provider_load_named (provider, "Raleigh", NULL);
+ }
+ }
}
/**