GtkTreeModel *ret;
GType *gtypes;
+
guint cols;
guint col;
+ GtkTreeModel *model_child;
+
GtkTreeIter iter;
+ GtkTreeIter iter_child;
GtkTreeIter iter_new;
ret = NULL;
gtypes = solipa_gtktreemodel_get_gtypes (model, &cols);
if (gtypes != NULL)
{
- if (GTK_IS_LIST_STORE (model))
+ if (GTK_IS_TREE_MODEL_FILTER (model))
+ {
+ model_child = gtk_tree_model_filter_get_model (GTK_TREE_MODEL_FILTER (model));
+ }
+
+ if (GTK_IS_LIST_STORE (model)
+ || (model_child != NULL && GTK_IS_LIST_STORE (model_child)))
{
ret = GTK_TREE_MODEL (gtk_list_store_newv (cols, gtypes));
for (col = 0; col < cols; col++)
{
GValue gval = {0};
- gtk_tree_model_get_value (model, &iter, col, &gval);
+
+ if (model_child != NULL)
+ {
+ gtk_tree_model_filter_convert_iter_to_child_iter (GTK_TREE_MODEL_FILTER (model), &iter_child, &iter);
+ gtk_tree_model_get_value (model_child, &iter_child, col, &gval);
+ }
+ else
+ {
+ gtk_tree_model_get_value (model, &iter, col, &gval);
+ }
gtk_list_store_set_value (GTK_LIST_STORE (ret), &iter_new, col, &gval);
g_value_unset (&gval);
}
}
}
}
- else if (GTK_IS_TREE_MODEL (model))
+ else if (GTK_IS_TREE_STORE (model)
+ || (model_child != NULL && GTK_IS_TREE_STORE (model_child)))
{
ret = GTK_TREE_MODEL (gtk_tree_store_newv (cols, gtypes));