Re: Need to get the tree view from the model
- From: rpoe <randall c poe lmco com>
- To: gtk-app-devel-list gnome org
- Subject: Re: Need to get the tree view from the model
- Date: Wed, 17 Sep 2008 11:52:33 -0400
dhk wrote:
Emmanuele Bassi wrote:
On Wed, 2008-09-17 at 13:48 +0000, dhk wrote:
What is the most direct way to get the tree view from the tree
model? I don't see a function for doing this.
it wouldn't make any sense.
a model can be used as the data source for many TreeView widgets.
Also, when I went to the source, GtkTreeModel is defined a follows:
typedef struct _GtkTreeModel GtkTreeModel; /* Dummy typedef */
Why is it called a "Dummy typedef" and why can't I find the
structure
for it?
there is no data structure: GtkTreeModel is an interface. the dummy
typedef is there just for type casting purposes.
ciao,
Emmanuele.
I have different treeviews that use the same model, each on a notebook
tabs. Whenever a row is added I call gtk_tree_model_foreach(), which
passes in the model, to get the highest line number (user_data is used
to pass back the number). My GtkTreeModelForeachFunc function uses a
static variable to keep track of the highest number. The problem is if
the user switches tabs I need to reset the static variable since the
treview changed.
This doesn't sound like a very good design, since as you notice
this function can be called by any of the views, in no
predictable order.
If this highest line number is something the tree view needs to
keep track of, then perhaps code associated with the tree
view, not the tree model needs to keep track of it. For
instance, keep a structure like
struct mystruct {
GtkTreeModel *model;
int highest_row;
}
and pass a pointer to that to your function instead.
--
Randall Poe (randall c poe lmco com)
Senior Member Engineering Staff
Lockheed Martin Advanced Technology Laboratory
Sixth Floor, 3 Executive Campus
Cherry Hill, NJ 08002
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]