From 909873bc6f6459dd1975979373a10dc3ad23a1a3 Mon Sep 17 00:00:00 2001 From: Ignacio Casal Quinteiro Date: Wed, 12 Sep 2012 16:10:56 +0200 Subject: [PATCH] Load settings.ini also from XDG_CONFIG_DIRS https://bugzilla.gnome.org/show_bug.cgi?id=683874 --- gtk/gtksettings.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/gtk/gtksettings.c b/gtk/gtksettings.c index bfcd8c9390..cfcc192484 100644 --- a/gtk/gtksettings.c +++ b/gtk/gtksettings.c @@ -71,7 +71,9 @@ * utilities that let the user change these settings. In the absence of * an Xsettings manager, GTK+ reads default values for settings from * settings.ini files in - * /etc/gtk-3.0 and $XDG_CONFIG_HOME/gtk-3.0. These files must be valid key files (see #GKeyFile), and have + * /etc/gtk-3.0, $XDG_CONFIG_DIRS/gtk-3.0 + * and $XDG_CONFIG_HOME/gtk-3.0. + * These files must be valid key files (see #GKeyFile), and have * a section called Settings. Themes can also provide default values * for settings by installing a settings.ini file * next to their gtk.css file. @@ -277,6 +279,8 @@ gtk_settings_init (GtkSettings *settings) GParamSpec **pspecs, **p; guint i = 0; gchar *path; + const gchar * const *config_dirs; + const gchar *config_dir; priv = G_TYPE_INSTANCE_GET_PRIVATE (settings, GTK_TYPE_SETTINGS, @@ -319,6 +323,15 @@ gtk_settings_init (GtkSettings *settings) gtk_settings_load_from_key_file (settings, path, GTK_SETTINGS_SOURCE_DEFAULT); g_free (path); + config_dirs = g_get_system_config_dirs (); + for (config_dir = *config_dirs; *config_dirs != NULL; config_dirs++) + { + path = g_build_filename (config_dir, "gtk-3.0", "settings.ini", NULL); + if (g_file_test (path, G_FILE_TEST_EXISTS)) + gtk_settings_load_from_key_file (settings, path, GTK_SETTINGS_SOURCE_DEFAULT); + g_free (path); + } + path = g_build_filename (g_get_user_config_dir (), "gtk-3.0", "settings.ini", NULL); if (g_file_test (path, G_FILE_TEST_EXISTS)) gtk_settings_load_from_key_file (settings, path, GTK_SETTINGS_SOURCE_DEFAULT);