I’m updating a tiny app (here) from Gtk 3 to Gtk 4.
And starting with Gtk 4.10,
Gtk.TreeView & co are
deprecated, so I used a
Gtk.ColumnView, with a
Gtk.FilterListModel, which use a
GLib.ListStore contains a list of really simple
What I want to do :
When a user is using the
Gtk.SearchEntry, I simply want to compare his input with two members of my object (
hostname) and filter the list accordingly.
But I don’t know how to proceed :
For the filter model of
Gtk.FilterListModel, I use a Gtk.StringFilter but I have no clue on how to use that.
My understanding so far is that the
- should use one of the sub-classes of Gtk.Expression which need to be evaluated in some way, to filter items list (to be setup with the method
set_expression (Expression? expression);
- and to “activate” the filtering process, I need to use the filter method
set_search (string? search), which should use the evaluation result of the
My problem is that I can’t find any relevant example of usage of
Gtk.Expression on the net so I don’t understand how I can use that. All examples about filtering a ListStore are with the
Note I use a resource file
main-window.ui to setup the different models, factories & co.
I suspect I need to setup all the filtering stuff in the construct method and use the method
set_search (string? search) in the method which handle the
changed signal of the
To summarize, the question is : how to filter a
Gtk.Expression is the way to do it, how can I use it ? If it’s not the way, can you pin-point me in the right direction - please ?
Thanks for reading this far.
Any help is welcome …