Merge branch 'matthiasc/for-main' into 'main'

inspector: Look for icon themes in system data dirs

See merge request GNOME/gtk!5567
This commit is contained in:
Matthias Clasen 2023-02-28 16:35:48 +00:00
commit 2a862c05a1

View File

@ -630,6 +630,8 @@ fill_icons (const char *path,
const char *dir_entry; const char *dir_entry;
GDir *dir; GDir *dir;
g_print ("fill icons from %s\n", path);
dir = g_dir_open (path, 0, NULL); dir = g_dir_open (path, 0, NULL);
if (!dir) if (!dir)
return; return;
@ -658,6 +660,7 @@ init_icons (GtkInspectorVisual *vis)
GList *list, *l; GList *list, *l;
int i; int i;
GtkStringList *names; GtkStringList *names;
const char * const *dirs;
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);
@ -669,6 +672,14 @@ init_icons (GtkInspectorVisual *vis)
fill_icons (path, t); fill_icons (path, t);
g_free (path); g_free (path);
dirs = g_get_system_data_dirs ();
for (i = 0; dirs[i]; i++)
{
path = g_build_filename (dirs[i], "icons", NULL);
fill_icons (path, t);
g_free (path);
}
list = NULL; list = NULL;
g_hash_table_iter_init (&iter, t); g_hash_table_iter_init (&iter, t);
while (g_hash_table_iter_next (&iter, (gpointer *)&theme, NULL)) while (g_hash_table_iter_next (&iter, (gpointer *)&theme, NULL))
@ -723,6 +734,7 @@ init_cursors (GtkInspectorVisual *vis)
GList *list, *l; GList *list, *l;
GtkStringList *names; GtkStringList *names;
int i; int i;
const char * const *dirs;
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);
@ -734,6 +746,14 @@ init_cursors (GtkInspectorVisual *vis)
fill_cursors (path, t); fill_cursors (path, t);
g_free (path); g_free (path);
dirs = g_get_system_data_dirs ();
for (i = 0; dirs[i]; i++)
{
path = g_build_filename (dirs[i], "icons", NULL);
fill_cursors (path, t);
g_free (path);
}
list = NULL; list = NULL;
g_hash_table_iter_init (&iter, t); g_hash_table_iter_init (&iter, t);
while (g_hash_table_iter_next (&iter, (gpointer *)&theme, NULL)) while (g_hash_table_iter_next (&iter, (gpointer *)&theme, NULL))