aboutsummaryrefslogtreecommitdiffstats
path: root/addressbook/backend/ebook
diff options
context:
space:
mode:
authorNat Friedman <nat@src.gnome.org>2000-01-18 11:31:07 +0800
committerNat Friedman <nat@src.gnome.org>2000-01-18 11:31:07 +0800
commit2f1705c6c0d747e708a34b089c4b6ebfc7832022 (patch)
tree1b94d61159ccf0ec4108f98214680850cc5ac350 /addressbook/backend/ebook
parente63f053c3e341251c123c72587e930228b781c67 (diff)
downloadgsoc2013-evolution-2f1705c6c0d747e708a34b089c4b6ebfc7832022.tar
gsoc2013-evolution-2f1705c6c0d747e708a34b089c4b6ebfc7832022.tar.gz
gsoc2013-evolution-2f1705c6c0d747e708a34b089c4b6ebfc7832022.tar.bz2
gsoc2013-evolution-2f1705c6c0d747e708a34b089c4b6ebfc7832022.tar.lz
gsoc2013-evolution-2f1705c6c0d747e708a34b089c4b6ebfc7832022.tar.xz
gsoc2013-evolution-2f1705c6c0d747e708a34b089c4b6ebfc7832022.tar.zst
gsoc2013-evolution-2f1705c6c0d747e708a34b089c4b6ebfc7832022.zip
A precommit so Federico can see.
svn path=/trunk/; revision=1584
Diffstat (limited to 'addressbook/backend/ebook')
-rw-r--r--addressbook/backend/ebook/Makefile.am52
-rw-r--r--addressbook/backend/ebook/e-book-listener.c271
-rw-r--r--addressbook/backend/ebook/e-book-listener.h65
-rw-r--r--addressbook/backend/ebook/e-book.c316
-rw-r--r--addressbook/backend/ebook/e-book.h106
-rw-r--r--addressbook/backend/ebook/e-card-cursor.h47
-rw-r--r--addressbook/backend/ebook/e-card.h51
7 files changed, 908 insertions, 0 deletions
diff --git a/addressbook/backend/ebook/Makefile.am b/addressbook/backend/ebook/Makefile.am
new file mode 100644
index 0000000000..e9e974b704
--- /dev/null
+++ b/addressbook/backend/ebook/Makefile.am
@@ -0,0 +1,52 @@
+corbadir = $(sysconfdir)/CORBA/servers
+
+CORBA_SOURCE = \
+ addressbook.h \
+ addressbook-common.c \
+ addressbook-stubs.c \
+ addressbook-skels.c
+
+idls = \
+ ../idl/addressbook.idl
+
+idl_flags = `$(GNOME_CONFIG) --cflags idl`
+
+$(CORBA_SOURCE): $(idls)
+ $(ORBIT_IDL) ../idl/addressbook.idl $(idl_flags)
+
+INCLUDES = \
+ -DGNOMELOCALEDIR=\""$(datadir)/locale"\" \
+ -DG_LOG_DOMAIN=\"EBook\" \
+ -I$(srcdir) -I$(top_srcdir) \
+ -I. \
+ -I.. \
+ -I$(top_builddir) \
+ -I$(includedir) \
+ $(GNOME_INCLUDEDIR)
+
+gnome_libs = \
+ $(GNOME_LIBDIR) \
+ $(GNOMEUI_LIBS) \
+ $(GNOMEGNORBA_LIBS) \
+ $(INTLLIBS)
+
+ebook_libs = \
+ libebook.la \
+ $(gnome_libs)
+
+lib_LTLIBRARIES = libebook.la
+
+libebook_la_SOURCES = \
+ $(CORBA_SOURCE) \
+ e-book-listener.c \
+ e-book.c
+
+libebookincludedir = $(includedir)/backend
+
+libebookinclude_HEADERS = \
+ e-book.h \
+ e-book-listener.h \
+ e-card.h
+
+BUILT_SOURCES = $(CORBA_SOURCE)
+CLEANFILES += $(BUILT_SOURCES)
diff --git a/addressbook/backend/ebook/e-book-listener.c b/addressbook/backend/ebook/e-book-listener.c
new file mode 100644
index 0000000000..b0e10fc90c
--- /dev/null
+++ b/addressbook/backend/ebook/e-book-listener.c
@@ -0,0 +1,271 @@
+/*
+ * Author:
+ * Nat Friedman (nat@helixcode.com)
+ *
+ * Copyright 2000, Helix Code, Inc.
+ */
+
+#include <e-book-listener.h>
+
+static GnomeObjectClass *e_book_listener_parent_class;
+POA_Evolution_BookListener__vepv e_book_listener_vepv;
+
+static EBookStatus
+e_book_listener_convert_status (const Evolution_BookListener_CallStatus status)
+{
+ switch (status) {
+
+ case Evolution_BookListener_RepositoryOffline:
+ return E_BOOK_STATUS_REPOSITORY_OFFLINE;
+ case Evolution_BookListener_PermissionDenied:
+ return E_BOOK_STATUS_PERMISSION_DENIED;
+ case Evolution_BookListener_CardNotFound:
+ return E_BOOK_STATUS_CARD_NOT_FOUND;
+ default:
+ g_warning ("e_book_listener_convert_status: Unknown status "
+ "from card server: %d\n", (int) status);
+ return E_BOOK_STATUS_UNKNOWN;
+
+ }
+}
+
+static EBookListener *
+e_book_listener_construct (EBookListener *listener, EBook *book)
+{
+ POA_Evolution_BookListener *servant;
+ CORBA_Environment ev;
+ CORBA_Object obj;
+
+ g_assert (listener != NULL);
+ g_assert (E_IS_BOOK_LISTENER (listener));
+ g_assert (book != NULL);
+ g_assert (E_IS_BOOK (book));
+
+ listener->book = book;
+
+ servant = (POA_Evolution_BookListener *) g_new0 (GnomeObjectServant, 1);
+ servant->vepv = &e_book_listener_vepv;
+
+ CORBA_exception_init (&ev);
+
+ POA_Evolution_BookListener__init ((PortableServer_Servant) servant, &ev);
+ if (ev._major != CORBA_NO_EXCEPTION) {
+ g_free (servant);
+ CORBA_exception_free (&ev);
+
+ return NULL;
+ }
+
+ CORBA_exception_free (&ev);
+
+ obj = gnome_object_activate_servant (GNOME_OBJECT (listener), servant);
+ if (obj == CORBA_OBJECT_NIL) {
+ g_free (servant);
+
+ return NULL;
+ }
+
+ gnome_object_construct (GNOME_OBJECT (listener), obj);
+
+ return listener;
+}
+
+/**
+ * e_book_listener_new:
+ */
+EBookListener *
+e_book_listener_new (EBook *book)
+{
+ EBookListener *listener;
+ EBookListener *retval;
+
+ g_return_val_if_fail (book != NULL, NULL);
+ g_return_val_if_fail (E_IS_BOOK (book), NULL);
+
+ listener = gtk_type_new (E_BOOK_LISTENER_TYPE);
+
+ retval = e_book_listener_construct (listener, book);
+
+ if (retval == NULL) {
+ g_warning ("e_book_listener_new: Error constructing "
+ "EBookListener!\n");
+ gtk_object_unref (GTK_OBJECT (listener));
+ return NULL;
+ }
+
+ return retval;
+}
+
+static void
+impl_BookListener_respond_create_card (PortableServer_Servant servant,
+ const Evolution_BookListener_CallStatus status,
+ CORBA_Environment *ev)
+{
+ EBookListener *listener = E_BOOK_LISTENER (gnome_object_from_servant (servant));
+
+ if (listener->create_response == NULL)
+ return;
+
+ (listener->create_response) (listener->book,
+ e_book_listener_convert_status (status),
+ listener->closure);
+}
+
+static void
+impl_BookListener_respond_remove_card (PortableServer_Servant servant,
+ const Evolution_BookListener_CallStatus status,
+ CORBA_Environment *ev)
+{
+ EBookListener *listener = E_BOOK_LISTENER (gnome_object_from_servant (servant));
+
+ if (listener->remove_response == NULL)
+ return;
+
+ (listener->remove_response) (listener->book,
+ e_book_listener_convert_status (status),
+ listener->closure);
+}
+
+static void
+impl_BookListener_respond_modify_card (PortableServer_Servant servant,
+ const Evolution_BookListener_CallStatus status,
+ CORBA_Environment *ev)
+{
+ EBookListener *listener = E_BOOK_LISTENER (gnome_object_from_servant (servant));
+
+ if (listener->modify_response == NULL)
+ return;
+
+ (listener->modify_response) (listener->book,
+ e_book_listener_convert_status (status),
+ listener->closure);
+}
+
+static void
+impl_BookListener_report_open_book_progress (PortableServer_Servant servant,
+ const CORBA_char *status_message,
+ const CORBA_short percent,
+ CORBA_Environment *ev)
+{
+ EBookListener *listener = E_BOOK_LISTENER (gnome_object_from_servant (servant));
+
+ if (listener->open_progress == NULL)
+ return;
+
+ (listener->open_progress) (listener->book,
+ status_message,
+ percent,
+ listener->closure);
+}
+
+static void
+impl_BookListener_respond_open_book (PortableServer_Servant servant,
+ const Evolution_BookListener_CallStatus status,
+ const Evolution_Book book,
+ CORBA_Environment *ev)
+{
+ EBookListener *listener = E_BOOK_LISTENER (gnome_object_from_servant (servant));
+
+ if (listener->open_response == NULL)
+ return;
+
+ (listener->open_response) (listener->book,
+ e_book_listener_convert_status (status),
+ book,
+ listener->closure);
+}
+
+
+static void
+impl_BookListener_report_connection_status (PortableServer_Servant servant,
+ const CORBA_boolean connected,
+ CORBA_Environment *ev)
+{
+ EBookListener *listener = E_BOOK_LISTENER (gnome_object_from_servant (servant));
+
+ if (listener->connect_status == NULL)
+ return;
+
+ (listener->connect_status) (listener->book, connected, listener->closure);
+}
+
+
+static void
+e_book_listener_init (EBook *listener)
+{
+}
+
+static void
+e_book_listener_destroy (GtkObject *object)
+{
+ EBookListener *listener = E_BOOK_LISTENER (object);
+ CORBA_Environment ev;
+
+ CORBA_exception_init (&ev);
+
+ GTK_OBJECT_CLASS (e_book_listener_parent_class)->destroy (object);
+}
+
+POA_Evolution_BookListener__epv *
+e_book_listener_get_epv (void)
+{
+ POA_Evolution_BookListener__epv *epv;
+
+ epv = g_new0 (POA_Evolution_BookListener__epv, 1);
+
+ epv->report_open_book_progress = impl_BookListener_report_open_book_progress;
+ epv->respond_open_book = impl_BookListener_respond_open_book;
+
+ epv->respond_create_card = impl_BookListener_respond_create_card;
+ epv->respond_remove_card = impl_BookListener_respond_remove_card;
+ epv->respond_modify_card = impl_BookListener_respond_modify_card;
+
+ epv->report_connection_status = impl_BookListener_report_connection_status;
+
+ return epv;
+}
+
+static void
+e_book_listener_corba_class_init (void)
+{
+ e_book_listener_vepv.GNOME_Unknown_epv = gnome_object_get_epv ();
+ e_book_listener_vepv.Evolution_BookListener_epv = e_book_listener_get_epv ();
+}
+
+static void
+e_book_listener_class_init (EBookListenerClass *klass)
+{
+ GtkObjectClass *object_class = (GtkObjectClass *) klass;
+
+ e_book_listener_parent_class = gtk_type_class (gnome_object_get_type ());
+
+ object_class->destroy = e_book_listener_destroy;
+
+ e_book_listener_corba_class_init ();
+}
+
+/**
+ * e_book_listener_get_type:
+ */
+GtkType
+e_book_listener_get_type (void)
+{
+ static GtkType type = 0;
+
+ if (! type) {
+ GtkTypeInfo info = {
+ "EBookListener",
+ sizeof (EBookListener),
+ sizeof (EBookListenerClass),
+ (GtkClassInitFunc) e_book_listener_class_init,
+ (GtkObjectInitFunc) e_book_listener_init,
+ NULL, /* reserved 1 */
+ NULL, /* reserved 2 */
+ (GtkClassInitFunc) NULL
+ };
+
+ type = gtk_type_unique (gnome_object_get_type (), &info);
+ }
+
+ return type;
+}
diff --git a/addressbook/backend/ebook/e-book-listener.h b/addressbook/backend/ebook/e-book-listener.h
new file mode 100644
index 0000000000..71004a966a
--- /dev/null
+++ b/addressbook/backend/ebook/e-book-listener.h
@@ -0,0 +1,65 @@
+/*
+ * A client-side GtkObject which exposes the
+ * Evolution:BookListener interface.
+ *
+ * Author:
+ * Nat Friedman (nat@helixcode.com)
+ *
+ * Copyright 2000, Helix Code, Inc.
+ */
+
+#ifndef __E_BOOK_LISTENER_H__
+#define __E_BOOK_LISTENER_H__
+
+#include <libgnome/gnome-defs.h>
+
+#include <bonobo/gnome-object.h>
+#include <e-book.h>
+
+#include <addressbook.h>
+
+BEGIN_GNOME_DECLS
+
+typedef struct _EBookListener EBookListener;
+
+typedef void (*EBookListenerRespondOpenBookCallback) (EBook *book,
+ EBookStatus status,
+ Evolution_Book corba_book,
+ gpointer closure);
+
+typedef void (*EBookListenerConnectionStatusCallback) (EBook *book,
+ gboolean connected,
+ gpointer closure);
+
+struct _EBookListener {
+ GnomeObject parent;
+
+ EBook *book;
+
+ gpointer closure;
+
+ EBookCallback create_response;
+ EBookCallback remove_response;
+ EBookCallback modify_response;
+
+ EBookOpenProgressCallback open_progress;
+ EBookListenerRespondOpenBookCallback open_response;
+ EBookListenerConnectionStatusCallback connect_status;
+};
+
+typedef struct {
+ GnomeObjectClass parent;
+} EBookListenerClass;
+
+EBookListener *e_book_listener_new (EBook *book);
+GtkType e_book_listener_get_type (void);
+
+#define E_BOOK_LISTENER_TYPE (e_book_listener_get_type ())
+#define E_BOOK_LISTENER(o) (GTK_CHECK_CAST ((o), E_BOOK_LISTENER_TYPE, EBookListener))
+#define E_BOOK_LISTENER_CLASS(k) (GTK_CHECK_CLASS_CAST((k), E_BOOK_LISTENER_TYPE, EBookListenerClass))
+#define E_IS_BOOK_LISTENER(o) (GTK_CHECK_TYPE ((o), E_BOOK_LISTENER_TYPE))
+#define E_IS_BOOK_LISTENER_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), E_BOOK_LISTENER_TYPE))
+
+END_GNOME_DECLS
+
+#endif /* ! __E_BOOK_LISTENER_H__ */
diff --git a/addressbook/backend/ebook/e-book.c b/addressbook/backend/ebook/e-book.c
new file mode 100644
index 0000000000..80d5173231
--- /dev/null
+++ b/addressbook/backend/ebook/e-book.c
@@ -0,0 +1,316 @@
+/*
+ * The Evolution addressbook client object.
+ *
+ * Author:
+ * Nat Friedman (nat@helixcode.com)
+ *
+ * Copyright 1999, 2000, Helix Code, Inc.
+ */
+
+#include <addressbook.h>
+#include <e-card-cursor.h>
+#include <e-book-listener.h>
+#include <e-book.h>
+
+#include <gtk/gtksignal.h>
+#include <gtk/gtkmarshal.h>
+
+GnomeObjectClass *e_book_parent_class;
+
+#define CARDSERVER_GOAD_ID "FIXME"
+
+struct _EBookPrivate {
+ Evolution_BookFactory book_factory;
+ EBookListener *listener;
+
+ gboolean operation_pending;
+
+ EBookCallback open_response;
+ gpointer closure;
+};
+
+enum {
+ CARD_CHANGED,
+ CARD_REMOVED,
+ CARD_ADDED,
+ LINK_STATUS,
+ LAST_SIGNAL
+};
+
+static guint e_book_signals [LAST_SIGNAL];
+
+static EBook *
+e_book_construct (EBook *book,
+ const char *uri,
+ EBookOpenProgressCallback progress_cb,
+ EBookCallback open_response,
+ gpointer closure)
+{
+ CORBA_Environment ev;
+
+ g_return_val_if_fail (book != NULL, NULL);
+ g_assert (uri != NULL);
+
+ /*
+ * Connect to the Personal Addressbook Server.
+ */
+ book->priv->book_factory = (Evolution_BookFactory)
+ goad_server_activate_with_id (NULL, CARDSERVER_GOAD_ID, 0, NULL);
+
+ if (book->priv->book_factory == CORBA_OBJECT_NIL) {
+ g_warning ("e_book_construct: Could not obtain a handle "
+ "to the Personal Addressbook Server!\n");
+ return NULL;
+ }
+
+ /*
+ * Create our local BookListener interface.
+ */
+ book->priv->listener = e_book_listener_new (book);
+ if (book->priv->listener == NULL) {
+ g_warning ("e_book_construct: Could not create EBookListener!\n");
+ return NULL;
+ }
+
+ /*
+ * Setup the callback for getting book-opening progress
+ * notifications.
+ */
+ book->priv->listener->open_progress = progress_cb;
+ book->priv->listener->closure = closure;
+ book->priv->open_response = open_response;
+ book->priv->closure = closure;
+ book->priv->operation_pending = TRUE;
+
+ /*
+ * Load the addressbook into the PAS.
+ */
+ CORBA_exception_init (&ev);
+
+ Evolution_BookFactory_open_book (
+ book->priv->book_factory, uri,
+ gnome_object_corba_objref (GNOME_OBJECT (book->priv->listener)),
+ &ev);
+
+ if (ev._major != CORBA_NO_EXCEPTION) {
+ g_warning ("e_book_construct: CORBA exception while opening addressbook!\n");
+ CORBA_exception_free (&ev);
+ return NULL;
+ }
+
+ CORBA_exception_free (&ev);
+}
+
+/**
+ * e_book_new:
+ */
+EBook *
+e_book_new (const char *uri,
+ EBookOpenProgressCallback progress_cb,
+ EBookCallback open_response,
+ gpointer closure)
+{
+ EBook *book;
+ EBook *retval;
+
+ g_return_val_if_fail (uri != NULL, NULL);
+
+ book = gtk_type_new (E_BOOK_TYPE);
+
+ retval = e_book_construct (book, uri, progress_cb,
+ open_response, closure);
+
+ if (retval == NULL) {
+ g_warning ("e_book_new: Could not construct EBook!\n");
+ gtk_object_unref (GTK_OBJECT (book));
+
+ return NULL;
+ }
+
+ return retval;
+}
+
+static void
+e_book_init (EBook *book)
+{
+ book->priv = g_new0 (EBookPrivate, 1);
+}
+
+static void
+e_book_destroy (GtkObject *object)
+{
+ EBook *book = E_BOOK (object);
+ CORBA_Environment ev;
+
+ gtk_object_unref (GTK_OBJECT (book->priv->listener));
+
+ CORBA_exception_init (&ev);
+
+ CORBA_Object_release (book->priv->book_factory, &ev);
+ if (ev._major != CORBA_NO_EXCEPTION) {
+ g_warning ("EBook: Exception while releasing BookFactory\n");
+
+ CORBA_exception_free (&ev);
+ CORBA_exception_init (&ev);
+ }
+
+ g_free (book->priv);
+
+ GTK_OBJECT_CLASS (e_book_parent_class)->destroy (object);
+}
+
+static void
+e_book_class_init (EBookClass *klass)
+{
+ GtkObjectClass *object_class = (GtkObjectClass *) klass;
+
+ e_book_parent_class = gtk_type_class (gtk_object_get_type ());
+
+ e_book_signals [CARD_CHANGED] =
+ gtk_signal_new ("card_changed",
+ GTK_RUN_LAST,
+ object_class->type,
+ GTK_SIGNAL_OFFSET (EBookClass, card_changed),
+ gtk_marshal_NONE__POINTER,
+ GTK_TYPE_NONE, 1,
+ GTK_TYPE_POINTER);
+
+ e_book_signals [CARD_ADDED] =
+ gtk_signal_new ("card_added",
+ GTK_RUN_LAST,
+ object_class->type,
+ GTK_SIGNAL_OFFSET (EBookClass, card_changed),
+ gtk_marshal_NONE__POINTER,
+ GTK_TYPE_NONE, 1,
+ GTK_TYPE_POINTER);
+
+ e_book_signals [CARD_REMOVED] =
+ gtk_signal_new ("card_removed",
+ GTK_RUN_LAST,
+ object_class->type,
+ GTK_SIGNAL_OFFSET (EBookClass, card_changed),
+ gtk_marshal_NONE__POINTER,
+ GTK_TYPE_NONE, 1,
+ GTK_TYPE_POINTER);
+
+ e_book_signals [LINK_STATUS] =
+ gtk_signal_new ("link_status",
+ GTK_RUN_LAST,
+ object_class->type,
+ GTK_SIGNAL_OFFSET (EBookClass, link_status),
+ gtk_marshal_NONE__BOOL,
+ GTK_TYPE_NONE, 1,
+ GTK_TYPE_BOOL);
+
+ gtk_object_class_add_signals (object_class, e_book_signals,
+ LAST_SIGNAL);
+
+ object_class->destroy = e_book_destroy;
+}
+
+/* Fetching cards */
+ECard *
+e_book_get_card (EBook *book,
+ char *id)
+{
+ g_return_val_if_fail (book != NULL, NULL);
+ g_return_val_if_fail (E_IS_BOOK (book), NULL);
+
+ if (book->priv->operation_pending) {
+ g_warning ("EBook: Operation attempted on busy EBook!\n");
+ return;
+ }
+}
+
+char *
+e_book_get_vcard (EBook *book,
+ char *id)
+{
+}
+
+ECardCursor *
+e_book_query (EBook *book,
+ char *query)
+{
+}
+
+/* Deleting cards. */
+void
+e_book_remove_card (EBook *book,
+ ECard *card,
+ EBookCallback cb,
+ gpointer closure)
+{
+}
+
+void
+e_book_remove_card_by_id (EBook *book,
+ char *id,
+ EBookCallback cb,
+ gpointer closure)
+
+{
+}
+
+/* Adding cards. */
+void
+e_book_add_card (EBook *book,
+ ECard *card,
+ EBookCallback cb,
+ gpointer closure)
+{
+}
+
+void
+e_book_add_vcard (EBook *book,
+ char *vcard,
+ char *id,
+ EBookCallback cb,
+ gpointer closure)
+{
+}
+
+
+/* Modifying cards. */
+void
+e_book_commit_card (EBook *book,
+ ECard *card,
+ EBookCallback cb,
+ gpointer closure)
+{
+}
+
+void
+e_book_commit_vcard (EBook *book,
+ char *vcard,
+ EBookCallback cb,
+ gpointer closure)
+{
+}
+
+
+/**
+ * e_book_get_type:
+ */
+GtkType
+e_book_get_type (void)
+{
+ static GtkType type = 0;
+
+ if (! type) {
+ GtkTypeInfo info = {
+ "EBook",
+ sizeof (EBook),
+ sizeof (EBookClass),
+ (GtkClassInitFunc) e_book_class_init,
+ (GtkObjectInitFunc) e_book_init,
+ NULL, /* reserved 1 */
+ NULL, /* reserved 2 */
+ (GtkClassInitFunc) NULL
+ };
+
+ type = gtk_type_unique (gtk_object_get_type (), &info);
+ }
+
+ return type;
+}
diff --git a/addressbook/backend/ebook/e-book.h b/addressbook/backend/ebook/e-book.h
new file mode 100644
index 0000000000..892f99fb53
--- /dev/null
+++ b/addressbook/backend/ebook/e-book.h
@@ -0,0 +1,106 @@
+/*
+ * The Evolution addressbook client object.
+ *
+ * Author:
+ * Nat Friedman (nat@helixcode.com)
+ *
+ * Copyright 1999, 2000, Helix Code, Inc.
+ */
+
+#ifndef __E_BOOK_H__
+#define __E_BOOK_H__
+
+#include <libgnome/gnome-defs.h>
+
+#include <e-card.h>
+
+BEGIN_GNOME_DECLS
+
+typedef enum {
+ E_BOOK_STATUS_SUCCESS,
+ E_BOOK_STATUS_UNKNOWN,
+ E_BOOK_STATUS_REPOSITORY_OFFLINE,
+ E_BOOK_STATUS_PERMISSION_DENIED,
+ E_BOOK_STATUS_CARD_NOT_FOUND
+} EBookStatus;
+
+typedef struct _EBookPrivate EBookPrivate;
+
+typedef struct {
+ GtkObject parent;
+ EBookPrivate *priv;
+} EBook;
+
+typedef struct {
+ GtkObjectClass parent;
+
+ /*
+ * Signals.
+ */
+ void (* card_changed) (const char *id);
+ void (* card_removed) (const char *id);
+ void (* card_added) (const char *id);
+ void (* link_status) (gboolean connected);
+} EBookClass;
+
+/* Callbacks for asynchronous functions. */
+typedef void (*EBookCallback) (EBook *book, EBookStatus status, gpointer closure);
+typedef void (*EBookOpenProgressCallback) (EBook *book,
+ const char *status_message,
+ short percent,
+ gpointer closure);
+
+
+/* Creating a new addressbook. */
+EBook *e_book_new (const char *uri,
+ EBookOpenProgressCallback progress_cb,
+ EBookCallback open_response,
+ gpointer closure);
+GtkType e_book_get_type (void);
+
+/* Fetching cards. */
+ECard *e_book_get_card (EBook *book,
+ char *id);
+char *e_book_get_vcard (EBook *book,
+ char *id);
+
+/* Deleting cards. */
+void e_book_remove_card (EBook *book,
+ ECard *card,
+ EBookCallback cb,
+ gpointer closure);
+void e_book_remove_card_by_id (EBook *book,
+ char *id,
+ EBookCallback cb,
+ gpointer closure);
+
+/* Adding cards. */
+void e_book_add_card (EBook *book,
+ ECard *card,
+ EBookCallback cb,
+ gpointer closure);
+void e_book_add_vcard (EBook *book,
+ char *vcard,
+ char *id,
+ EBookCallback cb,
+ gpointer closure);
+
+/* Modifying cards. */
+void e_book_commit_card (EBook *book,
+ ECard *card,
+ EBookCallback cb,
+ gpointer closure);
+void e_book_commit_vcard (EBook *book,
+ char *vcard,
+ EBookCallback cb,
+ gpointer closure);
+
+#define E_BOOK_TYPE (e_book_get_type ())
+#define E_BOOK(o) (GTK_CHECK_CAST ((o), E_BOOK_TYPE, EBook))
+#define E_BOOK_CLASS(k) (GTK_CHECK_CLASS_CAST((k), E_BOOK_TYPE, EBookClass))
+#define E_IS_BOOK(o) (GTK_CHECK_TYPE ((o), E_BOOK_TYPE))
+#define E_IS_BOOK_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), E_BOOK_TYPE))
+
+END_GNOME_DECLS
+
+#endif /* ! __E_BOOK_H__ */
diff --git a/addressbook/backend/ebook/e-card-cursor.h b/addressbook/backend/ebook/e-card-cursor.h
new file mode 100644
index 0000000000..5477a4f615
--- /dev/null
+++ b/addressbook/backend/ebook/e-card-cursor.h
@@ -0,0 +1,47 @@
+/*
+ *
+ * Author:
+ * Nat Friedman (nat@helixcode.com)
+ *
+ * Copyright 2000, Helix Code, Inc.
+ */
+
+#include <gtk/gtkobject.h>
+#include <libgnome/gnome-defs.h>
+
+#include <e-book.h>
+
+#ifndef __E_CARD_CURSOR_H__
+#define __E_CARD_CURSOR_H__
+
+BEGIN_GNOME_DECLS
+
+typedef struct _ECardCursorPrivate ECardCursorPrivate;
+
+typedef struct {
+ GtkObject parent;
+ ECardCursorPrivate *priv;
+} ECardCursor;
+
+typedef struct {
+ GtkObjectClass parent;
+} ECardCursorClass;
+
+/* Creating a new addressbook. */
+ECardCursor *e_card_cursor_new (EBook *book,
+ Evolution_CardCursor corba_cursor);
+GtkType e_card_cursor_get_type (void);
+
+/* Fetching cards. */
+int e_card_cursor_get_length (ECardCursor *cursor);
+ECard *e_card_cursor_get_nth (ECardCursor *cursor,
+ int nth);
+#define E_CARD_CURSOR_TYPE (e_card_cursor_get_type ())
+#define E_CARD_CURSOR(o) (GTK_CHECK_CAST ((o), E_CARD_CURSOR_TYPE, ECardCursor))
+#define E_CARD_CURSOR_CLASS(k) (GTK_CHECK_CLASS_CAST((k), E_CARD_CURSOR_TYPE, ECardCursorClass))
+#define E_IS_CARD_CURSOR(o) (GTK_CHECK_TYPE ((o), E_CARD_CURSOR_TYPE))
+#define E_IS_CARD_CURSOR_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), E_CARD_CURSOR_TYPE))
+
+END_GNOME_DECLS
+
+#endif /* ! __E_CARD_CURSOR_H__ */
diff --git a/addressbook/backend/ebook/e-card.h b/addressbook/backend/ebook/e-card.h
new file mode 100644
index 0000000000..7959377695
--- /dev/null
+++ b/addressbook/backend/ebook/e-card.h
@@ -0,0 +1,51 @@
+/*
+ * Author:
+ * Nat Friedman (nat@helixcode.com)
+ *
+ * Copyright 1999, Helix Code, Inc.
+ */
+
+#ifndef __E_CARD_H__
+#define __E_CARD_H__
+
+#include <gtk/gtkobject.h>
+#include <libgnome/gnome-defs.h>
+#include <ebook/e-card-fields.h>
+
+BEGIN_GNOME_DECLS
+
+typedef struct _ECardPrivate ECardPrivate;
+
+typedef struct {
+ GtkObject parent;
+ ECardPrivate *priv;
+} ECard;
+
+typedef struct {
+ GtkObjectClass parent;
+} ECardClass;
+
+ECard *e_card_new (void);
+GtkType e_card_get_type (void);
+
+char *e_card_get_string (ECard *card,
+ char *field);
+void e_card_set_string (ECard *card,
+ char *field,
+ char *value);
+
+gboolean e_card_get_boolean (ECard *card,
+ char *field);
+void e_card_set_boolean (ECard *card,
+ char *field,
+ gboolean value);
+
+#define E_CARD_TYPE (e_card_get_type ())
+#define E_CARD(o) (GTK_CHECK_CAST ((o), E_CARD_TYPE, ECard))
+#define E_CARD_CLASS(k) (GTK_CHECK_CLASS_CAST((k), E_CARD_TYPE, ECardClass))
+#define E_IS_CARD(o) (GTK_CHECK_TYPE ((o), E_CARD_TYPE))
+#define E_IS_CARD_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), E_CARD_TYPE))
+
+END_GNOME_DECLS
+
+#endif /* ! __E_CARD_H__ */