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
This commit is contained in:
Chris Toshok
2003-01-10 04:02:25 +00:00
committed by Chris Toshok
parent 462934169a
commit ebd4a9fa7f
4 changed files with 47 additions and 3 deletions
+18
View File
@@ -1,3 +1,21 @@
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
-1
View File
@@ -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);
@@ -302,6 +302,8 @@ pas_book_factory_process_request (PASBookFactory *factory,
CORBA_exception_free (&ev);
backend_last_client_gone_cb (backend, factory);
goto out;
}
+27 -2
View File
@@ -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);