aboutsummaryrefslogtreecommitdiffstats
path: root/e-util
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2013-02-21 01:48:46 +0800
committerMatthew Barnes <mbarnes@redhat.com>2013-02-21 05:35:58 +0800
commit5488c24819de10d0b9c4dc1c512adc859d47a777 (patch)
treea5dae9629db6a4227a888bf52d4133b50d96b820 /e-util
parentf8ff0f0fde14b3f80663d74ac6a5f7f83d12b0ec (diff)
downloadgsoc2013-evolution-5488c24819de10d0b9c4dc1c512adc859d47a777.tar.gz
gsoc2013-evolution-5488c24819de10d0b9c4dc1c512adc859d47a777.tar.zst
gsoc2013-evolution-5488c24819de10d0b9c4dc1c512adc859d47a777.zip
Add e_client_selector_ref_cached_client_by_iter().
Diffstat (limited to 'e-util')
-rw-r--r--e-util/e-client-selector.c37
-rw-r--r--e-util/e-client-selector.h3
2 files changed, 40 insertions, 0 deletions
diff --git a/e-util/e-client-selector.c b/e-util/e-client-selector.c
index a38cc381ce..1b753f5421 100644
--- a/e-util/e-client-selector.c
+++ b/e-util/e-client-selector.c
@@ -418,6 +418,43 @@ e_client_selector_ref_cached_client (EClientSelector *selector,
}
/**
+ * e_client_selector_ref_cached_client_by_iter:
+ * @selector: an #EClientSelector
+ * @iter: a #GtkTreeIter
+ *
+ * Returns a shared #EClient instance for the #ESource in the tree model
+ * row pointed to by @iter and the value of #ESourceSelector:extension-name
+ * if such an instance is already cached, or else %NULL. This function does
+ * not create a new #EClient instance, and therefore does not block.
+ *
+ * The returned #EClient is referenced for thread-safety and must be
+ * unreferenced with g_object_unref() when finished with it.
+ *
+ * Returns: an #EClient, or %NULL
+ **/
+EClient *
+e_client_selector_ref_cached_client_by_iter (EClientSelector *selector,
+ GtkTreeIter *iter)
+{
+ EClient *client = NULL;
+ ESource *source;
+
+ g_return_val_if_fail (E_IS_CLIENT_SELECTOR (selector), NULL);
+ g_return_val_if_fail (iter != NULL, NULL);
+
+ source = e_source_selector_ref_source_by_iter (
+ E_SOURCE_SELECTOR (selector), iter);
+
+ if (source != NULL) {
+ client = e_client_selector_ref_cached_client (
+ selector, source);
+ g_object_unref (source);
+ }
+
+ return client;
+}
+
+/**
* e_client_selector_is_backend_dead:
* @selector: an #EClientSelector
* @source: an #ESource
diff --git a/e-util/e-client-selector.h b/e-util/e-client-selector.h
index 8e3c1ac12f..ce91fe7c2f 100644
--- a/e-util/e-client-selector.h
+++ b/e-util/e-client-selector.h
@@ -82,6 +82,9 @@ EClient * e_client_selector_get_client_finish
EClient * e_client_selector_ref_cached_client
(EClientSelector *selector,
ESource *source);
+EClient * e_client_selector_ref_cached_client_by_iter
+ (EClientSelector *selector,
+ GtkTreeIter *iter);
gboolean e_client_selector_is_backend_dead
(EClientSelector *selector,
ESource *source);