GNOME Bugzilla – Bug 152764
PropertyProxies for signals with '_' in them do not fire
Last modified: 2004-12-22 21:47:04 UTC
This is the infamous '_' vs '-' problem rearing it's head again. It seems, from what I can read in the glibmm source that when attaching a property proxy, there is no special casing to convert the '_' to a '-'. If this is not done, gobject doesn't make a match when notifying the signal. Specifically, I'm trying to listen for change's to a Gtk::Action's stock_id property. If I attach a callback to property_stock_id(), I'm never notified but if I attach a gsignal callbakc to "notify::stock-id", I do get notified (and if I use "notify::stock_id", I get nothing, as expected). There are more than a few properties with '_' in their names out there...
I though that I had fixed this once before, though it might have been done in glib. If it needs fixing again then it should be quite simple. But I'll need a test case first, please. Or a patch would be even better. Thanks.
Created attachment 31621 [details] Test case for problem Here is a testcase illustating the problem. It fails with gtkmm 2.4.5 and glibmm 2.4.4 I have thought about how to fix it and it seems the only way is in the property proxy when it's comparing the notify it's just received with the detail that's being watched. It would need to do a -/_ insensitive compare to get it right. I don't think that a 'case' conversion could be done at PropertyProxy construction time because the get/set calls might not work with - instead of _. I can put a patch together if you think this is the right approach
Created attachment 32041 [details] [review] Fix for the problem. This patch implements my suggested solution and I've confirmed that my code now gets notified on properties with '_' in their names.
I suppose it's slightly abusive to do this, but the problem is confirmed.
Sorry, I still have to investigate this in more detail before applying the patch. It looks sensible though. Please remember to patch the ChangeLog in future: http://www.gtkmm.org/bugs.shtml#CreatingPatches
Created attachment 32296 [details] [review] Fix diff with changelog That was a tentative fix. Now that you think it's the right thing to do, here's one with a changelog.
Created attachment 32612 [details] [review] glibmm_canonical_property.patch I chose to do it with this patch instead, so that we do the work at build time, not at runtime. Please reopen this bug if it doesn't fix it. Thanks for the research.
Seems to have done the trick.