Re: Setting custom Glib::Property values in Gtk::Builder .ui XML



On 6/10/19 10:39 AM, Daniel Boles via gtkmm-list wrote:
A related question here is: How can we ensure the derived type is registered with GObject before GtkBuilder would need it? Will a simple g_type_ensure( g_type_from_name("gtkmm__Custom_Whatever") ) work? I imagine not, as the GObject class won't exist until C++ constructs the first instance, right? Then it would seem we must instead create a dummy C++ instance (and ensure it isn't optimised out) before trying anything that would require GObject to know about it...

I think you're right. The only way to have a custom widget's type registered in the GType system is to create an instance. All the ordinary gtkmm types are registered with calls to the static get_type() methods. That's done in wrap_init(). But there is no corresponding method to call for custom types.

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