It just occurred to me while tinkering with this, if the pdata
argument had come first, then one could use member functions directly in the GeanyPluginFuncs
setup without the need for separate C wrapper boilerplate. It would probably require typedefs for the function pointer types to facilitate type casts. A basic wrapper plugin over a GObject could've looked like this:
// some gobject in vala, to save typing
namespace Foo {
public class Plugin {
bool init(Geany.Plugin p) { return true; }
void cleanup(Geany.Plugin p) {}
}
}
// the actual plugin implementation
G_MODULE_EXPORT void
geany_load_module (GeanyPlugin *p)
{
p->info->name = "Foo";
...
p->funcs->init = (GeanyInitFunc) foo_plugin_init;
p->funcs->cleanup = (GeanyCleanupFunc) foo_plugin_cleanup;
...
GEANY_PLUGIN_REGISTER_FULL (p, 42, foo_plugin_new, g_object_unref);
}
I don't know if it can be changed now or some alternative funcs with swapped arguments added, I just thought I'd mention it as I just coded 4 hook functions to do nothing but reverse the arguments to call another C function.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or mute the thread.