Commit fd329e0e authored by Matthias Clasen's avatar Matthias Clasen
Browse files

Make theme fallback working with the new names

Since we are likely going to see theme names like
Adwaita and HighContrast, make fallback work as follows:

Adwaita -> Default
Adwaita:dark -> Default:dark
HighContrast -> Default:hc
HighContrast:dark -> Default:hc-dark
HighContrastInverse -> Default:hc-dark

Other themes will fall back to Default, as before.
parent 0bf3e4c2
Pipeline #271473 failed with stages
in 21 minutes and 41 seconds
......@@ -1385,16 +1385,20 @@ gtk_css_provider_load_named (GtkCssProvider *provider,
else
{
/* Things failed! Fall back! Fall back! */
if (variant)
if (strcmp (name, "HighContrast") == 0)
{
/* If there was a variant, try without */
gtk_css_provider_load_named (provider, name, NULL);
if (g_strcmp0 (variant, "dark") == 0)
gtk_css_provider_load_named (provider, DEFAULT_THEME_NAME, "hc-dark");
else
gtk_css_provider_load_named (provider, DEFAULT_THEME_NAME, "hc");
}
else if (strcmp (name, "HighConstrastInverse") == 0)
gtk_css_provider_load_named (provider, DEFAULT_THEME_NAME, "hc-dark");
else if (strcmp (name, DEFAULT_THEME_NAME) != 0)
gtk_css_provider_load_named (provider, DEFAULT_THEME_NAME, variant);
else
{
/* Worst case, fall back to the default */
g_return_if_fail (!g_str_equal (name, DEFAULT_THEME_NAME)); /* infloop protection */
g_return_if_fail (variant != NULL);
gtk_css_provider_load_named (provider, DEFAULT_THEME_NAME, NULL);
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment