Re: [gnome-db] GdaColumn as a GObject



On Thu, 2005-09-22 at 21:53 +0200, Vivien Malerba wrote:
> 2005/9/22, Murray Cumming <murrayc murrayc com>:
> > In libgda HEAD, GdaColumn was recently changed to be a GObject, instead
> > of being a copyable boxed type (struct).
> >
> > This makes ownership a little less obvious. For instance, may we ever
> > use the gda_column_set_*() methods on a GdaColumn that we get from
> > gda_data_model_describe_column() before passing it to
> > gda_data_model_append_column()? I guess not, because we are using the
> > same instance.
> >
> > I guess we need to always create a new GdaColumn before using the set
> > methods, but it seems worth asking/clarifying.
> >
> > If we could keep the copy function (removed when it was changed to a
> > GObject), some things would be easier for me.
> 
> You're right about that problem, I had not seen it!
> 
> However it seems that method is not implemented by any of the
> GdaDataModel* objects, so there are two possibilities there:
> -> change the API to something like
> GdaColumn *gda_data_model_append_column (GdaDataModel *model); or
> -> remore that method completely.

append_column() was just an example chosen at random. I'd guess that it
affects other uses of this object.

But with
GdaColumn *gda_data_model_append_column (GdaDataModel *model)
do you mean that we should then use the gda_column_set() after it has been 
appended? Surely we can't do that at any time, because the actual
database structure is only changed at certain times.
 
> I'd vote for the second solution because:
> -> data models are like tables and the number of columns is known when
> the object is created (like for the GtkListStore and GtkTreeStore
> models)
> -> obviously it has not been used much (otherwise people would have
> noticed that it was not implemented) and it's always better to have
> simple and concise API.
> 
> Tell me what you think and I'll do the changes before 2.0.

I'd prefer that 
- the copy() and equals() methods were re-added.
- Documentation (and use of const) would show whether a copy would be
taken. For instance, 

/** yadda yadda 
 * @column The description of the new column. This column object will be
copied.
 */
void gda_data_model_append_column (GdaDataModel *model, const GdaColumn*
column)

though that's not completely unambiguous.

But I don't know the reasons for changing it to a GObject in the first
place. GObjects are usually for things that you _want_ to share via a
reference.

-- 
Murray Cumming
murrayc murrayc com
www.murrayc.com
www.openismus.com





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