diff options
author | Chris Toshok <toshok@ximian.com> | 2002-07-10 16:47:11 +0800 |
---|---|---|
committer | Chris Toshok <toshok@src.gnome.org> | 2002-07-10 16:47:11 +0800 |
commit | 35624a9226fbb36f075ed40d1a61369f73570252 (patch) | |
tree | 9e7035df9ecb557a7c9c7fedfe46dc17474607d7 /addressbook/backend/pas/pas-book.c | |
parent | eed274191e31adb925555ebbb0fb58b7fb9989e8 (diff) | |
download | gsoc2013-evolution-35624a9226fbb36f075ed40d1a61369f73570252.tar gsoc2013-evolution-35624a9226fbb36f075ed40d1a61369f73570252.tar.gz gsoc2013-evolution-35624a9226fbb36f075ed40d1a61369f73570252.tar.bz2 gsoc2013-evolution-35624a9226fbb36f075ed40d1a61369f73570252.tar.lz gsoc2013-evolution-35624a9226fbb36f075ed40d1a61369f73570252.tar.xz gsoc2013-evolution-35624a9226fbb36f075ed40d1a61369f73570252.tar.zst gsoc2013-evolution-35624a9226fbb36f075ed40d1a61369f73570252.zip |
add Book.getCompletionView.
2002-07-10 Chris Toshok <toshok@ximian.com>
* backend/idl/addressbook.idl: add Book.getCompletionView.
* backend/ebook/e-book.c (e_book_get_completion_view): new
function, basically c&p of e_book_get_book_view, but call
getCompletionView.
* backend/ebook/e-book.h: add prototype for
e_book_get_completion_view.
* backend/pas/pas-backend-ldap.c
(pas_backend_ldap_process_client_requests): add a
GetCompletionView case here that just calls the same code as
GetBookView (since we don't build summaries for the ldap backend.)
* backend/pas/pas-backend-file.c (do_summary_query): add
@completion_search. If it's TRUE, just create the vcards from the
summary using pas_backend_summary_get_summary_vcard instead of
looking them up from the db.
(pas_backend_file_search): add @completion_search and pass it on
to do_summary_query.
(pas_backend_file_process_get_book_view): pass FALSE to
pas_backend_file_search.
(pas_backend_file_process_get_completion_view): new function,
basically c&p pas_backend_file_process_get_book_view, but pass
TRUE to pas_backend_file_search.
(pas_backend_file_process_client_requests): add a case for
GetCompletionView.
(pas_backend_file_load_uri): track the change to the summary api -
create the summary filename
* backend/pas/pas-book.c (pas_book_queue_get_completion_view): new
function, queue a GetCompletionView request to our queue.
(impl_GNOME_Evolution_Addressbook_Book_getCompletionView): new
function, call pas_book_queue_get_completion_view.
(pas_book_respond_get_completion_view): new function, just call
notifyViewRequested.
(pas_book_free_request): add a case for GetCompletionView.
(pas_book_get_epv): fill in epv->getCompletionView.
* backend/pas/pas-book.h: add a GetCompletionView PASOperation,
and a new structure (PASGetCompletionViewRequest). Also, add
get_completion_view to PASRequest.
* backend/pas/pas-backend-summary.c (clear_items): remove the
items from the hash table.
(pas_backend_summary_new): db_path -> summary_path.
(pas_backend_summary_destroy): db_.path -> summary_path, and
destroy the hash table.
(pas_backend_summary_init): db_path = summary_path, and initialize
the id_to_item hashtable.
(pas_backend_summary_load_header): handle the upgrading from
version 1.0 to version 2.0 (the addition of an mtime field in the
header)
(pas_backend_summary_load_item): version 1.0 and 2.0 have the same
format for items.
(pas_backend_summary_open): new function. open the summary so we
can load the header (and get the mtime).
(pas_backend_summary_load): rework this a bit since the header has
already been loaded, and also add the items to the hashtable.
(pas_backend_summary_add_card): add the new item to the hashtable.
(pas_backend_summary_remove_card): remove the item from the hash
table.
(pas_backend_summary_is_up_to_date): new function, chekc @t
against the summary's mtime.
(pas_backend_summary_get_summary_vcard): create a vcard from the
fields we have in the summary.
* backend/pas/pas-backend-summary.h: add prorotypes for
pas_backend_summary_is_up_to_date and
pas_backend_summary_get_summary_vcard.
svn path=/trunk/; revision=17402
Diffstat (limited to 'addressbook/backend/pas/pas-book.c')
-rw-r--r-- | addressbook/backend/pas/pas-book.c | 73 |
1 files changed, 73 insertions, 0 deletions
diff --git a/addressbook/backend/pas/pas-book.c b/addressbook/backend/pas/pas-book.c index 9bb2cd348e..7a3ab55f92 100644 --- a/addressbook/backend/pas/pas-book.c +++ b/addressbook/backend/pas/pas-book.c @@ -179,6 +179,30 @@ pas_book_queue_get_book_view (PASBook *book, const GNOME_Evolution_Addressbook_B } static void +pas_book_queue_get_completion_view (PASBook *book, const GNOME_Evolution_Addressbook_BookViewListener listener, const char *search) +{ + PASRequest *req; + CORBA_Environment ev; + + req = g_new0 (PASRequest, 1); + req->op = GetCompletionView; + req->get_book_view.search = g_strdup(search); + + CORBA_exception_init (&ev); + + req->get_book_view.listener = bonobo_object_dup_ref(listener, &ev); + + if (ev._major != CORBA_NO_EXCEPTION) { + g_warning ("pas_book_queue_get_completion_view: Exception " + "duplicating BookViewListener!\n"); + } + + CORBA_exception_free (&ev); + + pas_book_queue_request (book, req); +} + +static void pas_book_queue_get_changes (PASBook *book, const GNOME_Evolution_Addressbook_BookViewListener listener, const char *change_id) { PASRequest *req; @@ -286,6 +310,18 @@ impl_GNOME_Evolution_Addressbook_Book_getBookView (PortableServer_Servant servan pas_book_queue_get_book_view (book, listener, search); } + +static void +impl_GNOME_Evolution_Addressbook_Book_getCompletionView (PortableServer_Servant servant, + const GNOME_Evolution_Addressbook_BookViewListener listener, + const CORBA_char *search, + CORBA_Environment *ev) +{ + PASBook *book = PAS_BOOK (bonobo_object_from_servant (servant)); + + pas_book_queue_get_completion_view (book, listener, search); +} + static void impl_GNOME_Evolution_Addressbook_Book_getChanges (PortableServer_Servant servant, const GNOME_Evolution_Addressbook_BookViewListener listener, @@ -601,6 +637,32 @@ pas_book_respond_get_book_view (PASBook *book, } /** + * pas_book_respond_get_book_view: + */ +void +pas_book_respond_get_completion_view (PASBook *book, + GNOME_Evolution_Addressbook_BookListener_CallStatus status, + PASBookView *completion_view) +{ + CORBA_Environment ev; + CORBA_Object object; + + CORBA_exception_init (&ev); + + object = bonobo_object_corba_objref(BONOBO_OBJECT(completion_view)); + + GNOME_Evolution_Addressbook_BookListener_notifyViewRequested ( + book->priv->listener, status, object, &ev); + + if (ev._major != CORBA_NO_EXCEPTION) { + g_warning ("pas_book_respond_get_completion_view: Exception " + "responding to BookListener!\n"); + } + + CORBA_exception_free (&ev); +} + +/** * pas_book_respond_get_changes: */ void @@ -797,6 +859,16 @@ pas_book_free_request (PASRequest *req) CORBA_exception_free (&ev); break; + case GetCompletionView: + g_free (req->get_completion_view.search); + CORBA_exception_init (&ev); + bonobo_object_release_unref (req->get_completion_view.listener, &ev); + + if (ev._major != CORBA_NO_EXCEPTION) + g_message ("pas_book_free_request(GetCompletionView): could not release the listener"); + + CORBA_exception_free (&ev); + break; case GetChanges: g_free (req->get_changes.change_id); CORBA_exception_init (&ev); @@ -875,6 +947,7 @@ pas_book_get_epv (void) epv->getSupportedFields = impl_GNOME_Evolution_Addressbook_Book_getSupportedFields; epv->getCursor = impl_GNOME_Evolution_Addressbook_Book_getCursor; epv->getBookView = impl_GNOME_Evolution_Addressbook_Book_getBookView; + epv->getCompletionView = impl_GNOME_Evolution_Addressbook_Book_getCompletionView; epv->getChanges = impl_GNOME_Evolution_Addressbook_Book_getChanges; return epv; |