[gnumeric] solver: keep track of plugin usage.



commit 942fde26e6fdf24c6f2cb9d71fa3cb937e373151
Author: Morten Welinder <terra gnome org>
Date:   Thu Nov 12 10:25:16 2009 -0500

    solver: keep track of plugin usage.

 ChangeLog        |    4 ++++
 src/gnm-plugin.c |   14 ++++++++++++--
 2 files changed, 16 insertions(+), 2 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 8f02d0a..67e5d2f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2009-11-12  Morten Welinder  <terra gnome org>
+
+	* src/gnm-plugin.c (cb_load_and_create): Keep track of plugin usage.
+
 2009-11-11  Andreas J. Guelzow <aguelzow pyrshep ca>
 
 	* component/Gnumeric-embed.xml.in: move FormatWorkbook to View menu
diff --git a/src/gnm-plugin.c b/src/gnm-plugin.c
index 86625a0..5796100 100644
--- a/src/gnm-plugin.c
+++ b/src/gnm-plugin.c
@@ -490,16 +490,26 @@ cb_load_and_create (GnmSolverFactory *factory, SolverParameters *param)
 {
 	PluginServiceSolver *ssol =
 		g_object_get_data (G_OBJECT (factory), "ssol");
+	GOPluginService *service = GO_PLUGIN_SERVICE (ssol);
 	GOErrorInfo *ignored_error = NULL;
+	GnmSolver *res;
 
-	go_plugin_service_load (GO_PLUGIN_SERVICE (ssol), &ignored_error);
+	go_plugin_service_load (service, &ignored_error);
 	if (ignored_error != NULL) {
 		go_error_info_print (ignored_error);
 		go_error_info_free (ignored_error);
 		return NULL;
 	}
 
-	return ssol->cbs.creator (factory, param);
+	res = ssol->cbs.creator (factory, param);
+	if (res) {
+		go_plugin_use_ref (service->plugin);
+		g_object_set_data_full (G_OBJECT (res),
+					"plugin-use", service->plugin,
+					(GDestroyNotify)go_plugin_use_unref);
+	}
+
+	return res;
 }
 
 static void



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]