aboutsummaryrefslogtreecommitdiffstats
path: root/addressbook/gui
diff options
context:
space:
mode:
authorChris Toshok <toshok@ximian.com>2003-01-10 12:02:25 +0800
committerChris Toshok <toshok@src.gnome.org>2003-01-10 12:02:25 +0800
commitebd4a9fa7f3bd6d94e85cba93e4190a7bbb07f92 (patch)
tree437ab19795cdfb6cc17d9d54d543fa5201f9ef7f /addressbook/gui
parent462934169af9df210664ea018f678d0f8fbcd238 (diff)
downloadgsoc2013-evolution-ebd4a9fa7f3bd6d94e85cba93e4190a7bbb07f92.tar.gz
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/gui')
-rw-r--r--addressbook/gui/component/addressbook.c29
1 files changed, 27 insertions, 2 deletions
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);