From b41215bdeaff963a4ad8be9cda8d841feb612b2b Mon Sep 17 00:00:00 2001 From: Benjamin Otte Date: Wed, 19 Sep 2012 16:30:27 +0200 Subject: 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. --- gtk/gtkcssprovider.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'gtk/gtkcssprovider.c') 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); + } + } } /** -- cgit v1.2.1