On Sat, 22 Jan 2005 14:00:42 +0100, Sven Neumann <[EMAIL PROTECTED]> wrote:
> RaphaŽl Quinet <[EMAIL PROTECTED]> writes:
> > [...] I am worried about the configuration parameters that could
> > be used by more than one plug-in.
> Of course plug-ins must not access gimprc directly. gimprc is the core
> rc file and must only be read and written by the core. I was rather
> thinking of letting each plug-in use it's own config file, located in
> the ~/.gimp-2.x directory.
I expected this suggestion, which is why I wrote that I was worried
about the parameters the could be used by more than one plug-in. If
each plug-in uses its own config file, then it will become tricky for
two plug-ins to share some config settings. This could happen if the
load and save plug-ins for some file format want to share some
settings, or for parameters that could be shared by many plug-ins,
such as some metadata (default author, default copyright/license,
etc.) or color profile information, whether some conversions should be
done automatically, ... Some of these things could be handled by the
GIMP and stored into global parasites as we already have the default
comment but that would only solve a part of the problem. Besides, I
would prefer to get rid of the default-comment parasite and move that
to a proper GimpConfig object instead of having to add several new
global parasites for the configurable defaults of some other parts of
the metadata (author, copyright, etc.).
So we still have a problem for the settings that are used by more than
one plug-in. If two plug-ins (or a plug-in and the core) want to save
some settings into the same file (gimprc or some other shared file)
and do it at the same time, then you don't know if you will only get
the settings from one, from both, or if you will get garbage.
Although the race conditions would not occur too often and we could
decide to ignore them, there are some situations that make them more
likely. For example, when you have several images open and you save
them all before quitting the GIMP.
> Regarding concurrent writes, I should probably note that
> GimpConfigWriter writes to a temporary file and moves it to the final
> destination when done.
This is a good thing and that prevents the "garbage" case from
happening. But there is still a problem if two plug-ins want to
update some config settings stored in the same file: you will only get
the updates from one plug-in (or from the core), but you don't know
which one. Of course, if both plug-ins want to update the same
settings, then the user will only get what he deserves. But if they
want to update different settings (no conflict) then one of them will
be lost. This could be avoided if all GimpConfig updates were
serialized through the PDB.
Gimp-developer mailing list