[Geany-Devel] Storing per-project settings for plugins

Matthew Brush mbrush at xxxxx
Thu Feb 16 02:58:07 UTC 2017

On 2017-02-15 11:42 AM, Jiří Techet wrote:
> Hello Vasiliy,
> there should be no problem with your approach (the extra content of the
> config file will be preserved by Geany).
> However, Geany offers plugins the possibility to read/write from/to the
> project config files natively. When you register for the "project-open"
> signal, the callback is invoked every time a project is opened and you
> receive GKeyFile * config as a parameter from which you can read the
> configuration using
> https://developer.gnome.org/glib/stable/glib-Key-value-file-parser.html
> Similarly, when you register for "project-save", you can write your
> configuration to the GKeyFile signal parameter. You can also force the
> emission of the "project-save" signal by calling project_write_config().
> You can check my projectorganizer plugin to see how to use the signals (the
> signals are registered in prjorg-main.c). You can also check
> http://www.geany.org/manual/reference/pluginsignals_8c.html

I also do this in code-format plugin[0], so you can have 
project-specific formating settings. Seems to work well.

Matthew Brush

[0]: https://github.com/codebrainz/code-format/blob/master/plugin.c#L154

More information about the Devel mailing list