diff options
author | Chris Toshok <toshok@ximian.com> | 2002-05-24 18:32:16 +0800 |
---|---|---|
committer | Chris Toshok <toshok@src.gnome.org> | 2002-05-24 18:32:16 +0800 |
commit | 5009d8d479665301efdec3beb784e252fa29527d (patch) | |
tree | e10ee876f17a16a92910bea10bfd4cc0c694cad7 /addressbook/backend | |
parent | f836bed24997c679b99762ac81c8475110d29251 (diff) | |
download | gsoc2013-evolution-5009d8d479665301efdec3beb784e252fa29527d.tar gsoc2013-evolution-5009d8d479665301efdec3beb784e252fa29527d.tar.gz gsoc2013-evolution-5009d8d479665301efdec3beb784e252fa29527d.tar.bz2 gsoc2013-evolution-5009d8d479665301efdec3beb784e252fa29527d.tar.lz gsoc2013-evolution-5009d8d479665301efdec3beb784e252fa29527d.tar.xz gsoc2013-evolution-5009d8d479665301efdec3beb784e252fa29527d.tar.zst gsoc2013-evolution-5009d8d479665301efdec3beb784e252fa29527d.zip |
[ #24189 ] ifdef out the body of this because it only works with a single
2002-05-24 Chris Toshok <toshok@ximian.com>
[ #24189 ]
* gui/component/select-names/e-select-names-manager.c
(focus_out_cb): ifdef out the body of this because it only works
with a single completion book. not sure what to do here, but it
doesn't impact most usage scenarios.
(completion_popup_cb): same.
(e_select_names_manager_entry_new): add the books that have been
loaded successfully by the time this entry is created.
(open_book_cb): add the opened book to the entries that have
already been created, and store it in our list so that entries
that are created in the future can catch up.
(read_completion_books_from_db): slurp in the folder list from the
config db and load all the uris.
(uris_listener): listener function - when there's a change it
calls _clear_books on all the created entries, and clears our
list. It then re-reads the books from the db.
(e_select_names_manager_new): create our bonobo listener and call
read_completion_books_from_db.
(e_select_names_manager_init): init completion_books.
(e_select_names_manager_destroy): free our list of
completion_books.
* gui/component/select-names/e-select-names-manager.h: switch from
a single EBook to a GList of completion_books here.
* gui/component/select-names/e-select-names-completion.c
(e_select_names_completion_add_book): deal with the case where
there's an active query (by effectively restarting it.) This is
quite a contrived edge case.
(e_select_names_completion_clear_books): stop the current query
and clear our list of books.
(e_select_names_completion_new): track change to prototype, and
axe the majority of this method since an EBook* isn't passed
anymore.
(e_select_names_completion_clear_book_data): split this code out
from the destroy method so it can be called from _clear_books.
* gui/component/select-names/e-select-names-completion.h: the
constructor no longer takes an EBook -- pass in as many as you
want using _add_book. Also, add prototype for _clear_books.
* gui/component/addressbook.c (load_uri_cb): when
storing/retrieving passwords, use the cleaned (without params)
version of the uri, so changing things like download limit don't
cause the user to be prompted for a password again.
* gui/component/addressbook-component.c
(ensure_completion_uris_exist): new function - probably doesn't
belong in this file. Make sure the basic local Contacts folder
exists in the completion uris.
(addressbook_component_factory_init): call
ensure_completion_uris_exist.
* backend/ebook/e-book-util.h: add prototype for
e_book_get_default_book_uri.
* backend/ebook/e-book-util.c (e_book_get_default_book_uri): new
function, just return the default contacts uri.
(e_book_load_default_book): change
to use e_book_get_default_book_uri.
svn path=/trunk/; revision=16999
Diffstat (limited to 'addressbook/backend')
-rw-r--r-- | addressbook/backend/ebook/e-book-util.c | 55 | ||||
-rw-r--r-- | addressbook/backend/ebook/e-book-util.h | 2 |
2 files changed, 35 insertions, 22 deletions
diff --git a/addressbook/backend/ebook/e-book-util.c b/addressbook/backend/ebook/e-book-util.c index d3de9840f8..62694a8563 100644 --- a/addressbook/backend/ebook/e-book-util.c +++ b/addressbook/backend/ebook/e-book-util.c @@ -242,44 +242,55 @@ e_book_default_book_open (EBook *book, EBookStatus status, gpointer closure) gboolean e_book_load_default_book (EBook *book, EBookCallback open_response, gpointer closure) { - char *val, *uri; + char *uri; gboolean rv; - CORBA_Environment ev; - Bonobo_ConfigDatabase config_db; + DefaultBookClosure *default_book_closure; 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); + uri = e_book_get_default_book_uri (); + + default_book_closure = g_new (DefaultBookClosure, 1); + + default_book_closure->closure = closure; + default_book_closure->open_response = open_response; + + rv = e_book_load_uri (book, uri, + e_book_default_book_open, default_book_closure); + g_free (uri); + + if (!rv) { + g_warning ("Couldn't load default addressbook"); + } + + return rv; +} + +char* +e_book_get_default_book_uri () +{ + CORBA_Environment ev; + char *val, *uri; + Bonobo_ConfigDatabase config_db; + CORBA_exception_init (&ev); config_db = e_book_get_config_database (&ev); val = bonobo_config_get_string (config_db, "/DefaultFolders/contacts_uri", &ev); CORBA_exception_free (&ev); if (val) { - DefaultBookClosure *default_book_closure = g_new (DefaultBookClosure, 1); - default_book_closure->closure = closure; - default_book_closure->open_response = open_response; - - /* Sigh. FIXME. */ - if (!strncmp (val, "file:", 5)) - uri = g_strconcat (val, "/addressbook.db", NULL); - else - uri = g_strdup (val); - rv = e_book_load_uri (book, uri, - e_book_default_book_open, default_book_closure); - g_free (uri); - g_free (val); + uri = val; } else { - rv = e_book_load_local_address_book (book, open_response, closure); - } - - if (!rv) { - g_warning ("Couldn't load default addressbook"); + char *filename; + filename = gnome_util_prepend_user_home ("evolution/local/Contacts/addressbook.db"); + uri = g_strdup_printf ("file://%s", filename); + g_free (filename); } - return rv; + return uri; } /* diff --git a/addressbook/backend/ebook/e-book-util.h b/addressbook/backend/ebook/e-book-util.h index 33f90c399f..fe80b7e02c 100644 --- a/addressbook/backend/ebook/e-book-util.h +++ b/addressbook/backend/ebook/e-book-util.h @@ -42,6 +42,7 @@ typedef void (*EBookHaveAddressCallback) (EBook *book, const gchar *addr, ECard /* expand file:///foo/foo/ to file:///foo/foo/addressbook.db */ char *e_book_expand_uri (const char *uri); + gboolean e_book_load_address_book_by_uri (EBook *book, const char *uri, EBookCallback open_response, @@ -58,6 +59,7 @@ void e_book_use_local_address_book (EBookCommonCallback gboolean e_book_load_default_book (EBook *book, EBookCallback open_response, gpointer closure); +char *e_book_get_default_book_uri (void); /* Bonoboconf database interface. */ Bonobo_ConfigDatabase e_book_get_config_database (CORBA_Environment *ev); |