gnc_plugins

Chris Shoemaker c.shoemaker at cox.net
Fri Dec 31 14:18:25 EST 2004


On Fri, Dec 31, 2004 at 02:05:48PM -0500, David Hampton wrote:
> On Fri, 2004-12-31 at 13:21 -0500, Derek Atkins wrote:
> > 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.
> 
> There's a fair number of sections of gnucash that are initialized from
> scheme land.  This is a holdover from the direction of an earlier group
> of developers.  If you code is structured as a module, the best place to
> call the plugin manager is from the module init routine.

If I understand correctly, you're saying the plugin's init function
should add itself to the plugin manager.  AFAICS, no plugin works that
way now.  But, I could try changing that.

> 
> > > 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.
> 
> gncPlugin creates menu items that exist in all top level windows.
> gncPluginPage creates menus that apply only to a particular page within
> a window.  Using the plugins (and underlying action objects) its easier
> to enable/disable menu/toolbar items that it is with the
> gnc_menu_extension interface.
> 

That seems like a good reason to prefer gncPlugin.  Are there downsides?
-chris




More information about the gnucash-devel mailing list