aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2013-02-21 01:36:46 +0800
committerMatthew Barnes <mbarnes@redhat.com>2013-02-21 05:35:58 +0800
commitf8ff0f0fde14b3f80663d74ac6a5f7f83d12b0ec (patch)
treeb98d643815af439fb8431c0bfff8b79462adc4b9
parenta955be9b70fd556310fc4c07aeef91c99bde3aaf (diff)
downloadgsoc2013-evolution-f8ff0f0fde14b3f80663d74ac6a5f7f83d12b0ec.tar.gz
gsoc2013-evolution-f8ff0f0fde14b3f80663d74ac6a5f7f83d12b0ec.tar.zst
gsoc2013-evolution-f8ff0f0fde14b3f80663d74ac6a5f7f83d12b0ec.zip
Add e_source_selector_ref_source_by_iter().
-rw-r--r--doc/reference/libeutil/libeutil-sections.txt1
-rw-r--r--e-util/e-source-selector.c31
-rw-r--r--e-util/e-source-selector.h3
3 files changed, 35 insertions, 0 deletions
diff --git a/doc/reference/libeutil/libeutil-sections.txt b/doc/reference/libeutil/libeutil-sections.txt
index 78e3b72d7d..f4eee6f7d5 100644
--- a/doc/reference/libeutil/libeutil-sections.txt
+++ b/doc/reference/libeutil/libeutil-sections.txt
@@ -3113,6 +3113,7 @@ e_source_selector_set_select_new
e_source_selector_edit_primary_selection
e_source_selector_ref_primary_selection
e_source_selector_set_primary_selection
+e_source_selector_ref_source_by_iter
e_source_selector_ref_source_by_path
e_source_selector_queue_write
e_source_selector_update_row
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
@@ -1911,6 +1911,37 @@ e_source_selector_set_primary_selection (ESourceSelector *selector,
}
/**
+ * 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
* @path: a #GtkTreePath
diff --git a/e-util/e-source-selector.h b/e-util/e-source-selector.h
index e25142146a..b49d65a782 100644
--- a/e-util/e-source-selector.h
+++ b/e-util/e-source-selector.h
@@ -130,6 +130,9 @@ ESource * e_source_selector_ref_primary_selection
void e_source_selector_set_primary_selection
(ESourceSelector *selector,
ESource *source);
+ESource * e_source_selector_ref_source_by_iter
+ (ESourceSelector *selector,
+ GtkTreeIter *iter);
ESource * e_source_selector_ref_source_by_path
(ESourceSelector *selector,
GtkTreePath *path);