aboutsummaryrefslogtreecommitdiffstats
path: root/addressbook
diff options
context:
space:
mode:
authorDan Winship <danw@src.gnome.org>2002-04-10 00:37:49 +0800
committerDan Winship <danw@src.gnome.org>2002-04-10 00:37:49 +0800
commit574ee58b9604a66ec48bedb385dc15acb0e44ae9 (patch)
treec4e671d0adc0ad1ffe9240847b4175b580c48ece /addressbook
parentef108f7218d01f8b57d588e904680c03f688eb16 (diff)
downloadgsoc2013-evolution-574ee58b9604a66ec48bedb385dc15acb0e44ae9.tar
gsoc2013-evolution-574ee58b9604a66ec48bedb385dc15acb0e44ae9.tar.gz
gsoc2013-evolution-574ee58b9604a66ec48bedb385dc15acb0e44ae9.tar.bz2
gsoc2013-evolution-574ee58b9604a66ec48bedb385dc15acb0e44ae9.tar.lz
gsoc2013-evolution-574ee58b9604a66ec48bedb385dc15acb0e44ae9.tar.xz
gsoc2013-evolution-574ee58b9604a66ec48bedb385dc15acb0e44ae9.tar.zst
gsoc2013-evolution-574ee58b9604a66ec48bedb385dc15acb0e44ae9.zip
Update for new-and-improved consistent default folder uri.
* backend/ebook/e-book-util.c (e_book_load_default_book): Update for new-and-improved consistent default folder uri. * gui/component/addressbook.c (addressbook_load_default_book): Use e_book_load_default_book rather than duplicating most of its logic here. (load_uri_cb): Modify to work as a callback for addressbook_load_default_book as well as addressbook_load_uri. svn path=/trunk/; revision=16409
Diffstat (limited to 'addressbook')
-rw-r--r--addressbook/ChangeLog11
-rw-r--r--addressbook/backend/ebook/e-book-util.c2
-rw-r--r--addressbook/gui/component/addressbook.c74
3 files changed, 23 insertions, 64 deletions
diff --git a/addressbook/ChangeLog b/addressbook/ChangeLog
index b0b76a5949..e90ccee469 100644
--- a/addressbook/ChangeLog
+++ b/addressbook/ChangeLog
@@ -1,3 +1,14 @@
+2002-04-09 Dan Winship <danw@ximian.com>
+
+ * backend/ebook/e-book-util.c (e_book_load_default_book): Update
+ for new-and-improved consistent default folder uri.
+
+ * gui/component/addressbook.c (addressbook_load_default_book): Use
+ e_book_load_default_book rather than duplicating most of its logic
+ here.
+ (load_uri_cb): Modify to work as a callback for
+ addressbook_load_default_book as well as addressbook_load_uri.
+
2002-04-08 Dan Winship <danw@ximian.com>
* gui/component/addressbook-component.c (create_view): Add
diff --git a/addressbook/backend/ebook/e-book-util.c b/addressbook/backend/ebook/e-book-util.c
index d214937843..7544342efe 100644
--- a/addressbook/backend/ebook/e-book-util.c
+++ b/addressbook/backend/ebook/e-book-util.c
@@ -253,7 +253,7 @@ e_book_load_default_book (EBook *book, EBookCallback open_response, gpointer clo
CORBA_exception_init (&ev);
config_db = e_book_get_config_database (&ev);
- val = bonobo_config_get_string (config_db, "/Addressbook/default_book_uri", &ev);
+ val = bonobo_config_get_string (config_db, "/DefaultFolders/contacts_uri", &ev);
CORBA_exception_free (&ev);
if (val) {
diff --git a/addressbook/gui/component/addressbook.c b/addressbook/gui/component/addressbook.c
index b70b9952bb..42f05f8217 100644
--- a/addressbook/gui/component/addressbook.c
+++ b/addressbook/gui/component/addressbook.c
@@ -597,7 +597,6 @@ get_prop (BonoboPropertyBag *bag,
}
typedef struct {
- char *uri;
EBookCallback cb;
gpointer closure;
} LoadUriData;
@@ -614,7 +613,6 @@ load_uri_auth_cb (EBook *book, EBookStatus status, gpointer closure)
data->cb (book, status, data->closure);
- g_free (data->uri);
g_free (data);
}
@@ -625,7 +623,7 @@ load_uri_cb (EBook *book, EBookStatus status, gpointer closure)
AddressbookSource *source;
LoadUriData *load_uri_data = closure;
- source = addressbook_storage_get_source_by_uri (load_uri_data->uri);
+ source = addressbook_storage_get_source_by_uri (e_book_get_uri (book));
if (status == E_BOOK_STATUS_SUCCESS) {
/* check if the addressbook needs authentication */
@@ -636,7 +634,7 @@ load_uri_cb (EBook *book, EBookStatus status, gpointer closure)
const char *password;
char *pass_dup = NULL;
- password = e_passwords_get_password(load_uri_data->uri);
+ password = e_passwords_get_password (e_book_get_uri (book));
if (!password) {
char *prompt;
@@ -650,7 +648,7 @@ load_uri_cb (EBook *book, EBookStatus status, gpointer closure)
source->name, source->email_addr);
remember = source->remember_passwd;
pass_dup = e_passwords_ask_password (
- prompt, load_uri_data->uri, prompt, TRUE,
+ prompt, e_book_get_uri (book), prompt, TRUE,
E_PASSWORDS_REMEMBER_FOREVER, &remember,
NULL);
if (remember != source->remember_passwd) {
@@ -679,7 +677,6 @@ load_uri_cb (EBook *book, EBookStatus status, gpointer closure)
}
load_uri_data->cb (book, status, load_uri_data->closure);
- g_free (load_uri_data->uri);
g_free (load_uri_data);
}
@@ -690,79 +687,30 @@ addressbook_load_uri (EBook *book, const char *uri,
LoadUriData *load_uri_data = g_new (LoadUriData, 1);
gboolean rv;
- load_uri_data->uri = g_strdup (uri);
load_uri_data->cb = cb;
load_uri_data->closure = closure;
rv = e_book_load_uri (book, uri, load_uri_cb, load_uri_data);
- if (!rv) {
- g_free (load_uri_data->uri);
+ if (!rv)
g_free (load_uri_data);
- }
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);
-
- /* special case the protocol not supported error, since we
- really only want to failover to the local book in the case
- where there's no installed backend for that protocol. all
- other errors (failure to connect, etc.) should get reported
- to the caller as normal. */
- if (status == E_BOOK_STATUS_PROTOCOL_NOT_SUPPORTED) {
- 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)
+addressbook_load_default_book (EBook *book, EBookCallback cb, gpointer closure)
{
- char *val;
+ LoadUriData *load_uri_data = g_new (LoadUriData, 1);
gboolean rv;
- CORBA_Environment ev;
- Bonobo_ConfigDatabase config_db;
-
- g_return_val_if_fail (book != NULL, FALSE);
- g_return_val_if_fail (E_IS_BOOK (book), FALSE);
- g_return_val_if_fail (open_response != NULL, FALSE);
- CORBA_exception_init (&ev);
- config_db = addressbook_config_database (&ev);
- val = bonobo_config_get_string (config_db, "/Addressbook/default_book_uri", &ev);
- CORBA_exception_free (&ev);
+ load_uri_data->cb = cb;
+ load_uri_data->closure = closure;
- if (val) {
- 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 {
- rv = e_book_load_local_address_book (book, open_response, closure);
- }
+ rv = e_book_load_default_book (book, load_uri_cb, load_uri_data);
- if (!rv) {
- g_warning ("Couldn't load default addressbook");
- }
+ if (!rv)
+ g_free (load_uri_data);
return rv;
}