Re: Use user_data in callback



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]