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

Kjell Ahlstedt via gtkmm-list <[email protected]>
Newsgroups gmane.comp.gnome.gtkmm
Message-ID <[email protected]>
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.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.