aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2013-03-12 02:23:16 +0800
committerMatthew Barnes <mbarnes@redhat.com>2013-03-12 02:23:16 +0800
commitd1eb86b2c37237bce7635ce77d3f208a7604263d (patch)
tree29db6e0a7929ffc14dff93b2cefa16afe3ee6239
parent98f4b4a74bd7492f28e1fba889ed10e9c82a7cd5 (diff)
downloadgsoc2013-evolution-d1eb86b2c37237bce7635ce77d3f208a7604263d.tar
gsoc2013-evolution-d1eb86b2c37237bce7635ce77d3f208a7604263d.tar.gz
gsoc2013-evolution-d1eb86b2c37237bce7635ce77d3f208a7604263d.tar.bz2
gsoc2013-evolution-d1eb86b2c37237bce7635ce77d3f208a7604263d.tar.lz
gsoc2013-evolution-d1eb86b2c37237bce7635ce77d3f208a7604263d.tar.xz
gsoc2013-evolution-d1eb86b2c37237bce7635ce77d3f208a7604263d.tar.zst
gsoc2013-evolution-d1eb86b2c37237bce7635ce77d3f208a7604263d.zip
EContactStore: Remove unnecessary warnings.
-rw-r--r--e-util/e-contact-store.c29
-rw-r--r--e-util/e-contact-store.h2
2 files changed, 17 insertions, 14 deletions
diff --git a/e-util/e-contact-store.c b/e-util/e-contact-store.c
index acfbe71e79..6d2adc067f 100644
--- a/e-util/e-contact-store.c
+++ b/e-util/e-contact-store.c
@@ -1022,8 +1022,9 @@ e_contact_store_get_clients (EContactStore *contact_store)
* @contact_store: an #EContactStore
* @book_client: an #EBookClient
*
- * Adds @book_client to the list of book clients that provide contacts for @contact_store.
- * The @contact_store adds a reference to @book_client, if added.
+ * Adds @book_client to the list of clients that provide contacts for
+ * @contact_store. The @contact_store adds a reference to @book_client,
+ * if added.
*
* Since: 3.2
**/
@@ -1038,10 +1039,9 @@ e_contact_store_add_client (EContactStore *contact_store,
g_return_if_fail (E_IS_CONTACT_STORE (contact_store));
g_return_if_fail (E_IS_BOOK_CLIENT (book_client));
- if (find_contact_source_by_client (contact_store, book_client) >= 0) {
- g_warning ("Same book client added more than once to EContactStore!");
+ /* Return silently if we already have this EBookClient. */
+ if (find_contact_source_by_client (contact_store, book_client) >= 0)
return;
- }
array = contact_store->priv->contact_sources;
@@ -1060,11 +1060,14 @@ e_contact_store_add_client (EContactStore *contact_store,
* @contact_store: an #EContactStore
* @book_client: an #EBookClient
*
- * Removes @book from the list of book clients that provide contacts for @contact_store.
+ * Removes @book_client from the list of clients that provide contacts for
+ * @contact_store.
+ *
+ * Returns: whether @book_client was found and removed
*
* Since: 3.2
**/
-void
+gboolean
e_contact_store_remove_client (EContactStore *contact_store,
EBookClient *book_client)
{
@@ -1072,14 +1075,12 @@ e_contact_store_remove_client (EContactStore *contact_store,
ContactSource *source;
gint source_index;
- g_return_if_fail (E_IS_CONTACT_STORE (contact_store));
- g_return_if_fail (E_IS_BOOK_CLIENT (book_client));
+ g_return_val_if_fail (E_IS_CONTACT_STORE (contact_store), FALSE);
+ g_return_val_if_fail (E_IS_BOOK_CLIENT (book_client), FALSE);
source_index = find_contact_source_by_client (contact_store, book_client);
- if (source_index < 0) {
- g_warning ("Tried to remove unknown book client from EContactStore!");
- return;
- }
+ if (source_index < 0)
+ return FALSE;
array = contact_store->priv->contact_sources;
@@ -1089,6 +1090,8 @@ e_contact_store_remove_client (EContactStore *contact_store,
g_object_unref (book_client);
g_array_remove_index (array, source_index); /* Preserve order */
+
+ return TRUE;
}
/**
diff --git a/e-util/e-contact-store.h b/e-util/e-contact-store.h
index de86c5f325..5fb79f840b 100644
--- a/e-util/e-contact-store.h
+++ b/e-util/e-contact-store.h
@@ -85,7 +85,7 @@ gboolean e_contact_store_find_contact (EContactStore *contact_store,
GSList * e_contact_store_get_clients (EContactStore *contact_store);
void e_contact_store_add_client (EContactStore *contact_store,
EBookClient *book_client);
-void e_contact_store_remove_client (EContactStore *contact_store,
+gboolean e_contact_store_remove_client (EContactStore *contact_store,
EBookClient *book_client);
void e_contact_store_set_query (EContactStore *contact_store,
EBookQuery *book_query);