Re: [gtk-list] Re: Gtk--: Accelerators and ItemFactory the hard way



lecorfec@etudiant.univ-mlv.fr (David LE CORFEC) writes:
>     accelGroup = new Gtk_AccelGroup();
>     itemFactory = new Gtk_ItemFactory_MenuBar("<Main>", *accelGroup);
>     ...
>     s = strdup (MENU_APPLICATION_OPEN); // ???

Hmm, I dont think we have anywhere a thing which takes ownership of a string.
strdup() is certainly not needed. (or if it is, then there's a major bug
in gtk--.)

>     item = itemFactory->create_item (s, "<control>F", "",
>          ItemFactoryConnector<Gui, string>(this,&appMenuCallback, s));
>     menuHash->insert (s, item);         // ???

what is this? create_item returns a Gtk_Widget* and thus it handles
the memory of the widget -- you dont need to deal with deallocating
such object.  It'll be deleted when the factory is deleted, so you
dont need to deal with it.

>  This morning I also had the funny warning in the gtk_widget_destroy()
>  assertion. Looks like I should not return from the callback connected
>  to the "destroy" signal of my window
>  (I wanted to do this to put a "delete w" in an idle cb)

probably calling delete_self() inside some callback will work better.

>  Perhaps there's a better way to handle window closing via window manager ...
>  (it happens only when quitting this way)

delete_event_impl and return proper value from it?

-- 
-- Tero Pulkkinen -- terop@modeemi.cs.tut.fi --



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