After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 721116 - Example cellrenderertoggle.cc needs update to avoid warnings
Example cellrenderertoggle.cc needs update to avoid warnings
Status: RESOLVED OBSOLETE
Product: gtkmm
Classification: Bindings
Component: documentation
3.8.x
Other Linux
: Normal normal
: ---
Assigned To: gtkmm-forge
gtkmm-forge
Depends on:
Blocks:
 
 
Reported: 2013-12-27 05:46 UTC by Andrew Potter
Modified: 2014-06-09 14:42 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Andrew Potter 2013-12-27 05:46:03 UTC
I'm not sure how to properly add a new Glib::Property to custom cell renderers with the recent glib changes to class initialization.
 
https://git.gnome.org/browse/gtkmm-documentation/tree/examples/others/cellrenderercustom/cellrenderertoggle.cc gives these runtime warnings that imitate what I'm trying to do:

(a.out:1199): GLib-GObject-WARNING **: Attempt to add property gtkmm__CustomObject_N12_GLOBAL__N_120MyCellRendererToggleE::activatable after class was initialised

(a.out:1199): GLib-GObject-WARNING **: Attempt to add property gtkmm__CustomObject_N12_GLOBAL__N_120MyCellRendererToggleE::active after class was initialised

(a.out:1199): GLib-GObject-WARNING **: Attempt to add property gtkmm__CustomObject_N12_GLOBAL__N_120MyCellRendererToggleE::radio after class was initialised

It would be helpful if this example could be updated. Thanks!
Comment 1 Kjell Ahlstedt 2013-12-30 18:39:16 UTC
At present there is no proper way of adding custom properties in a gtkmm
application. It's not just a matter of updating the example in the gtkmm
tutorial. This problem requires changes in glibmm. I've thought a bit about
the problem, but I haven't found a reasonable solution.

There is some related information in glibmm bug 697229 comment 27 and in
glib bug 698614 comment 18.
Comment 2 Andrew Potter 2013-12-30 21:17:34 UTC
I began to suspect that and ended up implementing my cell renderer in C.

It seems like Glib::Property will need to be depreciated (if depreciation is even the word for "Doesn't work anymore") since its constructor does the property installation and there's no way to call its constructor after ObjectBase() but before Object(). 

Would it be possible to replace the functionality by adding a Glib::ObjectBase constructor method that takes an additional argument, something like a std::list of type/name pairs?
Comment 3 Kjell Ahlstedt 2014-06-09 14:42:59 UTC
The glib developers have decided to continue allowing installation of
properties after class_init. Fine! See
https://git.gnome.org/browse/glib/commit/?id=85e9455f68c6cc6093a1ede1c5f15587bba08b51

Such properties may not be completely thread-safe, though. See
https://git.gnome.org/browse/glib/commit/?id=f2f66bfe45f41d18e7437341e5ebf4c70d815958

With the latest glib version from the git master branch the cellrenderertoggle
example does not complain about adding properties after class_init.
The glib bug 698614 has been closed and marked FIXED, although I would say
WONTFIX is the right resolution code.

With that fix in glib, I consider this gtkmm bug obsolete.