Filtering a GtkTreeStore correctly
- From: Marcus von Appen <mva sysfault org>
- To: gtk-app-devel-list gnome org
- Subject: Filtering a GtkTreeStore correctly
- Date: Mon, 10 Jan 2005 14:54:41 +0100
I wonder, how I can filter entries in a GtkTreeStore correctly.
The current stuff I use is a GtkTreeModelFilter with an own function
connected using gtk_tree_model_filter_set_visible_func.
The problem is that only the parent rows/iters are checked, but not
their children, what's - in my opinion - a wrong behaviour.
The connected function(s) should also operate on the children
automatically. Or do I something wrong?
model = gtk_tree_model_filter_get_model (GTK_TREE_MODEL_FILTER (filter));
model = gtk_tree_model_filter_new (model, NULL);
/* connector */
gtk_tree_model_filter_set_visible_func (GTK_TREE_MODEL_FILTER (model),
(gpointer) text, NULL);
filter_translation (GtkTreeModel *model, GtkTreeIter *iter, gpointer data)
gchar *text = (gchar *) data;
gchar *value = NULL;
gboolean retval = FALSE;
gtk_tree_model_get (model, iter, EDIT_TRANS, &value, -1);
retval = (g_strrstr (value, text) != NULL);
If I have a model with data like this:
and want to filter on "Test", the expected result would be
Intstead I receive
What would be the correct approach here (if any)?
We don't understand the software, and sometimes we don't understand the
hardware, but we can *see* the blinking lights!
] [Thread Prev