[Xfce4-commits] <garcon:master> Also try the garcon install sysconfigdir for config lookups.

Nick Schermer noreply at xfce.org
Thu Jan 20 11:34:01 CET 2011


Updating branch refs/heads/master
         to 799e206b6780ee6bab2bb56debf8412dca0346f5 (commit)
       from 16b348163bb064eddecd222e24da5e52e93abb56 (commit)

commit 799e206b6780ee6bab2bb56debf8412dca0346f5
Author: Nick Schermer <nick at xfce.org>
Date:   Thu Jan 20 11:31:10 2011 +0100

    Also try the garcon install sysconfigdir for config lookups.
    
    Hard-code the $(sysconfdir)/xdg path in garcon_config_lookup(),
    so the chance we find xfce-applications.menu is higher on
    systems that do not have XDG_CONFIG_DIRS setup properly.

 garcon/Makefile.am     |    1 +
 garcon/garcon-config.c |   11 ++++++++++-
 2 files changed, 11 insertions(+), 1 deletions(-)

diff --git a/garcon/Makefile.am b/garcon/Makefile.am
index b524b38..3ba0b19 100644
--- a/garcon/Makefile.am
+++ b/garcon/Makefile.am
@@ -22,6 +22,7 @@ INCLUDES = 								\
 	-DGARCON_COMPILATION						\
 	-DGARCON_VERSION_API=\"$(GARCON_VERSION_API)\"			\
 	-DG_LOG_DOMAIN=\"garcon\"					\
+	-DSYSCONFIGDIR=\"$(sysconfdir)/xdg\"				\
 	$(PLATFORM_CFLAGS)
 
 lib_LTLIBRARIES = 							\
diff --git a/garcon/garcon-config.c b/garcon/garcon-config.c
index a6917ee..9f69f58 100644
--- a/garcon/garcon-config.c
+++ b/garcon/garcon-config.c
@@ -169,7 +169,7 @@ garcon_config_lookup (const gchar *filename)
   path = g_build_filename (g_get_user_config_dir (), filename, NULL);
   if (g_path_is_absolute (path) && g_file_test (path, G_FILE_TEST_IS_REGULAR))
     return path;
-    
+
   g_free (path);
   path = NULL;
 
@@ -186,6 +186,15 @@ garcon_config_lookup (const gchar *filename)
         }
     }
 
+  /* Also try the install prefix of garcon in case XDG_CONFIG_DIRS is not
+   * properly set (startxfce4 for exaple should take care of that) */
+  path = g_build_filename (SYSCONFIGDIR, filename, NULL);
+  if (g_path_is_absolute (path) && g_file_test (path, G_FILE_TEST_IS_REGULAR))
+    return path;
+
+  g_free (path);
+  path = NULL;
+
   /* Return the path or NULL if the file could not be found */
   return path;
 }



More information about the Xfce4-commits mailing list