diff options
author | Chris Toshok <toshok@ximian.com> | 2003-01-10 12:02:25 +0800 |
---|---|---|
committer | Chris Toshok <toshok@src.gnome.org> | 2003-01-10 12:02:25 +0800 |
commit | ebd4a9fa7f3bd6d94e85cba93e4190a7bbb07f92 (patch) | |
tree | 437ab19795cdfb6cc17d9d54d543fa5201f9ef7f /addressbook | |
parent | 462934169af9df210664ea018f678d0f8fbcd238 (diff) | |
download | gsoc2013-evolution-ebd4a9fa7f3bd6d94e85cba93e4190a7bbb07f92.tar gsoc2013-evolution-ebd4a9fa7f3bd6d94e85cba93e4190a7bbb07f92.tar.gz gsoc2013-evolution-ebd4a9fa7f3bd6d94e85cba93e4190a7bbb07f92.tar.bz2 gsoc2013-evolution-ebd4a9fa7f3bd6d94e85cba93e4190a7bbb07f92.tar.lz gsoc2013-evolution-ebd4a9fa7f3bd6d94e85cba93e4190a7bbb07f92.tar.xz gsoc2013-evolution-ebd4a9fa7f3bd6d94e85cba93e4190a7bbb07f92.tar.zst gsoc2013-evolution-ebd4a9fa7f3bd6d94e85cba93e4190a7bbb07f92.zip |
try to load the uri again if it failed previously. (book_open_cb): set
2003-01-09 Chris Toshok <toshok@ximian.com>
* gui/component/addressbook.c (control_activate_cb): try to load
the uri again if it failed previously.
(book_open_cb): set failed_to_load based on the response.
(set_prop): initialize failed_to_load to FALSE before we kick off
the first load.
* backend/pas/pas-book-factory.c
(pas_book_factory_process_request): if the load_uri fails, remove
it from the hashtable and free it, so we'll try to load it again
from scratch the next time it's requested instead of serving up a
backend that doesn't function.
* backend/pas/pas-backend.c (pas_backend_get_uri): we need to be
able to get the uri from backends that aren't loaded (so we can
remove them from the hashtable.)
svn path=/trunk/; revision=19392
Diffstat (limited to 'addressbook')
-rw-r--r-- | addressbook/ChangeLog | 18 | ||||
-rw-r--r-- | addressbook/backend/pas/pas-backend.c | 1 | ||||
-rw-r--r-- | addressbook/backend/pas/pas-book-factory.c | 2 | ||||
-rw-r--r-- | addressbook/gui/component/addressbook.c | 29 |
4 files changed, 47 insertions, 3 deletions
diff --git a/addressbook/ChangeLog b/addressbook/ChangeLog index e83f41d9bf..1b51c47c9d 100644 --- a/addressbook/ChangeLog +++ b/addressbook/ChangeLog @@ -1,5 +1,23 @@ 2003-01-09 Chris Toshok <toshok@ximian.com> + * gui/component/addressbook.c (control_activate_cb): try to load + the uri again if it failed previously. + (book_open_cb): set failed_to_load based on the response. + (set_prop): initialize failed_to_load to FALSE before we kick off + the first load. + + * backend/pas/pas-book-factory.c + (pas_book_factory_process_request): if the load_uri fails, remove + it from the hashtable and free it, so we'll try to load it again + from scratch the next time it's requested instead of serving up a + backend that doesn't function. + + * backend/pas/pas-backend.c (pas_backend_get_uri): we need to be + able to get the uri from backends that aren't loaded (so we can + remove them from the hashtable.) + +2003-01-09 Chris Toshok <toshok@ximian.com> + * backend/pas/pas-backend-ldap.c (query_ldap_root_dse): doh, fix build error. diff --git a/addressbook/backend/pas/pas-backend.c b/addressbook/backend/pas/pas-backend.c index c8acad3c93..b47afd8d30 100644 --- a/addressbook/backend/pas/pas-backend.c +++ b/addressbook/backend/pas/pas-backend.c @@ -58,7 +58,6 @@ pas_backend_get_uri (PASBackend *backend) { g_return_val_if_fail (backend != NULL, NULL); g_return_val_if_fail (PAS_IS_BACKEND (backend), NULL); - g_return_val_if_fail (backend->priv->loaded, NULL); g_assert (PAS_BACKEND_GET_CLASS (backend)->get_uri != NULL); diff --git a/addressbook/backend/pas/pas-book-factory.c b/addressbook/backend/pas/pas-book-factory.c index 5a258edcfe..460e83e73a 100644 --- a/addressbook/backend/pas/pas-book-factory.c +++ b/addressbook/backend/pas/pas-book-factory.c @@ -302,6 +302,8 @@ pas_book_factory_process_request (PASBookFactory *factory, CORBA_exception_free (&ev); + backend_last_client_gone_cb (backend, factory); + goto out; } diff --git a/addressbook/gui/component/addressbook.c b/addressbook/gui/component/addressbook.c index 1fb5520454..2c2001c4c6 100644 --- a/addressbook/gui/component/addressbook.c +++ b/addressbook/gui/component/addressbook.c @@ -83,6 +83,7 @@ typedef struct { char *uri; char *passwd; gboolean ignore_search_changes; + gboolean failed_to_load; } AddressbookView; static void addressbook_view_ref (AddressbookView *); @@ -91,6 +92,8 @@ static void addressbook_view_unref (AddressbookView *); static void addressbook_authenticate (EBook *book, gboolean previous_failure, AddressbookSource *source, EBookCallback cb, gpointer closure); +static void book_open_cb (EBook *book, EBookStatus status, gpointer closure); + static void save_contact_cb (BonoboUIComponent *uih, void *user_data, const char *path) { @@ -394,13 +397,27 @@ control_activate_cb (BonoboControl *control, uic = bonobo_control_get_ui_component (control); g_assert (uic != NULL); - - if (activate) { + if (activate) { control_activate (control, uic, view); if (activate && view->view && view->view->model) e_addressbook_model_force_folder_bar_message (view->view->model); + /* if the book failed to load, we kick off another + load here */ + + if (view->failed_to_load && view->uri) { + EBook *book; + char *uri_data; + + book = e_book_new (); + uri_data = e_book_expand_uri (view->uri); + + if (! addressbook_load_uri (book, uri_data, book_open_cb, view)) + printf ("error calling load_uri!\n"); + + g_free(uri_data); + } } else { bonobo_ui_component_unset_container (uic, NULL); e_addressbook_view_discard_menus (view->view); @@ -478,6 +495,8 @@ book_open_cb (EBook *book, EBookStatus status, gpointer closure) AddressbookView *view = closure; if (status == E_BOOK_STATUS_SUCCESS) { + view->failed_to_load = FALSE; + g_object_set(view->view, "book", book, NULL); @@ -488,6 +507,8 @@ book_open_cb (EBook *book, EBookStatus status, gpointer closure) GtkWidget *href = NULL; AddressbookSource *source = NULL; + view->failed_to_load = TRUE; + if (!strncmp (view->uri, "file:", 5)) { label_string = _("We were unable to open this addressbook. Please check that the\n" @@ -543,6 +564,8 @@ book_open_cb (EBook *book, EBookStatus status, gpointer closure) gtk_widget_show_all (warning_dialog); } + + g_object_unref (book); } static void @@ -767,6 +790,8 @@ set_prop (BonoboPropertyBag *bag, book = e_book_new (); } + view->failed_to_load = FALSE; + view->uri = g_strdup(BONOBO_ARG_GET_STRING (arg)); uri_data = e_book_expand_uri (view->uri); |