On Tue, 20 Nov 2007 16:59:55 +0100, Bo Lorentsen bl@lue.dk wrote:
It isn't really needed. There is no consistent handle for the project's keyfile while Geany is running. The file is only opened when the project is opened, configured or closed. Plugins already have access to the project's configuration file path. Maybe, when opening or closing a project, the used handle can be passed to the signal handler to minimize file access(i.e. the plugin doesn't have to open and write the configuration file again on project open/close).
Passing a valid keyfile pointer when firing the signals would be a huge help, and a nice way of doing this.
I just added three signals: project-open, project-save and project-close. project-open and project-save submit the keyfile object which may be modified. Some basic documentation can be found at the top of src/plugindata.h, I'll write some more plugin documentation soon.
At the moment, I'm not completely sure whether it is save to pass the keyfile object when emitting the signal. It might be it can already be invalid(due to free()) in the signal handler although my tests worked fine. I just don't know for sure whether g_signal_emit emits the signal instantly and wait for all connected handlers to return or whether it returns before handlers are finished. In the latter case, the passed keyfile object may become invalid because after the signal(e.g. project-open) is emitted, the keyfile object is freed.
Regards, Enrico