[Xfce4-commits] [apps/xfdashboard] 04/04: Allow path to UI file of settings application be configurable and overriden by environment variable XFDASHBOARD_UI_PATH

noreply at xfce.org noreply at xfce.org
Wed Sep 16 16:09:42 CEST 2015


This is an automated email from the git hooks/post-receive script.

nomad pushed a commit to branch master
in repository apps/xfdashboard.

commit 644b7142a01e3e0afb567112c4a090e5880837c5
Author: Stephan Haller <nomad at froevel.de>
Date:   Wed Sep 16 16:08:11 2015 +0200

    Allow path to UI file of settings application be configurable and overriden by environment variable XFDASHBOARD_UI_PATH
    
    This makes development easier to test modifications of UI file without installing it system-wide.
---
 settings/settings.c |   41 ++++++++++++++++++++++++++++++++---------
 1 file changed, 32 insertions(+), 9 deletions(-)

diff --git a/settings/settings.c b/settings/settings.c
index 8afd8ad..a274bcd 100644
--- a/settings/settings.c
+++ b/settings/settings.c
@@ -1034,18 +1034,41 @@ static gboolean _xfdashboard_settings_create_builder(XfdashboardSettings *self)
 	/* If builder is already set up return immediately */
 	if(priv->builder) return(TRUE);
 
-	/* Find UI file */
-	builderFile=g_build_filename(PACKAGE_DATADIR, "xfdashboard", PREFERENCES_UI_FILE, NULL);
-	g_debug("Trying UI file: %s", builderFile);
-	if(!g_file_test(builderFile, G_FILE_TEST_EXISTS | G_FILE_TEST_IS_REGULAR))
+	/* Search UI file in given environment variable if set.
+	 * This makes development easier to test modifications at UI file.
+	 */
+	if(!builderFile)
 	{
-		g_critical(_("Could not find UI file '%s'."), builderFile);
+		const gchar		*envPath;
 
-		/* Release allocated resources */
-		g_free(builderFile);
+		envPath=g_getenv("XFDASHBOARD_UI_PATH");
+		if(envPath)
+		{
+			builderFile=g_build_filename(envPath, PREFERENCES_UI_FILE, NULL);
+			g_debug("Trying UI file: %s", builderFile);
+			if(!g_file_test(builderFile, G_FILE_TEST_EXISTS | G_FILE_TEST_IS_REGULAR))
+			{
+				g_free(builderFile);
+				builderFile=NULL;
+			}
+		}
+	}
 
-		/* Return fail result */
-		return(FALSE);
+	/* Find UI file at install path */
+	if(!builderFile)
+	{
+		builderFile=g_build_filename(PACKAGE_DATADIR, "xfdashboard", PREFERENCES_UI_FILE, NULL);
+		g_debug("Trying UI file: %s", builderFile);
+		if(!g_file_test(builderFile, G_FILE_TEST_EXISTS | G_FILE_TEST_IS_REGULAR))
+		{
+			g_critical(_("Could not find UI file '%s'."), builderFile);
+
+			/* Release allocated resources */
+			g_free(builderFile);
+
+			/* Return fail result */
+			return(FALSE);
+		}
 	}
 
 	/* Create builder */

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Xfce4-commits mailing list