[Geany] Plugin Events Patch

Nick Treleaven nick.treleaven at xxxxx
Wed Aug 1 15:28:39 UTC 2007


On 08/01/2007 02:38:53 PM, blackdog wrote:
> 
> Hi there
> 
> So here's a patch tested against r 1767 which adds a single
> onCharAdded
> event for plugins that implement onCharAdded().
> 
> This is experimental and is really for you to comment on, if it's ok
> by
> you I'll add the other events.
> 
Thanks, but IMO it could be done a bit differently. (I didn't have time 
to reply to your previous message about this, sorry).

I would prefer it to be done in a way that had less changes to the core 
- really I think the plugin API should be kept quite lean. Because I 
think you might want other callbacks besides onCharAdded, perhaps it 
would be best to have a single on_sci_notify() plugin callback (we 
don't really use CamelCase for function names, only typenames ;-)).

Then something like:

// callback func called by all editors when a signal arises
void on_editor_notification(GtkWidget *editor, gint scn, gpointer lscn, 
gpointer user_data)
{
	SCNotification *nt;
	ScintillaObject *sci;
	gint idx;

	idx = GPOINTER_TO_INT(user_data);
	sci = doc_list[idx].sci;

	nt = lscn;
	
	plugins_sci_notify(editor, scn, nt, idx);

Where plugins_sci_notify() calls any plugin that has an on_sci_notify 
symbol.

Also, I'm assuming that this notification doesn't slow down Geany (I 
guess it shouldn't though). I'm also wondering about replacing 
plugin_list GList with a GPtrArray, which could speed up things if 
necessary.

Regards,
Nick



More information about the Users mailing list