From f8ff0f0fde14b3f80663d74ac6a5f7f83d12b0ec Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Wed, 20 Feb 2013 12:36:46 -0500 Subject: Add e_source_selector_ref_source_by_iter(). --- e-util/e-source-selector.c | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) (limited to 'e-util/e-source-selector.c') diff --git a/e-util/e-source-selector.c b/e-util/e-source-selector.c index b746230a59..15f7781dcb 100644 --- a/e-util/e-source-selector.c +++ b/e-util/e-source-selector.c @@ -1910,6 +1910,37 @@ e_source_selector_set_primary_selection (ESourceSelector *selector, gtk_tree_path_free (parent_path); } +/** + * e_source_selector_ref_source_by_iter: + * @selector: an #ESourceSelector + * @iter: a #GtkTreeIter + * + * Returns the #ESource object at @iter. + * + * The returned #ESource is referenced for thread-safety and must be + * unreferenced with g_object_unref() when finished with it. + * + * Returns: the #ESource object at @iter, or %NULL + * + * Since: 3.8 + **/ +ESource * +e_source_selector_ref_source_by_iter (ESourceSelector *selector, + GtkTreeIter *iter) +{ + ESource *source = NULL; + GtkTreeModel *model; + + g_return_val_if_fail (E_IS_SOURCE_SELECTOR (selector), NULL); + g_return_val_if_fail (iter != NULL, NULL); + + model = gtk_tree_view_get_model (GTK_TREE_VIEW (selector)); + + gtk_tree_model_get (model, iter, COLUMN_SOURCE, &source, -1); + + return source; +} + /** * e_source_selector_ref_source_by_path: * @selector: an #ESourceSelector -- cgit v1.2.3