[Geany-devel] API: headers / GeanyEditor / gint idx

Enrico Tröger enrico.troeger at xxxxx
Tue Jun 10 13:09:41 UTC 2008


On Tue, 10 Jun 2008 13:10:30 +0100, Nick Treleaven
<nick.treleaven at btinternet.com> wrote:

> Hi,
> I've thought of some more plugin API changes to improve consistency
> and/or organisation:
> 
> 1. Make header names consistent - I've used ui_utils.h,
> plugin-symbols.c - probably they should just be uiutils.h,
> pluginsymbols.c.

I'm not sure. We could rename the plugin-symbols.c but do we need to
rename ui_utils.h? I personally like the underscore because it is more
readable than without even if it is a little harder to type.

> 2. Make editor functions take a GeanyEditor struct pointer. The editor
> fields of GeanyDocument could be moved into a separate struct, as the
> document struct is quite big, making it harder to locate fields. This
> is also good for an object-based design.

I agree.

> 3. The document functions could take/return a GeanyDocument pointer
> instead of a document index, which would avoid the use of:
> documents[idx]->
> being repeated all over the code base when doc-> is much neater. We
> would also need to update functions like msgwin_msg_add which take a
> idx parameter (this seems to be the only one at first glance).
> 
> I forgot to say, it would also mean much neater checks for an invalid
> document, just doc != NULL instead of DOC_IDX_VALID(idx) in most cases
> after using p_document->get_current().

Yeah, that's the killer argument ;-). I like the idea even if it is a
lot of work.

> This could be quite a big change, so it could be brought in gradually
> by having an additional p_documents field in GeanyFunctions, using a
> documents_ prefix for the new functions instead of document_. Once the
> changes are complete we could deprecate the old ones.

Don't know if it is worth. I don't mind if the SVN version is broken
for the one or another day. It's a development version and users should
expect it to be broken.

Regards,
Enrico

-- 
Get my GPG key from http://www.uvena.de/pub.asc
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://lists.geany.org/pipermail/devel/attachments/20080610/469f096d/attachment.pgp>


More information about the Devel mailing list