diff options
author | Sergio Villar Senin <svillar@igalia.com> | 2012-08-24 18:13:34 +0800 |
---|---|---|
committer | Sergio Villar Senin <svillar@igalia.com> | 2012-09-03 18:13:18 +0800 |
commit | c077cdea4bcdb95b58b7fff0b9dc7cce3aaa2982 (patch) | |
tree | 7f5b65f173df8517d7279c608c8fbad2b028d3af | |
parent | 0fc791e776d61d83d67c2984a003a2f42bd769d1 (diff) | |
download | gsoc2013-epiphany-c077cdea4bcdb95b58b7fff0b9dc7cce3aaa2982.tar.gz gsoc2013-epiphany-c077cdea4bcdb95b58b7fff0b9dc7cce3aaa2982.tar.zst gsoc2013-epiphany-c077cdea4bcdb95b58b7fff0b9dc7cce3aaa2982.zip |
ephy-node-view: added ephy_node_view_get_iter_for_node()
The EphyNodeView is based on the following stack of models:
Sort model -> Filter model -> EphyTreeModelNode
This function returns a GtkTreeIter pointing to a row in the sort model from
a EphyNode that belongs to the EphyTreeModelNode.
https://bugzilla.gnome.org/show_bug.cgi?id=673795
-rw-r--r-- | lib/widgets/ephy-node-view.c | 19 | ||||
-rw-r--r-- | lib/widgets/ephy-node-view.h | 4 |
2 files changed, 23 insertions, 0 deletions
diff --git a/lib/widgets/ephy-node-view.c b/lib/widgets/ephy-node-view.c index abd1f0f41..1be6c93d0 100644 --- a/lib/widgets/ephy-node-view.c +++ b/lib/widgets/ephy-node-view.c @@ -1809,6 +1809,25 @@ ephy_node_view_popup (EphyNodeView *view, GtkWidget *menu) } } +gboolean +ephy_node_view_get_iter_for_node (EphyNodeView *view, + GtkTreeIter *iter, + EphyNode *node) +{ + GtkTreeIter node_iter, filter_iter; + + ephy_tree_model_node_iter_from_node (EPHY_TREE_MODEL_NODE (view->priv->nodemodel), node, &node_iter); + if (!gtk_tree_model_filter_convert_child_iter_to_iter (GTK_TREE_MODEL_FILTER (view->priv->filtermodel), + &filter_iter, &node_iter)) + return FALSE; + + if (!gtk_tree_model_sort_convert_child_iter_to_iter (GTK_TREE_MODEL_SORT (view->priv->sortmodel), + iter, &filter_iter)) + return FALSE; + + return TRUE; +} + static void ephy_node_view_class_init (EphyNodeViewClass *klass) { diff --git a/lib/widgets/ephy-node-view.h b/lib/widgets/ephy-node-view.h index 70f503991..423292593 100644 --- a/lib/widgets/ephy-node-view.h +++ b/lib/widgets/ephy-node-view.h @@ -129,6 +129,10 @@ gboolean ephy_node_view_is_target (EphyNodeView *view); void ephy_node_view_popup (EphyNodeView *view, GtkWidget *menu); +gboolean ephy_node_view_get_iter_for_node (EphyNodeView *view, + GtkTreeIter *iter, + EphyNode *node); + G_END_DECLS #if !defined (__EPHY_EPIPHANY_H_INSIDE__) && !defined (EPIPHANY_COMPILATION) |