Re: [gtk-list] Re: Lack of gtk_menu_delete function




Jeremy Weatherford <xidus@xidus.net> writes:
> I think you're missing the point... even if there is a way to do that
> (which still isn't useful in my case since I don't want to keep up with
> the GtkMenuItem pointers),

You have to keep track of either pointers or indexes or something,
otherwise you have no way to remove the item. What args do you want
gtk_menu_delete() to take? Pointers are better than indexes in my
experience, because indexes change as you add/remove items.

> why shouldn't there be a gtk_menu_remove
> function, similar to gtk_clist_remove?  

Because GtkMenu is a GtkContainer, so gtk_container_remove() operates
on it. Also, gtk_widget_destroy() on the child of a GtkContainer is
always guaranteed to work properly. So you deal with the menu in terms
of base classes.

The rows in a clist are not widgets and are not children of the
container, so gtk_container_remove() doesn't apply and there is a
separate gtk_clist_remove().

> And what about gtk_menu_get_item?
> It seems to me like breaking encapsulation to go in and remove/destroy the
> menu item yourself when it's supposed to be owned by the GtkMenu.
> 

The GtkMenu doesn't own the item, it just owns a reference to it. 
And if you destroy the item it will automatically unparent itself.

Havoc



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