After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 794008 - GtkListBoxRow signal poorly documented
GtkListBoxRow signal poorly documented
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Widget: Other
3.22.x
Other Linux
: Normal normal
: ---
Assigned To: gtk-bugs
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2018-03-03 01:26 UTC by abonnementspaul
Modified: 2018-03-12 16:14 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Glade file using the "activate" signal (2.05 KB, application/x-glade)
2018-03-03 01:26 UTC, abonnementspaul
  Details
ListBox: Avoid ::row-activated/Row::activate ambig (1.26 KB, patch)
2018-03-12 16:11 UTC, Daniel Boles
committed Details | Review

Description abonnementspaul 2018-03-03 01:26:39 UTC
Created attachment 369208 [details]
Glade file using the "activate" signal

Hello,

I'm creating a gtk application featuring a list. I want every row in this list to do different things when clicked on. My first reflex is to look at the available signals for GtkListBoxRow, so that I can write something like:


   g_signal_connect(m_my_list_row, "activate", (GCallback)my_custom_function, my_custom_data);


Unfortunately, the "activate" event does not trigger on single or double click. It does trigger when pressing the Return key. So I looked in the documentation for more details.


https://developer.gnome.org/gtk3/stable/GtkListBox.html#GtkListBoxRow-activate


Unfortunately there is not much here. I know a ListBoxRow is not meant to be a button, but it can emit a signal when activated by a button press. Why can't it be activated on a mouse click too? Where is all of this described in the first place? Or, did I miss something?


I included a glade file which reproduces in a simple way what I want to make, what I thought would work. Everything is setup in place, the property "Activate on single click" is turned on for the list. All of the listBoxRows are set as "Activable". Yet, nothing happens on click.

Thank you for your replies
Comment 1 Timm Bäder 2018-03-03 06:35:00 UTC
From the GtkListBox docs:

GtkListBoxRows can be marked as activatable or selectable. If a row is activatable, “row-activated” will be emitted for it when the user tries to activate it. If it is selectable, the row will be marked as selected when the user tries to select it.

GtkListBoxRow::activate is one of those keybinding signals that only exist because GtkBindingSet needs that. For your use case, you need to connect to GtkListBox::row-activated which gives you the activated row as an argument.
Comment 2 abonnementspaul 2018-03-03 10:08:13 UTC
Thank you for your answer, I now get what this signal is for.
I'm going to use "row-activated" for what I need.

This has a downside though, which is I can't directly connect each row to different callbacks, or differeent "user data", as the unique GtkListBox is the emiter, and not the different GtkListBoxRows.


I'm going to find a way arount it.

Thank you for your reply
Comment 3 Daniel Boles 2018-03-08 11:36:02 UTC
Is there anything to be done regarding docs, or are you happy to close this?
Comment 4 abonnementspaul 2018-03-08 19:20:39 UTC
Well, unless I missed it, maybe a little description on the "activate" signal would have been useful to me. 
Something along the lines of "signal used for key bindings, refer to GtkListBox::row-activated instead" would do fine.

Other than that, my question is answered. Thank you again for the support!
Comment 5 Daniel Boles 2018-03-08 20:25:32 UTC
Right - I guess we could adapt Timm's comment just to mention that ::activate is probably not what the reader wants and point them in the right direction instead.
Comment 6 abonnementspaul 2018-03-10 10:33:39 UTC
I totally agree with this idea, I couldn't ask for more
Comment 7 Daniel Boles 2018-03-12 16:11:56 UTC
Created attachment 369581 [details] [review]
ListBox: Avoid ::row-activated/Row::activate ambig

…uity, by adding a doc comment to Row::activate explaining what it does
and why it is probably not what the user reading that is looking for.
Comment 8 Daniel Boles 2018-03-12 16:14:49 UTC
Attachment 369581 [details] pushed as f08eeec - ListBox: Avoid ::row-activated/Row::activate ambig