Re: [gtk-list] GtkList handling



On Thu, 9 Jul 1998, Georg Greve wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> 
> Hi !
> 
> I got a few questions about list handling that are (hopefully) easy to
> answer : ;-)
> 
> - - If I remove a GtkListItem Widget from a GtkList via 
> 	gtk_container_remove(GTK_CONTAINER(list), active_item);
>    do I have to destroy that widget then ? gtk_widget_destroy tells me
>    it is no widget anymore, so I guess so, but guessing isn't knowing...

yes, the item is destroyed upon removal because its ref-count drops to
zero. if you want to reuse the item in another list or so, do something
like
gtk_widget_ref (item);
gtk_container_remove(list1, item);
gtk_container_add(list2, item);
gtk_widget_unref (item);


> - - When I try to set up a GList to insert GtkListItem Widgets in a
>    list, the gtk_list_insert_items function exits fine, but then the
>    program crashes - what else do I have to do to insert an item
>    properly ?

you probably free the list via g_list_free().
gtk_list_insert_items() has special semantics in that it takes over
the list nodes (as stated in the tutorial).

> 
> Later,
> 	Georg
> 

---
ciaoTJ



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