mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-12-27 14:10:30 +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
|
||||
{
|
||||
/* 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);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user