aboutsummaryrefslogtreecommitdiffstats
path: root/addressbook/backend/pas/pas-backend-file.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/pas/pas-backend-file.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/pas/pas-backend-file.c')
-rw-r--r--addressbook/backend/pas/pas-backend-file.c106
1 files changed, 104 insertions, 2 deletions
diff --git a/addressbook/backend/pas/pas-backend-file.c b/addressbook/backend/pas/pas-backend-file.c
index bf5ef55c2f..04f59d40f8 100644
--- a/addressbook/backend/pas/pas-backend-file.c
+++ b/addressbook/backend/pas/pas-backend-file.c
@@ -17,11 +17,13 @@
#include <pas-backend-file.h>
#include <pas-book.h>
+#include <pas-card-cursor.h>
#define PAS_BACKEND_FILE_VERSION_NAME "PAS-DB-VERSION"
#define PAS_BACKEND_FILE_VERSION "0.1"
static PASBackendClass *pas_backend_file_parent_class;
+typedef struct _PASBackendFileCursorPrivate PASBackendFileCursorPrivate;
struct _PASBackendFilePrivate {
GList *clients;
@@ -29,6 +31,52 @@ struct _PASBackendFilePrivate {
DB *file_db;
};
+struct _PASBackendFileCursorPrivate {
+ PASBackend *backend;
+ PASBook *book;
+};
+
+static long
+get_length(PASCardCursor *cursor, gpointer data)
+{
+#if 0
+ PASBackendFileCursorPrivate *cursor_data = (PASBackendFileCursorPrivate *) data;
+#endif
+ return 0;
+}
+
+static char *
+get_nth(PASCardCursor *cursor, long n, gpointer data)
+{
+#if 0
+ PASBackendFileCursorPrivate *cursor_data = (PASBackendFileCursorPrivate *) data;
+#endif
+ return "";
+}
+
+static void
+cursor_destroy(GtkObject *object, gpointer data)
+{
+ CORBA_Environment ev;
+ Evolution_Book corba_book;
+ PASBackendFileCursorPrivate *cursor_data = (PASBackendFileCursorPrivate *) data;
+
+ corba_book = bonobo_object_corba_objref(cursor_data->book);
+
+ CORBA_exception_init(&ev);
+
+ Evolution_Book_unref(corba_book, &ev);
+
+ if (ev._major != CORBA_NO_EXCEPTION) {
+ g_warning("cursor_destroy: Exception unreffing "
+ "corba book.\n");
+ }
+
+ CORBA_exception_free(&ev);
+
+ g_free(cursor_data);
+}
+
static void
string_to_dbt(const char *str, DBT *dbt)
{
@@ -65,7 +113,8 @@ pas_backend_file_process_create_card (PASBackend *backend,
pas_book_respond_create (
book,
- Evolution_BookListener_Success);
+ Evolution_BookListener_Success,
+ id);
db_error = db->sync (db, 0);
if (db_error != 0)
@@ -76,7 +125,8 @@ pas_backend_file_process_create_card (PASBackend *backend,
think */
pas_book_respond_create (
book,
- Evolution_BookListener_CardNotFound);
+ Evolution_BookListener_CardNotFound,
+ "");
}
g_free (id);
@@ -154,6 +204,54 @@ pas_backend_file_process_modify_card (PASBackend *backend,
}
static void
+pas_backend_file_process_get_all_cards (PASBackend *backend,
+ PASBook *book,
+ PASRequest *req)
+{
+ /*
+ PASBackendFile *bf = PAS_BACKEND_FILE (backend);
+ DB *db = bf->priv->file_db;
+ DBT id_dbt, vcard_dbt;
+ */
+ CORBA_Environment ev;
+ int db_error = 0;
+ PASBackendFileCursorPrivate *cursor_data;
+ PASCardCursor *cursor;
+ Evolution_Book corba_book;
+
+ cursor_data = g_new(PASBackendFileCursorPrivate, 1);
+ cursor_data->backend = backend;
+ cursor_data->book = book;
+
+ corba_book = bonobo_object_corba_objref(book);
+
+ CORBA_exception_init(&ev);
+
+ Evolution_Book_ref(corba_book, &ev);
+
+ if (ev._major != CORBA_NO_EXCEPTION) {
+ g_warning("pas_backend_file_process_get_all_cards: Exception reffing "
+ "corba book.\n");
+ }
+
+ CORBA_exception_free(&ev);
+
+ cursor = pas_card_cursor_new(get_length,
+ get_nth,
+ cursor_data);
+
+ gtk_signal_connect(GTK_OBJECT(cursor), "destroy",
+ GTK_SIGNAL_FUNC(cursor_destroy), cursor_data);
+
+ pas_book_respond_get_cursor (
+ book,
+ (db_error == 0
+ ? Evolution_BookListener_Success
+ : Evolution_BookListener_CardNotFound),
+ cursor);
+}
+
+static void
pas_backend_file_process_check_connection (PASBackend *backend,
PASBook *book,
PASRequest *req)
@@ -191,6 +289,10 @@ pas_backend_file_process_client_requests (PASBook *book)
case CheckConnection:
pas_backend_file_process_check_connection (backend, book, req);
break;
+
+ case GetAllCards:
+ pas_backend_file_process_get_all_cards (backend, book, req);
+ break;
}
g_free (req);