Re: custom signals



Il giorno lun, 07/07/2014 alle 17.50 +0100, Emmanuele Bassi ha scritto:
hi;

to define new signals, you need to use the `Signals` key in object you
pass to the Lang.Class() constructor you use when subclassing a
GObject.
ok, i've resolved in this way, it's equivalent?

const WebBrowserTabLabel = new Lang.Class({
    Name: 'WebBrowserTabLabel',
    Extends: Gtk.Box,
    _init: function() {
        this.parent();
        Signals.addSignalMethods(WebBrowserTabLabel.prototype);
[...]
        button.connect("clicked", this.buttonClick);
        this.pack_start(button, false, false, 0);
        this.show_all();
    },
    clickClose: function() {},
    buttonClick: function(self, button, data) {
        self.p.emit('close-clicked');
    },
});

what's the difference using Signals property and
Signals.addSignalMethods?

without the Singals.addSignalMethods, the interpreter tell me that the
Gtk.Box haven't the signal 'close-clicked' (it's normal, i know).

regards,
Dimitri



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