Commit 34dac1b3 authored by Morten Welinder's avatar Morten Welinder

Introspection fixes

parent 046e1f59
......@@ -547,7 +547,8 @@ struct GnmPluginServiceSolver_ {
};
static GnmSolver *
cb_load_and_create (GnmSolverFactory *factory, GnmSolverParameters *param)
cb_load_and_create (GnmSolverFactory *factory, GnmSolverParameters *param,
gpointer data)
{
PluginServiceSolver *ssol =
g_object_get_data (G_OBJECT (factory), "ssol");
......@@ -562,7 +563,7 @@ cb_load_and_create (GnmSolverFactory *factory, GnmSolverParameters *param)
return NULL;
}
res = ssol->cbs.creator (factory, param);
res = ssol->cbs.creator (factory, param, data);
if (res) {
go_plugin_use_ref (service->plugin);
g_object_set_data_full (G_OBJECT (res),
......@@ -575,7 +576,8 @@ cb_load_and_create (GnmSolverFactory *factory, GnmSolverParameters *param)
static gboolean
cb_load_and_functional (GnmSolverFactory *factory,
WBCGtk *wbcg)
WBCGtk *wbcg,
gpointer data)
{
PluginServiceSolver *ssol =
g_object_get_data (G_OBJECT (factory), "ssol");
......@@ -591,7 +593,7 @@ cb_load_and_functional (GnmSolverFactory *factory,
}
functional = ssol->cbs.functional;
return (functional == NULL || functional (factory, wbcg));
return (functional == NULL || functional (factory, wbcg, data));
}
static void
......@@ -659,7 +661,9 @@ plugin_service_solver_read_xml (GOPluginService *service, xmlNode *tree,
CXML2C (s_name),
type,
cb_load_and_create,
cb_load_and_functional);
cb_load_and_functional,
NULL,
NULL);
g_object_set_data (G_OBJECT (ssol->factory), "ssol", ssol);
}
xmlFree (s_id);
......
2018-05-14 Morten Welinder <terra@gnome.org>
* gnm-solver.c (gnm_solver_factory_finalize): Renamed from
gnm_solver_factory_dispose and hooked up according. Call notify
as needed.
(gnm_solver_factory_new): Add data and notify arguments for the
benefit of introspection.
2018-05-07 Morten Welinder <terra@gnome.org>
* Release 1.12.41
......@@ -8,8 +16,8 @@
2018-04-24 Andreas J. Guelzow <aguelzow@pyrshep.ca>
* analysis-histogram.c (analysis_tool_histogram_engine_run): shorten the source only
in the presence of labels
* analysis-histogram.c (analysis_tool_histogram_engine_run):
shorten the source only in the presence of labels
2018-03-13 Morten Welinder <terra@gnome.org>
......
......@@ -3729,14 +3729,17 @@ GSF_CLASS (GnmIterSolver, gnm_iter_solver,
static GObjectClass *gnm_solver_factory_parent_class;
static void
gnm_solver_factory_dispose (GObject *obj)
gnm_solver_factory_finalize (GObject *obj)
{
GnmSolverFactory *factory = GNM_SOLVER_FACTORY (obj);
if (factory->notify)
factory->notify (factory->data);
g_free (factory->id);
g_free (factory->name);
gnm_solver_factory_parent_class->dispose (obj);
gnm_solver_factory_parent_class->finalize (obj);
}
static void
......@@ -3745,7 +3748,7 @@ gnm_solver_factory_class_init (GObjectClass *object_class)
gnm_solver_factory_parent_class =
g_type_class_peek_parent (object_class);
object_class->dispose = gnm_solver_factory_dispose;
object_class->finalize = gnm_solver_factory_finalize;
}
GSF_CLASS (GnmSolverFactory, gnm_solver_factory,
......@@ -3767,12 +3770,14 @@ gnm_solver_db_get (void)
}
/**
* gnm_solver_factory_new: (skip)
* @id:
* @name:
* @type:
* @creator: xxx(scope forever)
* @functional: xxx(scope forever)
* gnm_solver_factory_new:
* @id: Unique identifier
* @name: Translated name for UI purposes
* @type: Model type created by factory
* @creator: (scope notified): callback for creating a solver
* @functional: (scope notified): callback for checking if factory is functional
* @data: User pointer for @creator and @functional
* @notify: Destroy notification for @data.
*
* Returns: (transfer full): a new #GnmSolverFactory
*/
......@@ -3781,7 +3786,9 @@ gnm_solver_factory_new (const char *id,
const char *name,
GnmSolverModelType type,
GnmSolverCreator creator,
GnmSolverFactoryFunctional functional)
GnmSolverFactoryFunctional functional,
gpointer data,
GDestroyNotify notify)
{
GnmSolverFactory *res;
......@@ -3795,6 +3802,8 @@ gnm_solver_factory_new (const char *id,
res->type = type;
res->creator = creator;
res->functional = functional;
res->data = data;
res->notify = notify;
return res;
}
......@@ -3810,7 +3819,7 @@ gnm_solver_factory_create (GnmSolverFactory *factory,
GnmSolverParameters *param)
{
g_return_val_if_fail (GNM_IS_SOLVER_FACTORY (factory), NULL);
return factory->creator (factory, param);
return factory->creator (factory, param, factory->data);
}
gboolean
......@@ -3821,7 +3830,7 @@ gnm_solver_factory_functional (GnmSolverFactory *factory,
return FALSE;
return (factory->functional == NULL ||
factory->functional (factory, wbcg));
factory->functional (factory, wbcg, factory->data));
}
static int
......
......@@ -484,18 +484,23 @@ void gnm_iter_solver_set_solution (GnmIterSolver *isol);
#define GNM_IS_SOLVER_FACTORY(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GNM_SOLVER_FACTORY_TYPE))
typedef GnmSolver * (*GnmSolverCreator) (GnmSolverFactory *factory,
GnmSolverParameters *param);
GnmSolverParameters *param,
gpointer data);
typedef gboolean (*GnmSolverFactoryFunctional) (GnmSolverFactory *factory,
WBCGtk *wbcg);
WBCGtk *wbcg,
gpointer data);
struct GnmSolverFactory_ {
GObject parent;
/* <private> */
char *id;
char *name; /* Already translated */
GnmSolverModelType type;
GnmSolverCreator creator;
GnmSolverFactoryFunctional functional;
gpointer data;
GDestroyNotify notify;
};
typedef struct {
......@@ -508,7 +513,9 @@ GnmSolverFactory *gnm_solver_factory_new (const char *id,
const char *name,
GnmSolverModelType type,
GnmSolverCreator creator,
GnmSolverFactoryFunctional functional);
GnmSolverFactoryFunctional functional,
gpointer data,
GDestroyNotify notify);
GnmSolver *gnm_solver_factory_create (GnmSolverFactory *factory,
GnmSolverParameters *param);
gboolean gnm_solver_factory_functional (GnmSolverFactory *factory,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment