[Xfce4-commits] [apps/xfdashboard] 01/01: Allow a search provider to initialize after property 'provider-id' is set. The property 'provider-id' is set on object creation but after *_class_init and *_init function of object class and inherited classes are called. So the provider's *_init function cannot rely on this property to initialize early. So the search manager calls the overidable initialize function if it was set in *_class_init function.

noreply at xfce.org noreply at xfce.org
Tue Jan 5 12:19:08 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 c0fcf668b13b4fa7b1d5435aedf39fa7beddaf96
Author: Stephan Haller <nomad at froevel.de>
Date:   Tue Jan 5 12:16:21 2016 +0100

    Allow a search provider to initialize after property 'provider-id' is set. The property 'provider-id' is set on object creation but after *_class_init and *_init function of object class and inherited classes are called. So the provider's *_init function cannot rely on this property to initialize early. So the search manager calls the overidable initialize function if it was set in *_class_init function.
---
 xfdashboard/search-manager.c  |    5 +++++
 xfdashboard/search-provider.h |    2 ++
 2 files changed, 7 insertions(+)

diff --git a/xfdashboard/search-manager.c b/xfdashboard/search-manager.c
index e3bd54f..0bca429 100644
--- a/xfdashboard/search-manager.c
+++ b/xfdashboard/search-manager.c
@@ -389,6 +389,11 @@ GObject* xfdashboard_search_manager_create_provider(XfdashboardSearchManager *se
 
 	/* Create search provider */
 	provider=g_object_new(data->gtype, "provider-id", data->ID, NULL);
+	if(provider &&
+		XFDASHBOARD_SEARCH_PROVIDER_GET_CLASS(provider)->initialize)
+	{
+		XFDASHBOARD_SEARCH_PROVIDER_GET_CLASS(provider)->initialize(provider);
+	}
 
 	/* Return newly created search provider */
 	return(provider);
diff --git a/xfdashboard/search-provider.h b/xfdashboard/search-provider.h
index 7180ff6..8725096 100644
--- a/xfdashboard/search-provider.h
+++ b/xfdashboard/search-provider.h
@@ -58,6 +58,8 @@ struct _XfdashboardSearchProviderClass
 
 	/*< public >*/
 	/* Virtual functions */
+	void (*initialize)(XfdashboardSearchProvider *self);
+
 	const gchar* (*get_name)(XfdashboardSearchProvider *self);
 	const gchar* (*get_icon)(XfdashboardSearchProvider *self);
 

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


More information about the Xfce4-commits mailing list