[Geany-Devel] Plugin development questions
lists.ban at xxxxx
Mon Oct 7 20:21:28 UTC 2013
Le 07/10/2013 22:06, Thomas Martitz a écrit :
> Am 07.10.2013 21:53, schrieb Thomas Martitz:
>> Regarding your other question, are you talking about the
>> "editor-notify" signal? Yes, that's not really per-document, I came
>> across this recently. The solution is to connect to "sci-notify" of
>> ScintillaObject directly, this will give a proper per-document signal
>> (the document-specific ScintillaObject pointer). However you need to
>> get the GeanyDocument pointer elsewhere. See how I did it here.
> I need to correct myself. "editor-notify" is correctly per-document and
> you can get the GeanyDocument pointer via the GeanyEditor pointer passed
> to it. What I meant to say is that you cannot use "editor-notify" if you
> need to attach user_data on a per-document basis. The user_data pointer
> passed to plugin_signal_connect("editor-notify", ...) will be
> overwritten on each successive all.
It's not perfectly right either, if you connect to the "editor-notify"
signal several times, each callback will be called (I believe in reverse
registration order) until one returns TRUE. So the behavior you
describe is probably simply you connecting several time and your
callback always returning TRUE, preventing the previously registered
callbacks to fire up.
Anyway, it's indeed not the right signal if you need per-document
user_data, but it's fine if you don't need it since it will fire for any
document without the need to manually connect to each. It probably
depends on your specific needs, and it's indeed worth noting the difference.
Also note that the "sci-notify" signal is valid on ScintillaObjects,
while "editor-notify" is on the global GeanyObject (which is the one
used if you pass NULL as the object to plugin_signal_connect()).
More information about the Devel