Re: How to get id of/remove a default handler?



Thanks Tristan,

I think I understand but I still don't know how to proceed with my case (-:
In your example what arguments would you pass to the
g_signal_handlers_block_by_func() function? How do I get the 'func' one
("The C closure callback of the handlers") in my case?



Tristan Van Berkom wrote:
> 
> On Fri, Jul 31, 2009 at 6:44 PM,
> machinegodzilla<machinegodzilla gmail com> wrote:
>>
>> Thank you Yeti for you reply. Now I can see that I should've added some
>> context to my questions.
>>
>> What I mean by a default handler is a piece of code that gets executed
>> when
>> an object emits a signal, and which code you don't have to write yourself
>> but is there, somewhere already (as opposed to a custom handler that I'd
>> attach to an object with g_signal_connect()). I am currently playing with
>> GStreamer framework, where I create elements that emit signals in
>> response
>> to particular situations, e.g. disconnection from other elements. Then a
>> thing that I call "a default handler" catches those signals and does
>> something accordingly.
>>
>> For example, I can create an element of type GstBin:
>> [
>> http://gstreamer.freedesktop.org/data/doc/gstreamer/stable/gstreamer/html/GstBin.html
>> ]
>> in which I can place other elements. Every time an elements is placed in
>> a
>> bin an "element-added" signal is emitted:
>> [
>> http://gstreamer.freedesktop.org/data/doc/gstreamer/stable/gstreamer/html/GstBin.html#GstBin-element-added
>> ].
>> Now what I want to do is to block/freeze/temporarily disable the handler
>> that is about to get executed, or hijack the signal.
>>
>> I've just stumbled across g_signal_override_class_handler () method which
>> seems to be sort of what I'm after... I'll try that tomorrow (-:
>>
> 
> Heres my interpretation of your seemingly complex problem ;-)
> 
> You are listening to a callback "element-added"; you dont want the
> callback to
> fire when you explicitly add an element (doh, the code adding the element
> already knows its adding the element, no need to fire some possibly
> dangerously
> recursive code).
> 
> Or synonymously; you have a function that updates the database when a
> toggle button
> is pressed, and sometimes the database hooks indicate that you need to
> update the
> state of the toggle button, again you dont want the "toggled" handler to
> run.
> 
> set_toggle_button_state() {
>    g_signal_handers_block_by_func ()
>    gtk_toggle_button_set_active ();
>    g_signal_handers_unblock_by_func ()
> }
> 
> Hope this helps ;-)
> 
> Cheers,
>          -Tristan
> 
> http://library.gnome.org/devel/gobject/unstable/gobject-Signals.html#g-signal-handlers-block-by-func
> _______________________________________________
> gtk-list mailing list
> gtk-list gnome org
> http://mail.gnome.org/mailman/listinfo/gtk-list
> 
> 

-- 
View this message in context: http://www.nabble.com/How-to-get-id-of-remove-a-default-handler--tp24755772p24770544.html
Sent from the Gtk+ - General mailing list archive at Nabble.com.



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