Re: [gnome-db] Tree-structured data
- From: Vivien Malerba <vmalerba gmail com>
- To: Diego Zuccato <diego otello alma unibo it>
- Cc: GNOME-DB List <gnome-db-list gnome org>
- Subject: Re: [gnome-db] Tree-structured data
- Date: Tue, 31 Jan 2006 11:15:08 +0100
2006/1/31, Diego Zuccato <diego otello alma unibo it>:
> Vivien Malerba wrote:
> > If you can think of any good data presentation to the user, I'll be
> > happy to include your ideas/code.
> IMO a good starting point could be GtkTreeStore, plus
> expand()/collapse() methods (only expand() actually fetches rows from db).
> We need another method (and a constructor) to set the query used by
> expand() to retrieve child nodes and which column to use as parameter.
> OR we could provide a callback (it's more general).
>
> > Ok, can you propose some API/Code for that?
> Here's my API proposal. It probably needs some fine tuning (I'm quite
> biased by my experience implementing my own case) but it should be a
> good starting point.
>
> GdaDataModelTree *gda_data_model_tree_new(
> gint cols,
> void (*expand_cbk)(GdaDataModelTree *, GdaRow *, gpointer),
> gpointer data);
> This creates the model. expand_cbk is the callback used when expanding a
> row. It gets the tree, a pointer to the row being expanded and user-data.
> I don't think an automatic freeze/thaw is a good idea... Better leave it
> to the programmer.
>
> void gda_data_model_tree_expand(GdaDataModelTree *, GdaRow *);
> This programmatically expands a node (actually calling expand_cbk).
>
> void gda_data_model_tree_collapse(GdaDataModelTree *, GdaRow *);
> This programmatically collapses a node, removing from the model its
> children.
I suggest rather a function like:
GdaDataModelTree *gda_data_model_tree_new (GdaDataModel *model);
which creates a GdaDataModelTree object.
Each row of @model will possibly be expanded.
Then make that object emit a "row_to_expand (gchar *row_path)" signal
which can be caught to actually add the children of the
GdaDataModelTree for the corresponding row. The children are added by
specifying a new GdaDataModel which contents is added below (as
children) of the corresponding row.
It can also emit a "row_to_collapse (gint row)" which can be caught
before the GdaDataModel which represented the children of the row is
removed.
Also we need to have:
void gda_data_model_tree_expand(GdaDataModelTree *, gchar *row_path);
void gda_data_model_tree_collapse(GdaDataModelTree *, gchar *row_path);
The row_path is the same as the string used along with GtkTreePath objects.
Now, I think the GdaDataModelTree should really be just another
GdaDataModel object (to be put into libgda) and we need to write an
object in libgnomedb which implements the GtkTreeModel interface on
top of the GdaDataModelTree.
How does it sound?
Vivien
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]