> *- Is there a way to pass a function to free certain struct in a 
> GtkTreeModel so GTK frees the allocated space when the model's reference 
> count reach to 0? (without registering it as a G_TYPE).*
>   

One way is to register the struct as a "weak reference" to the model, 
using g_object_weak_ref. See:

http://developer.gnome.org/doc/API/2.0/gobject/gobject-The-Base-Object-Type.html
> *- When reference count starts? I read somewhere that it starts when you 
> add the widget into a container, is it always this way??? Eg:*
>   
Reference counting starts when an object is created. In your example:

   GtkWidget *entry = gtk_entry_new ();

After this statement, there is one reference to the entry. When 
gtk_container_add is invoked, it takes over ownership of this 
reference.  That is when the container is destroyed, g_object_unref is 
invoked on the entry. So one needs to invoke destroy only on the root 
widget (typically).

> //*No reference counting on GtkEntry*//
>     GtkWidget *entry = gtk_entry_new ();
> //*Reference counting starts here *//
>     gtk_container_add (GTK_CONTAINER (window), entry);/
> /* Another doubt: in this case, reference couting starts with 1 or 2? */
> /
> -* If i get a string from a GtkTreeModel, it gives me a copy or the 
> actual pointer to the data?
>   
If you're using the get_value method on the iterator, the object is 
"copied" into the GValue supplied. Typically this gives you just a 
reference, and invoking g_value_unset results in just decrementing the  
reference count. But what exactly happens during copying depends on your 
object. See:

http://developer.gnome.org/doc/API/2.0/gobject/gobject-Generic-values.html

> *That's it, thanks in advance. Matias.
> _______________________________________________
> gtk-app-devel-list mailing list
> gtk-app-devel-list@gnome.org
> http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
>   

_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Reply via email to