[Xfce4-commits] [apps/xfdashboard] 01/01: Add an invalid desktop file for a desktop ID to application database to prevent that a valid desktop file for the same desktop ID will be found at path of lower prioritory which will then be store in the database as no entry exists at that point of time. The first entry found - valid or invalid - has the highest priority. Later all invalid desktop IDs in the application database are removed before populated.

noreply at xfce.org noreply at xfce.org
Mon Nov 26 15:19:57 CET 2018


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

n   o   m   a   d       p   u   s   h   e   d       a       c   o   m   m   i   t       t   o       b   r   a   n   c   h       m   a   s   t   e   r   
   in repository apps/xfdashboard.

commit 61676fd951baa8b3b5829b91207e7b4684c90b72
Author: Stephan Haller <nomad at froevel.de>
Date:   Mon Nov 26 15:03:47 2018 +0100

    Add an invalid desktop file for a desktop ID to application database to prevent that a valid desktop file for the same desktop ID will be found at path of lower prioritory which will then be store in the database as no entry exists at that point of time. The first entry found - valid or invalid - has the highest priority. Later all invalid desktop IDs in the application database are removed before populated.
    
    Should fix the expected behaviour at GH #169
---
 libxfdashboard/application-database.c | 36 ++++++++++++++++++++++++++++++++++-
 1 file changed, 35 insertions(+), 1 deletion(-)

diff --git a/libxfdashboard/application-database.c b/libxfdashboard/application-database.c
index 1d3cb94..1f1a2a9 100644
--- a/libxfdashboard/application-database.c
+++ b/libxfdashboard/application-database.c
@@ -891,8 +891,18 @@ static gboolean _xfdashboard_application_database_load_applications_recursive(Xf
 				}
 					else
 					{
+						/* Although desktop file for desktop ID is invalid, add
+						 * it to the database to prevent that a valid desktop file
+						 * for the same desktop ID will be found at path of lower
+						 * prioritory which will then be store in the database as
+						 * no entry exists. The first entry found - valid or invalid -
+						 * has the highest priority. Later the caller has to ensure
+						 * that all invalid desktop IDs in the database will be removed.
+						 */
+						g_hash_table_insert(*ioDesktopAppInfos, g_strdup(desktopID), g_object_ref(appInfo));
+
 						XFDASHBOARD_DEBUG(self, APPLICATIONS,
-											"Not adding invalid desktop file '%s%s%s' with desktop ID '%s' at search path '%s'",
+											"Adding and mark invalid desktop file '%s%s%s' with desktop ID '%s' at search path '%s'",
 											path,
 											G_DIR_SEPARATOR_S,
 											childName,
@@ -1070,6 +1080,30 @@ static gboolean _xfdashboard_application_database_load_applications(XfdashboardA
 
 		if(directory) g_object_unref(directory);
 	}
+
+	/* Remove invalid desktop IDs from database */
+	if(apps)
+	{
+		GHashTableIter								appsIter;
+		const gchar									*desktopID;
+		XfdashboardDesktopAppInfo					*appInfo;
+
+		g_hash_table_iter_init(&appsIter, apps);
+		while(g_hash_table_iter_next(&appsIter, (gpointer*)&desktopID, (gpointer*)&appInfo))
+		{
+			/* If value for key is invalid then remove this entry now */
+			if(!xfdashboard_desktop_app_info_is_valid(appInfo))
+			{
+				XFDASHBOARD_DEBUG(self, APPLICATIONS,
+									"Removing invalid desktop ID '%s' from application database",
+									desktopID);
+
+				/* Remove entry from hash table via the iterator */
+				g_hash_table_iter_remove(&appsIter);
+			}
+		}
+	}
+
 	XFDASHBOARD_DEBUG(self, APPLICATIONS,
 						"Loaded %u applications desktop files",
 						g_hash_table_size(apps));

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


More information about the Xfce4-commits mailing list