[Xfce4-commits] [apps/xfdashboard] 01/01: Add new plugin gnome-shell-search-providers which uses all search providers used by Gnome-Shell

noreply at xfce.org noreply at xfce.org
Sun Jan 31 17:31:22 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 43b341b06afa117b5a9fb600c410c0666a9051c3
Author: Stephan Haller <nomad at froevel.de>
Date:   Sun Jan 31 17:30:32 2016 +0100

    Add new plugin gnome-shell-search-providers which uses all search providers used by Gnome-Shell
---
 configure.ac.in                                    |    1 +
 plugins/Makefile.am                                |    3 +-
 plugins/gnome-shell-search-provider/Makefile.am    |   46 +
 .../gnome-shell-search-provider.c                  |  919 ++++++++++++++++++++
 .../gnome-shell-search-provider.h                  |   70 ++
 plugins/gnome-shell-search-provider/plugin.c       |  239 +++++
 6 files changed, 1277 insertions(+), 1 deletion(-)

diff --git a/configure.ac.in b/configure.ac.in
index 583de7b..39dc28a 100644
--- a/configure.ac.in
+++ b/configure.ac.in
@@ -259,6 +259,7 @@ data/themes/xfdashboard-moranga/Makefile
 data/themes/xfdashboard-wine/Makefile
 plugins/Makefile
 plugins/clock-view/Makefile
+plugins/gnome-shell-search-provider/Makefile
 po/Makefile.in
 settings/Makefile
 xfdashboard/Makefile
diff --git a/plugins/Makefile.am b/plugins/Makefile.am
index 4927e70..701c02f 100644
--- a/plugins/Makefile.am
+++ b/plugins/Makefile.am
@@ -1,2 +1,3 @@
 SUBDIRS = \
