[Xfce4-commits] <garcon:jannis/global-monitoring> Add method garcon_config_build_paths().

Jannis Pohlmann noreply at xfce.org
Sun Sep 5 14:50:11 CEST 2010


Updating branch refs/heads/jannis/global-monitoring
         to 02ef07e7a192d3fa3f9d6a4d004b2a1ec9ce5caf (commit)
       from 8f0989fca751ea0a91a47792f1312984b95b8733 (commit)

commit 02ef07e7a192d3fa3f9d6a4d004b2a1ec9ce5caf
Author: Jannis Pohlmann <jannis at xfce.org>
Date:   Wed Mar 10 20:53:53 2010 +0100

    Add method garcon_config_build_paths().
    
    This method builds all config base dir paths for a relative filename
    like "menus/applications.menu".

 garcon/garcon-config.c                         |   23 ++++++++++
 garcon/{garcon-config.h.in => garcon-config.h} |   52 ++++--------------------
 2 files changed, 31 insertions(+), 44 deletions(-)

diff --git a/garcon/garcon-config.c b/garcon/garcon-config.c
index 56fef3d..75693d3 100644
--- a/garcon/garcon-config.c
+++ b/garcon/garcon-config.c
@@ -122,6 +122,29 @@ garcon_check_version (guint required_major,
 
 
 
+gchar **
+garcon_config_build_paths (const gchar *filename)
+{
+  const gchar * const *dirs;
+  gchar              **paths;
+  guint                n;
+
+  g_return_val_if_fail (filename != NULL && *filename != '\0', NULL);
+
+  dirs = g_get_system_config_dirs ();
+
+  paths = g_new0 (gchar *, 1 + g_strv_length ((gchar **)dirs) + 1);
+  
+  paths[0] = g_build_filename (g_get_user_config_dir (), filename, NULL);
+  for (n = 1; dirs[n-1] != NULL; ++n)
+    paths[n] = g_build_filename (dirs[n-1], filename, NULL);
+  paths[n] = NULL;
+
+  return paths;
+}
+
+
+
 /**
  * garcon_config_lookup:
  * @filename : relative filename of the config resource.
diff --git a/garcon/garcon-config.h.in b/garcon/garcon-config.h
similarity index 51%
copy from garcon/garcon-config.h.in
copy to garcon/garcon-config.h
index baae3b8..c7494e8 100644
--- a/garcon/garcon-config.h.in
+++ b/garcon/garcon-config.h
@@ -30,47 +30,10 @@
 
 G_BEGIN_DECLS
 
-/**
- * GARCON_MAJOR_VERSION:
- *
- * The major version number of the garcon library.
- * Like garcon_major_version, but from the headers used at
- * application compile time, rather than from the library
- * linked against at application run time.
- **/
-#define GARCON_MAJOR_VERSION @GARCON_VERSION_MAJOR@
-
-/**
- * GARCON_MINOR_VERSION:
- *
- * The minor version number of the garcon library.
- * Like garcon_minor_version, but from the headers used at
- * application compile time, rather than from the library
- * linked against at application run time.
- **/
-#define GARCON_MINOR_VERSION @GARCON_VERSION_MINOR@
+#define GARCON_MAJOR_VERSION 0
+#define GARCON_MINOR_VERSION 1
+#define GARCON_MICRO_VERSION 0
 
-/**
- * GARCON_MICRO_VERSION:
- *
- * The micro version number of the garcon library.
- * Like garcon_micro_version, but from the headers used at
- * application compile time, rather than from the library
- * linked against at application run time.
- **/
-#define GARCON_MICRO_VERSION @GARCON_VERSION_MICRO@
-
-/**
- * GARCON_CHECK_VERSION:
- * @major : the major version number.
- * @minor : the minor version number.
- * @micro : the micro version number.
- *
- * Checks the version of the garcon library.
- *
- * Returns: %TRUE if the version of the garcon header files is
- *          the same as or newer than the passed-in version.
- **/
 #define GARCON_CHECK_VERSION(major,minor,micro) \
   (GARCON_MAJOR_VERSION > (major) \
    || (GARCON_MAJOR_VERSION == (major) \
@@ -83,11 +46,12 @@ extern const guint garcon_major_version;
 extern const guint garcon_minor_version;
 extern const guint garcon_micro_version;
 
-const gchar *garcon_check_version (guint required_major,
-                                   guint required_minor,
-                                   guint required_micro);
+const gchar *garcon_check_version      (guint        required_major,
+                                        guint        required_minor,
+                                        guint        required_micro);
 
-gchar       *garcon_config_lookup (const gchar *filename) G_GNUC_MALLOC G_GNUC_WARN_UNUSED_RESULT;
+gchar      **garcon_config_build_paths (const gchar *filename) G_GNUC_MALLOC G_GNUC_WARN_UNUSED_RESULT;
+gchar       *garcon_config_lookup      (const gchar *filename) G_GNUC_MALLOC G_GNUC_WARN_UNUSED_RESULT;
 
 G_END_DECLS
 



More information about the Xfce4-commits mailing list