[Geany-Devel] Adding a plugin

Matthew Brush mbrush at xxxxx
Sun Jun 9 10:19:15 UTC 2013


On 13-06-09 03:07 AM, Frank Lanitz wrote:
> On Sun, 09 Jun 2013 01:46:09 -0700
> Matthew Brush <mbrush at codebrainz.ca> wrote:
>
>> On 13-06-08 02:54 AM, Roger Booth wrote:
>>> [...]
>>
>>> One thing I could ask for is a reference in the docs to where I can
>>> find the correspondence between api and abi. Maybe thats the wrong
>>> question, but anyway, how do i know which abi version I need? This
>>> is in regards to PLUGIN_VERSION_CHECK(xxx)
>>>
>>
>> As mentioned in other replies, there's the wiki page that maps API,
>> ABI and other versions into a simple table.
>>
>> IMO, plugin authors shouldn't have to bother with ABI numbers at all
>> and API numbers should be transparent. If I want to write a plugin, I
>> would like to have some boilerplate like:
>>
>>       #include <geanyplugins.h>
>>
>>       GEANY_PLUGIN_REGISTER(1, 24, 0, /* min supported geany version */
>>                             "Hello World",
>>                             "0.01",
>>                             "Another hello world",
>>                             "You <you at yourdomain.org>");
>>
>>       void plugin_load(GeanyPlugin *plugin)
>>       {
>>           g_print("Loading plugin '%s'...\n",
>>                   geany_plugin_get_name(plugin));
>>       }
>>
>>       void plugin_unload(GeanyPlugin *plugin)
>>       {
>>           g_print("Unloading plugin '%s'...\n",
>>                   geany_plugin_get_name(plugin));
>>       }
>
>
> Well... Not sure whether it's really better than the current approach
> but patches are welcome ;)
>

Compared to current approach:

     #include <geanyplugin.h>

     GeanyFunctions *geany_functions; // WTF is this?
     GeanyPlugin *geany_plugin; // Why is this global?
     GeanyData *geany_data; // WTF?

     GEANY_VERSION_CHECK(211 /* WTF!? What is this!? */) /* semi-colon? */

     GEANY_SET_INFO("Hello World",
                    _("0.01"), /* What stuff to translate? */
                    "Another hello world",
                    "You <you at yourdomain.org>");

     void plugin_init(GeanyData *data /* WTF!? isn't this the global 
GeanyData? */
     {
       /* If you use any custom GObjects, you must register them and 
then you must call the Geany version of the make_resident() function 
from GModule. */
     }

     void plugin_cleanup(void /* WTF!? Why not GeanyData or GeanyPlugin? */)
     {
       /* free nasty globals here */
     }

Cheers,
Matthew Brush



More information about the Devel mailing list