mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-12-28 22:41:43 +00:00
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.
This commit is contained in:
parent
0bf3e4c25b
commit
fd329e0ec5
@ -1385,16 +1385,20 @@ gtk_css_provider_load_named (GtkCssProvider *provider,
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* Things failed! Fall back! Fall back! */
|
/* Things failed! Fall back! Fall back! */
|
||||||
|
if (strcmp (name, "HighContrast") == 0)
|
||||||
if (variant)
|
|
||||||
{
|
{
|
||||||
/* If there was a variant, try without */
|
if (g_strcmp0 (variant, "dark") == 0)
|
||||||
gtk_css_provider_load_named (provider, name, NULL);
|
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
|
else
|
||||||
{
|
{
|
||||||
/* Worst case, fall back to the default */
|
g_return_if_fail (variant != NULL);
|
||||||
g_return_if_fail (!g_str_equal (name, DEFAULT_THEME_NAME)); /* infloop protection */
|
|
||||||
gtk_css_provider_load_named (provider, DEFAULT_THEME_NAME, NULL);
|
gtk_css_provider_load_named (provider, DEFAULT_THEME_NAME, NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user