Re: Use user_data in callback



It is very useful, as this is exactly how it works now.
Thank you.
        
What is the reason that without Lang.bind() the function can access the
first two arguments ("emitter" and "event") but not the third one?

And why is it different with Lang.bind()?

Regards
Jay

On 22.09.2015 19:05, Norman L. Smith wrote:

You need to use Lang.bind.

See 
https://paste.fedoraproject.org/270197/
or
http://ur1.ca/nu9t9


Hope this is useful.

Norman

On Tue, 2015-09-22 at 11:44 +0200, Jay Strict wrote:
I am writing a gnome-shell extension and I am trying to connect the
'activate'-signal of a PopupMenuItem to a callback function like
this:


=====================================================================
=
let item = new PopupMenu.PopupMenuItem("test")
item.connect(
    'activate',
    function(emitter, event, user_data) {
        Main.notifyError("user_data: " + user_data);
    },
    "test1",
    "test2",
    "test3",
    "test4");
this.folderMenu.addMenuItem(item);
=====================================================================
=

I expected the output to be "user_data: test1".
However, when I click on the PopupMenuItem, the output is "user_data:
undefined".
How can I assign some user_data to this signal?


Thank you in advance.
Jay
_______________________________________________
gnome-shell-list mailing list
gnome-shell-list gnome org
https://mail.gnome.org/mailman/listinfo/gnome-shell-list


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