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 641165 - gmmproc: Improve _WRAP_VFUNC with more optional arguments
gmmproc: Improve _WRAP_VFUNC with more optional arguments
Status: RESOLVED FIXED
Product: glibmm
Classification: Bindings
Component: build
2.27.x
Other All
: Normal enhancement
: ---
Assigned To: gtkmm-forge
gtkmm-forge
Depends on:
Blocks:
 
 
Reported: 2011-02-01 16:26 UTC by Kjell Ahlstedt
Modified: 2011-02-02 10:23 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
patch: gmmproc - Add optional arguments custom_vfunc[_callback] to _WRAP_VFUNC. (9.10 KB, patch)
2011-02-01 17:52 UTC, Kjell Ahlstedt
none Details | Review

Description Kjell Ahlstedt 2011-02-01 16:26:28 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.
Comment 1 Kjell Ahlstedt 2011-02-01 17:52:16 UTC
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.
Comment 2 Murray Cumming 2011-02-02 08:38:11 UTC
Great. Pushed to git master.

Now, I guess you share my dislike of the perl and m4 mix.
Comment 3 Krzesimir Nowak 2011-02-02 09:06:29 UTC
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.
Comment 4 Kjell Ahlstedt 2011-02-02 10:07:01 UTC
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?
Comment 5 Murray Cumming 2011-02-02 10:23:16 UTC
Sorry. This one fixes that:
http://git.gnome.org/browse/glibmm/commit/?id=f4d6bc29fcf364ddfb5cd714ccf41637f1e2c676