[Geany-devel] Symbols access from plugins

Enrico Tröger enrico.troeger at xxxxx
Mon Feb 23 19:28:18 UTC 2009

On Mon, 23 Feb 2009 15:36:40 +0100, Colomban Wendling
<ban-ubuntu at club-internet.fr> wrote:


>I've started yesterday to write a (small) plugin to generate advanced
>documentation comments since I'm not pretty sure Geany's core is the
>right place. With advanced, I mean I would try to support Doxygen as
>well as GTK+ doc style, generate list of parameters automatically and
>so on.

Sounds cool.

>Then, I have some questions:
> * Is it possible to get tags for the current function, or at least
>function's start line, from inside a plugin?

Not directly. Without having tested, it should be possible to get the
tag list for a document by using the 'tm_file' field of the
GeanyDocument structure.

GeanyDocument *doc;
TMWorkObject *tm_wo = doc->tm_file;
GPtrArray *tags = tm_wo->tags_array;

This should give you an array of TMTag objects for the current file,
then you can search this array for the corresponding TMTag object of
the desired line in the document or function name or whatever.
The above is untested but should work or at least should suffice as a
start to get it working :).

> * Am I in the wrong way for anything? (is there a better way to get
>current function property; should I only improve Geany's
>functionality; …) 

I'd say it depends on how heavy your improvements will go. It's
probably best to first develop it as a plugin and then we can still
think about integrating it into the core.

> * Is there a way to add an item into the
>editor_popup=>insert_comments submenu from a plugin?

For some example code, see src/scplugin.c and src/gui.c of the
spellcheck plugin [1].

In plugin_init() just create your menu item and attach it to the menu.
The pointer to the submenu item you want can be retrieved with:

ui_lookup_widget(geany->main_widgets->editor_menu, "comments");

Don't forget to destroy the create menu item(s) in plugin_cleanup().

In case you want show/hide/update the menu item when the editor menu is
actually shown, you need to connect to the "update-editor-menu" signal.

[1] http://geany-plugins.svn.sourceforge.net/viewvc/geany-plugins/trunk/


Get my GPG key from http://www.uvena.de/pub.asc
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
URL: <http://lists.geany.org/pipermail/devel/attachments/20090223/e19fe9fd/attachment.pgp>

More information about the Devel mailing list