zim-wiki team mailing list archive
-
zim-wiki team
-
Mailing list archive
-
Message #01669
Re: Disabling/Enabling plugins per Notebook
On Tue, Mar 6, 2012 at 7:00 AM, Jaap Karssenberg
<jaap.karssenberg@xxxxxxxxx> wrote:
> On Tue, Mar 6, 2012 at 5:25 AM, Adam Porter <adam@xxxxxxxxxxxxx> wrote:
>> Does Zim load the plugins when a notebook is opened, or when the
>> daemon is loaded?
>
> They are opened per instance, but they open before the notebook is
> opened. So may need a little bit of refactoring.
>
> Zim first constructs the GtkInterface object, this loads the plugins,
> than it loads the Notebook object. Probably we can delay loading
> preferences in the GtkInterface until the notebook is loaded. Or load
> the default ones, and replace them when the notebook turns out to have
> a non-default profile.
>
I've been looking at the code yesterday, and I think I have identified
the process you describe.
So, using your general idea, what I'm planning to do is this:
* add a class attribute to the plugin base class,
is_notebook_independent or something, the default would be False.
automount (and any other plugin that requires it) should overwrite
this with True
* load the general preferences, but as far as plugins is concerned,
load only those marked with is_notebook_independent
* open/initialize the notebook
* try to load a specific notebook profile with preferences. If one is
found, merge (or replace?) the general preferences. If we merge, the
specific profile should take precedence.
* load the plugins
Does this seem reasonable?
--
Mariano
Follow ups
References