inspector: Don't hardcode builtin themes

Insteead, enumerate the resources that are available. Fixes windows
themes not being listed in the inspector.
This commit is contained in:
Benjamin Otte
2016-02-04 13:34:34 +01:00
parent d0fd7990c3
commit b783670820

View File

@ -242,14 +242,19 @@ init_theme (GtkInspectorVisual *vis)
GHashTable *t; GHashTable *t;
GHashTableIter iter; GHashTableIter iter;
gchar *theme, *path; gchar *theme, *path;
gchar **builtin_themes;
GList *list, *l; GList *list, *l;
guint i;
t = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL); t = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
/* Builtin themes */ /* Builtin themes */
g_hash_table_add (t, g_strdup ("Adwaita")); builtin_themes = g_resources_enumerate_children ("/org/gtk/libgtk/theme", 0, NULL);
g_hash_table_add (t, g_strdup ("HighContrast")); for (i = 0; builtin_themes[i] != NULL; i++)
g_hash_table_add (t, g_strdup ("HighContrastInverse")); {
g_hash_table_add (t, g_strdup ("Raleigh")); if (g_str_has_suffix (builtin_themes[i], "/"))
g_hash_table_add (t, g_strndup (builtin_themes[i], strlen (builtin_themes[i]) - 1));
}
g_strfreev (builtin_themes);
path = _gtk_css_provider_get_theme_dir (); path = _gtk_css_provider_get_theme_dir ();
fill_gtk (path, t); fill_gtk (path, t);