Use user_data in callback



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


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