Question

According to the GTK+3 reference site:

The "row-activated" signal is emitted when the method gtk_tree_view_row_activated() is called, when the user double clicks a treeview row with the "activate-on-single-click" property set to FALSE, or when the user single clicks a row when the "activate-on-single-click" property set to TRUE. It is also emitted when a non-editable row is selected and one of the keys: Space, Shift+Space, Return or Enter is pressed.

Is there really no way to deal with both single and double click? For example, single click does an action, double click another one.

Was it helpful?

Solution

You can try to use parent signals, in this case GtkWidget's signal "button-press-event", with the event of GDK_BUTTON_PRESS doing something and GDK_2BUTTON_PRESS doing other. Little note: you have grab the GtkTreeViewSelection on which row you need.

OTHER TIPS

This was meant to be a comment under luciomrx answer, but is to long. In my case button-press-event didn't worked, because its handler gets fired before selection is even performed. So I simply switched to button-release-event and from there I checked for selection using gtk_tree_selection_get_selected (works only for "single" and "browse" selection modes). But in my case I wanted to show some window on double click, and simply change descriptions when user selects a row (i.e. when row gets highlighted). I think this is common scenario. And the drawback of aforementioned implementation is that user can change selection using keyboard, so my labels were left unchanged. So I used GtkTreeSelection "changed" signal instead (obtain it using gtk_tree_view_get_selection method).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top