GNOME Bugzilla – Bug 373110
add a way to specify constructors of internal objects
Last modified: 2006-12-08 20:44:42 UTC
Currently, GtkComboBoxEntry always creates an entry using gtk_entry_new(). It would be great if GTK+ had a way to specify usage of a different construct of GtkEntry-derived object. I imagine you could specify GType for internal objects and such objects were created with untyped constructor (g_object_new (type, NULL).) Even more flexible approach would be to use a callback function to specify arbitrary constructor, but I'm not sure how to infer GType from a function... (Such approach is more flexible since some language bindings don't use GType.) Probably constructors could be static. It hardly makes sense or justifies additional effort to use several in one application. This is a generic problem in GTK+, not limited to combo box entries, but rather to any composite objects/widgets.
In general, you should never have to deal with internal objects anyway. What can't you do without this? Maybe the answer would be a more specific bug request.
In my particular case I want C++ objects to be able to synchronize their values with external variables. I cannot do this currently, because combo box creates an entry with gtk_entry_new() which knows nothing about gtkmm. I can wrap GtkEntry objects to necessary type (derived from Gtk::Entry.) Signals then work, but not on_*() methods in C++ object, which are never called. If GTK+ created entry with a callback (which would amount to gtk_entry_new() by default), gtkmm could tell it to create entries with Entry_Class. Then C++ inheritance would work automatically, as long as you register necessary wrappers.
Also it is weird to be a duplicate of a younger bug, I close this one as it is better to have similar bug opened by a GTK+ developer. *** This bug has been marked as a duplicate of 356864 ***