GNOME Bugzilla – Bug 748228
G_DEFINE_BOXED_TYPE_WITH_CODE() needs better documentation
Last modified: 2015-05-30 09:04:51 UTC
The documentation of G_DEFINE_BOXED_TYPE_WITH_CODE() says Similar to G_DEFINE_BOXED_TYPE(), but allows to insert custom code into the type_name_get_type() function, e.g. to register value transformations with g_value_register_transform_func(). That's true, but it should also be mentioned that the calls to g_value_register_transform_func() must not be made in the most natural way. In custom code in a call from G_DEFINE_BOXED_TYPE_WITH_CODE(GFoo,...) it's not possible to have a call of type g_value_register_transform_func(G_TYPE_FOO, G_TYPE_BAR, transform_func). The call must be g_value_register_transform_func(g_define_type_id, G_TYPE_BAR, transform_func). See also bug 723394 comment 18.
Created attachment 302058 [details] [review] docs: Add an example of G_DEFINE_BOXED_TYPE Mention that the GType of the boxed type is stored inside the g_define_type_id variable. See bug: https://bugzilla.gnome.org/show_bug.cgi?id=723394
Review of attachment 302058 [details] [review]: Looks good to me! Just two trivial comments about the commit message. 1. s/G_DEFINE_BOXED_TYPE/G_DEFINE_BOXED_TYPE_WITH_CODE/ in the subject line. 2. Shouldn't the commit message refer to this bug (748228) rather than to 723394?
Review of attachment 302058 [details] [review]: Emmanuele has committed the patch. https://git.gnome.org/browse/glib/commit/?id=5e7e058a9c26fa735386cf45b41ad91cc7768137