GNOME Bugzilla – Bug 641165
gmmproc: Improve _WRAP_VFUNC with more optional arguments
Last modified: 2011-02-02 10:23:16 UTC
The _WRAP_SIGNAL macro can take the optional arguments custom_default_handler, no_default_handler and custom_c_callback. Similar optional arguments on _WRAP_VFUNC can sometimes be useful. Those arguments can be named, let's say, custom_vfunc and custom_vfunc_callback. Consider e.g. this newly occurring virtual function in gtkmm/gtk/src/widget.hg: virtual void get_preferred_width_vfunc(int& minimum_width, int& natural_width) const; _VFUNC_PH(get_preferred_width, void, `GtkWidget* self, int* minimum_width, int* natural_width') _VFUNC_CC(get_preferred_width_vfunc, get_preferred_width, void, void, `int& minimum_width, int& natural_width', `&minimum_width, &natural_width', 1) _WRAP_VFUNC would generate a get_preferred_width_vfunc_callback function which must be slightly changed manually. The generated get_preferred_width_vfunc can be used as is. How much more readable (and easier to write) the widget.hg file would be, if you could instead write: _WRAP_VFUNC(void get_preferred_width(int& minimum_width, int& natural_width) const, get_preferred_width, custom_vfunc_callback) I will soon attach a patch.
Created attachment 179815 [details] [review] patch: gmmproc - Add optional arguments custom_vfunc[_callback] to _WRAP_VFUNC. Here's the patch. I'm not a perl expert, but the changes are quite straight- forward. I've tested the modified perl code by rebuilding a fair amount of the code in gtkmm, with the argument custom_vfunc_callback used in widget.hg.
Great. Pushed to git master. Now, I guess you share my dislike of the perl and m4 mix.
Fortunately perl as a language is not that bad. Hopefully I'll manage to get rid of m4 at some point after cleaning up the perl code. But that rather will be usable for gtkmm4 as you rather won't risk ABI breaks caused by changed generator.
The commit http://git.gnome.org/browse/glibmm/commit/?id=abd2e2a991155d83e5eba620565b651a942d10f3 changes only ChangeLog. What happened to the changes in WrapParser.pm and Output.pm?
Sorry. This one fixes that: http://git.gnome.org/browse/glibmm/commit/?id=f4d6bc29fcf364ddfb5cd714ccf41637f1e2c676