[Geany] [PATCH] plugin api request filetypes_get_from_uid()
Nick Treleaven
nick.treleaven at xxxxx
Wed Mar 12 12:38:15 UTC 2008
On Wed, 12 Mar 2008 11:13:36 +0200
Yura Siamashka <yurand2 at gmail.com> wrote:
> Hi
>
> I need to loop all supported geany filetypes in my geanydoc plugin
> (http://repo.or.cz/w/geanydoc.git).
Out of interest, what does the plugin do? I couldn't find anything that
explained it.
> filetypes_get_from_uid() is just what I need. Please add it to plugin
> api. Patch attached.
>
> Also I notice filetypes_get_from_uid() is written somehow strange.
> Since "id" field also act as pos in filetypes array I think it is not
> necessary to loop filetypes every time. Second patch use simple if to
> do job.
The UID is not the index into the filetypes array. Look at
the enum with FILETYPE_UID_C in filetypes.c, the enum values cannot
change. The filetype_id enum can change, and is the index.
You can use GeanyData::filetypes, which is an array of filetype
pointers, to loop through each filetype.
Regards,
Nick
More information about the Users
mailing list