Re: Unable to instantiate GtkTreeModelSort with g_object_new.



On 18 Nov 2001, Jonathan Blandford wrote:

> Tim Janik <timj gtk org> writes:
> 
> > On 18 Nov 2001, Owen Taylor wrote:
> > 
> > > 
> > > Jeff Franks <jcf tpg com au> writes:
> > > 
> > > > Hi,
> > > > 
> > > > I've noticed that you can't instantiate GtkTreeModelSort with
> > > > g_object_new as there is no way the set the child_model. This wouldn't
> > > > be an problem if the gtk_tree_model_sort_set_model() function declared
> > > > in gtktreemodelsort.c were exported.
> > > 
> > >  g_object_new (GTK_TYPE_TREE_MODEL_SORT, "model", model, NULL);
> > > 
> > > The reason that there is no set_model() is that the model can't
> > > be changed after construction... there would be lots of problems
> > > if you had a ModelSort added to a tree view and then changed
> > > the model of the ModelSort.
> > 
> > then there needs to be a ::model property that is flagged as
> > CONSTRUCT_ONLY.
> 
> There is:
> 
>   g_object_class_install_property (object_class,
>                                    PROP_MODEL,
>                                    g_param_spec_object ("model",
> 							_("TreeModelSort Model"),
> 							_("The model for the TreeModelSort to sort"),
> 							GTK_TYPE_TREE_MODEL,
> 							G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));

oops, ok, misparsed owen's mail ;)

> 
> -Jonathan
> 

---
ciaoTJ




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