[gtk+/composite-templates] Load settings.ini also from XDG_CONFIG_DIRS



commit d90d140f991608dc0fcaaa5f24decd5bd6a87723
Author: Ignacio Casal Quinteiro <icq gnome org>
Date:   Wed Sep 12 16:10:56 2012 +0200

    Load settings.ini also from XDG_CONFIG_DIRS
    
    https://bugzilla.gnome.org/show_bug.cgi?id=683874

 gtk/gtksettings.c |   15 ++++++++++++++-
 1 files changed, 14 insertions(+), 1 deletions(-)
---
diff --git a/gtk/gtksettings.c b/gtk/gtksettings.c
index bfcd8c9..cfcc192 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
  * <filename>settings.ini</filename> files in
- * <filename>/etc/gtk-3.0</filename> and <filename>$XDG_CONFIG_HOME/gtk-3.0</filename>. These files must be valid key files (see #GKeyFile), and have
+ * <filename>/etc/gtk-3.0</filename>, <filename>$XDG_CONFIG_DIRS/gtk-3.0</filename>
+ * and <filename>$XDG_CONFIG_HOME/gtk-3.0</filename>.
+ * 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 <filename>settings.ini</filename> file
  * next to their <filename>gtk.css</filename> 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);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]