Plugins, callbacks, signals, oh my!



Hi everyone (sorry about the stupid title :-))

I'm writing a BitTorrent client which uses GObjects to expose a simple
and wrappable interface. I'd also like to allow plugins to hook into
events and add functionality. However, I'm not sure what's the best
way to do this. So far I've come up with three ways: the first is to
let plugins have a init() function which just hooks up its own
callbacks with g_signal_connect, and the objects would then have to
emit signals. Another way would be to have plugins expose functions
that I then call from the appropriate places (no signals, and since I
don't completely understand them, it would be easier). The third (how
I think GEdit does it) is to let plugins implement their own GObjects,
which are then used in some way I don't quite understand.

I've never written a plugin system, and don't have much experience
with writing GObjects with signals (I've done simple subclassing and
such). Could anyone point me to docs about or explain how to write a
plugin system such as this? Which way would be easiest/fastest or are
there any other options? Sorry for the mass of questions, I just want
to learn more about this.

Thanks alot for any tips :-)

Samuel Cormier-Iijima



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]