programmatically list available signals



Hi all,

Is there a way to programmatically ask an object if it has a
particular signal, or get a list of signals it has?

I currently listen to Meta.Display's grab-op-begin and grab-op-end,
but these don't exist in GNOME 3.2. I do have an alternative (will
listen to size/position-changed) but wish to only use these if
grab-op-{begin,end} don't exist as they are a little more expensive.

I'd like to be able to say:

if ( Meta.Display has 'grab-op-begin' ) {
   global.display.connect('grab-op-begin', ...);
} else {
  // the alternative
}

At the moment I can try enclosing the block in a try-catch:

try {
    global.display.connect('grab-op-begin', ...);
catch (err) {
   // the alternative
}

But this is not ideal as it can mask any number of errors. (I suppose
I could see if GNOME version >= (??) instead of the try/catch, or even
better if Meta version >= xx, although imports.gi.versions.Meta is
undefined).

cheers.

(PS: gnome-shell XPenguins is coming along nicely! I can currently get
them walking all over my windows, but still want to implement an
interactive squish-the-toons mode and improve the efficiency - seems a
bit laggy in GNOME 3.2).


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