On 13-10-24 12:23 AM, Thomas Martitz wrote:
Am 24.10.2013 04:09, schrieb Matthew Brush:
On 13-10-23 11:36 AM, Thomas Martitz wrote:
[snip]
Regarding that pattern we discussed previously and used in this AutoClose code for attaching data to a document, I'd be interested whether you or anyone thinks this branch (last/top two commits) would be useful to plugins:
https://github.com/codebrainz/geany/commits/document-datalist
IMO it'd be better to make GeanyDocument an actual GObject and get the data lists for "free", but at least this is sort of a step in the same direction.
I agree with that.
I also agree with your general idea of per-document data lists. However, I'm not seeing the point of the new code you added because each doc has already a ScintillaObject, which is a GObject. I would suggest that the document_set_data() and friends wrap around g_object_set_data(doc->editor->sci). This way things are prepared for when GeanyDocument becomes a GObject but without the need to duplicate the glib interface in Geany.
Unless I missed anything that requires the datalist in GeanyDocument directly?
There isn't (or rather shouldn't be) a 1:1 correspondence between a GeanyDocument and the view that's showing it. Consider say a split view where the same document is shown in multiple views, or in two windows or whatever. But you're right, with the way the code is currently, you could just wrap the Scintilla data list, it's just not very future-proof (at least this was my thinking).
Cheers, Matthew Brush