Hi. I’d like some help to to the Right Thing.
GtkTreeView has a keybinding for CtrlA which, as expected, select all rows.
However, there are certain circumstances where I don’t want this keyboard shortcut to do this.
So, I would like to handle this keyboard shortcut from the application side. But it’s not obvious to me how to disable a keybinding in a non-terrible way.
Some hypothesis:
-
Subclass GtkTreeView and override the ::select-all default signal handler. But subclassing seems excessive for only this.
-
Use custom CSS to unbind the keybinding.
-
Block the keybinding signal emission and handle the keyboard shortcut on app code.
g_signal_connect (view->details->tree_view, "select-all", G_CALLBACK (g_signal_stop_emission_by_name), "select-all");
This works but relies on
GtkTreeView::select-all
beingG_SIGNAL_RUN_LAST
signal, which I believe to be an implementation detail (is it?).
Thanks in advance for any advice!