Re: Disconnect signals without id?


With much deserved respect to Amy, I don't think you 
really want to disconnect all signals.

Depending upon the behavior you need to implement, you 
may not need to disconnect the signal. As an example an 
object has a handler connected for a signal. You want to 
implement code that does additional work before or after 
the default action. Connect your signal (connect_after or 
connect) and if (connect) return true in your handler. 
Your handler will be executed after or before the default. 
Suppose you want to replace all the actions of the default. 
Connect your signal do what needs to be done and return 
false in your handler. Your handler will be executed.

Another option is to monkey patch the method where the 
default handler is connected and gain access to the signal 
id by assignment which lets you disconnect it as needed.

Worst case, subclass the class with the thingy you need 
to get to, get to it, create your instance of the subclass
and replace the original object with yours.  The worst case
solution will properly run afoul of other extensions.

As I am sure you know, anything done must be undone in your

This is very general, less than expert, advice and may not
fit your needs but if I am too far off someone will set
us straight.


On Wed, 2012-12-26 at 22:48 +0000, Sam Bull wrote:
> Hi again,
> Thanks to Norman, my extension is now usable, and pending review. But,
> there are still some things to be improved.
> My next question, is it possible to disconnect a signal without any ID?
> For my extension to work perfectly, I need to disconnect a signal that
> is created in ViewSelector, and it doesn't store the signal ID. Is there
> some way to disconnect a signal without it's ID, or some kind of
> disconnect_all method?
> _______________________________________________
> gnome-shell-list mailing list
> gnome-shell-list gnome org

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