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 705199 - Cannot construct MenuItem - warning, no property named "label"
Cannot construct MenuItem - warning, no property named "label"
Status: RESOLVED FIXED
Product: glibmm
Classification: Bindings
Component: giomm
2.37.x
Other All
: Normal normal
: ---
Assigned To: gtkmm-forge
gtkmm-forge
Depends on: 705201
Blocks:
 
 
Reported: 2013-07-31 10:49 UTC by Pete Woods
Modified: 2013-07-31 12:18 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Delegate to wrapped methods instead of constructor methods (1.51 KB, patch)
2013-07-31 10:54 UTC, Pete Woods
none Details | Review

Description Pete Woods 2013-07-31 10:49:30 UTC
When constructing a MenuItem instance, the following error occurs:

(process:32410): glibmm-WARNING **: Glib::ConstructParams::ConstructParams(): object class "gtkmm__GMenuItem" has no property named "label"

I have attached a simple patch that I hope fixed this issue. The solution idea was copied from "dbusmessage.hg".
Comment 1 Pete Woods 2013-07-31 10:50:37 UTC
To recreate the problem, the code:

MenuItem::create("foo", "app.foo);

is all that is required.
Comment 2 Pete Woods 2013-07-31 10:54:31 UTC
Created attachment 250532 [details] [review]
Delegate to wrapped methods instead of constructor methods
Comment 3 Murray Cumming 2013-07-31 11:04:23 UTC
Yes, I noticed today that these GMenuItem _new() functions are awkward. I filed bug #705201 just in case it can be improved in glib.

For now, I would prefer to reimplement these _new() functions in our constructors rather than call them, because they are fairly simple _new() functions. That lets us continue to instantiate our derived GType.

Would you like to try that?
Comment 4 Pete Woods 2013-07-31 11:14:37 UTC
That's actually the first thing I wanted to do, but I have absolutely no familiarity with the wrapping macros at all.

Is there somewhere I can read up on how to override the constructor bodies?

I would say, however, that the wrapping the methods does have an advantage. It protects glibmm against any future changes in the g_menu_item_new method.
Comment 5 Murray Cumming 2013-07-31 11:17:08 UTC
(In reply to comment #4)
> That's actually the first thing I wanted to do, but I have absolutely no
> familiarity with the wrapping macros at all.
> 
> Is there somewhere I can read up on how to override the constructor bodies?

I'll take care of it. That's probably the best way to show you.

> I would say, however, that the wrapping the methods does have an advantage. It
> protects glibmm against any future changes in the g_menu_item_new method.

Yeah, it's a calculated risk.

Thanks.
Comment 6 Pete Woods 2013-07-31 11:20:48 UTC
(In reply to comment #5)
> I'll take care of it. That's probably the best way to show you.

Okay, cool, thanks! :)
Comment 7 Murray Cumming 2013-07-31 11:33:26 UTC
Here it is:
https://git.gnome.org/browse/glibmm/commit/?id=23823fdf3a54ed3851b8564fa8df993ce6e5e33f

Those _CONSTRUCT() macros would contain property values if there were any properties in GMenuItem. It's documented in the gtkmm-documentation book.

Please confirm that it fixes the problem for you.

Note that these are fairly new classes that obviously haven't been used much yet, so you are likely to find other problems.
Comment 8 Pete Woods 2013-07-31 12:18:08 UTC
Thanks for this! :)

That commit fixes the problem for me.