[Geany] Plugin Events Patch

blackdog blackdog at xxxxx
Thu Aug 2 13:25:46 UTC 2007


Hi there

I've attached a patch for the last implementation that Nick suggested.
This is just in case the signals idea doesn't pan out, or it's not
implemented due to time issues etc. If we know that a plugin implements
on_sci_notify the geany implementation can be changed later without
affecting anything else - so maybe this patch can suffice in the
meantime? The one issue in the patch is I'm calling
on_plugin_notification from on_editor_notification, maybe it should be
a proper callback from g_signal_connect, just like
on_editor_notification?

Also, I added a sci_show_autocomplete in this patch too, as it's needed
for my plugin.

Cheers.

bd


On Wed, 1 Aug 2007 19:17:37 +0200
Enrico Tröger <enrico.troeger at uvena.de> wrote:

> On Wed, 01 Aug 2007 16:28:39 +0100, Nick Treleaven
> <nick.treleaven at btinternet.com> wrote:
> 
> Hi,
> 
> > 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.
> Why don't we just use the signal framework from Glib/GTK?
> My suggestion:
> Let's define a bunch of available signals like
> "plugin::sci-notify"
> "plugin::build-complete"
> "plugin::show-auto-complete-list"
> ...
> Then every plugin can connect to these signals using the
> g_signal_connect() family.
> Within the core of Geany, we emit the signal at the appropriate place
> (e.g. in the signal handler of sci-notify we emit plugin::sci-notify)
> and so the signal handler within the plugin is called. The only
> difficult thing probably will be to define the signals.
> 
> I came across this way of signal usage while writing a panel plugin
> for the Xfce panel. There are (at least) these signals for the plugins
> available:
> "configure-plugin"
> "free-data"
> "save"
> 
> configure-plugin is used to tell the plugin it should show its
> configuration dialog, save is when the plugin settings should be saved
> and free-data is fired when the panel is about to remove the plugin.
> 
> Another possibility could be to let the plugins set function pointers
> for several pre-defined actions to functions within the plugin. But
> this would be nothing else than a more simple way of defining signals
> and connecting handlers to them. So, I suggest we use the existing and
> working signals framework from GLib/GTK.
> 
> What do you think?
> 
> Regards,
> Enrico
> 


-- 
http://www.blackdog-haxe.com/

"It is no measure of health to be well adjusted to a profoundly sick
society." --Jiddu Krishnamurti


-- 
http://www.blackdog-haxe.com/

"It is no measure of health to be well adjusted to a profoundly sick
society." --Jiddu Krishnamurti
-------------- next part --------------
A non-text attachment was scrubbed...
Name: events.diff
Type: text/x-patch
Size: 3430 bytes
Desc: not available
URL: <http://lists.geany.org/pipermail/users/attachments/20070802/d9fba7d6/attachment.bin>


More information about the Users mailing list