Commit 7ee5e7af authored by Jasper St. Pierre's avatar Jasper St. Pierre

treemodelfilter: Make the constructor binding friendly

This means reffing the root in the set property implementation,
rather than in the constructor. We don't need to unref the root
on set, as it's a CONSTRUCT_ONLY property.

https://bugzilla.gnome.org/show_bug.cgi?id=680065
parent a61b3594
......@@ -3758,10 +3758,14 @@ gtk_tree_model_filter_set_root (GtkTreeModelFilter *filter,
{
g_return_if_fail (GTK_IS_TREE_MODEL_FILTER (filter));
if (!root)
filter->priv->virtual_root = NULL;
if (root)
{
filter->priv->virtual_root = gtk_tree_path_copy (root);
gtk_tree_model_filter_ref_path (filter, filter->priv->virtual_root);
filter->priv->virtual_root_deleted = FALSE;
}
else
filter->priv->virtual_root = gtk_tree_path_copy (root);
filter->priv->virtual_root = NULL;
}
/* public API */
......@@ -3782,24 +3786,12 @@ GtkTreeModel *
gtk_tree_model_filter_new (GtkTreeModel *child_model,
GtkTreePath *root)
{
GtkTreeModel *retval;
GtkTreeModelFilter *filter;
g_return_val_if_fail (GTK_IS_TREE_MODEL (child_model), NULL);
retval = g_object_new (GTK_TYPE_TREE_MODEL_FILTER,
"child-model", child_model,
"virtual-root", root,
NULL);
filter = GTK_TREE_MODEL_FILTER (retval);
if (filter->priv->virtual_root)
{
gtk_tree_model_filter_ref_path (filter, filter->priv->virtual_root);
filter->priv->virtual_root_deleted = FALSE;
}
return retval;
return g_object_new (GTK_TYPE_TREE_MODEL_FILTER,
"child-model", child_model,
"virtual-root", root,
NULL);
}
/**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment