GTK4: Implementing a context menu for a ListView

I’m trying to implement a right-click context menu for items in a ListView. I created a GestureClick controller, set it on the ListView, and connected the pressed signal. Next, I want to take actions based on the item that is right-clicked. How can I determine which item is being clicked?

I’m doing this: https://gitlab.gnome.org/GNOME/gssdp/-/blob/master/tools/main-window.c#L731

Although I’m not really sure that this is the correct thing to do