Setting custom Glib::Property values in Gtk::Builder .ui XML
Daniel Boles via gtkmm-list <[email protected]>
| Newsgroups | gmane.comp.gnome.gtkmm |
|---|---|
| Message-ID | <CAKChMKMD0CrJfYMf2Rg=Nv6tj+H3rC8w+H56u_O6hPpjepbtXg@mail.gmail.com> |
Short of having to write an underlying class in C, is there any way to have custom derived widgets with custom Glib::Property, and set those custom properties through a Gtk::Builder .ui? Presuming the answer is no, because the properties are only registered with GType when the instance is constructed - not when the class is constructed, which GtkBuilder won't do anyway if it's C++ - is there any way this could possibly work in future, or discussion I can read? Basically, I'd like to move a tonne of code that does widget packing and property-setting out of .cpp files into .ui files, but it doesn't really seem worth doing if the added properties of my custom widgets would all need set/get through .cpp files still. I'd like to move everything that could be expressed statically/declaratively to .ui files, or nothing. I don't think moving only the base Widget bits to .ui but having to keep the rest in .cpp is better overall, but worse. So far I can derive a subclass of e.g. Gtk::Button, add whatever Glib::Property, and see/change its value in the GTK Inspector. Even this isn't very well documented; it doesn't seem to be included in the main gtkmm doc book at all, for instance, so we might want to fix that. Anyway, this registers properties per-instance when the C++ constructor is called, so GtkBuilder doesn't actually apply the values of custom properties, and the GTK Inspector gives warnings about invalid property IDs when you try to check/change customer properties in a .ui I'm guessing this has been discussed and just can't be done, but I'd just like to check anyway. _______________________________________________ gtkmm-list mailing list [email protected] https://mail.gnome.org/mailman/listinfo/gtkmm-list