How to make Gtk.ListBoxRow accept right clicks on any area?

Viewed 292

Edit: corrected code.

ListBox listBox = new ListBox ();
ListBoxRow row = new ListBoxRow ();
row.add (new Label ("Test row"));
row.button_release_event.connect ((event) => {
    if (event.button == 3) {
        debug ("Right button clicked.\n");
    }
    return false;
});
listBox.add (row);

Doesn't work. Prints nothing. But this other one works fine

ListBox listBox = new ListBox ();
ListBoxRow row = new ListBoxRow ();
row.add (new CheckButton.with_label ("Test row"));
row.button_release_event.connect ((event) => {
    if (event.button == 3) {
        debug ("Right button clicked.\n");
    }
    return false;
});
listBox.add (row);

as it prints the debug message. Is it possible to handle right clicks on the ListBoxRow on any area, regardless of what its children are?

1 Answers
Related