[gnome-db] GdaDataModel is hard to implement on Vala



I'm implementing GdaDataModel interface in an Gee Collection object
called GdaData.DataModelIterable, but I can't implement the following
virtual functions:

		[NoWrapper]
		public abstract bool i_get_notify ();
		[NoWrapper]
		public abstract bool i_iter_at_row (Gda.DataModelIter iter, int row);
		[NoWrapper]
		public abstract bool i_iter_next (Gda.DataModelIter iter);
		[NoWrapper]
		public abstract bool i_iter_prev (Gda.DataModelIter iter);
		[NoWrapper]
		public abstract bool i_iter_set_value (Gda.DataModelIter iter, int
col, GLib.Value value) throws GLib.Error;
		[NoWrapper]
		public abstract void i_set_notify (bool do_notify_changes);

These functions are declared *abstract* because they must be
implemented and with the annotation [NoWrapper] because they don't
have any function in the public header to call like the for example
get_n_rows ();

		[CCode (vfunc_name = "i_get_n_rows")]
		public abstract int get_n_rows ();

In the last function implementors must declare a get_n_rows ().

In the case of the above functions they have the following problems:

* i_iter_at_row, i_iter_next, i_iter_prev are functions that are
implemented on a separated object GdaDataModelIter, then how to deal
with that in C? Is this correct or can be modified in future version?


 * i_set_notify and  i_get_notify they have a function that wrap it
but they are "incompatible" because require different number of
arguments and return type: freeze() and thaw (), initially I've
declared them in GIR  as the one to call for the virtual functions but
fails when Vala try to use them. Now they are declared as above with
no invoker and with [NoWrapper] in Vala bindings.

To fix all this problems is possible to add the following functions to
the GdaDataModel just to have an invoker as a function to call and
make easy to Vala (and maybe other languages) to implement
GdaDataModel interface:

gda_data_model_get_notify (GdaDataModel*)
gda_data_model_set_notify (GdaDataModel*, gboolean)
gda_data_model_iter_at_row (GdaDataModel*, GdaDataModelIter*, int)
gda_data_model_iter_next (GdaDataModel*, GdaDataModelIter*)
gda_data_model_iter_prev (GdaDataModel*, GdaDataModelIter*)

Please tell me if this is correct in order to implement them and
continue on Vala extensions.

-- 
Trabajar, la mejor arma para tu superación
"de grano en grano, se hace la arena" (R) (en trámite, pero para los
cuates: LIBRE)


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