It's useful to be able to attach arbitrary data to documents, especially for plugins. This PR adds GObject-like keyed data lists to documents so plugins can add stuff similar to `g_object_get|set_data()`. The first commit adds a simple wrapper to the document module, the second exposes a safe API for plugins.
In the future if GeanyDocument is ever converted to a GObject, the new `document_get|set_data()` functions could become simple wrappers around `g_object_get|set_data()` rather than using keyed data lists directly.
Aside from conventional plugins, this will also be useful for planned "filetype plugins" from #1195 and possibly for certain proxy plugin implementations, and could even prove useful in the core.
A made a very simple test plugin to tinker with this in https://github.com/codebrainz/geany/commit/b662ba3ca15969429ee2f9cf4c00e8402.... You can view, comment on, or merge this pull request online at:
https://github.com/geany/geany/pull/1203
-- Commit Summary --
* Add support for Keyed Data Lists for documents * Add plugin API functions to get/set document data
-- File Changes --
M src/document.c (23) M src/document.h (7) M src/documentprivate.h (2) M src/plugins.c (39) M src/pluginutils.c (153) M src/pluginutils.h (11)
-- Patch Links --
https://github.com/geany/geany/pull/1203.patch https://github.com/geany/geany/pull/1203.diff