[Xfce4-commits] [apps/xfdashboard] 01/02: Another try for a workaround at FreeBSD with broken directory monitor in Glib

noreply at xfce.org noreply at xfce.org
Sat Nov 28 09:56:55 CET 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 13b037eedc6e9c329e4ef1dad659f1c3e1c24c48
Author: Stephan Haller <nomad at froevel.de>
Date:   Sat Nov 28 09:55:42 2015 +0100

    Another try for a workaround at FreeBSD with broken directory monitor in Glib
---
 xfdashboard/application-database.c |   24 +++++++++++++++---------
 1 file changed, 15 insertions(+), 9 deletions(-)

diff --git a/xfdashboard/application-database.c b/xfdashboard/application-database.c
index 4411600..1dfcc17 100644
--- a/xfdashboard/application-database.c
+++ b/xfdashboard/application-database.c
@@ -881,12 +881,6 @@ static gboolean _xfdashboard_application_database_load_applications_recursive(Xf
 
 	if(error)
 	{
-		g_debug("Failed to iterate path '%s' with info=%s@%p and error=@%p",
-				path,
-				info ? G_OBJECT_TYPE_NAME(info) : "<nil>",
-				info,
-				error);
-
 		/* Propagate error */
 		g_propagate_error(outError, error);
 
@@ -924,6 +918,13 @@ static gboolean _xfdashboard_application_database_load_applications_recursive(Xf
 	monitorData->monitor=g_file_monitor(inCurrentPath, G_FILE_MONITOR_NONE, NULL, &error);
 	if(!monitorData->monitor && error)
 	{
+#if defined(__unix__)
+		/* Workaround for FreeBSD with Glib bug (file/directory monitors cannot be created */
+		g_warning("[workaround for FreeBSD] Cannot initialize file monitor for path '%s' - will not detect changes", path);
+
+		/* Clear error as this error will not fail at FreeBSD */
+		g_clear_error(&error);
+#else
 		g_debug("Failed to initialize file monitor for path '%s'", path);
 
 		/* Propagate error */
@@ -931,23 +932,28 @@ static gboolean _xfdashboard_application_database_load_applications_recursive(Xf
 
 		/* Release allocated resources */
 		if(monitorData) _xfdashboard_application_database_monitor_data_free(monitorData);
+
 		if(path) g_free(path);
 		if(topLevelPath) g_free(topLevelPath);
 		if(enumerator) g_object_unref(enumerator);
 
 		return(FALSE);
+#endif
 	}
 
-	if(monitorData->monitor)
+	/* If file monitor could be created, add it to list of file monitors ... */
+	if(monitorData && monitorData->monitor)
 	{
 		*ioFileMonitors=g_list_prepend(*ioFileMonitors, monitorData);
 
 		g_debug("Added file monitor for path '%s'", path);
 	}
+		/* ... otherwise free file monitor data */
 		else
 		{
-			g_warning(_("Could not create file monitor for path '%s' so no changes will be detected"),
-						path);
+			if(monitorData) _xfdashboard_application_database_monitor_data_free(monitorData);
+
+			g_debug("Destroying file monitor for path '%s'", path);
 		}
 
 	g_debug("Finished scanning directory '%s' for search path '%s'",

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


More information about the Xfce4-commits mailing list