Re: g_io_channel_win32_new_messages() WaitForSingleObject()

2009-04-03 Thread Chris Vine
On Thu, 02 Apr 2009 19:49:48 -0500
Thomas Stover tho...@wsinnovations.com wrote:
 Some notes for anyone else who is just figuring out several things
 like myself:
 -a real new source would have a constructor that would do the 
 allocation and setup
 -it would also have its own functions for setting up callbacks to
 source specific events
 -I think g_source_remove_poll() would be called in related
 destructor, so I suppose the GPollFD structure needs to be stored in
 MySource as well -I guess the destructor would be the
 closer_callback of the GSourceFuncs parameter
 -the GSourceFuncs and GPollFD variables are just copied by glib when 
 they given as parameters, so they don't need to dynamic (or 
 global/static like my last examples)

I do not really understand what the issues are (that may be more my
problem than yours) but first, yes you generally would store the GPollFD
object in the source object by value if you are making your own custom
polling source, and secondly since you do need to pass g_source_new()
a GSourceFunc struct, the sensible way to implement that is to make the
GSourceFunc object (which is just a struct of function pointers common
to all source objects of that type) a static object - you don't have to,
but it would be pointless doing it any other way because you may have
more than one of the custom source objects in use at any one time which
would otherwise result in duplicated GSourceFunc objects.

Lastly, glib will correctly manage resources if you use the mechanisms
which it provides.  The finalize function you pass to GSourceFuncs
should free any MySource data which happens to have been allocated on
the heap (generally you would not have any).  Everything else will be
taken care of.  In particular g_source_attach() increments the
reference count on the source object, and after you have called
g_source_attach() you can pass ownership of the MySource object to the
main loop in the normal way by calling g_source_unref() on the MySource
source object. The main loop will then automatically destroy your
MySource object if either the dispatch function returns false, or if
g_source_remove() is called on the source id returned by
g_source_attach().  (The function you use to create your custom source
object should return this ID so that users can do just that.)

Chris

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


help with accelerator labels

2009-04-03 Thread Chuck Crisler
Hello all! I have added a capability to add accelerator keys to a menu
structure after the menu is built. That is a requirement due to the way
the app works. :-( Now I would like to add the accelerator labels to the
menu items. While that is quite easy, is there an easy way to generate
the text for the control keys in a multi-language keyboard manner? I am
referring to the control, shift and alt keys mainly. The Gdk keyval
support doesn't seem to do this. I could delete the menu items and
re-add them with labels, but I don't know that that approach would
properly add the label text vs. simply allowing me to add them like I do
now. Also, how do you delete a specific menu item (in order to add it
again)?

Thank you,
Chuck Crisler

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