-	clock-view
+	clock-view \
+	gnome-shell-search-provider
diff --git a/plugins/gnome-shell-search-provider/Makefile.am b/plugins/gnome-shell-search-provider/Makefile.am
new file mode 100644
index 0000000..4d3b570
--- /dev/null
+++ b/plugins/gnome-shell-search-provider/Makefile.am
@@ -0,0 +1,46 @@
+plugindir = $(libdir)/xfdashboard/plugins
+
+AM_CPPFLAGS = \
+	-I$(top_builddir) \
+	-I$(top_srcdir) \
+	-I$(top_srcdir)/xfdashboard \
+	-DG_LOG_DOMAIN=\"xfdashboard-plugin-gnome_shell_search_provider\" \
+	-DLIBEXECDIR=\"$(libexecdir)\" \
+	-DPACKAGE_LOCALE_DIR=\"$(localedir)\" \
+	-DGNOME_SHELL_PROVIDERS_PATH=\"$(prefix)/share/gnome-shell/search-providers\"
+
+plugin_LTLIBRARIES = \
+	gnome-shell-search-provider.la
+
+gnome_shell_search_provider_la_SOURCES = \
+	gnome-shell-search-provider.c \
+	gnome-shell-search-provider.h \
+	plugin.c
+
+gnome_shell_search_provider_la_CFLAGS = \
+	$(PLATFORM_CFLAGS) \
+	$(LIBXFCE4UTIL_CFLAGS) \
+	$(GTK_CFLAGS) \
+	$(CLUTTER_CFLAGS) \
+	$(GARCON_CFLAGS)
+
+gnome_shell_search_provider_la_LDFLAGS = \
+	-avoid-version \
+	-export-dynamic \
+	-module \
+	$(PLATFORM_LDFLAGS)
+
+gnome_shell_search_provider_la_LIBADD = \
+	$(LIBXFCE4UTIL_LIBS) \
+	$(GTK_LIBS) \
+	$(CLUTTER_LIBS) \
+	$(GARCON_LIBS)
+
+CLEANFILES = \
+	$(plugin_DATA)
+
+EXTRA_DIST = \
+	$(plugin_DATA)
+
+DISTCLEANFILES = \
+	$(plugin_DATA)
diff --git a/plugins/gnome-shell-search-provider/gnome-shell-search-provider.c b/plugins/gnome-shell-search-provider/gnome-shell-search-provider.c
new file mode 100644
index 0000000..12a2d8b
--- /dev/null
+++ b/plugins/gnome-shell-search-provider/gnome-shell-search-provider.c
@@ -0,0 +1,919 @@
+/*
+ * gnome-shell-search-provider: A search provider using GnomeShell
+ *                              search providers
+ * 
+ * Copyright 2012-2016 Stephan Haller <nomad at froevel.de>
+ * 
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ * 
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ * 
+ * 
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <glib/gi18n-lib.h>
+#include <gio/gio.h>
+
+#include "gnome-shell-search-provider.h"
+#include "application-database.h"
+#include "button.h"
+
+/* Define this class in GObject system */
+G_DEFINE_DYNAMIC_TYPE(XfdashboardGnomeShellSearchProvider,
+						xfdashboard_gnome_shell_search_provider,
+						XFDASHBOARD_TYPE_SEARCH_PROVIDER)
+
+/* Define this class in this plugin */
+XFDASHBOARD_DEFINE_PLUGIN_TYPE(xfdashboard_gnome_shell_search_provider);
+
+/* Private structure - access only by public API if needed */
+#define XFDASHBOARD_GNOME_SHELL_SEARCH_PROVIDER_GET_PRIVATE(obj) \
+	(G_TYPE_INSTANCE_GET_PRIVATE((obj), XFDASHBOARD_TYPE_GNOME_SHELL_SEARCH_PROVIDER, XfdashboardGnomeShellSearchProviderPrivate))
+
+struct _XfdashboardGnomeShellSearchProviderPrivate
+{
+	/* Instance related */
+	gchar			*gnomeShellID;
+	gchar			*filename;
+	gchar			*fileFullPath;
+
+	gchar			*desktopID;
+	gchar			*dbusBusName;
+	gchar			*dbusObjectPath;
+	gint			searchProviderVersion;
+
+	gchar			*providerName;
+	gchar			*providerIcon;
+};
+
+/* IMPLEMENTATION: Private variables and methods */
+#define XFDASHBOARD_GNOME_SHELL_SEARCH_PROVIDER_KEYFILE_GROUP		"Shell Search Provider"
+
+
+/* IMPLEMENTATION: XfdashboardSearchProvider */
+
+/* One-time initialization of search provider */
+static void _xfdashboard_gnome_shell_search_provider_initialize(XfdashboardSearchProvider *inProvider)
+{
+	XfdashboardGnomeShellSearchProvider				*self;
+	XfdashboardGnomeShellSearchProviderPrivate		*priv;
+	GError											*error;
+	GKeyFile										*providerKeyFile;
+	XfdashboardApplicationDatabase					*appDB;
+	GAppInfo										*appInfo;
+
+	g_return_if_fail(XFDASHBOARD_IS_GNOME_SHELL_SEARCH_PROVIDER(inProvider));
+
+	self=XFDASHBOARD_GNOME_SHELL_SEARCH_PROVIDER(inProvider);
+	priv=self->priv;
+	error=NULL;
+
+	/* Get ID of Gnome-Shell search provider */
+	if(!priv->gnomeShellID)
+	{
+		const gchar									*providerID;
+
+		providerID=xfdashboard_search_provider_get_id(inProvider);
+		priv->gnomeShellID=g_strdup(providerID+strlen(XFDASHBOARD_GNOME_SHELL_SEARCH_PROVIDER_PREFIX));
+	}
+	g_debug("Initializing search provider '%s' of type %s for Gnome-Shell search provider ID '%s'",
+				xfdashboard_search_provider_get_id(inProvider),
+				G_OBJECT_TYPE_NAME(self),
+				priv->gnomeShellID);
+
+	/* Get file basename of Gnome-Shell search provider's data file */
+	if(!priv->filename) priv->filename=g_strdup_printf("%s.ini", priv->gnomeShellID);
+
+	/* Get full path of Gnome-Shell search provider's data file */
+	if(!priv->fileFullPath) priv->fileFullPath=g_build_filename(GNOME_SHELL_PROVIDERS_PATH, priv->filename, NULL);
+	g_debug("Initializing search provider '%s' of type %s from data file at %s (path=%s and basename=%s)",
+				xfdashboard_search_provider_get_id(inProvider),
+				G_OBJECT_TYPE_NAME(self),
+				priv->fileFullPath,
+				GNOME_SHELL_PROVIDERS_PATH,
+				priv->filename);
+
+	/* Get data about search provider */
+	providerKeyFile=g_key_file_new();
+	if(!g_key_file_load_from_file(providerKeyFile,
+									priv->fileFullPath,
+									G_KEY_FILE_NONE,
+									&error))
+	{
+		/* Show error message */
+		g_warning(_("Cannot load information from '%s' for gnome-shell search provider '%s': %s"),
+					priv->fileFullPath,
+					priv->gnomeShellID,
+					(error && error->message) ? error->message : _("Unknown error"));
+
+		/* Release allocated resources */
+		if(error) g_error_free(error);
+		if(providerKeyFile) g_key_file_free(providerKeyFile);
+
+		return;
+	}
+
+	/* Get desktop ID from search provider's data file */
+	priv->desktopID=g_key_file_get_string(providerKeyFile,
+											XFDASHBOARD_GNOME_SHELL_SEARCH_PROVIDER_KEYFILE_GROUP,
+											"DesktopId",
+											&error);
+	if(!priv->desktopID)
+	{
+		/* Show error message */
+		g_warning(_("Incomplete information at '%s' for gnome-shell search provider '%s': %s"),
+					priv->fileFullPath,
+					priv->gnomeShellID,
+					(error && error->message) ? error->message : _("Unknown error"));
+
+		/* Release allocated resources */
+		if(error) g_error_free(error);
+		if(providerKeyFile) g_key_file_free(providerKeyFile);
+
+		return;
+	}
+
+	/* Get bus name from search provider's data file */
+	priv->dbusBusName=g_key_file_get_string(providerKeyFile,
+											XFDASHBOARD_GNOME_SHELL_SEARCH_PROVIDER_KEYFILE_GROUP,
+											"BusName",
+											&error);
+	if(!priv->dbusBusName)
+	{
+		/* Show error message */
+		g_warning(_("Incomplete information at '%s' for gnome-shell search provider '%s': %s"),
+					priv->fileFullPath,
+					priv->gnomeShellID,
+					(error && error->message) ? error->message : _("Unknown error"));
+
+		/* Release allocated resources */
+		if(error) g_error_free(error);
+		if(providerKeyFile) g_key_file_free(providerKeyFile);
+
+		return;
+	}
+
+	/* Get object path from search provider's data file */
+	priv->dbusObjectPath=g_key_file_get_string(providerKeyFile,
+												XFDASHBOARD_GNOME_SHELL_SEARCH_PROVIDER_KEYFILE_GROUP,
+												"ObjectPath",
+												&error);
+	if(!priv->dbusObjectPath)
+	{
+		/* Show error message */
+		g_warning(_("Incomplete information at '%s' for gnome-shell search provider '%s': %s"),
+					priv->fileFullPath,
+					priv->gnomeShellID,
+					(error && error->message) ? error->message : _("Unknown error"));
+
+		/* Release allocated resources */
+		if(error) g_error_free(error);
+		if(providerKeyFile) g_key_file_free(providerKeyFile);
+
+		return;
+	}
+
+	/* Get version from search provider's data file */
+	priv->searchProviderVersion=g_key_file_get_integer(providerKeyFile,
+														XFDASHBOARD_GNOME_SHELL_SEARCH_PROVIDER_KEYFILE_GROUP,
+														"Version",
+														&error);
+	if(!priv->searchProviderVersion)
+	{
+		/* Show error message */
+		g_warning(_("Incomplete information at '%s' for gnome-shell search provider '%s': %s"),
+					priv->fileFullPath,
+					priv->gnomeShellID,
+					(error && error->message) ? error->message : _("Unknown error"));
+
+		/* Release allocated resources */
+		if(error) g_error_free(error);
+		if(providerKeyFile) g_key_file_free(providerKeyFile);
+
+		return;
+	}
+
+	/* Get display name and icon from desktop file returned from application
+	 * database by lookup of desktop ID.
+	 */
+	appDB=xfdashboard_application_database_get_default();
+
+	appInfo=xfdashboard_application_database_lookup_desktop_id(appDB, priv->desktopID);
+	if(appInfo)
+	{
+		GIcon										*providerIcon;
+
+		/* Get name */
+		priv->providerName=g_strdup(g_app_info_get_display_name(appInfo));
+
+		/* Get icon */
+		providerIcon=g_app_info_get_icon(appInfo);
+		if(providerIcon)
+		{
+			priv->providerIcon=g_icon_to_string(providerIcon);
+			g_object_unref(providerIcon);
+		}
+	}
+		else
+		{
+			/* Show error message */
+			g_warning(_("Unknown application '%s' for gnome-shell search provider '%s'"),
+						priv->desktopID,
+						priv->gnomeShellID);
+		}
+
+	/* Set default values for display name and icon where the data could
+	 * not be retrieved from desktop file.
+	 */
+	if(!priv->providerIcon) priv->providerIcon=g_strdup("image-missing");
+	if(!priv->providerName) priv->providerName=g_strdup(priv->gnomeShellID);
+
+	/* Release allocated resources */
+	if(appInfo) g_object_unref(appInfo);
+	if(appDB) g_object_unref(appDB);
+	if(providerKeyFile) g_key_file_free(providerKeyFile);
+
+	g_debug("Initialized search provider '%s' of type %s for GnomeShell search provider interface version %d using DBUS name '%s' and object path '%s'",
+				xfdashboard_search_provider_get_id(inProvider),
+				G_OBJECT_TYPE_NAME(self),
+				priv->searchProviderVersion,
+				priv->dbusBusName,
+				priv->dbusObjectPath);
+
+	g_debug("Initialized search provider '%s' of type %s displayed as '%s' with icon '%s' from desktop ID '%s'",
+				xfdashboard_search_provider_get_id(inProvider),
+				G_OBJECT_TYPE_NAME(self),
+				priv->providerName,
+				priv->providerIcon,
+				priv->desktopID);
+}
+
+/* Get display name for this search provider */
+static const gchar* _xfdashboard_gnome_shell_search_provider_get_name(XfdashboardSearchProvider *inProvider)
+{
+	XfdashboardGnomeShellSearchProvider				*self;
+	XfdashboardGnomeShellSearchProviderPrivate		*priv;
+
+	g_return_if_fail(XFDASHBOARD_IS_GNOME_SHELL_SEARCH_PROVIDER(inProvider));
+
+	self=XFDASHBOARD_GNOME_SHELL_SEARCH_PROVIDER(inProvider);
+	priv=self->priv;
+
+	return(priv->providerName);
+}
+
+/* Get icon-name for this search provider */
+static const gchar* _xfdashboard_gnome_shell_search_provider_get_icon(XfdashboardSearchProvider *inProvider)
+{
+	XfdashboardGnomeShellSearchProvider				*self;
+	XfdashboardGnomeShellSearchProviderPrivate		*priv;
+
+	g_return_if_fail(XFDASHBOARD_IS_GNOME_SHELL_SEARCH_PROVIDER(inProvider));
+
+	self=XFDASHBOARD_GNOME_SHELL_SEARCH_PROVIDER(inProvider);
+	priv=self->priv;
+
+	return(priv->providerIcon);
+}
+
+/* Get result set for requested search terms */
+static XfdashboardSearchResultSet* _xfdashboard_gnome_shell_search_provider_get_result_set(XfdashboardSearchProvider *inProvider,
+																							const gchar **inSearchTerms,
+																							XfdashboardSearchResultSet *inPreviousResultSet)
+{
+	XfdashboardGnomeShellSearchProvider				*self;
+	XfdashboardGnomeShellSearchProviderPrivate		*priv;
+	GError											*error;
+	XfdashboardSearchResultSet						*resultSet;
+	GVariant										*resultItem;
+	GDBusProxy										*proxy;
+	GVariant										*proxyResult;
+	gchar											**proxyResultSet;
+	gchar											**iter;
+
+	g_return_val_if_fail(XFDASHBOARD_IS_GNOME_SHELL_SEARCH_PROVIDER(inProvider), NULL);
+
+	self=XFDASHBOARD_GNOME_SHELL_SEARCH_PROVIDER(inProvider);
+	priv=self->priv;
+	error=NULL;
+	resultSet=NULL;
+
+	/* Connect to search provider via DBUS */
+	proxy=g_dbus_proxy_new_for_bus_sync(G_BUS_TYPE_SESSION,
+										G_DBUS_PROXY_FLAGS_NONE,
+										NULL,
+										priv->dbusBusName,
+										priv->dbusObjectPath,
+										"org.gnome.Shell.SearchProvider2",
+										NULL,
+										&error);
+	if(!proxy)
+	{
+		/* Show error message */
+		g_warning(_("Could not create dbus connection for gnome-shell search provider '%s': %s"),
+					priv->gnomeShellID,
+					(error && error->message) ? error->message : _("Unknown error"));
+
+		/* Release allocated resources */
+		if(error) g_error_free(error);
+
+		/* Return NULL to indicate error */
+		return(NULL);
+	}
+
+	/* Call search method at search provider depending on if a initial
+	 * result set is requested or an update for a previous result set.
+	 */
+	if(!inPreviousResultSet)
+	{
+		/* Call search method at search provider to get initial result set */
+		proxyResult=g_dbus_proxy_call_sync(proxy,
+											"GetInitialResultSet",
+											g_variant_new("(^as)", inSearchTerms),
+											G_DBUS_CALL_FLAGS_NONE,
+											-1,
+											NULL,
+											&error);
+		g_debug("Fetched initial result set at %p for Gnome Shell search provider '%s' of type %s",
+					proxyResult,
+					priv->gnomeShellID,
+					G_OBJECT_TYPE_NAME(self));
+	}
+		else
+		{
+			GVariantBuilder						builder;
+			GList								*allPrevResults;
+			GList								*allPrevIter;
+
+			/* Initialize GVariant builder to get a GVariant with an array
+			 * of strings for previous result set.
+			 */
+			g_variant_builder_init(&builder, G_VARIANT_TYPE_STRING_ARRAY);
+
+			/* For each result item in previous result set add a string
+			 * to GVariant builder.
+			 */
+			allPrevResults=xfdashboard_search_result_set_get_all(inPreviousResultSet);
+			for(allPrevIter=allPrevResults; allPrevIter; allPrevIter=g_list_next(allPrevIter))
+			{
+				g_variant_builder_add(&builder, "s", g_variant_get_string((GVariant*)allPrevIter->data, NULL));
+			}
+			g_debug("Built previous result set with %d entries for Gnome Shell search provider '%s' of type %s",
+						g_list_length(allPrevResults),
+						priv->gnomeShellID,
+						G_OBJECT_TYPE_NAME(self));
+			g_list_free_full(allPrevResults, (GDestroyNotify)g_variant_unref);
+
+			/* Call search method at search provider to get an update
+			 * for previous result set.
+			 */
+			proxyResult=g_dbus_proxy_call_sync(proxy,
+												"GetSubsearchResultSet",
+												g_variant_new("(as^as)", &builder, inSearchTerms),
+												G_DBUS_CALL_FLAGS_NONE,
+												-1,
+												NULL,
+												&error);
+			g_debug("Fetched subset result set at %p for Gnome Shell search provider '%s' of type %s",
+						proxyResult,
+						priv->gnomeShellID,
+						G_OBJECT_TYPE_NAME(self));
+		}
+
+	if(!proxyResult)
+	{
+		/* Show error message */
+		g_warning(_("Could get result set from dbus connection for gnome-shell search provider '%s': %s"),
+					priv->gnomeShellID,
+					(error && error->message) ? error->message : _("Unknown error"));
+
+		/* Release allocated resources */
+		if(error) g_error_free(error);
+		if(proxy) g_object_unref(proxy);
+
+		/* Return NULL to indicate error */
+		return(NULL);
+	}
+
+	/* Retrieve result set for this application from returned result set of
+	 * search provider.
+	 */
+	proxyResultSet=NULL;
+	g_variant_get(proxyResult, "(^as)", &proxyResultSet);
+
+	if(proxyResultSet)
+	{
+		/* Initialize result set */
+		resultSet=xfdashboard_search_result_set_new();
+
+		/* For each string in returned result set of search provider create a GVariant
+		 * which gets added with full score to result set for this application.
+		 */
+		for(iter=proxyResultSet; *iter; iter++)
+		{
+			resultItem=g_variant_new_string(*iter);
+			if(resultItem)
+			{
+				xfdashboard_search_result_set_add_item(resultSet, g_variant_ref(resultItem));
+				xfdashboard_search_result_set_set_item_score(resultSet, resultItem, 1.0f);
+
+				/* Release result item added */
+				g_variant_unref(resultItem);
+			}
+		}
+		g_debug("Got result set with %u entries for Gnome Shell search provider '%s' of type %s",
+					xfdashboard_search_result_set_get_size(resultSet),
+					priv->gnomeShellID,
+					G_OBJECT_TYPE_NAME(self));
+	}
+
+	/* Release allocated resources */
+	if(proxyResultSet) g_strfreev(proxyResultSet);
+	if(proxyResult) g_variant_unref(proxyResult);
+	if(proxy) g_object_unref(proxy);
+
+	/* Return result set */
+	return(resultSet);
+}
+
+/* Create actor for a result item of the result set returned from a search request */
+static ClutterActor* _xfdashboard_gnome_shell_search_provider_create_result_actor(XfdashboardSearchProvider *inProvider,
+																					GVariant *inResultItem)
+{
+	XfdashboardGnomeShellSearchProvider				*self;
+	XfdashboardGnomeShellSearchProviderPrivate		*priv;
+	GError											*error;
+	const gchar										*identifier[2];
+	ClutterActor									*actor;
+	GDBusProxy										*proxy;
+	GVariant										*proxyResult;
+	GVariantIter									*resultIter;
+	gchar											*name;
+	gchar											*description;
+	GIcon											*icon;
+
+	g_return_val_if_fail(XFDASHBOARD_IS_GNOME_SHELL_SEARCH_PROVIDER(inProvider), NULL);
+	g_return_val_if_fail(inResultItem, NULL);
+
+	self=XFDASHBOARD_GNOME_SHELL_SEARCH_PROVIDER(inProvider);
+	priv=self->priv;
+	actor=NULL;
+	icon=NULL;
+	error=NULL;
+
+	/* Get meta data of result item */
+	proxy=g_dbus_proxy_new_for_bus_sync(G_BUS_TYPE_SESSION,
+										G_DBUS_PROXY_FLAGS_NONE,
+										NULL,
+										priv->dbusBusName,
+										priv->dbusObjectPath,
+										"org.gnome.Shell.SearchProvider2",
+										NULL,
+										&error);
+	if(!proxy)
+	{
+		/* Show error message */
+		g_warning(_("Could not create dbus connection for gnome-shell search provider '%s': %s"),
+					priv->gnomeShellID,
+					(error && error->message) ? error->message : _("Unknown error"));
+
+		/* Release allocated resources */
+		if(error) g_error_free(error);
+
+		/* Return NULL to indicate error */
+		return(NULL);
+	}
+
+	identifier[0]=g_variant_get_string(inResultItem, NULL);
+	identifier[1]=NULL;
+	proxyResult=g_dbus_proxy_call_sync(proxy,
+										"GetResultMetas",
+										g_variant_new("(^as)", identifier),
+										G_DBUS_CALL_FLAGS_NONE,
+										-1,
+										NULL,
+										&error);
+	if(!proxyResult)
+	{
+		/* Show error message */
+		g_warning(_("Could get meta data for '%s' from dbus connection for gnome-shell search provider '%s': %s"),
+					identifier[0],
+					priv->gnomeShellID,
+					(error && error->message) ? error->message : _("Unknown error"));
+
+		/* Release allocated resources */
+		if(error) g_error_free(error);
+		if(proxy) g_object_unref(proxy);
+
+		/* Return NULL to indicate error */
+		return(NULL);
+	}
+
+	/* Extract meta data from result we got from dbus call */
+	resultIter=NULL;
+
+	g_variant_get(proxyResult, "(aa{sv})", &resultIter);
+	if(resultIter)
+	{
+		GVariant									*metaData;
+
+		while((metaData=g_variant_iter_next_value(resultIter)))
+		{
+			GVariant								*iconVariant;
+			gchar									*iconString;
+			gchar									*resultID;
+
+			/* Get ID from meta data and check if it matches the ID requested.
+			 * If not try next meta data item in result.
+			 */
+			resultID=NULL;
+			if(!g_variant_lookup(metaData, "id", "s", &resultID) ||
+				g_strcmp0(resultID, identifier[0])!=0)
+			{
+				if(resultID) g_free(resultID);
+				continue;
+			}
+
+			g_free(resultID);
+
+			/* Get name from meta data */
+			g_variant_lookup(metaData, "name", "s", &name);
+
+			/* Get description from meta data */
+			g_variant_lookup(metaData, "description", "s", &description);
+
+			/* Get icon from meta data.
+			 * Try first to deserialize "icon" if available and supported,
+			 * then try to decode "gicon" if available and at last try
+			 * raw bytes from "icon-data".
+			 */
+#if GLIB_CHECK_VERSION(2, 38, 0)
+			if(!icon && g_variant_lookup(metaData, "icon", "v", &iconVariant))
+			{
+				/* Try deserializing icon from variant extracted from meta data */
+				icon=g_icon_deserialize(iconVariant);
+				if(!icon)
+				{
+					/* Show error message */
+					g_warning(_("Could get icon for '%s' of key '%s' for gnome-shell search provider '%s': %s"),
+								identifier[0],
+								"icon",
+								priv->gnomeShellID,
+								_("Deserialization failed"));
+				}
+
+				/* Release data extracted for icon */
+				g_variant_unref(iconVariant);
+			}
+#endif
+
+			if(!icon && g_variant_lookup(metaData, "gicon", "s", &iconString))
+			{
+				/* Try decoding icon from string extracted from meta data */
+				icon=g_icon_new_for_string(iconString, &error);
+				if(!icon)
+				{
+					/* Show error message */
+					g_warning(_("Could get icon for '%s' of key '%s' for gnome-shell search provider '%s': %s"),
+								identifier[0],
+								"gicon",
+								priv->gnomeShellID,
+								(error && error->message) ? error->message : _("Unknown error"));
+
+					/* Release allocated resources */
+					if(error)
+					{
+						g_error_free(error);
+						error=NULL;
+					}
+				}
+
+				/* Release data extracted for icon */
+				g_free(iconString);
+			}
+
+			if(g_variant_lookup(metaData, "icon-data", "(iiibiiay)", &iconString))
+			{
+				g_print("%s: identifier=%s -> has 'icon-data': %s\n", __func__, identifier[0], iconString);
+
+				/* Release data extracted for icon */
+				g_free(iconString);
+			}
+
+			/* Release allocated resources */
+			g_variant_unref(metaData);
+		}
+	}
+
+	/* Create actor for result item */
+	if(name)
+	{
+		gchar										*buttonText;
+
+		/* Build text to show at button */
+		if(description) buttonText=g_markup_printf_escaped("<b>%s</b>\n\n%s", name, description);
+			else buttonText=g_markup_printf_escaped("<b>%s</b>", name);
+
+		/* Create actor and set icon if available */
+		actor=xfdashboard_button_new_with_text(buttonText);
+
+		if(icon)
+		{
+			xfdashboard_button_set_style(XFDASHBOARD_BUTTON(actor), XFDASHBOARD_BUTTON_STYLE_BOTH);
+			xfdashboard_button_set_gicon(XFDASHBOARD_BUTTON(actor), icon);
+		}
+
+		clutter_actor_show(actor);
+
+		/* Release allocated resources */
+		g_free(buttonText);
+	}
+
+	/* Release allocated resources */
+	if(icon) g_object_unref(icon);
+	if(description) g_free(description);
+	if(name) g_free(name);
+	if(resultIter) g_variant_iter_free(resultIter);
+	if(proxyResult) g_variant_unref(proxyResult);
+	if(proxy) g_object_unref(proxy);
+
+	/* Return created actor */
+	return(actor);
+}
+
+/* Activate result item */
+static gboolean _xfdashboard_gnome_shell_search_provider_activate_result(XfdashboardSearchProvider* inProvider,
+																			GVariant *inResultItem,
+																			ClutterActor *inActor,
+																			const gchar **inSearchTerms)
+{
+	XfdashboardGnomeShellSearchProvider				*self;
+	XfdashboardGnomeShellSearchProviderPrivate		*priv;
+	GError											*error;
+	const gchar										*identifier;
+	GDBusProxy										*proxy;
+	GVariant										*proxyResult;
+
+	g_return_val_if_fail(XFDASHBOARD_IS_GNOME_SHELL_SEARCH_PROVIDER(inProvider), FALSE);
+	g_return_val_if_fail(inResultItem, FALSE);
+
+	self=XFDASHBOARD_GNOME_SHELL_SEARCH_PROVIDER(inProvider);
+	priv=self->priv;
+	error=NULL;
+
+	/* Get identifier to activate */
+	identifier=g_variant_get_string(inResultItem, NULL);
+
+	/* Call 'ActivateResult' over DBUS at Gnome-Shell search provider */
+	proxy=g_dbus_proxy_new_for_bus_sync(G_BUS_TYPE_SESSION,
+										G_DBUS_PROXY_FLAGS_NONE,
+										NULL,
+										priv->dbusBusName,
+										priv->dbusObjectPath,
+										"org.gnome.Shell.SearchProvider2",
+										NULL,
+										&error);
+	if(!proxy)
+	{
+		/* Show error message */
+		g_warning(_("Could not create dbus connection for gnome-shell search provider '%s': %s"),
+					priv->gnomeShellID,
+					(error && error->message) ? error->message : _("Unknown error"));
+
+		/* Release allocated resources */
+		if(error) g_error_free(error);
+
+		/* Return FALSE to indicate error */
+		return(FALSE);
+	}
+
+	proxyResult=g_dbus_proxy_call_sync(proxy,
+										"ActivateResult",
+										g_variant_new("(s(^as)u)",
+														identifier,
+														inSearchTerms,
+														clutter_get_current_event_time()),
+										G_DBUS_CALL_FLAGS_NONE,
+										-1,
+										NULL,
+										&error);
+	if(!proxyResult)
+	{
+		/* Show error message */
+		g_warning(_("Could activate result item '%s' over dbus connection for gnome-shell search provider '%s': %s"),
+					identifier,
+					priv->gnomeShellID,
+					(error && error->message) ? error->message : _("Unknown error"));
+
+		/* Release allocated resources */
+		if(error) g_error_free(error);
+		if(proxy) g_object_unref(proxy);
+
+		/* Return FALSE to indicate error */
+		return(FALSE);
+	}
+
+	/* Release allocated resources */
+	if(proxyResult) g_variant_unref(proxyResult);
+	if(proxy) g_object_unref(proxy);
+
+	/* If we get here activating result item was successful, so return TRUE */
+	return(TRUE);
+}
+
+/* Launch search in external service or application of search provider */
+static gboolean _xfdashboard_gnome_shell_search_provider_launch_search(XfdashboardSearchProvider* inProvider,
+																		const gchar **inSearchTerms)
+{
+	XfdashboardGnomeShellSearchProvider				*self;
+	XfdashboardGnomeShellSearchProviderPrivate		*priv;
+	GError											*error;
+	GDBusProxy										*proxy;
+	GVariant										*proxyResult;
+
+	g_return_val_if_fail(XFDASHBOARD_IS_GNOME_SHELL_SEARCH_PROVIDER(inProvider), FALSE);
+	g_return_val_if_fail(inSearchTerms, FALSE);
+
+	self=XFDASHBOARD_GNOME_SHELL_SEARCH_PROVIDER(inProvider);
+	priv=self->priv;
+	error=NULL;
+
+	/* Call 'LaunchSearch' over DBUS at Gnome-Shell search provider */
+	proxy=g_dbus_proxy_new_for_bus_sync(G_BUS_TYPE_SESSION,
+										G_DBUS_PROXY_FLAGS_NONE,
+										NULL,
+										priv->dbusBusName,
+										priv->dbusObjectPath,
+										"org.gnome.Shell.SearchProvider2",
+										NULL,
+										&error);
+	if(!proxy)
+	{
+		/* Show error message */
+		g_warning(_("Could not create dbus connection for gnome-shell search provider '%s': %s"),
+					priv->gnomeShellID,
+					(error && error->message) ? error->message : _("Unknown error"));
+
+		/* Release allocated resources */
+		if(error) g_error_free(error);
+
+		/* Return FALSE to indicate error */
+		return(FALSE);
+	}
+
+	proxyResult=g_dbus_proxy_call_sync(proxy,
+										"LaunchSearch",
+										g_variant_new("((^as)u)",
+														inSearchTerms,
+														clutter_get_current_event_time()),
+										G_DBUS_CALL_FLAGS_NONE,
+										-1,
+										NULL,
+										&error);
+	if(!proxyResult)
+	{
+		/* Show error message */
+		g_warning(_("Could not launch search over dbus connection for gnome-shell search provider '%s': %s"),
+					priv->gnomeShellID,
+					(error && error->message) ? error->message : _("Unknown error"));
+
+		/* Release allocated resources */
+		if(error) g_error_free(error);
+		if(proxy) g_object_unref(proxy);
+
+		/* Return FALSE to indicate error */
+		return(FALSE);
+	}
+
+	/* Release allocated resources */
+	if(proxyResult) g_variant_unref(proxyResult);
+	if(proxy) g_object_unref(proxy);
+
+	/* If we get here launching search was successful, so return TRUE */
+	return(TRUE);
+}
+
+/* IMPLEMENTATION: GObject */
+
+/* Dispose this object */
+static void _xfdashboard_gnome_shell_search_provider_dispose(GObject *inObject)
+{
+	XfdashboardGnomeShellSearchProvider			*self=XFDASHBOARD_GNOME_SHELL_SEARCH_PROVIDER(inObject);
+	XfdashboardGnomeShellSearchProviderPrivate	*priv=self->priv;
+
+	/* Release allocated resources */
+	if(priv->gnomeShellID)
+	{
+		g_free(priv->gnomeShellID);
+		priv->gnomeShellID=NULL;
+	}
+
+	if(priv->filename)
+	{
+		g_free(priv->filename);
+		priv->filename=NULL;
+	}
+
+	if(priv->fileFullPath)
+	{
+		g_free(priv->fileFullPath);
+		priv->fileFullPath=NULL;
+	}
+
+	if(priv->desktopID)
+	{
+		g_free(priv->desktopID);
+		priv->desktopID=NULL;
+	}
+
+	if(priv->dbusBusName)
+	{
+		g_free(priv->dbusBusName);
+		priv->dbusBusName=NULL;
+	}
+
+	if(priv->dbusObjectPath)
+	{
+		g_free(priv->dbusObjectPath);
+		priv->dbusObjectPath=NULL;
+	}
+
+	if(priv->providerIcon)
+	{
+		g_free(priv->providerIcon);
+		priv->providerIcon=NULL;
+	}
+
+	if(priv->providerName)
+	{
+		g_free(priv->providerName);
+		priv->providerName=NULL;
+	}
+
+	/* Call parent's class dispose method */
+	G_OBJECT_CLASS(xfdashboard_gnome_shell_search_provider_parent_class)->dispose(inObject);
+}
+
+/* Class initialization
+ * Override functions in parent classes and define properties
+ * and signals
+ */
+void xfdashboard_gnome_shell_search_provider_class_init(XfdashboardGnomeShellSearchProviderClass *klass)
+{
+	XfdashboardSearchProviderClass	*providerClass=XFDASHBOARD_SEARCH_PROVIDER_CLASS(klass);
+	GObjectClass					*gobjectClass=G_OBJECT_CLASS(klass);
+
+	/* Override functions */
+	gobjectClass->dispose=_xfdashboard_gnome_shell_search_provider_dispose;
+
+	providerClass->initialize=_xfdashboard_gnome_shell_search_provider_initialize;
+	providerClass->get_icon=_xfdashboard_gnome_shell_search_provider_get_icon;
+	providerClass->get_name=_xfdashboard_gnome_shell_search_provider_get_name;
+	providerClass->get_result_set=_xfdashboard_gnome_shell_search_provider_get_result_set;
+	providerClass->create_result_actor=_xfdashboard_gnome_shell_search_provider_create_result_actor;
+	providerClass->activate_result=_xfdashboard_gnome_shell_search_provider_activate_result;
+	providerClass->launch_search=_xfdashboard_gnome_shell_search_provider_launch_search;
+
+	/* Set up private structure */
+	g_type_class_add_private(klass, sizeof(XfdashboardGnomeShellSearchProviderPrivate));
+}
+
+/* Class finalization */
+void xfdashboard_gnome_shell_search_provider_class_finalize(XfdashboardGnomeShellSearchProviderClass *klass)
+{
+}
+
+/* Object initialization
+ * Create private structure and set up default values
+ */
+void xfdashboard_gnome_shell_search_provider_init(XfdashboardGnomeShellSearchProvider *self)
+{
+	XfdashboardGnomeShellSearchProviderPrivate		*priv;
+
+	self->priv=priv=XFDASHBOARD_GNOME_SHELL_SEARCH_PROVIDER_GET_PRIVATE(self);
+
+	/* Set up default values */
+	priv->gnomeShellID=NULL;
+	priv->filename=NULL;
+	priv->fileFullPath=NULL;
+	priv->desktopID=NULL;
+	priv->dbusBusName=NULL;
+	priv->dbusObjectPath=NULL;
+	priv->providerName=NULL;
+	priv->providerIcon=NULL;
+}
diff --git a/plugins/gnome-shell-search-provider/gnome-shell-search-provider.h b/plugins/gnome-shell-search-provider/gnome-shell-search-provider.h
new file mode 100644
index 0000000..6763ed7
--- /dev/null
+++ b/plugins/gnome-shell-search-provider/gnome-shell-search-provider.h
@@ -0,0 +1,70 @@
+/*
+ * gnome-shell-search-provider: A search provider using GnomeShell
+ *                              search providers
+ * 
+ * Copyright 2012-2016 Stephan Haller <nomad at froevel.de>
+ * 
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ * 
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ * 
+ * 
+ */
+
+#ifndef __XFDASHBOARD_GNOME_SHELL_SEARCH_PROVIDER__
+#define __XFDASHBOARD_GNOME_SHELL_SEARCH_PROVIDER__
+
+#include "plugin.h"
+#include "search-provider.h"
+
+G_BEGIN_DECLS
+
+#define XFDASHBOARD_TYPE_GNOME_SHELL_SEARCH_PROVIDER			(xfdashboard_gnome_shell_search_provider_get_type())
+#define XFDASHBOARD_GNOME_SHELL_SEARCH_PROVIDER(obj)			(G_TYPE_CHECK_INSTANCE_CAST((obj), XFDASHBOARD_TYPE_GNOME_SHELL_SEARCH_PROVIDER, XfdashboardGnomeShellSearchProvider))
+#define XFDASHBOARD_IS_GNOME_SHELL_SEARCH_PROVIDER(obj)			(G_TYPE_CHECK_INSTANCE_TYPE((obj), XFDASHBOARD_TYPE_GNOME_SHELL_SEARCH_PROVIDER))
+#define XFDASHBOARD_GNOME_SHELL_SEARCH_PROVIDER_CLASS(klass)	(G_TYPE_CHECK_CLASS_CAST((klass), XFDASHBOARD_TYPE_GNOME_SHELL_SEARCH_PROVIDER, XfdashboardGnomeShellSearchProviderClass))
+#define XFDASHBOARD_IS_GNOME_SHELL_SEARCH_PROVIDER_CLASS(klass)	(G_TYPE_CHECK_CLASS_TYPE((klass), XFDASHBOARD_TYPE_GNOME_SHELL_SEARCH_PROVIDER))
+#define XFDASHBOARD_GNOME_SHELL_SEARCH_PROVIDER_GET_CLASS(obj)	(G_TYPE_INSTANCE_GET_CLASS((obj), XFDASHBOARD_TYPE_GNOME_SHELL_SEARCH_PROVIDER, XfdashboardGnomeShellSearchProviderClass))
+
+typedef struct _XfdashboardGnomeShellSearchProvider				XfdashboardGnomeShellSearchProvider; 
+typedef struct _XfdashboardGnomeShellSearchProviderPrivate		XfdashboardGnomeShellSearchProviderPrivate;
+typedef struct _XfdashboardGnomeShellSearchProviderClass		XfdashboardGnomeShellSearchProviderClass;
+
+struct _XfdashboardGnomeShellSearchProvider
+{
+	/* Parent instance */
+	XfdashboardSearchProvider					parent_instance;
+
+	/* Private structure */
+	XfdashboardGnomeShellSearchProviderPrivate	*priv;
+};
+
+struct _XfdashboardGnomeShellSearchProviderClass
+{
+	/*< private >*/
+	/* Parent class */
+	XfdashboardSearchProviderClass				parent_class;
+};
+
+/* Public API */
+#define XFDASHBOARD_GNOME_SHELL_SEARCH_PROVIDER_PREFIX			"gnome-shell-search-provider_"
+
+GType xfdashboard_gnome_shell_search_provider_get_type(void) G_GNUC_CONST;
+void xfdashboard_gnome_shell_search_provider_type_register(GTypeModule *inModule);
+
+XFDASHBOARD_DECLARE_PLUGIN_TYPE(xfdashboard_gnome_shell_search_provider);
+
+G_END_DECLS
+
+#endif
diff --git a/plugins/gnome-shell-search-provider/plugin.c b/plugins/gnome-shell-search-provider/plugin.c
new file mode 100644
index 0000000..9169dd4
--- /dev/null
+++ b/plugins/gnome-shell-search-provider/plugin.c
@@ -0,0 +1,239 @@
+/*
+ * plugin: Plugin functions for 'gnome-shell-search-provider'
+ * 
+ * Copyright 2012-2016 Stephan Haller <nomad at froevel.de>
+ * 
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ * 
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ * 
+ * 
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "plugin.h"
+
+#include <libxfce4util/libxfce4util.h>
+
+#include "search-manager.h"
+#include "gnome-shell-search-provider.h"
+
+
+/* IMPLEMENTATION: Private variables and methods */
+static GList		*xfdashboard_gnome_shell_search_provider_registered_providers=NULL;
+
+
+/* IMPLEMENTATION: XfdashboardPlugin */
+
+/* Forward declarations */
+G_MODULE_EXPORT void plugin_init(XfdashboardPlugin *self);
+G_MODULE_EXPORT void plugin_enable(XfdashboardPlugin *self);
+G_MODULE_EXPORT void plugin_disable(XfdashboardPlugin *self);
+
+/* Plugin initialization function */
+G_MODULE_EXPORT void plugin_init(XfdashboardPlugin *self)
+{
+	/* Set up localization */
+	xfce_textdomain(GETTEXT_PACKAGE, PACKAGE_LOCALE_DIR, "UTF-8");
+
+	/* Set plugin info */
+	xfdashboard_plugin_set_info(self,
+								"id", "gnome-shell-search-provider",
+								"name", _("Gnome-Shell search provider"),
+								"description", _("Uses Gnome-Shell search providers as source for searches"),
+								"author", "Stephan Haller <nomad at froevel.de>",
+								NULL);
+
+	/* Register GObject types of this plugin */
+	XFDASHBOARD_REGISTER_PLUGIN_TYPE(self, xfdashboard_gnome_shell_search_provider);
+}
+
+/* Plugin enable function */
+G_MODULE_EXPORT void plugin_enable(XfdashboardPlugin *self)
+{
+	XfdashboardSearchManager	*searchManager;
+	GFile						*gnomeShellSearchProvidersPath;
+	GFileEnumerator				*enumerator;
+	GFileInfo					*info;
+	GError						*error;
+	gchar						*pluginID;
+
+	error=NULL;
+
+	/* Get plugin's ID */
+	g_object_get(G_OBJECT(self), "id", &pluginID, NULL);
+	g_debug("Enabling plugin '%s'", pluginID);
+
+	/* Get path where Gnome-Shell search providers are stored at */
+	gnomeShellSearchProvidersPath=g_file_new_for_path(GNOME_SHELL_PROVIDERS_PATH);
+	g_debug("Scanning directory '%s' for Gnome-Shell search providers",
+				GNOME_SHELL_PROVIDERS_PATH);
+
+	/* Get search manager where to register search providers at */
+	searchManager=xfdashboard_search_manager_get_default();
+
+	/* Create enumerator for search providers path to iterate through path and
+	 * register search providers found.
+	 */
+	enumerator=g_file_enumerate_children(gnomeShellSearchProvidersPath,
+											G_FILE_ATTRIBUTE_STANDARD_TYPE "," G_FILE_ATTRIBUTE_STANDARD_NAME,
+											G_FILE_QUERY_INFO_NONE,
+											NULL,
+											&error);
+	if(!enumerator)
+	{
+		/* Show error message */
+		g_warning(_("Could not scan for gnome-shell search provider at '%s': %s"),
+					GNOME_SHELL_PROVIDERS_PATH,
+					(error && error->message) ? error->message : _("Unknown error"));
+
+		/* Release allocated resources */
+		if(error) g_error_free(error);
+		if(pluginID) g_free(pluginID);
+		if(searchManager) g_object_unref(searchManager);
+		if(gnomeShellSearchProvidersPath) g_object_unref(gnomeShellSearchProvidersPath);
+
+		return;
+	}
+
+	/* Iterate through files in search providers path and for each
+	 * ".ini" file found register a search provider
+	 */
+	while((info=g_file_enumerator_next_file(enumerator, NULL, &error)))
+	{
+		/* If current iterated file ends with ".ini" then assume it is a Gnome-Shell
+		 * search provider and register it.
+		 */
+		if(g_file_info_get_file_type(info)==G_FILE_TYPE_REGULAR &&
+			g_str_has_suffix(g_file_info_get_name(info), ".ini"))
+		{
+			const gchar			*filename;
+			gchar				*gnomeShellSearchProviderName;
+			gchar				*providerName;
+			gboolean			success;
+
+			filename=g_file_info_get_name(info);
+			gnomeShellSearchProviderName=g_strndup(filename, strlen(filename)-4);
+			if(gnomeShellSearchProviderName)
+			{
+				/* Build unique provider name for Gnome-Shell search provider
+				 * using this plugin.
+				 */
+				providerName=g_strdup_printf("%s%s", XFDASHBOARD_GNOME_SHELL_SEARCH_PROVIDER_PREFIX, gnomeShellSearchProviderName);
+				g_debug("Register gnome shell search provider '%s' from file %s", providerName, filename);
+
+				/* Register search provider */
+				success=xfdashboard_search_manager_register(searchManager, providerName, XFDASHBOARD_TYPE_GNOME_SHELL_SEARCH_PROVIDER);
+				if(success)
+				{
+					xfdashboard_gnome_shell_search_provider_registered_providers=g_list_prepend(xfdashboard_gnome_shell_search_provider_registered_providers, g_strdup(providerName));
+					g_debug("Successfully registered Gnome-Shell search provider '%s' with ID '%s'", gnomeShellSearchProviderName, providerName);
+				}
+					else
+					{
+						g_debug("Failed to register Gnome-Shell search provider '%s' with ID '%s'", gnomeShellSearchProviderName, providerName);
+					}
+
+				g_free(providerName);
+				g_free(gnomeShellSearchProviderName);
+			}
+		}
+
+		/* Release allocated resources */
+		g_object_unref(info);
+	}
+
+	if(error)
+	{
+		/* Show error message */
+		g_warning(_("Could not scan for gnome-shell search provider at '%s': %s"),
+					GNOME_SHELL_PROVIDERS_PATH,
+					(error && error->message) ? error->message : _("Unknown error"));
+
+		/* Release allocated resources */
+		if(error) g_error_free(error);
+		if(pluginID) g_free(pluginID);
+		if(enumerator) g_object_unref(enumerator);
+		if(searchManager) g_object_unref(searchManager);
+		if(gnomeShellSearchProvidersPath) g_object_unref(gnomeShellSearchProvidersPath);
+
+		return;
+	}
+
+	/* Create monitor to get notified about new, changed and removed search providers */
+	// TODO:
+
+	/* Release allocated resources */
+	g_debug("Enabled plugin '%s' with %d search providers",
+				pluginID,
+				g_list_length(xfdashboard_gnome_shell_search_provider_registered_providers));
+
+	if(pluginID) g_free(pluginID);
+	if(enumerator) g_object_unref(enumerator);
+	if(searchManager) g_object_unref(searchManager);
+	if(gnomeShellSearchProvidersPath) g_object_unref(gnomeShellSearchProvidersPath);
+}
+
+/* Plugin disable function */
+G_MODULE_EXPORT void plugin_disable(XfdashboardPlugin *self)
+{
+	XfdashboardSearchManager	*searchManager;
+	GList						*iter;
+	const gchar					*providerName;
+	gboolean					success;
+	gchar						*pluginID;
+
+	/* Get plugin's ID */
+	g_object_get(G_OBJECT(self), "id", &pluginID, NULL);
+	g_debug("Disabling plugin '%s' with %d search providers",
+				pluginID,
+				g_list_length(xfdashboard_gnome_shell_search_provider_registered_providers));
+
+	/* Get search manager where search providers were registered at */
+	searchManager=xfdashboard_search_manager_get_default();
+
+	/* Unregister registered search providers */
+	for(iter=xfdashboard_gnome_shell_search_provider_registered_providers; iter; iter=g_list_next(iter))
+	{
+		providerName=(const gchar*)iter->data;
+
+		if(providerName)
+		{
+			success=xfdashboard_search_manager_unregister(searchManager, providerName);
+			if(success)
+			{
+				g_debug("Successfully unregistered Gnome-Shell search provider with ID '%s'", providerName);
+			}
+				else
+				{
+					g_debug("Failed to unregister Gnome-Shell search provider with ID '%s'", providerName);
+				}
+		}
+	}
+
+	g_object_unref(searchManager);
+
+	/* Release allocated resources */
+	g_debug("Disabled plugin '%s'", pluginID);
+
+	if(pluginID) g_free(pluginID);
+	if(xfdashboard_gnome_shell_search_provider_registered_providers)
+	{
+		g_list_free_full(xfdashboard_gnome_shell_search_provider_registered_providers, g_free);
+		xfdashboard_gnome_shell_search_provider_registered_providers=NULL;
+	}
+}

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


More information about the Xfce4-commits mailing list