gnc_plugins

Derek Atkins warlord at MIT.EDU
Fri Dec 31 13:21:08 EST 2004


Chris Shoemaker <c.shoemaker at cox.net> writes:

> I noticed that there are (at least) two ways that GncPlugins are added
> to the GncPluginManager:
>   1) in gnc_gui_init() in top-level.c: gnc_plugin_manager_add_plugin
> is called explictly.  (with a comment about removing this usage)
>   2) sometime before gnc_gui_init() is called, several other plugins
> are added, e.g. stylesheets.  I'm not really sure how, but I think it
> comes from scheme-land, e.g. perhaps: (load-module
> "gnucash/report/stylesheets" 0 #f) ?  (which also has a comment about
> eventually making modules loaded automatically instead of statically)
>
> So, what's the right way of adding plugins to the plugin manager.
> Keep in mind I'm considering a plugin that doesn't (currently) have
> any scm component.

You don't need a scheme component in a module, however I can't think
of any modules where you would not want a scheme component in order to
export your module functionality to the scheme interface.

gnc_gui_init() is an internal function that initializes the GUI.  You
shouldn't use it yourself.  You should, instead, plugin your menu
options using the various sets of APIs available to do so.

> And, while I'm asking about gui stuff... what about gncPlugins
> vs. gnc_menu_extenstion_ stuff?  All the Reports menu stuff uses
> gnc_menu_extensions and no gncPlugin at all.  

gncPlugin is a new-in-g2 api; the gnc_menu_extension is the older
interface.  There's no reason to use one vs. the other as far as I
know.

> There are so many menuing APIs in use, it makes my head spin (or is
> that the egg nog?)  Can't we all just use the same one?  :-)

No, we can't.  We need one API from scheme, one from C, and we need
static and dynamic interfaces.  The reports are all dynamic so they
need a dynamic menu interface.  However the business features are
static, so they can use a static interface.

> What shall it be?

Use whichever is reasonable for your module.

> -chris

-derek

-- 
       Derek Atkins, SB '93 MIT EE, SM '95 MIT Media Laboratory
       Member, MIT Student Information Processing Board  (SIPB)
       URL: http://web.mit.edu/warlord/    PP-ASEL-IA     N1NWH
       warlord at MIT.EDU                        PGP key available


More information about the gnucash-devel mailing list