summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBartosz Szatkowski <bulislaw@linux.com>2011-07-13 22:10:07 +0000
committerJohan Hedberg <johan.hedberg@intel.com>2011-07-14 16:43:58 +0300
commit5042e2f8107b4db88be141d700690ab58bf01211 (patch)
tree486b6e44f0ff5da32f116b0d89ed593aeba0eef6
parent8aa58d90df88ad9e33f9e83ddaab4b4dd4289b06 (diff)
downloadobexd-5042e2f8107b4db88be141d700690ab58bf01211.tar.gz
Fix ebook opening error handling
Individual address book may be not accessible (offline, not authenticated etc.) it should not prevent plugin to load properly.
-rw-r--r--plugins/phonebook-ebook.c21
1 files changed, 8 insertions, 13 deletions
diff --git a/plugins/phonebook-ebook.c b/plugins/phonebook-ebook.c
index b2f16e0..0b2878a 100644
--- a/plugins/phonebook-ebook.c
+++ b/plugins/phonebook-ebook.c
@@ -331,16 +331,16 @@ done:
static int traverse_sources(GSList *sources, char *default_src) {
GError *gerr;
- int status;
while (sources != NULL) {
EBook *ebook = e_book_new(E_SOURCE(sources->data), &gerr);
if (ebook == NULL) {
error("Can't create user's address book: %s",
gerr->message);
+ sources = sources->next;
- status = -EIO;
- goto fail;
+ g_error_free(gerr);
+ continue;
}
if (g_strcmp0(default_src, e_source_get_uri(
@@ -353,9 +353,11 @@ static int traverse_sources(GSList *sources, char *default_src) {
if (e_book_open(ebook, FALSE, &gerr) == FALSE) {
error("Can't open e-book address book: %s",
gerr->message);
+ sources = sources->next;
- status = -EIO;
- goto fail;
+ g_object_unref(ebook);
+ g_error_free(gerr);
+ continue;
}
if (default_src == NULL)
@@ -370,11 +372,6 @@ static int traverse_sources(GSList *sources, char *default_src) {
}
return 0;
-
-fail:
- g_error_free(gerr);
-
- return status;
}
int phonebook_init(void)
@@ -404,9 +401,7 @@ int phonebook_init(void)
GSList *sources = e_source_group_peek_sources(group);
- status = traverse_sources(sources, default_src);
- if (status != 0)
- goto fail;
+ traverse_sources(sources, default_src);
list = list->next;
}