Re: [anjuta-devel] Registering plugin



Hi Seb,

On 11/20/10, Sébastien Granjoux <seb sfo free fr> wrote:
Hi All,

I'm working on cleaning the code of the project manager and I have
several questions:

1. This plugin defines several GObject types, in order to be able to
unload it they should be registered using g_type_module_register_type.
There is a macros to do it in GLib: G_DEFINE_DYNAMIC_TYPE_EXTENDED with
a place to insert custom code. Anjuta provides a specialized version for
plugin object defined in libanjuta/anjuta-plugin.h and named
ANJUTA_PLUGIN_BEGIN and ANJUTA_PLUGIN_END.

I think the Anjuta way is slightly more readable but it's not the
standard way to do it. The instance initialization name is different
prefix##_instance_init instead of prefix##_init and the
prefix##_class_finalize function is needed too.

Do you think it's useful to rewrite Anjuta's macros to follow Glib way ?


I suppose, those boilerplate macros were created before the glib ones
existed (also the ones in libanjuta/anjuta-utils.h), so plugins can be
switched to use the standard glib ones. However, it will require
deprecation of existing anjuta macros, not just delete them.

2. These additional types need to be registered and Anjuta supports this
only for the plugin type, using the macro ANJUTA_SIMPLE_PLUGIN again in
libanjuta/anjuta-plugin.h.

Here I need to create a new macro, but do you think it's better to
define two macros with _BEGIN and _END or only one like in GLib ?

Moreover, the name of the already existing Anjuta macros:
ANJUTA_SIMPLE_PLUGIN is I think a bit tricky because this macros is used
to register the type which is not the same than defining the type done
by ANJUTA_PLUGIN_BEGIN and ANJUTA_PLUGIN_END macros.

So I think that it would be better to rename this macro something like
ANJUTA_REGISTER_SIMPLE_PLUGIN and have by example
ANJUTA_REGISTER_PLUGIN_BEGIN and ANJUTA_REGISTER_PLUGIN_END or
ANJUTA_REGISTER_PLUGIN_EXTENDED like in GLib. Again it changes all
plugins, including the one outside Anjuta tree, do you think it's useful
to do it ?

I would suggest ANJUTA_REGISTER_PLUGIN() and
ANJUTA_REGISTER_PLUGIN_EXTENDED() to be consistent. Again, the
existing macros would have to go through deprecation not to break
external plugins.

Regards,
-Naba



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]