GtkTreeModelFilter does not visit children
- From: Henrique Ferreiro <henrique ferreiro gmail com>
- To: gtk-app-devel-list gnome org
- Subject: GtkTreeModelFilter does not visit children
- Date: Fri, 11 Aug 2006 12:36:06 +0200
Hi all!
I have a problem with GtkTreeModelFilter. I have two combo boxes and one
tree model. Each combo has to present data with an opposite condition. To do
that I share the same tree model (list store) with two tree model filters
which have a visible function with the corresponding condition.
The problem is that, while one of the combo boxes appears to work ok, the
other does not show children nodes.
I have used gdb with a breakpoint at the visible function and it is only
called with the first-level nodes for that combo.
This is the relevant code:
void
f_widget_account_new_set_parent_model (FWidgetAccountNew *f_widget,
GtkTreeModel *parent_model)
{
...
filter_model = gtk_tree_model_filter_new (parent_model, NULL);
gtk_tree_model_filter_set_visible_func (filter_model,
_account_is_container,
&f_widget->update_code,
NULL);
...
gtk_combo_box_set_model (parent_box, filter_model);
g_object_unref (filter_model);
...
}
static boolean
_account_is_container (GtkTreeModel *treemodel,
GtkTreeIter *iter,
gpointer data)
{
gint type;
gtk_tree_model_get (treemodel, iter,
ACCOUNT_TYPE_COL, &type,
-1)
return type == TYPE_ACCOUNT_FOLDER;
}
void
f_widget_account_new_set_transfer_model (FWidgetAccountNew *f_widget,
GtkTreeModel *transfer_model)
{
...
gtk_tree_model_filter_set_visible_func (filter_model,
_account_is_real,
&f_widget->update_code,
NULL);
...
}
static boolean
_account_is_real (GtkTreeModel *treemodel,
GtkTreeIter *iter,
gpointer data)
{
gint type;
gtk_tree_model_get (treemodel, iter,
ACCOUNT_TYPE_COL, &type,
-1);
return type != TYPE_ACCOUNT_FOLDER;
}
Both set_xxx_model functions are called with the same GtkListStore and only
the first one works.
--
Henrique
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]