From 845369568d2f9af34a1a6e7e4ba08b0f0cd6964d Mon Sep 17 00:00:00 2001 From: Chris Toshok Date: Sat, 10 Nov 2001 00:48:43 +0000 Subject: [ Fixes Ximian bug #14646 ] new function. if the default_book failed to 2001-11-09 Chris Toshok [ Fixes Ximian bug #14646 ] * gui/component/addressbook.c (addressbook_default_book_open): new function. if the default_book failed to load, load the local addressbook in its place. addressbook_load_default_book): if we're loading the default_book uri, use addressbook_default_book_open as the open_response. * backend/ebook/e-book.c (e_book_load_uri_step): reset the load_state to NotLoaded so we can attempt another load_uri on the book if it fails. svn path=/trunk/; revision=14654 --- addressbook/ChangeLog | 13 +++++++++++++ addressbook/backend/ebook/e-book.c | 4 ++++ addressbook/gui/component/addressbook.c | 28 +++++++++++++++++++++++++++- 3 files changed, 44 insertions(+), 1 deletion(-) (limited to 'addressbook') diff --git a/addressbook/ChangeLog b/addressbook/ChangeLog index 6f5d0fe9e0..a0fcb2b711 100644 --- a/addressbook/ChangeLog +++ b/addressbook/ChangeLog @@ -1,3 +1,16 @@ +2001-11-09 Chris Toshok + + [ Fixes Ximian bug #14646 ] + * gui/component/addressbook.c (addressbook_default_book_open): new + function. if the default_book failed to load, load the local + addressbook in its place. + addressbook_load_default_book): if we're loading the default_book + uri, use addressbook_default_book_open as the open_response. + + * backend/ebook/e-book.c (e_book_load_uri_step): reset the + load_state to NotLoaded so we can attempt another load_uri on + the book if it fails. + 2001-11-08 Jon Trowbridge * gui/component/select-names/e-select-names-bonobo.c diff --git a/addressbook/backend/ebook/e-book.c b/addressbook/backend/ebook/e-book.c index e331df149e..c260f3402a 100644 --- a/addressbook/backend/ebook/e-book.c +++ b/addressbook/backend/ebook/e-book.c @@ -555,6 +555,10 @@ e_book_load_uri_step (EBook *book, EBookStatus status, EBookLoadURIData *data) else { EBookCallback cb = data->open_response; gpointer closure = data->closure; + + /* reset the load_state to NotLoaded so people can + attempt another load_uri on the book. */ + book->priv->load_state = URINotLoaded; g_free (data); diff --git a/addressbook/gui/component/addressbook.c b/addressbook/gui/component/addressbook.c index 3826978f64..10ef247d06 100644 --- a/addressbook/gui/component/addressbook.c +++ b/addressbook/gui/component/addressbook.c @@ -668,6 +668,28 @@ addressbook_load_uri (EBook *book, const char *uri, return rv; } +typedef struct { + gpointer closure; + EBookCallback open_response; +} DefaultBookClosure; + +static void +addressbook_default_book_open (EBook *book, EBookStatus status, gpointer closure) +{ + DefaultBookClosure *default_book_closure = closure; + gpointer user_closure = default_book_closure->closure; + EBookCallback user_response = default_book_closure->open_response; + + g_free (default_book_closure); + + if (status != E_BOOK_STATUS_SUCCESS) { + e_book_load_local_address_book (book, user_response, user_closure); + } + else { + user_response (book, status, user_closure); + } +} + gboolean addressbook_load_default_book (EBook *book, EBookCallback open_response, gpointer closure) { @@ -686,7 +708,11 @@ addressbook_load_default_book (EBook *book, EBookCallback open_response, gpointe CORBA_exception_free (&ev); if (val) { - rv = addressbook_load_uri (book, val, open_response, closure); + DefaultBookClosure *default_book_closure = g_new (DefaultBookClosure, 1); + default_book_closure->closure = closure; + default_book_closure->open_response = open_response; + rv = addressbook_load_uri (book, val, + addressbook_default_book_open, default_book_closure); g_free (val); } else { -- cgit v1.2.3