aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2013-02-21 04:41:36 +0800
committerMatthew Barnes <mbarnes@redhat.com>2013-02-21 05:35:58 +0800
commit214d832ccdcb79744f6b0a913ee221cb3d725356 (patch)
tree63c2224f3005ce4c66fd0e148728187646fd7f83
parent2c195f2266a51cce9499e3bb968d0a7a0ce90091 (diff)
downloadgsoc2013-evolution-214d832ccdcb79744f6b0a913ee221cb3d725356.tar.gz
gsoc2013-evolution-214d832ccdcb79744f6b0a913ee221cb3d725356.tar.zst
gsoc2013-evolution-214d832ccdcb79744f6b0a913ee221cb3d725356.zip
Add e_client_selector_is_backend_dead().
Returns TRUE if an EClient instance for the given source and the value of ESourceSelector's "extension-name" property was recently discarded after having emitted a "backend-died" signal, and a replacement EClient instance has not yet been created.
-rw-r--r--doc/reference/libeutil/libeutil-sections.txt1
-rw-r--r--e-util/e-client-selector.c36
-rw-r--r--e-util/e-client-selector.h3
3 files changed, 40 insertions, 0 deletions
diff --git a/doc/reference/libeutil/libeutil-sections.txt b/doc/reference/libeutil/libeutil-sections.txt
index 3a4d5ddd05..70f48a6121 100644
--- a/doc/reference/libeutil/libeutil-sections.txt
+++ b/doc/reference/libeutil/libeutil-sections.txt
@@ -1284,6 +1284,7 @@ e_client_selector_get_client_sync
e_client_selector_get_client
e_client_selector_get_client_finish
e_client_selector_ref_cached_client
+e_client_selector_is_backend_dead
<SUBSECTION Standard>
E_CLIENT_SELECTOR
E_IS_CLIENT_SELECTOR
diff --git a/e-util/e-client-selector.c b/e-util/e-client-selector.c
index bdff0594a3..a38cc381ce 100644
--- a/e-util/e-client-selector.c
+++ b/e-util/e-client-selector.c
@@ -417,3 +417,39 @@ e_client_selector_ref_cached_client (EClientSelector *selector,
return client;
}
+/**
+ * e_client_selector_is_backend_dead:
+ * @selector: an #EClientSelector
+ * @source: an #ESource
+ *
+ * Returns %TRUE if an #EClient instance for @source and the value of
+ * #ESourceSelector:extension-name was recently discarded after having
+ * emitted a #EClient:backend-died signal, and a replacement #EClient
+ * instance has not yet been created.
+ *
+ * Returns: whether the backend for @source died
+ **/
+gboolean
+e_client_selector_is_backend_dead (EClientSelector *selector,
+ ESource *source)
+{
+ EClientCache *client_cache;
+ const gchar *extension_name;
+ gboolean dead_backend;
+
+ g_return_val_if_fail (E_IS_CLIENT_SELECTOR (selector), FALSE);
+ g_return_val_if_fail (E_IS_SOURCE (source), FALSE);
+
+ extension_name = e_source_selector_get_extension_name (
+ E_SOURCE_SELECTOR (selector));
+
+ client_cache = e_client_selector_ref_client_cache (selector);
+
+ dead_backend = e_client_cache_is_backend_dead (
+ client_cache, source, extension_name);
+
+ g_object_unref (client_cache);
+
+ return dead_backend;
+}
+
diff --git a/e-util/e-client-selector.h b/e-util/e-client-selector.h
index 25974237d1..8e3c1ac12f 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);
+gboolean e_client_selector_is_backend_dead
+ (EClientSelector *selector,
+ ESource *source);
#endif /* E_CLIENT_SELECTOR_H */