On Mon, 2007-07-23 at 10:41 -0500, [EMAIL PROTECTED] wrote: [...] > So, my thought was to hook into some "constructor-like" event for some > container widget, and then create my custom widgets in that event > callback. That way I could at least begin to make progress.
If you want a temporary way to get started before integrating your widgets into glade/gazpacho, simply do this: - Add a widget to your project that your custom widget derives from, for example, GtkLabel for MyCustomLabel - search/replace occurences of <widget class="GtkLabel".. for <widget class="MyCustomLabel".. in the glade file - use glade_xml_register_widget() to tell libglade about MyCustomLabel (look at glade-gtk.c from libglade for examples of glade_xml_register_widget() & register_custom_prop() funcs). What kind of widget are you trying to add ? is it a container type ? See below, I'm including an example glade catalog file that should get your widget recognized in no time... > It *looked* like the realize/unrealize events were what I needed, however, > when I hook them they don't get called. If I change the .glade file to > hook, say, a button press, my event callbacks happen, so I know that at > that level my code is working. I would say that "realize" time is a bad time for rebuilding/reparenting your widget hierarchy, "realize" is when objects allocate thier gdk backend resources. > I am hooking the events as "after" events, so that they should be called > in addition to any other events. > > OK, so - what am I doing wrong here? If your toplevel widget is visible=True in the glade file then it will be shown by the time glade_xml_new() returns, so all the realize handlers have already run before ever connecting to the signal... if you hide the toplevel and do gtk_window_present() yourself then you'll be able to get the signal. Cheers, -Tristan Ok so here is your custom widget catalog for glade (goes in /usr/share/glade3/catalogs) : =================================================== <glade-catalog name="mywidgets" library="mywidgets" depends="gtk+"> <glade-widget-classes> <glade-widget-class name="MyCustomWidget" generic-name="custom" title="Custom"/> </glade-widget-classes> <glade-widget-group name="mywidgets" title="My Widgets"> <glade-widget-class-ref name="MyCustom"/> </glade-widget-group> </glade-catalog> =================================================== Notes: - MyCustomWidget will be used in the glade and also used to derive the function name "my_custom_widget_get_type()" that nameing scheme must work for libglade to work (and also for glade to instantiate your type inside the glade runtime). - Currently the "library" xml element is assumed to point to a support module that you can optionally add to /usr/share/glade3/modules, we should be also searching standard library paths but for now you can simply symlink your library to /usr/share/glade3/modules/libmywidgets.so (i.e. we dont need support code, but at least we need to open the library that contains your actual widget). - Using your widget in glade will have the side effect of adding a <requires lib="mywidgets"/> element to your glade file, libglade will be expecting a module for it, you can cheat around writing a module by just calling glade_xml_register_widget() & glade_provides() (i.e. funcs that would have been called by the module). That should be enough to get you up and running :) _______________________________________________ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list