aboutsummaryrefslogtreecommitdiffstats
path: root/addressbook/backend/ebook/e-book.c
diff options
context:
space:
mode:
authorChristopher James Lahey <clahey@helixcode.com>2000-03-28 11:52:46 +0800
committerChris Lahey <clahey@src.gnome.org>2000-03-28 11:52:46 +0800
commit21e60e238477edd1ad157bd17024d5ea6395e048 (patch)
tree4f251e318f085aecc387c49f052a14f7874c1a1a /addressbook/backend/ebook/e-book.c
parentbd46ea2926e3f244d6d875195363d261f53a4e07 (diff)
downloadgsoc2013-evolution-21e60e238477edd1ad157bd17024d5ea6395e048.tar
gsoc2013-evolution-21e60e238477edd1ad157bd17024d5ea6395e048.tar.gz
gsoc2013-evolution-21e60e238477edd1ad157bd17024d5ea6395e048.tar.bz2
gsoc2013-evolution-21e60e238477edd1ad157bd17024d5ea6395e048.tar.lz
gsoc2013-evolution-21e60e238477edd1ad157bd17024d5ea6395e048.tar.xz
gsoc2013-evolution-21e60e238477edd1ad157bd17024d5ea6395e048.tar.zst
gsoc2013-evolution-21e60e238477edd1ad157bd17024d5ea6395e048.zip
Fixed some warnings.
2000-03-27 Christopher James Lahey <clahey@helixcode.com> * addressbook/backend/ebook/test-card.c: Fixed some warnings. * addressbook/backend/ebook/test-client.c: Added a section to test cursors and returning an id when adding. * addressbook/backend/ebook/e-card-pairs.h: Removed the address pairs since they were added to e-card.c. * addressbook/backend/ebook/e-card.c, addressbook/backend/ebook/e-card.h: Made the set_id function take a const char *. * addressbook/backend/ebook/e-book-listener.c, addressbook/backend/ebook/e-book-listener.h, addressbook/backend/ebook/e-book.c, addressbook/backend/ebook/e-book.h, addressbook/backend/idl/addressbook.idl, addressbook/backend/pas/pas-backend-file.c, addressbook/backend/pas/pas-book.c, addressbook/backend/pas/pas-book.h: Added a get_all_cards function and made the response to the create_card function include the card id. * addressbook/backend/ebook/Makefile.am: Added e-card-cursor.c and e-card-cursor.h. * addressbook/backend/ebook/e-card-cursor.c, addressbook/backend/ebook/e-card-cursor.h: New class for proxying to an Evolution_CardCursor. * addressbook/backend/pas/Makefile.am: Added pas-card-cursor.c and pas-card-cursor.h. * addressbook/backend/pas/pas-card-cursor.c, addressbook/backend/pas/pas-card-cursor.h: New bonobo class for making an Evolution_CardCursor server. svn path=/trunk/; revision=2205
Diffstat (limited to 'addressbook/backend/ebook/e-book.c')
-rw-r--r--addressbook/backend/ebook/e-book.c121
1 files changed, 112 insertions, 9 deletions
diff --git a/addressbook/backend/ebook/e-book.c b/addressbook/backend/ebook/e-book.c
index b3c2e12b57..e95ff8f751 100644
--- a/addressbook/backend/ebook/e-book.c
+++ b/addressbook/backend/ebook/e-book.c
@@ -1,3 +1,4 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/*
* The Evolution addressbook client object.
*
@@ -97,6 +98,25 @@ e_book_pop_op (EBook *book)
}
static void
+e_book_do_response_create_card (EBook *book,
+ EBookListenerResponse *resp)
+{
+ EBookOp *op;
+
+ op = e_book_pop_op (book);
+
+ if (op == NULL) {
+ g_warning ("e_book_do_response_create_card: Cannot find operation "
+ "in local op queue!\n");
+ return;
+ }
+
+ ((EBookIdCallback) op->cb) (book, resp->status, resp->id, op->closure);
+ g_free (resp->id);
+ g_free (op);
+}
+
+static void
e_book_do_response_generic (EBook *book,
EBookListenerResponse *resp)
{
@@ -115,6 +135,52 @@ e_book_do_response_generic (EBook *book,
}
static void
+e_book_do_response_get_cursor (EBook *book,
+ EBookListenerResponse *resp)
+{
+ CORBA_Environment ev;
+ EBookOp *op;
+ ECardCursor *cursor;
+
+ op = e_book_pop_op (book);
+
+ if (op == NULL) {
+ g_warning ("e_book_do_response_create_card: Cannot find operation "
+ "in local op queue!\n");
+ return;
+ }
+
+ cursor = e_card_cursor_new(resp->cursor);
+
+ ((EBookCursorCallback) op->cb) (book, resp->status, cursor, op->closure);
+
+ /*
+ * Release the remote Evolution_Book in the PAS.
+ */
+ CORBA_exception_init (&ev);
+
+ Bonobo_Unknown_unref (resp->cursor, &ev);
+
+ if (ev._major != CORBA_NO_EXCEPTION) {
+ g_warning ("e_book_do_response_get_curosr: Exception unref'ing "
+ "remote Evolution_CardCursor interface!\n");
+ CORBA_exception_free (&ev);
+ CORBA_exception_init (&ev);
+ }
+
+ CORBA_Object_release (resp->cursor, &ev);
+
+ if (ev._major != CORBA_NO_EXCEPTION) {
+ g_warning ("e_book_do_response_get_cursor: Exception releasing "
+ "remote Evolution_CardCursor interface!\n");
+ }
+
+ CORBA_exception_free (&ev);
+
+ g_free (op);
+}
+
+static void
e_book_do_response_open (EBook *book,
EBookListenerResponse *resp)
{
@@ -205,10 +271,15 @@ e_book_check_listener_queue (EBookListener *listener)
switch (resp->op) {
case CreateCardResponse:
+ e_book_do_response_create_card (book, resp);
+ break;
case RemoveCardResponse:
case ModifyCardResponse:
e_book_do_response_generic (book, resp);
break;
+ case GetCursorResponse:
+ e_book_do_response_get_cursor (book, resp);
+ break;
case OpenBookResponse:
e_book_do_response_open (book, resp);
break;
@@ -541,10 +612,10 @@ e_book_remove_card_by_id (EBook *book,
* e_book_add_card:
*/
gboolean
-e_book_add_card (EBook *book,
- ECard *card,
- EBookCallback cb,
- gpointer closure)
+e_book_add_card (EBook *book,
+ ECard *card,
+ EBookIdCallback cb,
+ gpointer closure)
{
char *vcard;
@@ -579,10 +650,10 @@ e_book_add_card (EBook *book,
* e_book_add_vcard:
*/
gboolean
-e_book_add_vcard (EBook *book,
- const char *vcard,
- EBookCallback cb,
- gpointer closure)
+e_book_add_vcard (EBook *book,
+ const char *vcard,
+ EBookIdCallback cb,
+ gpointer closure)
{
CORBA_Environment ev;
@@ -609,7 +680,7 @@ e_book_add_vcard (EBook *book,
CORBA_exception_free (&ev);
- e_book_queue_op (book, cb, closure);
+ e_book_queue_op (book, (EBookCallback) cb, closure);
return TRUE;
}
@@ -726,6 +797,38 @@ e_book_check_connection (EBook *book)
return TRUE;
}
+gboolean e_book_get_all_cards (EBook *book,
+ EBookCursorCallback cb,
+ gpointer closure)
+{
+ CORBA_Environment ev;
+
+ g_return_val_if_fail (book != NULL, FALSE);
+ g_return_val_if_fail (E_IS_BOOK (book), FALSE);
+
+ if (book->priv->load_state != URILoaded) {
+ g_warning ("e_book_check_connection: No URI loaded!\n");
+ return FALSE;
+ }
+
+ CORBA_exception_init (&ev);
+
+ Evolution_Book_get_all_cards (book->priv->corba_book, &ev);
+
+ if (ev._major != CORBA_NO_EXCEPTION) {
+ g_warning ("e_book_get_all_cards: Exception "
+ "querying list of cards!\n");
+ CORBA_exception_free (&ev);
+ return FALSE;
+ }
+
+ CORBA_exception_free (&ev);
+
+ e_book_queue_op (book, cb, closure);
+
+ return TRUE;
+}
+
/**
* e_book_get_name:
*/