[Xfce4-commits] [apps/xfdashboard] 01/02: Add a utility function to search manager to check if a search provider with a specific ID was already registered
noreply at xfce.org
noreply at xfce.org
Sat Feb 13 09:35:10 CET 2016
This is an automated email from the git hooks/post-receive script.
nomad pushed a commit to branch master
in repository apps/xfdashboard.
commit 273d5d9a4247f4d0d90ae25453cb231c3529605f
Author: Stephan Haller <nomad at froevel.de>
Date: Sat Feb 13 09:27:00 2016 +0100
Add a utility function to search manager to check if a search provider with a specific ID was already registered
---
plugins/gnome-shell-search-provider/plugin.c | 3 ++-
xfdashboard/search-manager.c | 20 +++++++++++++++++++-
xfdashboard/search-manager.h | 1 +
3 files changed, 22 insertions(+), 2 deletions(-)
diff --git a/plugins/gnome-shell-search-provider/plugin.c b/plugins/gnome-shell-search-provider/plugin.c
index f8ac0c9..0981bea 100644
--- a/plugins/gnome-shell-search-provider/plugin.c
+++ b/plugins/gnome-shell-search-provider/plugin.c
@@ -146,7 +146,8 @@ static void _xfdashboard_gnome_shell_search_provider_plugin_on_file_monitor_chan
g_str_has_suffix(filePath, ".ini"))
{
providerName=_xfdashboard_gnome_shell_search_provider_plugin_get_provider_name_from_file(inFile, NULL);
- if(providerName)
+ if(providerName &&
+ xfdashboard_search_manager_has_registered_id(searchManager, providerName))
{
/* Unregister search provider */
success=xfdashboard_search_manager_unregister(searchManager, providerName);
diff --git a/xfdashboard/search-manager.c b/xfdashboard/search-manager.c
index b8598a2..6bbe482 100644
--- a/xfdashboard/search-manager.c
+++ b/xfdashboard/search-manager.c
@@ -370,7 +370,25 @@ GList* xfdashboard_search_manager_get_registered(XfdashboardSearchManager *self)
return(copy);
}
-/* Create view for requested ID */
+/* Check if a search provider for requested ID is registered */
+gboolean xfdashboard_search_manager_has_registered_id(XfdashboardSearchManager *self, const gchar *inID)
+{
+ GList *iter;
+
+ g_return_val_if_fail(XFDASHBOARD_IS_SEARCH_MANAGER(self), FALSE);
+ g_return_val_if_fail(inID && *inID, FALSE);
+
+ /* Check if search provider is registered by getting pointer to list element
+ * in list of registered providers.
+ */
+ iter=_xfdashboard_search_manager_entry_find_list_entry_by_id(self, inID);
+ if(iter) return(TRUE);
+
+ /* If we get here we did not find a search provider for requested ID */
+ return(FALSE);
+}
+
+/* Create search provider for requested ID */
GObject* xfdashboard_search_manager_create_provider(XfdashboardSearchManager *self, const gchar *inID)
{
XfdashboardSearchManagerData *data;
diff --git a/xfdashboard/search-manager.h b/xfdashboard/search-manager.h
index 92be3bd..d0c90c8 100644
--- a/xfdashboard/search-manager.h
+++ b/xfdashboard/search-manager.h
@@ -72,6 +72,7 @@ XfdashboardSearchManager* xfdashboard_search_manager_get_default(void);
gboolean xfdashboard_search_manager_register(XfdashboardSearchManager *self, const gchar *inID, GType inProviderType);
gboolean xfdashboard_search_manager_unregister(XfdashboardSearchManager *self, const gchar *inID);
GList* xfdashboard_search_manager_get_registered(XfdashboardSearchManager *self);
+gboolean xfdashboard_search_manager_has_registered_id(XfdashboardSearchManager *self, const gchar *inID);
GObject* xfdashboard_search_manager_create_provider(XfdashboardSearchManager *self, const gchar *inID);
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the Xfce4-commits
mailing list