Re: Get active text from GtkComboBox



Martyn,

I know of the tutorial ;)
I noted that one could also do
  g_object_get(combo_box,"model",&model,NULL);
in that case one would need to do g_object_unref(model), when done with it.
So I looked at the gtk+ code and yes it just does a
  return(self->priv->model);

No need to unref() .

Stefan

Martyn Russell wrote:
On Mon, 2004-12-13 at 13:56 +0100, Stefan Kost wrote:

A followup question:

should there be a g_object_unref(model); at the end of the function ?


No.

You create a store with gtk_list_store_new (), or gtk_tree_store_new ()
and you have a reference on that object.  As soon as you assign the
store to the GtkTreeView it adds its reference to the store.  As a
result you must unreference it when you are finished.  With the
GtkTreeModel you are not creating a new object and so don't need to
unreference it, this is up to GTK.

For further information, might I suggest you refer to this tutorial:
http://scentric.net/tutorial/treeview-tutorial.html


-- 
      \|/            Stefan Kost
     <@ @>           private            business
+-oOO-(_)-OOo------------------------------------------------------ - - -  -   -
|       __  Address  Simildenstr. 5     HTWK Leipzig, Fb IMN, Postfach 301166
|      ///           04277 Leipzig      04251 Leipzig
| __  ///            Germany            Germany
| \\\///    Phone    +49341 2253538     +49341 30766101
|  \__/     EMail    st_kost_at_gmx.net kost_at_imn.htwk-leipzig.de
|           WWW      www.sonicpulse.de  www.imn.htwk-leipzig.de/~kost/about.html
===-=-=--=---=---------------------------------- - - -  -    -


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