aboutsummaryrefslogtreecommitdiffstats
path: root/addressbook/backend/ebook
diff options
context:
space:
mode:
authornobody <nobody@localhost>2000-05-22 06:40:15 +0800
committernobody <nobody@localhost>2000-05-22 06:40:15 +0800
commitdc29053b0bf6030dc903fbb79962443276c776a1 (patch)
tree70ea22d6a4da2e07bedfe85a5cddc5e7ad0a1246 /addressbook/backend/ebook
parent3f5d9cb60827ca2a5e032e95aa241cc8376ab46f (diff)
downloadgsoc2013-evolution-dc29053b0bf6030dc903fbb79962443276c776a1.tar
gsoc2013-evolution-dc29053b0bf6030dc903fbb79962443276c776a1.tar.gz
gsoc2013-evolution-dc29053b0bf6030dc903fbb79962443276c776a1.tar.bz2
gsoc2013-evolution-dc29053b0bf6030dc903fbb79962443276c776a1.tar.lz
gsoc2013-evolution-dc29053b0bf6030dc903fbb79962443276c776a1.tar.xz
gsoc2013-evolution-dc29053b0bf6030dc903fbb79962443276c776a1.tar.zst
gsoc2013-evolution-dc29053b0bf6030dc903fbb79962443276c776a1.zip
This commit was manufactured by cvs2svn to create taggnome-debug-0-1-0
'gnome-debug-0-1-0'. svn path=/tags/gnome-debug-0-1-0/; revision=3160
Diffstat (limited to 'addressbook/backend/ebook')
-rw-r--r--addressbook/backend/ebook/.cvsignore15
-rw-r--r--addressbook/backend/ebook/Makefile.am102
-rw-r--r--addressbook/backend/ebook/TODO2
-rw-r--r--addressbook/backend/ebook/e-book-listener.c587
-rw-r--r--addressbook/backend/ebook/e-book-listener.h95
-rw-r--r--addressbook/backend/ebook/e-book-types.h31
-rw-r--r--addressbook/backend/ebook/e-book-view-listener.c345
-rw-r--r--addressbook/backend/ebook/e-book-view-listener.h72
-rw-r--r--addressbook/backend/ebook/e-book-view.c281
-rw-r--r--addressbook/backend/ebook/e-book-view.h55
-rw-r--r--addressbook/backend/ebook/e-book.c1010
-rw-r--r--addressbook/backend/ebook/e-book.h123
-rw-r--r--addressbook/backend/ebook/e-card-cursor.c235
-rw-r--r--addressbook/backend/ebook/e-card-cursor.h52
-rw-r--r--addressbook/backend/ebook/e-card-iterator.c169
-rw-r--r--addressbook/backend/ebook/e-card-iterator.h61
-rw-r--r--addressbook/backend/ebook/e-card-list-iterator.c199
-rw-r--r--addressbook/backend/ebook/e-card-list-iterator.h44
-rw-r--r--addressbook/backend/ebook/e-card-list.c140
-rw-r--r--addressbook/backend/ebook/e-card-list.h60
-rw-r--r--addressbook/backend/ebook/e-card-pairs.h118
-rw-r--r--addressbook/backend/ebook/e-card-simple.c1185
-rw-r--r--addressbook/backend/ebook/e-card-simple.h197
-rw-r--r--addressbook/backend/ebook/e-card-types.h89
-rw-r--r--addressbook/backend/ebook/e-card.c3248
-rw-r--r--addressbook/backend/ebook/e-card.h137
-rw-r--r--addressbook/backend/ebook/load-pine-addressbook.c147
-rw-r--r--addressbook/backend/ebook/test-card.c194
-rw-r--r--addressbook/backend/ebook/test-client-list.c82
-rw-r--r--addressbook/backend/ebook/test-client.c190
30 files changed, 0 insertions, 9265 deletions
diff --git a/addressbook/backend/ebook/.cvsignore b/addressbook/backend/ebook/.cvsignore
deleted file mode 100644
index c0341fbdce..0000000000
--- a/addressbook/backend/ebook/.cvsignore
+++ /dev/null
@@ -1,15 +0,0 @@
-.deps
-.libs
-.pure
-Makefile
-Makefile.in
-*.lo
-*.la
-addressbook-stubs.c
-addressbook-skels.c
-addressbook-common.c
-addressbook.h
-test-card
-test-client
-test-client-list
-load-pine-addressbook
diff --git a/addressbook/backend/ebook/Makefile.am b/addressbook/backend/ebook/Makefile.am
deleted file mode 100644
index c0ab395564..0000000000
--- a/addressbook/backend/ebook/Makefile.am
+++ /dev/null
@@ -1,102 +0,0 @@
-noinst_PROGRAMS = test-card test-client test-client-list load-pine-addressbook
-
-CORBA_SOURCE = \
- addressbook.h \
- addressbook-common.c \
- addressbook-stubs.c \
- addressbook-skels.c
-
-idls = \
- $(srcdir)/../idl/addressbook.idl
-
-idl_flags = `$(GNOME_CONFIG) --cflags idl` -I $(datadir)/idl
-
-$(CORBA_SOURCE): $(idls)
- $(ORBIT_IDL) $(srcdir)/../idl/addressbook.idl $(idl_flags)
-
-INCLUDES = \
- -DGNOMELOCALEDIR=\""$(datadir)/locale"\" \
- -DG_LOG_DOMAIN=\"EBook\" \
- -I$(top_srcdir) \
- -I$(top_srcdir)/addressbook/backend \
- -I$(top_srcdir)/addressbook/ename \
- -I$(top_builddir)/addressbook/backend \
- -I$(top_builddir)/addressbook/ename \
- $(BONOBO_GNOME_CFLAGS)
-
-lib_LTLIBRARIES = libebook.la
-
-libebook_la_SOURCES = \
- $(CORBA_SOURCE) \
- e-book-listener.c \
- e-book-view-listener.c \
- e-book-view.c \
- e-book.c \
- e-card-cursor.c \
- e-card-iterator.c \
- e-card-list-iterator.c \
- e-card-list.c \
- e-card-simple.c \
- e-card.c
-
-libebookincludedir = $(includedir)/evolution/ebook
-
-libebookinclude_HEADERS = \
- e-book-listener.h \
- e-book-types.h \
- e-book-view-listener.h \
- e-book-view.h \
- e-book.h \
- e-card-cursor.h \
- e-card-iterator.h \
- e-card-list-iterator.h \
- e-card-list.h \
- e-card-pairs.h \
- e-card-simple.h \
- e-card-types.h \
- e-card.h
-
-test_client_SOURCES = \
- test-client.c
-
-test_client_LDADD = \
- libebook.la \
- $(BONOBO_GNOME_LIBS) \
- $(top_builddir)/libversit/libversit.la \
- $(top_builddir)/addressbook/ename/libename.la \
- $(top_builddir)/e-util/libeutil.la
-
-test_client_list_SOURCES = \
- test-client-list.c
-
-test_client_list_LDADD = \
- libebook.la \
- $(BONOBO_GNOME_LIBS) \
- $(top_builddir)/addressbook/ename/libename.la \
- $(top_builddir)/libversit/libversit.la \
- $(top_builddir)/e-util/libeutil.la
-
-test_card_SOURCES = \
- test-card.c
-
-test_card_LDADD = \
- libebook.la \
- $(BONOBO_GNOME_LIBS) \
- $(top_builddir)/addressbook/ename/libename.la \
- $(top_builddir)/libversit/libversit.la \
- $(top_builddir)/e-util/libeutil.la
-
-
-load_pine_addressbook_SOURCES = \
- load-pine-addressbook.c
-
-load_pine_addressbook_LDADD = \
- libebook.la \
- $(BONOBO_GNOME_LIBS) \
- $(top_builddir)/addressbook/ename/libename.la \
- $(top_builddir)/libversit/libversit.la \
- $(top_builddir)/e-util/libeutil.la
-
-
-BUILT_SOURCES = $(CORBA_SOURCE)
-CLEANFILES += $(BUILT_SOURCES)
diff --git a/addressbook/backend/ebook/TODO b/addressbook/backend/ebook/TODO
deleted file mode 100644
index a69703cd92..0000000000
--- a/addressbook/backend/ebook/TODO
+++ /dev/null
@@ -1,2 +0,0 @@
-* Make sure open_book_progress does not use the EBook op queue; make
- sure it works.
diff --git a/addressbook/backend/ebook/e-book-listener.c b/addressbook/backend/ebook/e-book-listener.c
deleted file mode 100644
index 5efdaa37df..0000000000
--- a/addressbook/backend/ebook/e-book-listener.c
+++ /dev/null
@@ -1,587 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * Exports the BookListener interface. Maintains a queue of messages
- * which come in on the interface.
- *
- * Author:
- * Nat Friedman (nat@helixcode.com)
- *
- * Copyright 2000, Helix Code, Inc.
- */
-
-#include <config.h>
-#include <gtk/gtksignal.h>
-#include "e-book-listener.h"
-
-static EBookStatus e_book_listener_convert_status (Evolution_BookListener_CallStatus status);
-
-enum {
- RESPONSES_QUEUED,
- LAST_SIGNAL
-};
-
-static guint e_book_listener_signals [LAST_SIGNAL];
-
-static BonoboObjectClass *e_book_listener_parent_class;
-POA_Evolution_BookListener__vepv e_book_listener_vepv;
-
-struct _EBookListenerPrivate {
- GList *response_queue;
- gint idle_id;
-};
-
-static gboolean
-e_book_listener_check_queue (EBookListener *listener)
-{
- if (listener->priv->response_queue != NULL) {
- gtk_signal_emit (GTK_OBJECT (listener),
- e_book_listener_signals [RESPONSES_QUEUED]);
- }
-
- if (listener->priv->response_queue == NULL) {
- listener->priv->idle_id = 0;
- return FALSE;
- }
-
- return TRUE;
-}
-
-static void
-e_book_listener_queue_response (EBookListener *listener,
- EBookListenerResponse *response)
-{
- listener->priv->response_queue =
- g_list_append (listener->priv->response_queue,
- response);
-
- if (listener->priv->idle_id == 0) {
- listener->priv->idle_id = g_idle_add (
- (GSourceFunc) e_book_listener_check_queue, listener);
- }
-}
-
-/* Add, Remove, Modify */
-static void
-e_book_listener_queue_generic_response (EBookListener *listener,
- EBookListenerOperation op,
- EBookStatus status)
-{
- EBookListenerResponse *resp;
-
- resp = g_new0 (EBookListenerResponse, 1);
-
- resp->op = op;
- resp->status = status;
-
- e_book_listener_queue_response (listener, resp);
-}
-
-static void
-e_book_listener_queue_open_response (EBookListener *listener,
- EBookStatus status,
- Evolution_Book book)
-{
- EBookListenerResponse *resp;
-
- resp = g_new0 (EBookListenerResponse, 1);
-
- resp->op = OpenBookResponse;
- resp->status = status;
- resp->book = book;
-
- e_book_listener_queue_response (listener, resp);
-}
-
-static void
-e_book_listener_queue_open_progress (EBookListener *listener,
- const char *msg,
- short percent)
-{
- EBookListenerResponse *resp;
-
- resp = g_new0 (EBookListenerResponse, 1);
-
- resp->op = OpenProgressEvent;
- resp->msg = g_strdup (msg);
- resp->percent = percent;
-
- e_book_listener_queue_response (listener, resp);
-}
-
-
-static void
-e_book_listener_queue_create_card_response (EBookListener *listener,
- EBookStatus status,
- const char *id)
-{
- EBookListenerResponse *resp;
-
- resp = g_new0 (EBookListenerResponse, 1);
-
- resp->op = CreateCardResponse;
- resp->status = status;
- resp->id = g_strdup (id);
-
- e_book_listener_queue_response (listener, resp);
-}
-
-static void
-e_book_listener_queue_get_cursor_response (EBookListener *listener,
- EBookStatus status,
- Evolution_CardCursor cursor)
-{
- EBookListenerResponse *resp;
-
- resp = g_new0 (EBookListenerResponse, 1);
-
- resp->op = GetCursorResponse;
- resp->status = status;
- resp->cursor = cursor;
-
- e_book_listener_queue_response (listener, resp);
-}
-
-static void
-e_book_listener_queue_get_view_response (EBookListener *listener,
- EBookStatus status,
- Evolution_BookView book_view)
-{
- EBookListenerResponse *resp;
-
- resp = g_new0 (EBookListenerResponse, 1);
-
- resp->op = GetBookViewResponse;
- resp->status = status;
- resp->book_view = book_view;
-
- e_book_listener_queue_response (listener, resp);
-}
-
-static void
-e_book_listener_queue_link_status (EBookListener *listener,
- gboolean connected)
-{
- EBookListenerResponse *resp;
-
- resp = g_new0 (EBookListenerResponse, 1);
-
- resp->op = LinkStatusEvent;
- resp->connected = connected;
-
- e_book_listener_queue_response (listener, resp);
-}
-
-static void
-impl_BookListener_respond_create_card (PortableServer_Servant servant,
- const Evolution_BookListener_CallStatus status,
- const Evolution_CardId id,
- CORBA_Environment *ev)
-{
- EBookListener *listener = E_BOOK_LISTENER (bonobo_object_from_servant (servant));
-
- e_book_listener_queue_create_card_response (
- listener,
- e_book_listener_convert_status (status),
- id);
-}
-
-static void
-impl_BookListener_respond_remove_card (PortableServer_Servant servant,
- const Evolution_BookListener_CallStatus status,
- CORBA_Environment *ev)
-{
- EBookListener *listener = E_BOOK_LISTENER (bonobo_object_from_servant (servant));
-
- e_book_listener_queue_generic_response (
- listener, RemoveCardResponse,
- e_book_listener_convert_status (status));
-}
-
-static void
-impl_BookListener_respond_modify_card (PortableServer_Servant servant,
- const Evolution_BookListener_CallStatus status,
- CORBA_Environment *ev)
-{
- EBookListener *listener = E_BOOK_LISTENER (bonobo_object_from_servant (servant));
-
- e_book_listener_queue_generic_response (
- listener, ModifyCardResponse,
- e_book_listener_convert_status (status));
-}
-
-static void
-impl_BookListener_respond_get_cursor (PortableServer_Servant servant,
- const Evolution_BookListener_CallStatus status,
- const Evolution_CardCursor cursor,
- CORBA_Environment *ev)
-{
- EBookListener *listener = E_BOOK_LISTENER (bonobo_object_from_servant (servant));
- Evolution_CardCursor cursor_copy;
-
- cursor_copy = CORBA_Object_duplicate (cursor, ev);
-
- if (ev->_major != CORBA_NO_EXCEPTION) {
- g_warning ("EBookListener: Exception while duplicating CardCursor!\n");
- return;
- }
-
- e_book_listener_queue_get_cursor_response (
- listener,
- e_book_listener_convert_status (status),
- cursor_copy);
-}
-
-static void
-impl_BookListener_respond_get_view (PortableServer_Servant servant,
- const Evolution_BookListener_CallStatus status,
- const Evolution_BookView book_view,
- CORBA_Environment *ev)
-{
- EBookListener *listener = E_BOOK_LISTENER (bonobo_object_from_servant (servant));
- Evolution_BookView book_view_copy;
-
- book_view_copy = CORBA_Object_duplicate (book_view, ev);
-
- if (ev->_major != CORBA_NO_EXCEPTION) {
- g_warning ("EBookListener: Exception while duplicating BookView.\n");
- return;
- }
-
- e_book_listener_queue_get_view_response (
- listener,
- e_book_listener_convert_status (status),
- book_view_copy);
-}
-
-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 (bonobo_object_from_servant (servant));
- Evolution_Book book_copy;
-
- book_copy = CORBA_Object_duplicate (book, ev);
-
- if (ev->_major != CORBA_NO_EXCEPTION) {
- g_warning ("EBookListener: Exception while duplicating Book!\n");
- return;
- }
-
- e_book_listener_queue_open_response (
- listener,
- e_book_listener_convert_status (status),
- book_copy);
-}
-
-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 (bonobo_object_from_servant (servant));
-
- e_book_listener_queue_open_progress (
- listener, status_message, percent);
-}
-
-static void
-impl_BookListener_report_connection_status (PortableServer_Servant servant,
- const CORBA_boolean connected,
- CORBA_Environment *ev)
-{
- EBookListener *listener = E_BOOK_LISTENER (bonobo_object_from_servant (servant));
-
- e_book_listener_queue_link_status (
- listener, connected);
-}
-
-/**
- * e_book_listener_check_pending:
- * @listener: the #EBookListener
- *
- * Returns: the number of items on the response queue,
- * or -1 if the @listener is isn't an #EBookListener.
- */
-int
-e_book_listener_check_pending (EBookListener *listener)
-{
- g_return_val_if_fail (listener != NULL, -1);
- g_return_val_if_fail (E_IS_BOOK_LISTENER (listener), -1);
-
- return g_list_length (listener->priv->response_queue);
-}
-
-/**
- * e_book_listener_pop_response:
- * @listener: the #EBookListener for which a request is to be popped
- *
- * Returns: an #EBookListenerResponse if there are responses on the
- * queue to be returned; %NULL if there aren't, or if the @listener
- * isn't an EBookListener.
- */
-EBookListenerResponse *
-e_book_listener_pop_response (EBookListener *listener)
-{
- EBookListenerResponse *resp;
- GList *popped;
-
- g_return_val_if_fail (listener != NULL, NULL);
- g_return_val_if_fail (E_IS_BOOK_LISTENER (listener), NULL);
-
- if (listener->priv->response_queue == NULL)
- return NULL;
-
- resp = listener->priv->response_queue->data;
-
- popped = listener->priv->response_queue;
- listener->priv->response_queue =
- g_list_remove_link (listener->priv->response_queue,
- listener->priv->response_queue);
- g_list_free_1 (popped);
-
- return resp;
-}
-
-static EBookStatus
-e_book_listener_convert_status (const Evolution_BookListener_CallStatus status)
-{
- switch (status) {
- case Evolution_BookListener_Success:
- return E_BOOK_STATUS_SUCCESS;
- 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;
- case Evolution_BookListener_ProtocolNotSupported:
- return E_BOOK_STATUS_PROTOCOL_NOT_SUPPORTED;
- case Evolution_BookListener_OtherError:
- return E_BOOK_STATUS_OTHER_ERROR;
- 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)
-{
- POA_Evolution_BookListener *servant;
- CORBA_Environment ev;
- CORBA_Object obj;
-
- g_assert (listener != NULL);
- g_assert (E_IS_BOOK_LISTENER (listener));
-
- servant = (POA_Evolution_BookListener *) g_new0 (BonoboObjectServant, 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 = bonobo_object_activate_servant (BONOBO_OBJECT (listener), servant);
- if (obj == CORBA_OBJECT_NIL) {
- g_free (servant);
-
- return NULL;
- }
-
- bonobo_object_construct (BONOBO_OBJECT (listener), obj);
-
- return listener;
-}
-
-/**
- * e_book_listener_new:
- * @book: the #EBook for which the listener is to be bound
- *
- * Creates and returns a new #EBookListener for the book.
- *
- * Returns: a new #EBookListener
- */
-EBookListener *
-e_book_listener_new ()
-{
- EBookListener *listener;
- EBookListener *retval;
-
- listener = gtk_type_new (E_BOOK_LISTENER_TYPE);
-
- retval = e_book_listener_construct (listener);
-
- 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
-e_book_listener_init (EBookListener *listener)
-{
- listener->priv = g_new0 (EBookListenerPrivate, 1);
-}
-
-static void
-e_book_listener_destroy (GtkObject *object)
-{
- EBookListener *listener = E_BOOK_LISTENER (object);
- GList *l;
-
- for (l = listener->priv->response_queue; l != NULL; l = l->next) {
- EBookListenerResponse *resp = l->data;
-
- g_free (resp->msg);
- g_free (resp->id);
-
- if (resp->book != CORBA_OBJECT_NIL) {
- CORBA_Environment ev;
-
- CORBA_exception_init (&ev);
-
- CORBA_Object_release (resp->book, &ev);
-
- if (ev._major != CORBA_NO_EXCEPTION) {
- g_warning ("e_book_listener_destroy: "
- "Exception destroying book "
- "in response queue!\n");
- }
-
- CORBA_exception_free (&ev);
- }
-
- if (resp->cursor != CORBA_OBJECT_NIL) {
- CORBA_Environment ev;
-
- CORBA_exception_init (&ev);
-
- CORBA_Object_release (resp->cursor, &ev);
-
- if (ev._major != CORBA_NO_EXCEPTION) {
- g_warning ("e_book_listener_destroy: "
- "Exception destroying cursor "
- "in response queue!\n");
- }
-
- CORBA_exception_free (&ev);
- }
-
- if (resp->book_view != CORBA_OBJECT_NIL) {
- CORBA_Environment ev;
-
- CORBA_exception_init (&ev);
-
- CORBA_Object_release (resp->book_view, &ev);
-
- if (ev._major != CORBA_NO_EXCEPTION) {
- g_warning ("e_book_listener_destroy: "
- "Exception destroying book_view "
- "in response queue!\n");
- }
-
- CORBA_exception_free (&ev);
- }
-
- g_free (resp);
- }
- g_list_free (listener->priv->response_queue);
-
- g_free (listener->priv);
-
- 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->respond_get_cursor = impl_BookListener_respond_get_cursor;
- epv->respond_get_view = impl_BookListener_respond_get_view;
-
- epv->report_connection_status = impl_BookListener_report_connection_status;
-
- return epv;
-}
-
-static void
-e_book_listener_corba_class_init (void)
-{
- e_book_listener_vepv.Bonobo_Unknown_epv = bonobo_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 (bonobo_object_get_type ());
-
- e_book_listener_signals [RESPONSES_QUEUED] =
- gtk_signal_new ("responses_queued",
- GTK_RUN_LAST,
- object_class->type,
- GTK_SIGNAL_OFFSET (EBookListenerClass, responses_queued),
- gtk_marshal_NONE__NONE,
- GTK_TYPE_NONE, 0);
-
- gtk_object_class_add_signals (object_class, e_book_listener_signals, LAST_SIGNAL);
-
- 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 (bonobo_object_get_type (), &info);
- }
-
- return type;
-}
diff --git a/addressbook/backend/ebook/e-book-listener.h b/addressbook/backend/ebook/e-book-listener.h
deleted file mode 100644
index eb0432e360..0000000000
--- a/addressbook/backend/ebook/e-book-listener.h
+++ /dev/null
@@ -1,95 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * 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/bonobo-object.h>
-#include <ebook/addressbook.h>
-#include <ebook/e-book-types.h>
-
-BEGIN_GNOME_DECLS
-
-typedef struct _EBookListener EBookListener;
-typedef struct _EBookListenerClass EBookListenerClass;
-typedef struct _EBookListenerPrivate EBookListenerPrivate;
-
-struct _EBookListener {
- BonoboObject parent;
- EBookListenerPrivate *priv;
-};
-
-struct _EBookListenerClass {
- BonoboObjectClass parent;
-
- /*
- * Signals
- */
- void (*responses_queued) (void);
-};
-
-typedef enum {
- /* Async responses */
- OpenBookResponse,
- CreateCardResponse,
- RemoveCardResponse,
- ModifyCardResponse,
- GetCursorResponse,
- GetBookViewResponse,
-
- /* Async events */
- LinkStatusEvent,
- OpenProgressEvent,
-} EBookListenerOperation;
-
-typedef struct {
- EBookListenerOperation op;
-
- /* For most Response notifications */
- EBookStatus status;
-
- /* For OpenBookResponse */
- Evolution_Book book;
-
- /* For GetCursorResponse */
- Evolution_CardCursor cursor;
-
- /* For GetBookViewReponse */
- Evolution_BookView book_view;
-
- /* For OpenProgressEvent */
- char *msg;
- short percent;
-
- /* For LinkStatusEvent */
- gboolean connected;
-
- /* For Card[Added|Removed|Modified]Event */
- char *id;
-} EBookListenerResponse;
-
-EBookListener *e_book_listener_new (void);
-int e_book_listener_check_pending (EBookListener *listener);
-EBookListenerResponse *e_book_listener_pop_response (EBookListener *listener);
-GtkType e_book_listener_get_type (void);
-
-POA_Evolution_BookListener__epv *e_book_listener_get_epv (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-types.h b/addressbook/backend/ebook/e-book-types.h
deleted file mode 100644
index a3e8bbc032..0000000000
--- a/addressbook/backend/ebook/e-book-types.h
+++ /dev/null
@@ -1,31 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * A client-side GtkObject which exposes the
- * Evolution:BookListener interface.
- *
- * Author:
- * Nat Friedman (nat@helixcode.com)
- *
- * Copyright 2000, Helix Code, Inc.
- */
-
-#ifndef __E_BOOK_TYPES_H__
-#define __E_BOOK_TYPES_H__
-
-#include <libgnome/gnome-defs.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,
- E_BOOK_STATUS_PROTOCOL_NOT_SUPPORTED,
- E_BOOK_STATUS_OTHER_ERROR
-} EBookStatus;
-
-END_GNOME_DECLS
-
-#endif /* ! __E_BOOK_TYPES_H__ */
diff --git a/addressbook/backend/ebook/e-book-view-listener.c b/addressbook/backend/ebook/e-book-view-listener.c
deleted file mode 100644
index c84bf160c5..0000000000
--- a/addressbook/backend/ebook/e-book-view-listener.c
+++ /dev/null
@@ -1,345 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * Exports the BookViewListener interface. Maintains a queue of messages
- * which come in on the interface.
- *
- * Author:
- * Nat Friedman (nat@helixcode.com)
- *
- * Copyright 2000, Helix Code, Inc.
- */
-
-#include <config.h>
-#include <gtk/gtksignal.h>
-#include "e-book-view-listener.h"
-#include "e-book-view.h"
-#include "e-card.h"
-
-enum {
- RESPONSES_QUEUED,
- LAST_SIGNAL
-};
-
-static guint e_book_view_listener_signals [LAST_SIGNAL];
-
-static BonoboObjectClass *e_book_view_listener_parent_class;
-POA_Evolution_BookViewListener__vepv e_book_view_listener_vepv;
-
-struct _EBookViewListenerPrivate {
- GList *response_queue;
- gint idle_id;
-};
-
-static gboolean
-e_book_view_listener_check_queue (EBookViewListener *listener)
-{
- if (listener->priv->response_queue != NULL) {
- gtk_signal_emit (GTK_OBJECT (listener),
- e_book_view_listener_signals [RESPONSES_QUEUED]);
- }
-
- if (listener->priv->response_queue == NULL) {
- listener->priv->idle_id = 0;
- return FALSE;
- }
-
- return TRUE;
-}
-
-static void
-e_book_view_listener_queue_response (EBookViewListener *listener,
- EBookViewListenerResponse *response)
-{
- listener->priv->response_queue =
- g_list_append (listener->priv->response_queue,
- response);
-
- if (listener->priv->idle_id == 0) {
- listener->priv->idle_id = g_idle_add (
- (GSourceFunc) e_book_view_listener_check_queue, listener);
- }
-}
-
-/* Add, Remove, Modify */
-static void
-e_book_view_listener_queue_id_event (EBookViewListener *listener,
- EBookViewListenerOperation op,
- const char *id)
-{
- EBookViewListenerResponse *resp;
-
- resp = g_new0 (EBookViewListenerResponse, 1);
-
- resp->op = op;
- resp->id = g_strdup (id);
- resp->cards = NULL;
-
- e_book_view_listener_queue_response (listener, resp);
-}
-
-/* Add, Remove, Modify */
-static void
-e_book_view_listener_queue_sequence_event (EBookViewListener *listener,
- EBookViewListenerOperation op,
- const Evolution_VCardList *cards)
-{
- EBookViewListenerResponse *resp;
- int i;
-
- resp = g_new0 (EBookViewListenerResponse, 1);
-
- resp->op = op;
- resp->id = NULL;
- resp->cards = NULL;
-
- for ( i = 0; i < cards->_length; i++ ) {
- resp->cards = g_list_append(resp->cards, e_card_new(cards->_buffer[i]));
- }
-
- e_book_view_listener_queue_response (listener, resp);
-}
-
-static void
-impl_BookViewListener_signal_card_added (PortableServer_Servant servant,
- const Evolution_VCardList *cards,
- CORBA_Environment *ev)
-{
- EBookViewListener *listener = E_BOOK_VIEW_LISTENER (bonobo_object_from_servant (servant));
-
- e_book_view_listener_queue_sequence_event (
- listener, CardAddedEvent, cards);
-}
-
-static void
-impl_BookViewListener_signal_card_removed (PortableServer_Servant servant,
- const Evolution_CardId id,
- CORBA_Environment *ev)
-{
- EBookViewListener *listener = E_BOOK_VIEW_LISTENER (bonobo_object_from_servant (servant));
-
- e_book_view_listener_queue_id_event (
- listener, CardRemovedEvent, (const char *) id);
-}
-
-static void
-impl_BookViewListener_signal_card_changed (PortableServer_Servant servant,
- const Evolution_VCardList *cards,
- CORBA_Environment *ev)
-{
- EBookViewListener *listener = E_BOOK_VIEW_LISTENER (bonobo_object_from_servant (servant));
-
- e_book_view_listener_queue_sequence_event (
- listener, CardModifiedEvent, cards);
-}
-
-/**
- * e_book_view_listener_check_pending:
- * @listener: the #EBookViewListener
- *
- * Returns: the number of items on the response queue,
- * or -1 if the @listener is isn't an #EBookViewListener.
- */
-int
-e_book_view_listener_check_pending (EBookViewListener *listener)
-{
- g_return_val_if_fail (listener != NULL, -1);
- g_return_val_if_fail (E_IS_BOOK_VIEW_LISTENER (listener), -1);
-
- return g_list_length (listener->priv->response_queue);
-}
-
-/**
- * e_book_view_listener_pop_response:
- * @listener: the #EBookViewListener for which a request is to be popped
- *
- * Returns: an #EBookViewListenerResponse if there are responses on the
- * queue to be returned; %NULL if there aren't, or if the @listener
- * isn't an EBookViewListener.
- */
-EBookViewListenerResponse *
-e_book_view_listener_pop_response (EBookViewListener *listener)
-{
- EBookViewListenerResponse *resp;
- GList *popped;
-
- g_return_val_if_fail (listener != NULL, NULL);
- g_return_val_if_fail (E_IS_BOOK_VIEW_LISTENER (listener), NULL);
-
- if (listener->priv->response_queue == NULL)
- return NULL;
-
- resp = listener->priv->response_queue->data;
-
- popped = listener->priv->response_queue;
- listener->priv->response_queue =
- g_list_remove_link (listener->priv->response_queue,
- listener->priv->response_queue);
- g_list_free_1 (popped);
-
- return resp;
-}
-
-static EBookViewListener *
-e_book_view_listener_construct (EBookViewListener *listener)
-{
- POA_Evolution_BookViewListener *servant;
- CORBA_Environment ev;
- CORBA_Object obj;
-
- g_assert (listener != NULL);
- g_assert (E_IS_BOOK_VIEW_LISTENER (listener));
-
- servant = (POA_Evolution_BookViewListener *) g_new0 (BonoboObjectServant, 1);
- servant->vepv = &e_book_view_listener_vepv;
-
- CORBA_exception_init (&ev);
-
- POA_Evolution_BookViewListener__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 = bonobo_object_activate_servant (BONOBO_OBJECT (listener), servant);
- if (obj == CORBA_OBJECT_NIL) {
- g_free (servant);
-
- return NULL;
- }
-
- bonobo_object_construct (BONOBO_OBJECT (listener), obj);
-
- return listener;
-}
-
-/**
- * e_book_view_listener_new:
- * @book: the #EBookView for which the listener is to be bound
- *
- * Creates and returns a new #EBookViewListener for the book.
- *
- * Returns: a new #EBookViewListener
- */
-EBookViewListener *
-e_book_view_listener_new ()
-{
- EBookViewListener *listener;
- EBookViewListener *retval;
-
- listener = gtk_type_new (E_BOOK_VIEW_LISTENER_TYPE);
-
- retval = e_book_view_listener_construct (listener);
-
- if (retval == NULL) {
- g_warning ("e_book_view_listener_new: Error constructing "
- "EBookViewListener!\n");
- gtk_object_unref (GTK_OBJECT (listener));
- return NULL;
- }
-
- return retval;
-}
-
-static void
-e_book_view_listener_init (EBookViewListener *listener)
-{
- listener->priv = g_new0 (EBookViewListenerPrivate, 1);
- listener->priv->response_queue = NULL;
- listener->priv->idle_id = 0;
-}
-
-static void
-e_book_view_listener_destroy (GtkObject *object)
-{
- EBookViewListener *listener = E_BOOK_VIEW_LISTENER (object);
- GList *l;
-
- for (l = listener->priv->response_queue; l != NULL; l = l->next) {
- EBookViewListenerResponse *resp = l->data;
- if (resp->id)
- g_free(resp->id);
- if (resp->cards) {
- g_list_foreach(resp->cards, (GFunc) gtk_object_unref, NULL);
- g_list_free(resp->cards);
- }
- g_free (resp);
- }
- g_list_free (listener->priv->response_queue);
-
- g_free (listener->priv);
-
- GTK_OBJECT_CLASS (e_book_view_listener_parent_class)->destroy (object);
-}
-
-POA_Evolution_BookViewListener__epv *
-e_book_view_listener_get_epv (void)
-{
- POA_Evolution_BookViewListener__epv *epv;
-
- epv = g_new0 (POA_Evolution_BookViewListener__epv, 1);
-
- epv->signal_card_changed = impl_BookViewListener_signal_card_changed;
- epv->signal_card_removed = impl_BookViewListener_signal_card_removed;
- epv->signal_card_added = impl_BookViewListener_signal_card_added;
-
- return epv;
-}
-
-static void
-e_book_view_listener_corba_class_init (void)
-{
- e_book_view_listener_vepv.Bonobo_Unknown_epv = bonobo_object_get_epv ();
- e_book_view_listener_vepv.Evolution_BookViewListener_epv = e_book_view_listener_get_epv ();
-}
-
-static void
-e_book_view_listener_class_init (EBookViewListenerClass *klass)
-{
- GtkObjectClass *object_class = (GtkObjectClass *) klass;
-
- e_book_view_listener_parent_class = gtk_type_class (bonobo_object_get_type ());
-
- e_book_view_listener_signals [RESPONSES_QUEUED] =
- gtk_signal_new ("responses_queued",
- GTK_RUN_LAST,
- object_class->type,
- GTK_SIGNAL_OFFSET (EBookViewListenerClass, responses_queued),
- gtk_marshal_NONE__NONE,
- GTK_TYPE_NONE, 0);
-
- gtk_object_class_add_signals (object_class, e_book_view_listener_signals, LAST_SIGNAL);
-
- object_class->destroy = e_book_view_listener_destroy;
-
- e_book_view_listener_corba_class_init ();
-}
-
-/**
- * e_book_view_listener_get_type:
- */
-GtkType
-e_book_view_listener_get_type (void)
-{
- static GtkType type = 0;
-
- if (! type) {
- GtkTypeInfo info = {
- "EBookViewListener",
- sizeof (EBookViewListener),
- sizeof (EBookViewListenerClass),
- (GtkClassInitFunc) e_book_view_listener_class_init,
- (GtkObjectInitFunc) e_book_view_listener_init,
- NULL, /* reserved 1 */
- NULL, /* reserved 2 */
- (GtkClassInitFunc) NULL
- };
-
- type = gtk_type_unique (bonobo_object_get_type (), &info);
- }
-
- return type;
-}
diff --git a/addressbook/backend/ebook/e-book-view-listener.h b/addressbook/backend/ebook/e-book-view-listener.h
deleted file mode 100644
index 85542217df..0000000000
--- a/addressbook/backend/ebook/e-book-view-listener.h
+++ /dev/null
@@ -1,72 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * A client-side GtkObject which exposes the
- * Evolution:BookViewListener interface.
- *
- * Author:
- * Nat Friedman (nat@helixcode.com)
- *
- * Copyright 2000, Helix Code, Inc.
- */
-
-#ifndef __E_BOOK_VIEW_LISTENER_H__
-#define __E_BOOK_VIEW_LISTENER_H__
-
-#include <libgnome/gnome-defs.h>
-#include <bonobo/bonobo-object.h>
-#include <ebook/addressbook.h>
-
-BEGIN_GNOME_DECLS
-
-typedef struct _EBookViewListener EBookViewListener;
-typedef struct _EBookViewListenerClass EBookViewListenerClass;
-typedef struct _EBookViewListenerPrivate EBookViewListenerPrivate;
-
-struct _EBookViewListener {
- BonoboObject parent;
- EBookViewListenerPrivate *priv;
-};
-
-struct _EBookViewListenerClass {
- BonoboObjectClass parent;
-
- /*
- * Signals
- */
- void (*responses_queued) (void);
-};
-
-typedef enum {
- /* Async events */
- CardAddedEvent,
- CardRemovedEvent,
- CardModifiedEvent
-} EBookViewListenerOperation;
-
-typedef struct {
- EBookViewListenerOperation op;
-
- /* For CardRemovedEvent */
- char *id;
-
- /* For Card[Added|Modified]Event */
- GList *cards; /* Of type ECard. */
-
-} EBookViewListenerResponse;
-
-EBookViewListener *e_book_view_listener_new (void);
-int e_book_view_listener_check_pending (EBookViewListener *listener);
-EBookViewListenerResponse *e_book_view_listener_pop_response (EBookViewListener *listener);
-GtkType e_book_view_listener_get_type (void);
-
-POA_Evolution_BookViewListener__epv *e_book_view_listener_get_epv (void);
-
-#define E_BOOK_VIEW_LISTENER_TYPE (e_book_view_listener_get_type ())
-#define E_BOOK_VIEW_LISTENER(o) (GTK_CHECK_CAST ((o), E_BOOK_VIEW_LISTENER_TYPE, EBookViewListener))
-#define E_BOOK_VIEW_LISTENER_CLASS(k) (GTK_CHECK_CLASS_CAST((k), E_BOOK_VIEW_LISTENER_TYPE, EBookViewListenerClass))
-#define E_IS_BOOK_VIEW_LISTENER(o) (GTK_CHECK_TYPE ((o), E_BOOK_VIEW_LISTENER_TYPE))
-#define E_IS_BOOK_VIEW_LISTENER_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), E_BOOK_VIEW_LISTENER_TYPE))
-
-END_GNOME_DECLS
-
-#endif /* ! __E_BOOK_VIEW_LISTENER_H__ */
diff --git a/addressbook/backend/ebook/e-book-view.c b/addressbook/backend/ebook/e-book-view.c
deleted file mode 100644
index 65a90b8ede..0000000000
--- a/addressbook/backend/ebook/e-book-view.c
+++ /dev/null
@@ -1,281 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * The Evolution addressbook client object.
- *
- * Author:
- * Nat Friedman (nat@helixcode.com)
- *
- * Copyright 1999, 2000, Helix Code, Inc.
- */
-
-#include <config.h>
-#include <gtk/gtksignal.h>
-#include <gtk/gtkmarshal.h>
-
-#include "addressbook.h"
-#include "e-card-cursor.h"
-#include "e-book-view-listener.h"
-#include "e-book-view.h"
-
-GtkObjectClass *e_book_view_parent_class;
-
-struct _EBookViewPrivate {
- Evolution_BookView corba_book_view;
-
- EBookViewListener *listener;
-
- int responses_queued_id;
-};
-
-enum {
- CARD_CHANGED,
- CARD_REMOVED,
- CARD_ADDED,
- LAST_SIGNAL
-};
-
-static guint e_book_view_signals [LAST_SIGNAL];
-
-static void
-e_book_view_do_added_event (EBookView *book_view,
- EBookViewListenerResponse *resp)
-{
- gtk_signal_emit (GTK_OBJECT (book_view), e_book_view_signals [CARD_ADDED],
- resp->cards);
-
- g_list_foreach (resp->cards, (GFunc) gtk_object_unref, NULL);
- g_list_free (resp->cards);
-}
-
-static void
-e_book_view_do_modified_event (EBookView *book_view,
- EBookViewListenerResponse *resp)
-{
- gtk_signal_emit (GTK_OBJECT (book_view), e_book_view_signals [CARD_CHANGED],
- resp->cards);
-
- g_list_foreach (resp->cards, (GFunc) gtk_object_unref, NULL);
- g_list_free (resp->cards);
-}
-
-static void
-e_book_view_do_removed_event (EBookView *book_view,
- EBookViewListenerResponse *resp)
-{
- gtk_signal_emit (GTK_OBJECT (book_view), e_book_view_signals [CARD_REMOVED],
- resp->id);
-
- g_free(resp->id);
-}
-
-
-/*
- * Reading notices out of the EBookViewListener's queue.
- */
-static void
-e_book_view_check_listener_queue (EBookViewListener *listener, EBookView *book_view)
-{
- EBookViewListenerResponse *resp;
-
- resp = e_book_view_listener_pop_response (listener);
-
- if (resp == NULL)
- return;
-
- switch (resp->op) {
- case CardAddedEvent:
- e_book_view_do_added_event (book_view, resp);
- break;
- case CardModifiedEvent:
- e_book_view_do_modified_event (book_view, resp);
- break;
- case CardRemovedEvent:
- e_book_view_do_removed_event (book_view, resp);
- break;
- default:
- g_error ("EBookView: Unknown operation %d in listener queue!\n",
- resp->op);
- }
-
- g_free (resp);
-}
-
-static gboolean
-e_book_view_construct (EBookView *book_view, Evolution_BookView corba_book_view, EBookViewListener *listener)
-{
- CORBA_Environment ev;
- g_return_val_if_fail (book_view != NULL, FALSE);
- g_return_val_if_fail (E_IS_BOOK_VIEW (book_view), FALSE);
-
- /*
- * Copy in the corba_book_view.
- */
- CORBA_exception_init (&ev);
-
- book_view->priv->corba_book_view = CORBA_Object_duplicate(corba_book_view, &ev);
-
- if (ev._major != CORBA_NO_EXCEPTION) {
- g_warning ("e_book_view_construct: Exception duplicating corba_book_view.\n");
- CORBA_exception_free (&ev);
- return FALSE;
- }
-
- Evolution_BookView_ref(book_view->priv->corba_book_view, &ev);
-
- if (ev._major != CORBA_NO_EXCEPTION) {
- g_warning ("e_book_view_construct: Exception reffing corba_book_view.\n");
- CORBA_exception_free (&ev);
- CORBA_exception_init (&ev);
- CORBA_Object_release (book_view->priv->corba_book_view, &ev);
- if (ev._major != CORBA_NO_EXCEPTION) {
- g_warning ("e_book_view_construct: Exception releasing corba_book_view.\n");
- }
- CORBA_exception_free (&ev);
- book_view->priv->corba_book_view = NULL;
- return FALSE;
- }
-
- CORBA_exception_free (&ev);
-
- /*
- * Create our local BookListener interface.
- */
- book_view->priv->listener = listener;
-
- bonobo_object_ref(BONOBO_OBJECT(book_view->priv->listener));
- book_view->priv->responses_queued_id = gtk_signal_connect (GTK_OBJECT (book_view->priv->listener), "responses_queued",
- e_book_view_check_listener_queue, book_view);
-
- return TRUE;
-}
-
-/**
- * e_book_view_new:
- */
-EBookView *
-e_book_view_new (Evolution_BookView corba_book_view, EBookViewListener *listener)
-{
- EBookView *book_view;
-
- book_view = gtk_type_new (E_BOOK_VIEW_TYPE);
-
- if (! e_book_view_construct (book_view, corba_book_view, listener)) {
- gtk_object_unref (GTK_OBJECT (book_view));
- return NULL;
- }
-
- return book_view;
-}
-
-static void
-e_book_view_init (EBookView *book_view)
-{
- book_view->priv = g_new0 (EBookViewPrivate, 1);
- book_view->priv->corba_book_view = CORBA_OBJECT_NIL;
- book_view->priv->listener = NULL;
- book_view->priv->responses_queued_id = 0;
-}
-
-static void
-e_book_view_destroy (GtkObject *object)
-{
- EBookView *book_view = E_BOOK_VIEW (object);
- CORBA_Environment ev;
-
- if (book_view->priv->corba_book_view) {
- CORBA_exception_init (&ev);
-
- Evolution_BookView_unref(book_view->priv->corba_book_view, &ev);
- if (ev._major != CORBA_NO_EXCEPTION) {
- g_warning ("EBookView: Exception while unreffing BookView\n");
-
- CORBA_exception_free (&ev);
- CORBA_exception_init (&ev);
- }
-
- CORBA_Object_release (book_view->priv->corba_book_view, &ev);
- if (ev._major != CORBA_NO_EXCEPTION) {
- g_warning ("EBookView: Exception while releasing BookView\n");
- }
-
- CORBA_exception_free (&ev);
- }
-
- if (book_view->priv->listener) {
- if (book_view->priv->responses_queued_id)
- gtk_signal_disconnect(GTK_OBJECT(book_view->priv->listener),
- book_view->priv->responses_queued_id);
- bonobo_object_unref (BONOBO_OBJECT(book_view->priv->listener));
- }
-
- g_free (book_view->priv);
-
- if (GTK_OBJECT_CLASS (e_book_view_parent_class)->destroy)
- GTK_OBJECT_CLASS (e_book_view_parent_class)->destroy (object);
-}
-
-static void
-e_book_view_class_init (EBookViewClass *klass)
-{
- GtkObjectClass *object_class = (GtkObjectClass *) klass;
-
- e_book_view_parent_class = gtk_type_class (gtk_object_get_type ());
-
- e_book_view_signals [CARD_CHANGED] =
- gtk_signal_new ("card_changed",
- GTK_RUN_LAST,
- object_class->type,
- GTK_SIGNAL_OFFSET (EBookViewClass, card_changed),
- gtk_marshal_NONE__POINTER,
- GTK_TYPE_NONE, 1,
- GTK_TYPE_POINTER);
-
- e_book_view_signals [CARD_ADDED] =
- gtk_signal_new ("card_added",
- GTK_RUN_LAST,
- object_class->type,
- GTK_SIGNAL_OFFSET (EBookViewClass, card_added),
- gtk_marshal_NONE__STRING,
- GTK_TYPE_NONE, 1,
- GTK_TYPE_STRING);
-
- e_book_view_signals [CARD_REMOVED] =
- gtk_signal_new ("card_removed",
- GTK_RUN_LAST,
- object_class->type,
- GTK_SIGNAL_OFFSET (EBookViewClass, card_removed),
- gtk_marshal_NONE__POINTER,
- GTK_TYPE_NONE, 1,
- GTK_TYPE_POINTER);
-
- gtk_object_class_add_signals (object_class, e_book_view_signals,
- LAST_SIGNAL);
-
- object_class->destroy = e_book_view_destroy;
-}
-
-/**
- * e_book_view_get_type:
- */
-GtkType
-e_book_view_get_type (void)
-{
- static GtkType type = 0;
-
- if (! type) {
- GtkTypeInfo info = {
- "EBookView",
- sizeof (EBookView),
- sizeof (EBookViewClass),
- (GtkClassInitFunc) e_book_view_class_init,
- (GtkObjectInitFunc) e_book_view_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-view.h b/addressbook/backend/ebook/e-book-view.h
deleted file mode 100644
index 5ae20e1521..0000000000
--- a/addressbook/backend/ebook/e-book-view.h
+++ /dev/null
@@ -1,55 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * The Evolution addressbook client object.
- *
- * Author:
- * Nat Friedman (nat@helixcode.com)
- *
- * Copyright 1999, 2000, Helix Code, Inc.
- */
-
-#ifndef __E_BOOK_VIEW_H__
-#define __E_BOOK_VIEW_H__
-
-#include <libgnome/gnome-defs.h>
-
-#include <ebook/e-card.h>
-#include <ebook/e-book-view-listener.h>
-
-BEGIN_GNOME_DECLS
-
-typedef struct _EBookView EBookView;
-typedef struct _EBookViewClass EBookViewClass;
-typedef struct _EBookViewPrivate EBookViewPrivate;
-
-struct _EBookView {
- GtkObject parent;
- EBookViewPrivate *priv;
-};
-
-struct _EBookViewClass {
- GtkObjectClass parent;
-
- /*
- * Signals.
- */
- void (* card_changed) (EBookView *book_view, const GList *cards);
- void (* card_removed) (EBookView *book_view, const char *id);
- void (* card_added) (EBookView *book_view, const GList *cards);
-};
-
-/* Creating a new addressbook. */
-EBookView *e_book_view_new (Evolution_BookView corba_book_view, EBookViewListener *listener);
-
-GtkType e_book_view_get_type (void);
-void e_book_view_get_book_view_listener (EBookView *book_view);
-
-#define E_BOOK_VIEW_TYPE (e_book_view_get_type ())
-#define E_BOOK_VIEW(o) (GTK_CHECK_CAST ((o), E_BOOK_VIEW_TYPE, EBookView))
-#define E_BOOK_VIEW_CLASS(k) (GTK_CHECK_CLASS_CAST((k), E_BOOK_VIEW_TYPE, EBookViewClass))
-#define E_IS_BOOK_VIEW(o) (GTK_CHECK_TYPE ((o), E_BOOK_VIEW_TYPE))
-#define E_IS_BOOK_VIEW_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), E_BOOK_VIEW_TYPE))
-
-END_GNOME_DECLS
-
-#endif /* ! __E_BOOK_VIEW_H__ */
diff --git a/addressbook/backend/ebook/e-book.c b/addressbook/backend/ebook/e-book.c
deleted file mode 100644
index ce1c663073..0000000000
--- a/addressbook/backend/ebook/e-book.c
+++ /dev/null
@@ -1,1010 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * The Evolution addressbook client object.
- *
- * Author:
- * Nat Friedman (nat@helixcode.com)
- *
- * Copyright 1999, 2000, Helix Code, Inc.
- */
-
-#include <config.h>
-#include <gtk/gtksignal.h>
-#include <gtk/gtkmarshal.h>
-
-#include "addressbook.h"
-#include "e-card-cursor.h"
-#include "e-book-listener.h"
-#include "e-book.h"
-
-GtkObjectClass *e_book_parent_class;
-
-#ifdef USING_OAF
-#include <liboaf/liboaf.h>
-#define CARDSERVER_OAF_ID "OAFIID:evolution:addressbook-server:0fbc844d-c721-4615-98d0-d67eacf42d80"
-#else
-#include <libgnorba/gnorba.h>
-#define CARDSERVER_GOAD_ID "evolution:addressbook-server"
-#endif
-
-typedef enum {
- URINotLoaded,
- URILoading,
- URILoaded
-} EBookLoadState;
-
-struct _EBookPrivate {
- Evolution_BookFactory book_factory;
- EBookListener *listener;
-
- Evolution_Book corba_book;
-
- EBookLoadState load_state;
-
- /*
- * The operation queue. New operations are appended to the
- * end of the queue. When responses come back from the PAS,
- * the op structures are popped off the front of the queue.
- */
- GList *pending_ops;
-};
-
-enum {
- OPEN_PROGRESS,
- LINK_STATUS,
- LAST_SIGNAL
-};
-
-static guint e_book_signals [LAST_SIGNAL];
-
-typedef struct {
- gpointer cb;
- gpointer closure;
- EBookViewListener *listener;
-} EBookOp;
-
-/*
- * Local response queue management.
- */
-static void
-e_book_queue_op (EBook *book,
- gpointer cb,
- gpointer closure,
- EBookViewListener *listener)
-{
- EBookOp *op;
-
- op = g_new0 (EBookOp, 1);
- op->cb = cb;
- op->closure = closure;
- op->listener = listener;
-
- book->priv->pending_ops =
- g_list_append (book->priv->pending_ops, op);
-}
-
-static EBookOp *
-e_book_pop_op (EBook *book)
-{
- GList *popped;
- EBookOp *op;
-
- if (book->priv->pending_ops == NULL)
- return NULL;
-
- op = book->priv->pending_ops->data;
-
- popped = book->priv->pending_ops;
- book->priv->pending_ops =
- g_list_remove_link (book->priv->pending_ops,
- book->priv->pending_ops);
-
- g_list_free_1 (popped);
-
- return op;
-}
-
-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;
- }
-
- if (op->cb)
- ((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)
-{
- EBookOp *op;
-
- op = e_book_pop_op (book);
-
- if (op == NULL) {
- g_warning ("e_book_do_response_generic: Cannot find operation "
- "in local op queue!\n");
- }
-
- if (op->cb)
- ((EBookCallback) op->cb) (book, resp->status, op->closure);
-
- g_free (op);
-}
-
-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_get_cursor: Cannot find operation "
- "in local op queue!\n");
- return;
- }
-
- cursor = e_card_cursor_new(resp->cursor);
-
- if (op->cb)
- ((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_cursor: 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);
-
- gtk_object_unref(GTK_OBJECT(cursor));
-
- g_free (op);
-}
-
-static void
-e_book_do_response_get_view (EBook *book,
- EBookListenerResponse *resp)
-{
- CORBA_Environment ev;
- EBookOp *op;
- EBookView *book_view;
-
- op = e_book_pop_op (book);
-
- if (op == NULL) {
- g_warning ("e_book_do_response_get_view: Cannot find operation "
- "in local op queue!\n");
- return;
- }
-
- book_view = e_book_view_new(resp->book_view, op->listener);
-
- if (op->cb)
- ((EBookBookViewCallback) op->cb) (book, resp->status, book_view, op->closure);
-
- /*
- * Release the remote Evolution_Book in the PAS.
- */
- CORBA_exception_init (&ev);
-
- Bonobo_Unknown_unref (resp->book_view, &ev);
-
- if (ev._major != CORBA_NO_EXCEPTION) {
- g_warning ("e_book_do_response_get_view: Exception unref'ing "
- "remote Evolution_BookView interface!\n");
- CORBA_exception_free (&ev);
- CORBA_exception_init (&ev);
- }
-
- CORBA_Object_release (resp->book_view, &ev);
-
- if (ev._major != CORBA_NO_EXCEPTION) {
- g_warning ("e_book_do_response_get_view: Exception releasing "
- "remote Evolution_BookView interface!\n");
- }
-
- CORBA_exception_free (&ev);
-
- gtk_object_unref(GTK_OBJECT(book_view));
- bonobo_object_unref(BONOBO_OBJECT(op->listener));
-
- g_free (op);
-}
-
-static void
-e_book_do_response_open (EBook *book,
- EBookListenerResponse *resp)
-{
- EBookOp *op;
-
- if (resp->status == E_BOOK_STATUS_SUCCESS) {
- book->priv->corba_book = resp->book;
- book->priv->load_state = URILoaded;
- }
-
- op = e_book_pop_op (book);
-
- if (op == NULL) {
- g_warning ("e_book_do_response_open: Cannot find operation "
- "in local op queue!\n");
- return;
- }
-
- if (op->cb)
- ((EBookCallback) op->cb) (book, resp->status, op->closure);
- g_free (op);
-}
-
-static void
-e_book_do_progress_event (EBook *book,
- EBookListenerResponse *resp)
-{
- gtk_signal_emit (GTK_OBJECT (book), e_book_signals [OPEN_PROGRESS],
- resp->msg, resp->percent);
-
- g_free (resp->msg);
-}
-
-static void
-e_book_do_link_event (EBook *book,
- EBookListenerResponse *resp)
-{
- gtk_signal_emit (GTK_OBJECT (book), e_book_signals [LINK_STATUS],
- resp->connected);
-}
-
-
-/*
- * Reading notices out of the EBookListener's queue.
- */
-static void
-e_book_check_listener_queue (EBookListener *listener, EBook *book)
-{
- EBookListenerResponse *resp;
-
- resp = e_book_listener_pop_response (listener);
-
- if (resp == NULL)
- return;
-
- 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 GetBookViewResponse:
- e_book_do_response_get_view(book, resp);
- break;
- case OpenBookResponse:
- e_book_do_response_open (book, resp);
- break;
-
- case OpenProgressEvent:
- e_book_do_progress_event (book, resp);
- break;
- case LinkStatusEvent:
- e_book_do_link_event (book, resp);
- break;
- default:
- g_error ("EBook: Unknown operation %d in listener queue!\n",
- resp->op);
- }
-
- g_free (resp);
-}
-
-/**
- * e_book_load_uri:
- */
-gboolean
-e_book_load_uri (EBook *book,
- const char *uri,
- EBookCallback open_response,
- gpointer closure)
-{
- CORBA_Environment ev;
-
- g_return_val_if_fail (book != NULL, FALSE);
- g_return_val_if_fail (E_IS_BOOK (book), FALSE);
- g_return_val_if_fail (uri != NULL, FALSE);
- g_return_val_if_fail (open_response != NULL, FALSE);
-
- if (book->priv->load_state != URINotLoaded) {
- g_warning ("e_book_load_uri: Attempted to load a URI "
- "on a book which already has a URI loaded!\n");
- return FALSE;
- }
-
- /*
- * Create our local BookListener interface.
- */
- book->priv->listener = e_book_listener_new ();
- if (book->priv->listener == NULL) {
- g_warning ("e_book_load_uri: Could not create EBookListener!\n");
- return FALSE;
- }
-
- gtk_signal_connect (GTK_OBJECT (book->priv->listener), "responses_queued",
- e_book_check_listener_queue, book);
-
- /*
- * Load the addressbook into the PAS.
- */
- CORBA_exception_init (&ev);
-
- Evolution_BookFactory_open_book (
- book->priv->book_factory, uri,
- bonobo_object_corba_objref (BONOBO_OBJECT (book->priv->listener)),
- &ev);
-
- if (ev._major != CORBA_NO_EXCEPTION) {
- g_warning ("e_book_load_uri: CORBA exception while opening addressbook!\n");
- CORBA_exception_free (&ev);
- return FALSE;
- }
-
- CORBA_exception_free (&ev);
-
- book->priv->load_state = URILoading;
-
- e_book_queue_op (book, open_response, closure, NULL);
-
- /* Now we play the waiting game. */
-
- return TRUE;
-}
-
-/**
- * e_book_unload_uri:
- */
-void
-e_book_unload_uri (EBook *book)
-{
- CORBA_Environment ev;
-
- g_return_if_fail (book != NULL);
- g_return_if_fail (E_IS_BOOK (book));
-
- /*
- * FIXME: Make sure this works if the URI is still being
- * loaded.
- */
- if (book->priv->load_state == URINotLoaded) {
- g_warning ("e_book_unload_uri: No URI is loaded!\n");
- return;
- }
-
- /*
- * Release the remote Evolution_Book in the PAS.
- */
- CORBA_exception_init (&ev);
-
- Bonobo_Unknown_unref (book->priv->corba_book, &ev);
-
- if (ev._major != CORBA_NO_EXCEPTION) {
- g_warning ("e_book_unload_uri: Exception unref'ing "
- "remote Evolution_Book interface!\n");
- CORBA_exception_free (&ev);
- CORBA_exception_init (&ev);
- }
-
- CORBA_Object_release (book->priv->corba_book, &ev);
-
- if (ev._major != CORBA_NO_EXCEPTION) {
- g_warning ("e_book_unload_uri: Exception releasing "
- "remote book interface!\n");
- }
-
- CORBA_exception_free (&ev);
-
- bonobo_object_unref (BONOBO_OBJECT (book->priv->listener));
-
- book->priv->listener = NULL;
- book->priv->load_state = URINotLoaded;
-}
-
-static gboolean
-e_book_construct (EBook *book)
-{
- g_return_val_if_fail (book != NULL, FALSE);
- g_return_val_if_fail (E_IS_BOOK (book), FALSE);
-
- /*
- * Connect to the Personal Addressbook Server.
- */
-
-#ifdef USING_OAF
- book->priv->book_factory = (Evolution_BookFactory)
- oaf_activate_from_id (CARDSERVER_OAF_ID, 0, NULL, NULL);
-#else
- book->priv->book_factory = (Evolution_BookFactory)
- goad_server_activate_with_id (NULL, CARDSERVER_GOAD_ID, 0, NULL);
-#endif
-
- 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 FALSE;
- }
-
- return TRUE;
-}
-
-/**
- * e_book_new:
- */
-EBook *
-e_book_new (void)
-{
- EBook *book;
-
- book = gtk_type_new (E_BOOK_TYPE);
-
- if (! e_book_construct (book)) {
- gtk_object_unref (GTK_OBJECT (book));
- return NULL;
- }
-
- return book;
-}
-
-/* Fetching cards */
-
-/**
- * e_book_get_card:
- */
-ECard *
-e_book_get_card (EBook *book,
- const char *id)
-{
- char *vcard;
- ECard *card;
-
- g_return_val_if_fail (book != NULL, NULL);
- g_return_val_if_fail (E_IS_BOOK (book), NULL);
-
- if (book->priv->load_state != URILoaded) {
- g_warning ("e_book_get_card: No URI loaded!\n");
- return NULL;
- }
-
- vcard = e_book_get_vcard (book, id);
-
- if (vcard == NULL) {
- g_warning ("e_book_get_card: Got bogus VCard from PAS!\n");
- return NULL;
- }
-
- card = e_card_new (vcard);
- g_free(vcard);
-
- e_card_set_id(card, id);
-
- return card;
-}
-
-/**
- * e_book_get_vcard:
- */
-char *
-e_book_get_vcard (EBook *book,
- const char *id)
-{
- CORBA_Environment ev;
- char *retval;
- char *vcard;
-
- g_return_val_if_fail (book != NULL, NULL);
- g_return_val_if_fail (E_IS_BOOK (book), NULL);
-
- if (book->priv->load_state != URILoaded) {
- g_warning ("e_book_get_vcard: No URI loaded!\n");
- return NULL;
- }
-
- CORBA_exception_init (&ev);
-
- vcard = Evolution_Book_get_vcard (book->priv->corba_book,
- (Evolution_CardId) id,
- &ev);
-
- if (ev._major != CORBA_NO_EXCEPTION) {
- g_warning ("e_book_get_vcard: Exception getting VCard from PAS!\n");
- CORBA_exception_free (&ev);
- return NULL;
- }
-
- CORBA_exception_free (&ev);
-
- if (vcard == NULL || strlen (vcard) == 0) {
- g_warning ("e_book_get_vcard: Got NULL VCard from PAS!\n");
- return NULL;
- }
-
- retval = g_strdup (vcard);
- CORBA_free (vcard);
-
- return retval;
-}
-
-/* Deleting cards. */
-
-/**
- * e_book_remove_card:
- */
-gboolean
-e_book_remove_card (EBook *book,
- ECard *card,
- EBookCallback cb,
- gpointer closure)
-{
- const char *id;
-
- g_return_val_if_fail (book != NULL, FALSE);
- g_return_val_if_fail (E_IS_BOOK (book), FALSE);
- g_return_val_if_fail (card != NULL, FALSE);
- g_return_val_if_fail (E_IS_CARD (card), FALSE);
-
- if (book->priv->load_state != URILoaded) {
- g_warning ("e_book_remove_card: No URI loaded!\n");
- return FALSE;
- }
-
- id = e_card_get_id (card);
- g_assert (id != NULL);
-
- return e_book_remove_card_by_id (book, id, cb, closure);
-}
-
-/**
- * e_book_remove_card_by_id:
- */
-gboolean
-e_book_remove_card_by_id (EBook *book,
- const char *id,
- EBookCallback cb,
- gpointer closure)
-
-{
- CORBA_Environment ev;
-
- g_return_val_if_fail (book != NULL, FALSE);
- g_return_val_if_fail (E_IS_BOOK (book), FALSE);
- g_return_val_if_fail (id != NULL, FALSE);
-
- if (book->priv->load_state != URILoaded) {
- g_warning ("e_book_remove_card_by_id: No URI loaded!\n");
- return FALSE;
- }
-
- CORBA_exception_init (&ev);
-
- Evolution_Book_remove_card (
- book->priv->corba_book, (const Evolution_CardId) id, &ev);
-
- if (ev._major != CORBA_NO_EXCEPTION) {
- g_warning ("e_book_remove_card_by_id: CORBA exception "
- "talking to PAS!\n");
- CORBA_exception_free (&ev);
- return FALSE;
- }
-
- CORBA_exception_free (&ev);
-
- e_book_queue_op (book, cb, closure, NULL);
-
- return TRUE;
-}
-
-/* Adding cards. */
-
-/**
- * e_book_add_card:
- */
-gboolean
-e_book_add_card (EBook *book,
- ECard *card,
- EBookIdCallback cb,
- gpointer closure)
-
-{
- char *vcard;
- gboolean retval;
-
- g_return_val_if_fail (book != NULL, FALSE);
- g_return_val_if_fail (E_IS_BOOK (book), FALSE);
- g_return_val_if_fail (card != NULL, FALSE);
- g_return_val_if_fail (E_IS_CARD (card), FALSE);
-
- if (book->priv->load_state != URILoaded) {
- g_warning ("e_book_add_card: No URI loaded!\n");
- return FALSE;
- }
-
- vcard = e_card_get_vcard (card);
-
- if (vcard == NULL) {
- g_warning ("e_book_add_card: Cannot convert card to VCard string!\n");
- return FALSE;
- }
-
- retval = e_book_add_vcard (book, vcard, cb, closure);
-
- g_free (vcard);
-
- return retval;
-}
-
-/**
- * e_book_add_vcard:
- */
-gboolean
-e_book_add_vcard (EBook *book,
- const char *vcard,
- EBookIdCallback cb,
- gpointer closure)
-{
- CORBA_Environment ev;
-
- g_return_val_if_fail (book != NULL, FALSE);
- g_return_val_if_fail (E_IS_BOOK (book), FALSE);
- g_return_val_if_fail (vcard != NULL, FALSE);
-
- if (book->priv->load_state != URILoaded) {
- g_warning ("e_book_add_vcard: No URI loaded!\n");
- return FALSE;
- }
-
- CORBA_exception_init (&ev);
-
- Evolution_Book_create_card (
- book->priv->corba_book, (const Evolution_VCard) vcard, &ev);
-
- if (ev._major != CORBA_NO_EXCEPTION) {
- g_warning ("e_book_add_vcard: Exception adding card to PAS!\n");
- CORBA_exception_free (&ev);
- return FALSE;
- }
-
- CORBA_exception_free (&ev);
-
- e_book_queue_op (book, (EBookCallback) cb, closure, NULL);
-
- return TRUE;
-}
-
-/* Modifying cards. */
-
-/**
- * e_book_commit_card:
- */
-gboolean
-e_book_commit_card (EBook *book,
- ECard *card,
- EBookCallback cb,
- gpointer closure)
-{
- char *vcard;
- gboolean retval;
-
- g_return_val_if_fail (book != NULL, FALSE);
- g_return_val_if_fail (E_IS_BOOK (book), FALSE);
- g_return_val_if_fail (card != NULL, FALSE);
- g_return_val_if_fail (E_IS_CARD (card), FALSE);
-
- if (book->priv->load_state != URILoaded) {
- g_warning ("e_book_commit_card: No URI loaded!\n");
- return FALSE;
- }
-
- vcard = e_card_get_vcard (card);
-
- if (vcard == NULL) {
- g_warning ("e_book_commit_card: Error "
- "getting VCard for card!\n");
- return FALSE;
- }
-
- retval = e_book_commit_vcard (book, vcard, cb, closure);
-
- g_free (vcard);
-
- return retval;
-}
-
-/**
- * e_book_commit_vcard:
- */
-gboolean
-e_book_commit_vcard (EBook *book,
- const char *vcard,
- EBookCallback cb,
- gpointer closure)
-{
- CORBA_Environment ev;
-
- g_return_val_if_fail (book != NULL, FALSE);
- g_return_val_if_fail (E_IS_BOOK (book), FALSE);
- g_return_val_if_fail (vcard != NULL, FALSE);
-
- if (book->priv->load_state != URILoaded) {
- g_warning ("e_book_commit_vcard: No URI loaded!\n");
- return FALSE;
- }
-
- CORBA_exception_init (&ev);
-
- Evolution_Book_modify_card (
- book->priv->corba_book, (const Evolution_VCard) vcard, &ev);
-
- if (ev._major != CORBA_NO_EXCEPTION) {
- g_warning ("e_book_commit_vcard: Exception "
- "modifying card in PAS!\n");
- CORBA_exception_free (&ev);
- return FALSE;
- }
-
- CORBA_exception_free (&ev);
-
- e_book_queue_op (book, cb, closure, NULL);
-
- return TRUE;
-}
-
-/**
- * e_book_check_connection:
- */
-gboolean
-e_book_check_connection (EBook *book)
-{
- 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_check_connection (book->priv->corba_book, &ev);
-
- if (ev._major != CORBA_NO_EXCEPTION) {
- g_warning ("e_book_check_connection: Exception "
- "querying the PAS!\n");
- CORBA_exception_free (&ev);
- return FALSE;
- }
-
- CORBA_exception_free (&ev);
-
- return TRUE;
-}
-
-gboolean e_book_get_cursor (EBook *book,
- gchar *query,
- 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_cursor (book->priv->corba_book, query, &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, NULL);
-
- return TRUE;
-}
-
-gboolean e_book_get_book_view (EBook *book,
- gchar *query,
- EBookBookViewCallback cb,
- gpointer closure)
-{
- CORBA_Environment ev;
- EBookViewListener *listener;
-
- 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_get_book_view: No URI loaded!\n");
- return FALSE;
- }
-
- listener = e_book_view_listener_new();
-
- CORBA_exception_init (&ev);
-
- Evolution_Book_get_book_view (book->priv->corba_book, bonobo_object_corba_objref(BONOBO_OBJECT(listener)), query, &ev);
-
- if (ev._major != CORBA_NO_EXCEPTION) {
- g_warning ("e_book_get_book_view: Exception "
- "getting book_view!\n");
- CORBA_exception_free (&ev);
- return FALSE;
- }
-
- CORBA_exception_free (&ev);
-
- e_book_queue_op (book, cb, closure, listener);
-
- return TRUE;
-}
-
-/**
- * e_book_get_name:
- */
-char *
-e_book_get_name (EBook *book)
-{
- CORBA_Environment ev;
- char *retval;
- char *name;
-
- g_return_val_if_fail (book != NULL, NULL);
- g_return_val_if_fail (E_IS_BOOK (book), NULL);
-
- if (book->priv->load_state != URILoaded) {
- g_warning ("e_book_get_name: No URI loaded!\n");
- return NULL;
- }
-
- CORBA_exception_init (&ev);
-
- name = Evolution_Book_get_name (book->priv->corba_book, &ev);
-
- if (ev._major != CORBA_NO_EXCEPTION) {
- g_warning ("e_book_get_name: Exception getting name from PAS!\n");
- CORBA_exception_free (&ev);
- return NULL;
- }
-
- CORBA_exception_free (&ev);
-
- if (name == NULL) {
- g_warning ("e_book_get_name: Got NULL name from PAS!\n");
- return NULL;
- }
-
- retval = g_strdup (name);
- CORBA_free (name);
-
- return retval;
-}
-
-static void
-e_book_init (EBook *book)
-{
- book->priv = g_new0 (EBookPrivate, 1);
- book->priv->load_state = URINotLoaded;
-}
-
-static void
-e_book_destroy (GtkObject *object)
-{
- EBook *book = E_BOOK (object);
- CORBA_Environment ev;
-
- if (book->priv->load_state != URINotLoaded)
- e_book_unload_uri (book);
-
- 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 [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;
-}
-
-/**
- * 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
deleted file mode 100644
index 4cab606239..0000000000
--- a/addressbook/backend/ebook/e-book.h
+++ /dev/null
@@ -1,123 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * 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 <ebook/e-card.h>
-#include <ebook/e-card-cursor.h>
-#include <ebook/e-book-view.h>
-#include <ebook/e-book-types.h>
-
-BEGIN_GNOME_DECLS
-
-typedef struct _EBook EBook;
-typedef struct _EBookClass EBookClass;
-typedef struct _EBookPrivate EBookPrivate;
-
-struct _EBook {
- GtkObject parent;
- EBookPrivate *priv;
-};
-
-struct _EBookClass {
- GtkObjectClass parent;
-
- /*
- * Signals.
- */
- void (* open_progress) (EBook *book, const char *msg, short percent);
- void (* link_status) (EBook *book, gboolean connected);
-};
-
-/* 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);
-typedef void (*EBookIdCallback) (EBook *book, EBookStatus status, const char *id, gpointer closure);
-typedef void (*EBookCursorCallback) (EBook *book, EBookStatus status, ECardCursor *cursor, gpointer closure);
-typedef void (*EBookBookViewCallback) (EBook *book, EBookStatus status, EBookView *book_view, gpointer closure);
-
-
-/* Creating a new addressbook. */
-EBook *e_book_new (void);
-gboolean e_book_load_uri (EBook *book,
- const char *uri,
- EBookCallback open_response,
- gpointer closure);
-void e_book_unload_uri (EBook *book);
-
-/* Fetching cards. */
-ECard *e_book_get_card (EBook *book,
- const char *id);
-char *e_book_get_vcard (EBook *book,
- const char *id);
-
-/* Deleting cards. */
-gboolean e_book_remove_card (EBook *book,
- ECard *card,
- EBookCallback cb,
- gpointer closure);
-gboolean e_book_remove_card_by_id (EBook *book,
- const char *id,
- EBookCallback cb,
- gpointer closure);
-
-/* Adding cards. */
-gboolean e_book_add_card (EBook *book,
- ECard *card,
- EBookIdCallback cb,
- gpointer closure);
-gboolean e_book_add_vcard (EBook *book,
- const char *vcard,
- EBookIdCallback cb,
- gpointer closure);
-
-/* Modifying cards. */
-gboolean e_book_commit_card (EBook *book,
- ECard *card,
- EBookCallback cb,
- gpointer closure);
-gboolean e_book_commit_vcard (EBook *book,
- const char *vcard,
- EBookCallback cb,
- gpointer closure);
-
-/* Checking to see if we're connected to the card repository. */
-gboolean e_book_check_connection (EBook *book);
-
-gboolean e_book_get_cursor (EBook *book,
- char *query,
- EBookCursorCallback cb,
- gpointer closure);
-
-gboolean e_book_get_book_view (EBook *book,
- char *query,
- EBookBookViewCallback cb,
- gpointer closure);
-
-/* Getting the name of the repository. */
-char *e_book_get_name (EBook *book);
-
-GtkType e_book_get_type (void);
-
-#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.c b/addressbook/backend/ebook/e-card-cursor.c
deleted file mode 100644
index 1618a6ddee..0000000000
--- a/addressbook/backend/ebook/e-card-cursor.c
+++ /dev/null
@@ -1,235 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-card-cursor.c: Implements card cursors.
- *
- * Author:
- * Christopher James Lahey <clahey@helixcode.com.
- */
-
-#include <config.h>
-#include <gtk/gtk.h>
-#include "addressbook.h"
-#include "e-card-cursor.h"
-
-struct _ECardCursorPrivate {
- Evolution_CardCursor corba_cursor;
-};
-
-/*
- * A pointer to our parent object class
- */
-static GtkObjectClass *parent_class;
-
-/*
- * Implemented GtkObject::destroy
- */
-static void
-e_card_cursor_destroy (GtkObject *object)
-{
- ECardCursor *cursor = E_CARD_CURSOR (object);
- CORBA_Environment ev;
-
- CORBA_exception_init (&ev);
-
- Evolution_CardCursor_unref( cursor->priv->corba_cursor, &ev );
-
- if (ev._major != CORBA_NO_EXCEPTION) {
- g_warning("e_card_cursor_destroy: Exception unreffing "
- "corba cursor.\n");
- CORBA_exception_free (&ev);
- CORBA_exception_init (&ev);
- }
-
- CORBA_Object_release (cursor->priv->corba_cursor, &ev);
-
- if (ev._major != CORBA_NO_EXCEPTION) {
- g_warning("e_card_cursor_destroy: Exception releasing "
- "corba cursor.\n");
- }
-
- CORBA_exception_free (&ev);
-
- if ( cursor->priv )
- g_free ( cursor->priv );
-
- GTK_OBJECT_CLASS (parent_class)->destroy (object);
-}
-
-/**
- * e_card_cursor_get_length:
- * @cursor: the #ECardCursor whose length is being queried
- *
- * Returns: the number of items the cursor references, or -1 there's
- * an error.
- */
-long
-e_card_cursor_get_length (ECardCursor *cursor)
-{
- if ( cursor->priv->corba_cursor != CORBA_OBJECT_NIL ) {
- CORBA_Environment ev;
- long ret_val;
-
- CORBA_exception_init (&ev);
-
- ret_val = Evolution_CardCursor_get_length(cursor->priv->corba_cursor, &ev);
-
- if (ev._major != CORBA_NO_EXCEPTION) {
- g_warning("e_card_cursor_get_length: Exception during "
- "get_length corba call.\n");
- ret_val = -1;
- }
-
- CORBA_exception_free (&ev);
-
- return ret_val;
- }
- else
- return -1;
-}
-
-/**
- * e_card_cursor_get_nth:
- * @cursor: an #ECardCursor object
- * @n: the index of the item requested
- *
- * Gets an #ECard based on an index.
- *
- * Returns: a new #ECard on success, or %NULL on failure.
- */
-ECard *
-e_card_cursor_get_nth (ECardCursor *cursor,
- const long n)
-{
- if ( cursor->priv->corba_cursor != CORBA_OBJECT_NIL ) {
- CORBA_Environment en;
- CORBA_char *vcard;
- ECard *card;
-
- CORBA_exception_init (&en);
-
- vcard = Evolution_CardCursor_get_nth(cursor->priv->corba_cursor, n, &en);
-
- if (en._major != CORBA_NO_EXCEPTION) {
- g_warning("e_card_cursor_get_nth: Exception during "
- "get_nth corba call.\n");
- }
-
- CORBA_exception_free (&en);
-
- card = e_card_new (vcard);
-
- CORBA_free(vcard);
-
- return card;
- }
- else
- return e_card_new("");
-}
-
-static void
-e_card_cursor_class_init (ECardCursorClass *klass)
-{
- GtkObjectClass *object_class = (GtkObjectClass *) klass;
-
- parent_class = gtk_type_class (gtk_object_get_type ());
-
- object_class->destroy = e_card_cursor_destroy;
-}
-
-static void
-e_card_cursor_init (ECardCursor *cursor)
-{
- cursor->priv = g_new(ECardCursorPrivate, 1);
- cursor->priv->corba_cursor = CORBA_OBJECT_NIL;
-}
-
-GtkType
-e_card_cursor_get_type (void)
-{
- static GtkType type = 0;
-
- if (!type){
- GtkTypeInfo info = {
- "ECardCursor",
- sizeof (ECardCursor),
- sizeof (ECardCursorClass),
- (GtkClassInitFunc) e_card_cursor_class_init,
- (GtkObjectInitFunc) e_card_cursor_init,
- NULL, /* reserved 1 */
- NULL, /* reserved 2 */
- (GtkClassInitFunc) NULL
- };
-
- type = gtk_type_unique (gtk_object_get_type (), &info);
- }
-
- return type;
-}
-
-/**
- * e_card_cursor_construct:
- * @cursor: an #ECardCursor object
- * @corba_cursor: an #Evolution_CardCursor
- *
- * Wraps an #Evolution_CardCursor object inside the #ECardCursor
- * @cursor object.
- *
- * Returns: a new #ECardCursor on success, or %NULL on failure.
- */
-ECardCursor *
-e_card_cursor_construct (ECardCursor *cursor,
- Evolution_CardCursor corba_cursor)
-{
- CORBA_Environment ev;
- g_return_val_if_fail (cursor != NULL, NULL);
- g_return_val_if_fail (E_IS_CARD_CURSOR (cursor), NULL);
- g_return_val_if_fail (corba_cursor != CORBA_OBJECT_NIL, NULL);
-
- CORBA_exception_init (&ev);
-
- /*
- * Initialize cursor
- */
- cursor->priv->corba_cursor = CORBA_Object_duplicate(corba_cursor, &ev);
-
- if (ev._major != CORBA_NO_EXCEPTION) {
- g_warning("e_card_cursor_construct: Exception duplicating "
- "corba cursor.\n");
- CORBA_exception_free (&ev);
- CORBA_exception_init (&ev);
- }
-
- Evolution_CardCursor_ref(cursor->priv->corba_cursor, &ev);
-
- if (ev._major != CORBA_NO_EXCEPTION) {
- g_warning("e_card_cursor_construct: Exception reffing "
- "corba cursor.\n");
- }
-
- CORBA_exception_free (&ev);
-
- /*
- * Success: return the GtkType we were given
- */
- return cursor;
-}
-
-/**
- * e_card_cursor_new:
- * @cursor: the #Evolution_CardCursor to be wrapped
- *
- * Creates a new #ECardCursor, which wraps an #Evolution_CardCursor
- * object.
- *
- * Returns: a new #ECardCursor on success, or %NULL on failure.
- */
-ECardCursor *
-e_card_cursor_new (Evolution_CardCursor corba_cursor)
-{
- ECardCursor *cursor;
-
- cursor = gtk_type_new (e_card_cursor_get_type ());
-
- return e_card_cursor_construct (cursor,
- corba_cursor);
-}
diff --git a/addressbook/backend/ebook/e-card-cursor.h b/addressbook/backend/ebook/e-card-cursor.h
deleted file mode 100644
index 67020071d1..0000000000
--- a/addressbook/backend/ebook/e-card-cursor.h
+++ /dev/null
@@ -1,52 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- *
- * Author:
- * Nat Friedman (nat@helixcode.com)
- *
- * Copyright 2000, Helix Code, Inc.
- */
-
-#ifndef __E_CARD_CURSOR_H__
-#define __E_CARD_CURSOR_H__
-
-#include <libgnome/gnome-defs.h>
-#include <gtk/gtk.h>
-#include <ebook/addressbook.h>
-#include <ebook/e-card.h>
-
-BEGIN_GNOME_DECLS
-
-typedef struct _ECardCursor ECardCursor;
-typedef struct _ECardCursorPrivate ECardCursorPrivate;
-typedef struct _ECardCursorClass ECardCursorClass;
-
-struct _ECardCursor {
- GtkObject parent;
- ECardCursorPrivate *priv;
-};
-
-struct _ECardCursorClass {
- GtkObjectClass parent;
-};
-
-/* Creating a new addressbook. */
-ECardCursor *e_card_cursor_new (Evolution_CardCursor corba_cursor);
-ECardCursor *e_card_cursor_construct (ECardCursor *cursor,
- Evolution_CardCursor corba_cursor);
-
-GtkType e_card_cursor_get_type (void);
-
-/* Fetching cards. */
-long e_card_cursor_get_length (ECardCursor *cursor);
-ECard *e_card_cursor_get_nth (ECardCursor *cursor,
- const long 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-iterator.c b/addressbook/backend/ebook/e-card-iterator.c
deleted file mode 100644
index b5a023b5c1..0000000000
--- a/addressbook/backend/ebook/e-card-iterator.c
+++ /dev/null
@@ -1,169 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * Authors:
- * Christopher James Lahey <clahey@umich.edu>
- *
- * Copyright (C) 2000 Helix Code, Inc.
- * Copyright (C) 1999 The Free Software Foundation
- */
-
-#include <config.h>
-#include <gtk/gtk.h>
-
-#include "e-card-iterator.h"
-
-#define ECI_CLASS(object) (E_CARD_ITERATOR_CLASS(GTK_OBJECT((object))->klass))
-
-static void e_card_iterator_init (ECardIterator *card);
-static void e_card_iterator_class_init (ECardIteratorClass *klass);
-
-#define PARENT_TYPE (gtk_object_get_type ())
-
-static GtkObjectClass *parent_class;
-
-enum {
- INVALIDATE,
- LAST_SIGNAL
-};
-
-static guint e_card_iterator_signals [LAST_SIGNAL] = { 0, };
-
-/**
- * e_card_iterator_get_type:
- * @void:
- *
- * Registers the &ECardIterator class if necessary, and returns the type ID
- * associated to it.
- *
- * Return value: The type ID of the &ECardIterator class.
- **/
-GtkType
-e_card_iterator_get_type (void)
-{
- static GtkType type = 0;
-
- if (!type) {
- GtkTypeInfo info = {
- "ECardIterator",
- sizeof (ECardIterator),
- sizeof (ECardIteratorClass),
- (GtkClassInitFunc) e_card_iterator_class_init,
- (GtkObjectInitFunc) e_card_iterator_init,
- NULL, /* reserved_1 */
- NULL, /* reserved_2 */
- (GtkClassInitFunc) NULL
- };
-
- type = gtk_type_unique (PARENT_TYPE, &info);
- }
-
- return type;
-}
-
-static void
-e_card_iterator_class_init (ECardIteratorClass *klass)
-{
- GtkObjectClass *object_class;
-
- object_class = GTK_OBJECT_CLASS(klass);
-
- parent_class = gtk_type_class (PARENT_TYPE);
-
- e_card_iterator_signals [INVALIDATE] =
- gtk_signal_new ("invalidate",
- GTK_RUN_LAST,
- object_class->type,
- GTK_SIGNAL_OFFSET (ECardIteratorClass, invalidate),
- gtk_marshal_NONE__NONE,
- GTK_TYPE_NONE, 0);
-
- gtk_object_class_add_signals (object_class, e_card_iterator_signals, LAST_SIGNAL);
-
- klass->invalidate = NULL;
- klass->get = NULL;
- klass->reset = NULL;
- klass->next = NULL;
- klass->prev = NULL;
- klass->delete = NULL;
- klass->set = NULL;
- klass->is_valid = NULL;
-}
-
-/**
- * e_card_iterator_init:
- */
-static void
-e_card_iterator_init (ECardIterator *card)
-{
-}
-
-/*
- * Virtual functions:
- */
-const void *
-e_card_iterator_get (ECardIterator *iterator)
-{
- if (ECI_CLASS(iterator)->get)
- return ECI_CLASS(iterator)->get(iterator);
- else
- return NULL;
-}
-
-void
-e_card_iterator_reset (ECardIterator *iterator)
-{
- if (ECI_CLASS(iterator)->reset)
- ECI_CLASS(iterator)->reset(iterator);
-}
-
-gboolean
-e_card_iterator_next (ECardIterator *iterator)
-{
- if (ECI_CLASS(iterator)->next)
- return ECI_CLASS(iterator)->next(iterator);
- else
- return FALSE;
-}
-
-gboolean
-e_card_iterator_prev (ECardIterator *iterator)
-{
- if (ECI_CLASS(iterator)->prev)
- return ECI_CLASS(iterator)->prev(iterator);
- else
- return FALSE;
-}
-
-void
-e_card_iterator_delete (ECardIterator *iterator)
-{
- if (ECI_CLASS(iterator)->delete)
- ECI_CLASS(iterator)->delete(iterator);
-}
-
-void
-e_card_iterator_set (ECardIterator *iterator,
- const void *object)
-{
- if (ECI_CLASS(iterator)->set)
- ECI_CLASS(iterator)->set(iterator, object);
-}
-
-gboolean
-e_card_iterator_is_valid (ECardIterator *iterator)
-{
- if (ECI_CLASS(iterator)->is_valid)
- return ECI_CLASS(iterator)->is_valid(iterator);
- else
- return FALSE;
-}
-
-void
-e_card_iterator_invalidate (ECardIterator *iterator)
-{
- g_return_if_fail (iterator != NULL);
- g_return_if_fail (E_IS_CARD_ITERATOR (iterator));
-
- gtk_signal_emit (GTK_OBJECT (iterator),
- e_card_iterator_signals [INVALIDATE]);
-}
diff --git a/addressbook/backend/ebook/e-card-iterator.h b/addressbook/backend/ebook/e-card-iterator.h
deleted file mode 100644
index 9d657e03ef..0000000000
--- a/addressbook/backend/ebook/e-card-iterator.h
+++ /dev/null
@@ -1,61 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * Authors:
- * Chris Lahey <clahey@helixcode.com>
- *
- * Copyright (C) 2000 Helix Code, Inc.
- * Copyright (C) 1999 The Free Software Foundation
- */
-
-#ifndef __E_CARD_ITERATOR_H__
-#define __E_CARD_ITERATOR_H__
-
-#include <time.h>
-#include <gtk/gtk.h>
-#include <stdio.h>
-
-#define E_TYPE_CARD_ITERATOR (e_card_iterator_get_type ())
-#define E_CARD_ITERATOR(obj) (GTK_CHECK_CAST ((obj), E_TYPE_CARD_ITERATOR, ECardIterator))
-#define E_CARD_ITERATOR_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), E_TYPE_CARD_ITERATOR, ECardIteratorClass))
-#define E_IS_CARD_ITERATOR(obj) (GTK_CHECK_TYPE ((obj), E_TYPE_CARD_ITERATOR))
-#define E_IS_CARD_ITERATOR_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), E_TYPE_CARD_ITERATOR))
-
-typedef struct _ECardIterator ECardIterator;
-typedef struct _ECardIteratorClass ECardIteratorClass;
-
-struct _ECardIterator {
- GtkObject object;
-};
-
-struct _ECardIteratorClass {
- GtkObjectClass parent_class;
-
- /* Signals */
- void (*invalidate) (ECardIterator *iterator);
-
- /* Virtual functions */
- const void * (*get) (ECardIterator *iterator);
- void (*reset) (ECardIterator *iterator);
- gboolean (*next) (ECardIterator *iterator);
- gboolean (*prev) (ECardIterator *iterator);
- void (*delete) (ECardIterator *iterator);
- void (*set) (ECardIterator *iterator,
- const void *object);
- gboolean (*is_valid) (ECardIterator *iterator);
-};
-
-const void *e_card_iterator_get (ECardIterator *iterator);
-void e_card_iterator_reset (ECardIterator *iterator);
-gboolean e_card_iterator_next (ECardIterator *iterator);
-gboolean e_card_iterator_prev (ECardIterator *iterator);
-void e_card_iterator_delete (ECardIterator *iterator);
-void e_card_iterator_set (ECardIterator *iterator,
- const void *object);
-gboolean e_card_iterator_is_valid (ECardIterator *iterator);
-
-void e_card_iterator_invalidate (ECardIterator *iterator);
-
-/* Standard Gtk function */
-GtkType e_card_iterator_get_type (void);
-
-#endif /* ! __E_CARD_ITERATOR_H__ */
diff --git a/addressbook/backend/ebook/e-card-list-iterator.c b/addressbook/backend/ebook/e-card-list-iterator.c
deleted file mode 100644
index d23060fda2..0000000000
--- a/addressbook/backend/ebook/e-card-list-iterator.c
+++ /dev/null
@@ -1,199 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * Authors:
- * Christopher James Lahey <clahey@umich.edu>
- *
- * Copyright (C) 2000 Helix Code, Inc.
- * Copyright (C) 1999 The Free Software Foundation
- */
-
-#include <config.h>
-#include <gtk/gtk.h>
-
-#include "e-card-list-iterator.h"
-#include "e-card-list.h"
-
-static void e_card_list_iterator_init (ECardListIterator *card);
-static void e_card_list_iterator_class_init (ECardListIteratorClass *klass);
-
-static void e_card_list_iterator_invalidate (ECardIterator *iterator);
-static gboolean e_card_list_iterator_is_valid (ECardIterator *iterator);
-static void e_card_list_iterator_set (ECardIterator *iterator,
- const void *object);
-static void e_card_list_iterator_delete (ECardIterator *iterator);
-static gboolean e_card_list_iterator_prev (ECardIterator *iterator);
-static gboolean e_card_list_iterator_next (ECardIterator *iterator);
-static void e_card_list_iterator_reset (ECardIterator *iterator);
-static const void *e_card_list_iterator_get (ECardIterator *iterator);
-static void e_card_list_iterator_destroy (GtkObject *object);
-
-#define PARENT_TYPE (e_card_iterator_get_type ())
-
-static GtkObjectClass *parent_class;
-#define PARENT_CLASS (E_CARD_LIST_ITERATOR_CLASS(parent_class))
-
-/**
- * e_card_list_iterator_get_type:
- * @void:
- *
- * Registers the &ECardListIterator class if necessary, and returns the type ID
- * associated to it.
- *
- * Return value: The type ID of the &ECardListIterator class.
- **/
-GtkType
-e_card_list_iterator_get_type (void)
-{
- static GtkType type = 0;
-
- if (!type) {
- GtkTypeInfo info = {
- "ECardListIterator",
- sizeof (ECardListIterator),
- sizeof (ECardListIteratorClass),
- (GtkClassInitFunc) e_card_list_iterator_class_init,
- (GtkObjectInitFunc) e_card_list_iterator_init,
- NULL, /* reserved_1 */
- NULL, /* reserved_2 */
- (GtkClassInitFunc) NULL
- };
-
- type = gtk_type_unique (PARENT_TYPE, &info);
- }
-
- return type;
-}
-
-static void
-e_card_list_iterator_class_init (ECardListIteratorClass *klass)
-{
- GtkObjectClass *object_class;
- ECardIteratorClass *iterator_class;
-
- object_class = GTK_OBJECT_CLASS(klass);
- iterator_class = E_CARD_ITERATOR_CLASS(klass);
-
- parent_class = gtk_type_class (PARENT_TYPE);
-
- object_class->destroy = e_card_list_iterator_destroy;
-
- iterator_class->invalidate = e_card_list_iterator_invalidate;
- iterator_class->get = e_card_list_iterator_get;
- iterator_class->reset = e_card_list_iterator_reset;
- iterator_class->next = e_card_list_iterator_next;
- iterator_class->prev = e_card_list_iterator_prev;
- iterator_class->delete = e_card_list_iterator_delete;
- iterator_class->set = e_card_list_iterator_set;
- iterator_class->is_valid = e_card_list_iterator_is_valid;
-}
-
-
-
-/**
- * e_card_list_iterator_init:
- */
-static void
-e_card_list_iterator_init (ECardListIterator *card)
-{
-}
-
-ECardIterator *
-e_card_list_iterator_new (ECardList *list)
-{
- ECardListIterator *iterator = gtk_type_new(e_card_list_iterator_get_type());
-
- iterator->list = list;
- gtk_object_ref(GTK_OBJECT(list));
- iterator->iterator = list->list;
-
- return E_CARD_ITERATOR(iterator);
-}
-
-/*
- * Virtual functions:
- */
-static void
-e_card_list_iterator_destroy (GtkObject *object)
-{
- ECardListIterator *iterator = E_CARD_LIST_ITERATOR(object);
- e_card_list_remove_iterator(iterator->list, E_CARD_ITERATOR(iterator));
- gtk_object_unref(GTK_OBJECT(iterator->list));
-}
-
-static const void *
-e_card_list_iterator_get (ECardIterator *_iterator)
-{
- ECardListIterator *iterator = E_CARD_LIST_ITERATOR(_iterator);
- if (iterator->iterator)
- return iterator->iterator->data;
- else
- return NULL;
-}
-
-static void
-e_card_list_iterator_reset (ECardIterator *_iterator)
-{
- ECardListIterator *iterator = E_CARD_LIST_ITERATOR(_iterator);
- iterator->iterator = iterator->list->list;
-}
-
-static gboolean
-e_card_list_iterator_next (ECardIterator *_iterator)
-{
- ECardListIterator *iterator = E_CARD_LIST_ITERATOR(_iterator);
- if (iterator->iterator)
- iterator->iterator = g_list_next(iterator->iterator);
- return (iterator->iterator != NULL);
-}
-
-static gboolean
-e_card_list_iterator_prev (ECardIterator *_iterator)
-{
- ECardListIterator *iterator = E_CARD_LIST_ITERATOR(_iterator);
- if (iterator->iterator)
- iterator->iterator = g_list_previous(iterator->iterator);
- return (iterator->iterator != NULL);
-}
-
-static void
-e_card_list_iterator_delete (ECardIterator *_iterator)
-{
- ECardListIterator *iterator = E_CARD_LIST_ITERATOR(_iterator);
- if (iterator->iterator) {
- GList *temp = iterator->iterator->next;
- if (iterator->list->free)
- iterator->list->free(iterator->iterator->data, iterator->list->closure);
- iterator->list->list = g_list_remove_link(iterator->list->list, iterator->iterator);
- iterator->iterator = temp;
- e_card_list_invalidate_iterators(iterator->list, E_CARD_ITERATOR(iterator));
- }
-}
-
-static void
-e_card_list_iterator_set (ECardIterator *_iterator,
- const void *object)
-{
- ECardListIterator *iterator = E_CARD_LIST_ITERATOR(_iterator);
- if (iterator->iterator) {
- if (iterator->list->free)
- iterator->list->free(iterator->iterator->data, iterator->list->closure);
- if (iterator->list->copy)
- iterator->iterator->data = iterator->list->copy(object, iterator->list->closure);
- else
- iterator->iterator->data = (void *) object;
- }
-}
-
-static gboolean
-e_card_list_iterator_is_valid (ECardIterator *_iterator)
-{
- ECardListIterator *iterator = E_CARD_LIST_ITERATOR(_iterator);
- return iterator->iterator != NULL;
-}
-
-static void
-e_card_list_iterator_invalidate (ECardIterator *_iterator)
-{
- ECardListIterator *iterator = E_CARD_LIST_ITERATOR(_iterator);
- iterator->iterator = NULL;
-}
diff --git a/addressbook/backend/ebook/e-card-list-iterator.h b/addressbook/backend/ebook/e-card-list-iterator.h
deleted file mode 100644
index 38a7d77f21..0000000000
--- a/addressbook/backend/ebook/e-card-list-iterator.h
+++ /dev/null
@@ -1,44 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * Authors:
- * Chris Lahey <clahey@helixcode.com>
- *
- * Copyright (C) 2000 Helix Code, Inc.
- * Copyright (C) 1999 The Free Software Foundation
- */
-
-#ifndef __E_CARD_LIST_ITERATOR_H__
-#define __E_CARD_LIST_ITERATOR_H__
-
-#include <time.h>
-#include <gtk/gtk.h>
-#include <stdio.h>
-#include <ebook/e-card-iterator.h>
-#include <ebook/e-card-list.h>
-
-#define E_TYPE_CARD_LIST_ITERATOR (e_card_list_iterator_get_type ())
-#define E_CARD_LIST_ITERATOR(obj) (GTK_CHECK_CAST ((obj), E_TYPE_CARD_LIST_ITERATOR, ECardListIterator))
-#define E_CARD_LIST_ITERATOR_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), E_TYPE_CARD_LIST_ITERATOR, ECardListIteratorClass))
-#define E_IS_CARD_LIST_ITERATOR(obj) (GTK_CHECK_TYPE ((obj), E_TYPE_CARD_LIST_ITERATOR))
-#define E_IS_CARD_LIST_ITERATOR_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), E_TYPE_CARD_LIST_ITERATOR))
-
-typedef struct _ECardListIterator ECardListIterator;
-typedef struct _ECardListIteratorClass ECardListIteratorClass;
-
-struct _ECardListIterator {
- ECardIterator parent;
-
- ECardList *list;
- GList *iterator;
-};
-
-struct _ECardListIteratorClass {
- ECardIteratorClass parent_class;
-};
-
-ECardIterator *e_card_list_iterator_new (ECardList *list);
-
-/* Standard Gtk function */
-GtkType e_card_list_iterator_get_type (void);
-
-#endif /* ! __E_CARD_LIST_ITERATOR_H__ */
diff --git a/addressbook/backend/ebook/e-card-list.c b/addressbook/backend/ebook/e-card-list.c
deleted file mode 100644
index e912de7b6e..0000000000
--- a/addressbook/backend/ebook/e-card-list.c
+++ /dev/null
@@ -1,140 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * Authors:
- * Christopher James Lahey <clahey@umich.edu>
- *
- * Copyright (C) 2000 Helix Code, Inc.
- * Copyright (C) 1999 The Free Software Foundation
- */
-
-#include <config.h>
-#include <gtk/gtk.h>
-
-#include "e-card-list.h"
-#include "e-card-list-iterator.h"
-
-#define ECL_CLASS(object) (E_CARD_LIST_CLASS(GTK_OBJECT((object))->klass))
-
-static void e_card_list_init (ECardList *card);
-static void e_card_list_class_init (ECardListClass *klass);
-static void e_card_list_destroy (GtkObject *object);
-
-#define PARENT_TYPE (gtk_object_get_type ())
-
-static GtkObjectClass *parent_class;
-
-/**
- * e_card_list_get_type:
- * @void:
- *
- * Registers the &ECardList class if necessary, and returns the type ID
- * associated to it.
- *
- * Return value: The type ID of the &ECardList class.
- **/
-GtkType
-e_card_list_get_type (void)
-{
- static GtkType type = 0;
-
- if (!type) {
- GtkTypeInfo info = {
- "ECardList",
- sizeof (ECardList),
- sizeof (ECardListClass),
- (GtkClassInitFunc) e_card_list_class_init,
- (GtkObjectInitFunc) e_card_list_init,
- NULL, /* reserved_1 */
- NULL, /* reserved_2 */
- (GtkClassInitFunc) NULL
- };
-
- type = gtk_type_unique (PARENT_TYPE, &info);
- }
-
- return type;
-}
-
-static void
-e_card_list_class_init (ECardListClass *klass)
-{
- GtkObjectClass *object_class;
-
- object_class = GTK_OBJECT_CLASS(klass);
-
- parent_class = gtk_type_class (PARENT_TYPE);
-
- object_class->destroy = e_card_list_destroy;
-}
-
-/**
- * e_card_list_init:
- */
-static void
-e_card_list_init (ECardList *list)
-{
- list->list = NULL;
- list->iterators = NULL;
-}
-
-ECardList *
-e_card_list_new (ECardListCopyFunc copy, ECardListFreeFunc free, void *closure)
-{
- ECardList *list = gtk_type_new(e_card_list_get_type());
- list->copy = copy;
- list->free = free;
- list->closure = closure;
- return list;
-}
-
-ECardIterator *
-e_card_list_get_iterator (ECardList *list)
-{
- ECardIterator *iterator = e_card_list_iterator_new(list);
- list->iterators = g_list_append(list->iterators, iterator);
- return iterator;
-}
-
-int
-e_card_list_length (ECardList *list)
-{
- return g_list_length(list->list);
-}
-
-void
-e_card_list_append (ECardList *list, const void *data)
-{
- e_card_list_invalidate_iterators(list, NULL);
- if (list->copy)
- list->list = g_list_append(list->list, list->copy(data, list->closure));
- else
- list->list = g_list_append(list->list, (void *) data);
-}
-
-void
-e_card_list_invalidate_iterators (ECardList *list, ECardIterator *skip)
-{
- GList *iterators = list->iterators;
- for (; iterators; iterators = iterators->next) {
- if (iterators->data != skip) {
- e_card_iterator_invalidate(E_CARD_ITERATOR(iterators->data));
- }
- }
-}
-
-void
-e_card_list_remove_iterator (ECardList *list, ECardIterator *iterator)
-{
- list->iterators = g_list_remove(list->iterators, iterator);
-}
-
-/*
- * Virtual functions
- */
-static void
-e_card_list_destroy (GtkObject *object)
-{
- ECardList *list = E_CARD_LIST(object);
- g_list_foreach(list->list, (GFunc) list->free, list->closure);
- g_list_free(list->list);
-}
diff --git a/addressbook/backend/ebook/e-card-list.h b/addressbook/backend/ebook/e-card-list.h
deleted file mode 100644
index 0a4a5bf105..0000000000
--- a/addressbook/backend/ebook/e-card-list.h
+++ /dev/null
@@ -1,60 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * Authors:
- * Chris Lahey <clahey@helixcode.com>
- *
- * Copyright (C) 2000 Helix Code, Inc.
- * Copyright (C) 1999 The Free Software Foundation
- */
-
-#ifndef __E_CARD_LIST_H__
-#define __E_CARD_LIST_H__
-
-#include <time.h>
-#include <gtk/gtk.h>
-#include <stdio.h>
-#include <ebook/e-card-iterator.h>
-
-#define E_TYPE_CARD_LIST (e_card_list_get_type ())
-#define E_CARD_LIST(obj) (GTK_CHECK_CAST ((obj), E_TYPE_CARD_LIST, ECardList))
-#define E_CARD_LIST_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), E_TYPE_CARD_LIST, ECardListClass))
-#define E_IS_CARD_LIST(obj) (GTK_CHECK_TYPE ((obj), E_TYPE_CARD_LIST))
-#define E_IS_CARD_LIST_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), E_TYPE_CARD_LIST))
-
-typedef void *(*ECardListCopyFunc) (const void *data, void *closure);
-typedef void (*ECardListFreeFunc) (void *data, void *closure);
-
-typedef struct _ECardList ECardList;
-typedef struct _ECardListClass ECardListClass;
-
-struct _ECardList {
- GtkObject object;
- GList *list;
- GList *iterators;
- ECardListCopyFunc copy;
- ECardListFreeFunc free;
- void *closure;
-};
-
-struct _ECardListClass {
- GtkObjectClass parent_class;
-};
-
-ECardList *e_card_list_new (ECardListCopyFunc copy,
- ECardListFreeFunc free,
- void *closure);
-ECardIterator *e_card_list_get_iterator (ECardList *list);
-void e_card_list_append (ECardList *list,
- const void *data);
-int e_card_list_length (ECardList *list);
-
-/* For iterators to call. */
-void e_card_list_invalidate_iterators (ECardList *list,
- ECardIterator *skip);
-void e_card_list_remove_iterator (ECardList *list,
- ECardIterator *iterator);
-
-/* Standard Gtk function */
-GtkType e_card_list_get_type (void);
-
-#endif /* ! __E_CARD_LIST_H__ */
diff --git a/addressbook/backend/ebook/e-card-pairs.h b/addressbook/backend/ebook/e-card-pairs.h
deleted file mode 100644
index 0f379d3477..0000000000
--- a/addressbook/backend/ebook/e-card-pairs.h
+++ /dev/null
@@ -1,118 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* GnomeCard - a graphical contact manager.
- *
- * pairs.h: This file is part of GnomeCard.
- *
- * Copyright (C) 1999 The Free Software Foundation
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-#ifndef __E_CARD_PAIRS_H__
-#define __E_CARD_PAIRS_H__
-
-#include <libversit/vcc.h>
-#include <ebook/e-card.h>
-
-
-#if 0
-struct pair
-{
- char *str;
- ECardPropertyType i ;
-};
-
-struct pair prop_lookup[] = {
- { VCFullNameProp, PROP_FNAME },
- { VCNameProp, PROP_NAME },
- { VCPhotoProp, PROP_PHOTO },
- { VCBirthDateProp, PROP_BDAY },
- { VCAdrProp, PROP_DELADDR },
- { VCDeliveryLabelProp, PROP_DELLABEL },
- { VCTelephoneProp, PROP_PHONE },
- { VCEmailAddressProp, PROP_EMAIL },
- { VCMailerProp, PROP_MAILER },
- { VCTimeZoneProp, PROP_TIMEZN },
- { VCGeoProp, PROP_GEOPOS },
- { VCTitleProp, PROP_TITLE },
- { VCBusinessRoleProp, PROP_ROLE },
- { VCLogoProp, PROP_LOGO },
- { VCAgentProp, PROP_AGENT },
- { VCOrgProp, PROP_ORG },
- { VCCategoriesProp, PROP_CATEGORIES },
- { VCCommentProp, PROP_COMMENT },
- { VCLastRevisedProp, PROP_REV },
- { VCPronunciationProp, PROP_SOUND },
- { VCURLProp, PROP_URL },
- { VCUniqueStringProp, PROP_UID },
- { VCVersionProp, PROP_VERSION },
- { VCPublicKeyProp, PROP_KEY },
- { VCValueProp, PROP_VALUE },
- { VCEncodingProp, PROP_ENCODING },
- { VCQuotedPrintableProp, PROP_QUOTED_PRINTABLE },
- { VC8bitProp, PROP_8BIT },
- { VCBase64Prop, PROP_BASE64 },
- { VCLanguageProp, PROP_LANG },
- { VCCharSetProp, PROP_CHARSET },
- { NULL, PROP_NONE} };
-
-struct pair photo_pairs[] = {
- { VCGIFProp, PHOTO_GIF },
- { VCCGMProp, PHOTO_CGM },
- { VCWMFProp, PHOTO_WMF },
- { VCBMPProp, PHOTO_BMP },
- { VCMETProp, PHOTO_MET },
- { VCPMBProp, PHOTO_PMB },
- { VCDIBProp, PHOTO_DIB },
- { VCPICTProp, PHOTO_PICT },
- { VCTIFFProp, PHOTO_TIFF },
- { VCPDFProp, PHOTO_PDF },
- { VCPSProp, PHOTO_PS },
- { VCJPEGProp, PHOTO_JPEG },
- { VCMPEGProp, PHOTO_MPEG },
- { VCMPEG2Prop, PHOTO_MPEG2 },
- { VCAVIProp, PHOTO_AVI },
- { VCQuickTimeProp, PHOTO_QTIME },
- { NULL, 0 } };
-
-struct pair email_pairs[] = {
- { VCAOLProp, EMAIL_AOL },
- { VCAppleLinkProp, EMAIL_APPLE_LINK },
- { VCATTMailProp, EMAIL_ATT },
- { VCCISProp, EMAIL_CIS },
- { VCEWorldProp, EMAIL_EWORLD },
- { VCInternetProp, EMAIL_INET },
- { VCIBMMailProp, EMAIL_IBM },
- { VCMCIMailProp, EMAIL_MCI },
- { VCPowerShareProp, EMAIL_POWERSHARE },
- { VCProdigyProp, EMAIL_PRODIGY },
- { VCTLXProp, EMAIL_TLX },
- { VCX400Prop, EMAIL_X400 },
- { NULL, 0 } };
-
-struct pair sound_pairs[] = {
- { VCAIFFProp, SOUND_AIFF },
- { VCPCMProp, SOUND_PCM },
- { VCWAVEProp, SOUND_WAVE },
- { NULL, 0 } };
-
-struct pair key_pairs[] = {
- { VCX509Prop, KEY_X509 },
- { VCPGPProp, KEY_PGP },
- { NULL, 0 } };
-
-
-#endif
-#endif /* ! __E_CARD_PAIRS_H__ */
diff --git a/addressbook/backend/ebook/e-card-simple.c b/addressbook/backend/ebook/e-card-simple.c
deleted file mode 100644
index 8d2a0f44b4..0000000000
--- a/addressbook/backend/ebook/e-card-simple.c
+++ /dev/null
@@ -1,1185 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * Authors:
- * Chris Lahey <clahey@helixcode.com>
- * Arturo Espinosa (arturo@nuclecu.unam.mx)
- * Nat Friedman (nat@helixcode.com)
- *
- * Copyright (C) 2000 Helix Code, Inc.
- * Copyright (C) 1999 The Free Software Foundation
- */
-
-#include <config.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <gtk/gtk.h>
-
-#include <libversit/vcc.h>
-#include "e-card-simple.h"
-
-/* Object argument IDs */
-enum {
- ARG_0,
- ARG_CARD,
-#if 0
- ARG_FILE_AS,
- ARG_FULL_NAME,
- ARG_NAME,
- ARG_ADDRESS,
- ARG_ADDRESS_LABEL,
- ARG_PHONE,
- ARG_EMAIL,
- ARG_BIRTH_DATE,
- ARG_URL,
- ARG_ORG,
- ARG_ORG_UNIT,
- ARG_OFFICE,
- ARG_TITLE,
- ARG_ROLE,
- ARG_MANAGER,
- ARG_ASSISTANT,
- ARG_NICKNAME,
- ARG_SPOUSE,
- ARG_ANNIVERSARY,
- ARG_FBURL,
- ARG_NOTE,
- ARG_ID
-#endif
-};
-
-
-typedef enum _ECardSimpleInternalType ECardSimpleInternalType;
-typedef struct _ECardSimpleFieldData ECardSimpleFieldData;
-
-enum _ECardSimpleInternalType {
- E_CARD_SIMPLE_INTERNAL_TYPE_STRING,
- E_CARD_SIMPLE_INTERNAL_TYPE_DATE,
- E_CARD_SIMPLE_INTERNAL_TYPE_ADDRESS,
- E_CARD_SIMPLE_INTERNAL_TYPE_PHONE,
- E_CARD_SIMPLE_INTERNAL_TYPE_EMAIL,
-};
-
-struct _ECardSimpleFieldData {
- ECardSimpleField field;
- char *ecard_field;
- char *name;
- char *short_name;
- int list_type_index;
- ECardSimpleInternalType type;
-};
-
-/* This order must match the order in the .h. */
-
-static ECardSimpleFieldData field_data[] =
-{
- { E_CARD_SIMPLE_FIELD_FILE_AS, "file_as", "File As", "", 0, E_CARD_SIMPLE_INTERNAL_TYPE_STRING },
- { E_CARD_SIMPLE_FIELD_FULL_NAME, "full_name", "Name", "Name", 0, E_CARD_SIMPLE_INTERNAL_TYPE_STRING },
- { E_CARD_SIMPLE_FIELD_EMAIL, "", "Email", "Email", E_CARD_SIMPLE_EMAIL_ID_EMAIL, E_CARD_SIMPLE_INTERNAL_TYPE_EMAIL },
- { E_CARD_SIMPLE_FIELD_PHONE_PRIMARY, "", "Primary", "Prim", E_CARD_SIMPLE_PHONE_ID_PRIMARY, E_CARD_SIMPLE_INTERNAL_TYPE_PHONE },
- { E_CARD_SIMPLE_FIELD_PHONE_BUSINESS, "", "Business", "Bus", E_CARD_SIMPLE_PHONE_ID_BUSINESS, E_CARD_SIMPLE_INTERNAL_TYPE_PHONE },
- { E_CARD_SIMPLE_FIELD_PHONE_HOME, "", "Home", "Home", E_CARD_SIMPLE_PHONE_ID_HOME, E_CARD_SIMPLE_INTERNAL_TYPE_PHONE },
- { E_CARD_SIMPLE_FIELD_ORG, "org", "Organization", "Org", 0, E_CARD_SIMPLE_INTERNAL_TYPE_STRING },
- { E_CARD_SIMPLE_FIELD_ADDRESS_BUSINESS, "", "Business", "Bus", E_CARD_SIMPLE_ADDRESS_ID_BUSINESS, E_CARD_SIMPLE_INTERNAL_TYPE_ADDRESS },
- { E_CARD_SIMPLE_FIELD_ADDRESS_HOME, "", "Home", "Home", E_CARD_SIMPLE_ADDRESS_ID_HOME, E_CARD_SIMPLE_INTERNAL_TYPE_ADDRESS },
- { E_CARD_SIMPLE_FIELD_PHONE_MOBILE, "", "Mobile", "Mobile", E_CARD_SIMPLE_PHONE_ID_MOBILE, E_CARD_SIMPLE_INTERNAL_TYPE_PHONE },
- { E_CARD_SIMPLE_FIELD_PHONE_CAR, "", "Car", "Car", E_CARD_SIMPLE_PHONE_ID_CAR, E_CARD_SIMPLE_INTERNAL_TYPE_PHONE },
- { E_CARD_SIMPLE_FIELD_PHONE_BUSINESS_FAX, "", "Business Fax", "Bus Fax", E_CARD_SIMPLE_PHONE_ID_BUSINESS_FAX, E_CARD_SIMPLE_INTERNAL_TYPE_PHONE },
- { E_CARD_SIMPLE_FIELD_PHONE_HOME_FAX, "", "Home Fax", "Home Fax", E_CARD_SIMPLE_PHONE_ID_HOME_FAX, E_CARD_SIMPLE_INTERNAL_TYPE_PHONE },
- { E_CARD_SIMPLE_FIELD_PHONE_BUSINESS_2, "", "Business 2", "Bus 2", E_CARD_SIMPLE_PHONE_ID_BUSINESS_2, E_CARD_SIMPLE_INTERNAL_TYPE_PHONE },
- { E_CARD_SIMPLE_FIELD_PHONE_HOME_2, "", "Home 2", "Home 2", E_CARD_SIMPLE_PHONE_ID_HOME_2, E_CARD_SIMPLE_INTERNAL_TYPE_PHONE },
- { E_CARD_SIMPLE_FIELD_PHONE_ISDN, "", "ISDN", "ISDN", E_CARD_SIMPLE_PHONE_ID_ISDN, E_CARD_SIMPLE_INTERNAL_TYPE_PHONE },
- { E_CARD_SIMPLE_FIELD_PHONE_OTHER, "", "Other", "Other", E_CARD_SIMPLE_PHONE_ID_OTHER, E_CARD_SIMPLE_INTERNAL_TYPE_PHONE },
- { E_CARD_SIMPLE_FIELD_PHONE_PAGER, "", "Pager", "Pager", E_CARD_SIMPLE_PHONE_ID_PAGER, E_CARD_SIMPLE_INTERNAL_TYPE_PHONE },
- { E_CARD_SIMPLE_FIELD_ADDRESS_OTHER, "", "Other", "Other", E_CARD_SIMPLE_ADDRESS_ID_OTHER, E_CARD_SIMPLE_INTERNAL_TYPE_ADDRESS },
- { E_CARD_SIMPLE_FIELD_EMAIL_2, "", "Email 2", "Email 2", E_CARD_SIMPLE_EMAIL_ID_EMAIL_2, E_CARD_SIMPLE_INTERNAL_TYPE_EMAIL },
- { E_CARD_SIMPLE_FIELD_EMAIL_3, "", "Email 3", "Email 3", E_CARD_SIMPLE_EMAIL_ID_EMAIL_3, E_CARD_SIMPLE_INTERNAL_TYPE_EMAIL },
- { E_CARD_SIMPLE_FIELD_URL, "url", "Web Site", "Url", 0, E_CARD_SIMPLE_INTERNAL_TYPE_STRING },
- { E_CARD_SIMPLE_FIELD_ORG_UNIT, "org_unit", "Department", "Dep", 0, E_CARD_SIMPLE_INTERNAL_TYPE_STRING },
- { E_CARD_SIMPLE_FIELD_OFFICE, "office", "Office", "Off", 0, E_CARD_SIMPLE_INTERNAL_TYPE_STRING },
- { E_CARD_SIMPLE_FIELD_TITLE, "title", "Title", "Title", 0, E_CARD_SIMPLE_INTERNAL_TYPE_STRING },
- { E_CARD_SIMPLE_FIELD_ROLE, "role", "Profession", "Prof", 0, E_CARD_SIMPLE_INTERNAL_TYPE_STRING },
- { E_CARD_SIMPLE_FIELD_MANAGER, "manager", "Manager", "Man", 0, E_CARD_SIMPLE_INTERNAL_TYPE_STRING },
- { E_CARD_SIMPLE_FIELD_ASSISTANT, "assistant", "Assistant", "Ass", 0, E_CARD_SIMPLE_INTERNAL_TYPE_STRING },
- { E_CARD_SIMPLE_FIELD_NICKNAME, "nickname", "Nickname", "Nick", 0, E_CARD_SIMPLE_INTERNAL_TYPE_STRING },
- { E_CARD_SIMPLE_FIELD_SPOUSE, "spouse", "Spouse", "Spouse", 0, E_CARD_SIMPLE_INTERNAL_TYPE_STRING },
- { E_CARD_SIMPLE_FIELD_NOTE, "note", "Note", "Note", 0, E_CARD_SIMPLE_INTERNAL_TYPE_STRING },
- { E_CARD_SIMPLE_FIELD_FBURL, "fburl", "Free-busy URL", "FBUrl", 0, E_CARD_SIMPLE_INTERNAL_TYPE_STRING },
- { E_CARD_SIMPLE_FIELD_ANNIVERSARY, "anniversary", "Anniversary", "Anniv", 0, E_CARD_SIMPLE_INTERNAL_TYPE_DATE },
- { E_CARD_SIMPLE_FIELD_BIRTH_DATE, "birth_date", "Birth Date", "", 0, E_CARD_SIMPLE_INTERNAL_TYPE_DATE },
- { E_CARD_SIMPLE_FIELD_MAILER, "mailer", "", "", 0, E_CARD_SIMPLE_INTERNAL_TYPE_STRING },
-};
-
-static void e_card_simple_init (ECardSimple *simple);
-static void e_card_simple_class_init (ECardSimpleClass *klass);
-
-static void e_card_simple_destroy (GtkObject *object);
-static void e_card_simple_set_arg (GtkObject *object, GtkArg *arg, guint arg_id);
-static void e_card_simple_get_arg (GtkObject *object, GtkArg *arg, guint arg_id);
-
-static void fill_in_info(ECardSimple *simple);
-
-ECardPhoneFlags phone_correspondences[] = {
- 0xFF, /* E_CARD_SIMPLE_PHONE_ID_ASSISTANT, */
- E_CARD_PHONE_WORK | E_CARD_PHONE_VOICE, /* E_CARD_SIMPLE_PHONE_ID_BUSINESS, */
- E_CARD_PHONE_WORK | E_CARD_PHONE_VOICE, /* E_CARD_SIMPLE_PHONE_ID_BUSINESS_2, */
- E_CARD_PHONE_WORK | E_CARD_PHONE_FAX, /* E_CARD_SIMPLE_PHONE_ID_BUSINESS_FAX, */
- 0xFF, /* E_CARD_SIMPLE_PHONE_ID_CALLBACK, */
- E_CARD_PHONE_CAR | E_CARD_PHONE_VOICE, /* E_CARD_SIMPLE_PHONE_ID_CAR, */
- 0xFF, /* E_CARD_SIMPLE_PHONE_ID_COMPANY, */
- E_CARD_PHONE_HOME | E_CARD_PHONE_VOICE, /* E_CARD_SIMPLE_PHONE_ID_HOME, */
- E_CARD_PHONE_HOME | E_CARD_PHONE_VOICE, /* E_CARD_SIMPLE_PHONE_ID_HOME_2, */
- E_CARD_PHONE_HOME | E_CARD_PHONE_FAX, /* E_CARD_SIMPLE_PHONE_ID_HOME_FAX, */
- E_CARD_PHONE_ISDN, /* E_CARD_SIMPLE_PHONE_ID_ISDN, */
- E_CARD_PHONE_CELL | E_CARD_PHONE_VOICE, /* E_CARD_SIMPLE_PHONE_ID_MOBILE, */
- E_CARD_PHONE_VOICE, /* E_CARD_SIMPLE_PHONE_ID_OTHER, */
- 0xFF, /* E_CARD_SIMPLE_PHONE_ID_OTHER_FAX, */
- E_CARD_PHONE_PAGER | E_CARD_PHONE_VOICE, /* E_CARD_SIMPLE_PHONE_ID_PAGER, */
- E_CARD_PHONE_PREF, /* E_CARD_SIMPLE_PHONE_ID_PRIMARY, */
- 0xFF, /* E_CARD_SIMPLE_PHONE_ID_RADIO, */
- 0xFF, /* E_CARD_SIMPLE_PHONE_ID_TELEX, */
- 0xFF, /* E_CARD_SIMPLE_PHONE_ID_TTYTTD, */
-};
-
-char *phone_names[] = {
- NULL, /* E_CARD_SIMPLE_PHONE_ID_ASSISTANT, */
- "Business",
- "Business 2",
- "Business Fax",
- NULL, /* E_CARD_SIMPLE_PHONE_ID_CALLBACK, */
- "Car",
- NULL, /* E_CARD_SIMPLE_PHONE_ID_COMPANY, */
- "Home",
- "Home 2",
- "Home Fax",
- "ISDN",
- "Mobile",
- "Other",
- NULL, /* E_CARD_SIMPLE_PHONE_ID_OTHER_FAX, */
- "Pager",
- "Primary",
- NULL, /* E_CARD_SIMPLE_PHONE_ID_RADIO, */
- NULL, /* E_CARD_SIMPLE_PHONE_ID_TELEX, */
- NULL, /* E_CARD_SIMPLE_PHONE_ID_TTYTTD, */
-};
-
-char *phone_short_names[] = {
- NULL, /* E_CARD_SIMPLE_PHONE_ID_ASSISTANT, */
- "Bus",
- "Bus 2",
- "Bus Fax",
- NULL, /* E_CARD_SIMPLE_PHONE_ID_CALLBACK, */
- "Car",
- NULL, /* E_CARD_SIMPLE_PHONE_ID_COMPANY, */
- "Home",
- "Home 2",
- "Home Fax",
- "ISDN",
- "Mob",
- "Other",
- NULL, /* E_CARD_SIMPLE_PHONE_ID_OTHER_FAX, */
- "Pag",
- "Prim",
- NULL, /* E_CARD_SIMPLE_PHONE_ID_RADIO, */
- NULL, /* E_CARD_SIMPLE_PHONE_ID_TELEX, */
- NULL, /* E_CARD_SIMPLE_PHONE_ID_TTYTTD, */
-};
-
-ECardAddressFlags addr_correspondences[] = {
- E_CARD_ADDR_WORK, /* E_CARD_SIMPLE_ADDRESS_ID_BUSINESS, */
- E_CARD_ADDR_HOME, /* E_CARD_SIMPLE_ADDRESS_ID_HOME, */
- E_CARD_ADDR_POSTAL, /* E_CARD_SIMPLE_ADDRESS_ID_OTHER, */
-};
-
-char *address_names[] = {
- "Business",
- "Home",
- "Other",
-};
-
-/**
- * e_card_simple_get_type:
- * @void:
- *
- * Registers the &ECardSimple class if necessary, and returns the type ID
- * associated to it.
- *
- * Return value: The type ID of the &ECardSimple class.
- **/
-GtkType
-e_card_simple_get_type (void)
-{
- static GtkType simple_type = 0;
-
- if (!simple_type) {
- GtkTypeInfo simple_info = {
- "ECardSimple",
- sizeof (ECardSimple),
- sizeof (ECardSimpleClass),
- (GtkClassInitFunc) e_card_simple_class_init,
- (GtkObjectInitFunc) e_card_simple_init,
- NULL, /* reserved_1 */
- NULL, /* reserved_2 */
- (GtkClassInitFunc) NULL
- };
-
- simple_type = gtk_type_unique (gtk_object_get_type (), &simple_info);
- }
-
- return simple_type;
-}
-
-/**
- * e_card_simple_new:
- * @VCard: a string in vCard format
- *
- * Returns: a new #ECardSimple that wraps the @VCard.
- */
-ECardSimple *
-e_card_simple_new (ECard *card)
-{
- ECardSimple *simple = E_CARD_SIMPLE(gtk_type_new(e_card_simple_get_type()));
- gtk_object_set(GTK_OBJECT(simple),
- "card", card,
- NULL);
- return simple;
-}
-
-ECardSimple *e_card_simple_duplicate(ECardSimple *simple)
-{
- char *vcard = e_card_simple_get_vcard(simple);
- ECard *card = e_card_new(vcard);
- ECardSimple *new_simple = e_card_simple_new(card);
- g_free (vcard);
- return new_simple;
-}
-
-/**
- * e_card_simple_get_id:
- * @simple: an #ECardSimple
- *
- * Returns: a string representing the id of the simple, which is unique
- * within its book.
- */
-char *
-e_card_simple_get_id (ECardSimple *simple)
-{
- if (simple->card)
- return e_card_get_id(simple->card);
- else
- return "";
-}
-
-/**
- * e_card_simple_get_id:
- * @simple: an #ECardSimple
- * @id: a id in string format
- *
- * Sets the identifier of a simple, which should be unique within its
- * book.
- */
-void
-e_card_simple_set_id (ECardSimple *simple, const char *id)
-{
- if ( simple->card )
- e_card_set_id(simple->card, id);
-}
-
-/**
- * e_card_simple_get_vcard:
- * @simple: an #ECardSimple
- *
- * Returns: a string in vcard format, which is wrapped by the @simple.
- */
-char
-*e_card_simple_get_vcard (ECardSimple *simple)
-{
- if (simple->card)
- return e_card_get_vcard(simple->card);
- else
- return g_strdup("");
-}
-
-static void
-e_card_simple_class_init (ECardSimpleClass *klass)
-{
- GtkObjectClass *object_class;
-
- object_class = GTK_OBJECT_CLASS(klass);
-
- gtk_object_add_arg_type ("ECardSimple::card",
- GTK_TYPE_OBJECT, GTK_ARG_READWRITE, ARG_CARD);
-#if 0
- gtk_object_add_arg_type ("ECardSimple::file_as",
- GTK_TYPE_STRING, GTK_ARG_READWRITE, ARG_FILE_AS);
- gtk_object_add_arg_type ("ECardSimple::full_name",
- GTK_TYPE_STRING, GTK_ARG_READWRITE, ARG_FULL_NAME);
- gtk_object_add_arg_type ("ECardSimple::name",
- GTK_TYPE_POINTER, GTK_ARG_READWRITE, ARG_NAME);
- gtk_object_add_arg_type ("ECardSimple::address",
- GTK_TYPE_OBJECT, GTK_ARG_READABLE, ARG_ADDRESS);
- gtk_object_add_arg_type ("ECardSimple::address_label",
- GTK_TYPE_OBJECT, GTK_ARG_READABLE, ARG_ADDRESS_LABEL);
- gtk_object_add_arg_type ("ECardSimple::phone",
- GTK_TYPE_OBJECT, GTK_ARG_READABLE, ARG_PHONE);
- gtk_object_add_arg_type ("ECardSimple::email",
- GTK_TYPE_OBJECT, GTK_ARG_READABLE, ARG_EMAIL);
- gtk_object_add_arg_type ("ECardSimple::birth_date",
- GTK_TYPE_POINTER, GTK_ARG_READWRITE, ARG_BIRTH_DATE);
- gtk_object_add_arg_type ("ECardSimple::url",
- GTK_TYPE_STRING, GTK_ARG_READWRITE, ARG_URL);
- gtk_object_add_arg_type ("ECardSimple::org",
- GTK_TYPE_STRING, GTK_ARG_READWRITE, ARG_ORG);
- gtk_object_add_arg_type ("ECardSimple::org_unit",
- GTK_TYPE_STRING, GTK_ARG_READWRITE, ARG_ORG_UNIT);
- gtk_object_add_arg_type ("ECardSimple::office",
- GTK_TYPE_STRING, GTK_ARG_READWRITE, ARG_OFFICE);
- gtk_object_add_arg_type ("ECardSimple::title",
- GTK_TYPE_STRING, GTK_ARG_READWRITE, ARG_TITLE);
- gtk_object_add_arg_type ("ECardSimple::role",
- GTK_TYPE_STRING, GTK_ARG_READWRITE, ARG_ROLE);
- gtk_object_add_arg_type ("ECardSimple::manager",
- GTK_TYPE_STRING, GTK_ARG_READWRITE, ARG_MANAGER);
- gtk_object_add_arg_type ("ECardSimple::assistant",
- GTK_TYPE_STRING, GTK_ARG_READWRITE, ARG_ASSISTANT);
- gtk_object_add_arg_type ("ECardSimple::nickname",
- GTK_TYPE_STRING, GTK_ARG_READWRITE, ARG_NICKNAME);
- gtk_object_add_arg_type ("ECardSimple::spouse",
- GTK_TYPE_STRING, GTK_ARG_READWRITE, ARG_SPOUSE);
- gtk_object_add_arg_type ("ECardSimple::anniversary",
- GTK_TYPE_POINTER, GTK_ARG_READWRITE, ARG_ANNIVERSARY);
- gtk_object_add_arg_type ("ECardSimple::fburl",
- GTK_TYPE_STRING, GTK_ARG_READWRITE, ARG_FBURL);
- gtk_object_add_arg_type ("ECardSimple::note",
- GTK_TYPE_STRING, GTK_ARG_READWRITE, ARG_NOTE);
- gtk_object_add_arg_type ("ECardSimple::id",
- GTK_TYPE_STRING, GTK_ARG_READWRITE, ARG_ID);
-#endif
-
- object_class->destroy = e_card_simple_destroy;
- object_class->get_arg = e_card_simple_get_arg;
- object_class->set_arg = e_card_simple_set_arg;
-}
-
-/*
- * ECardSimple lifecycle management and vcard loading/saving.
- */
-
-static void
-e_card_simple_destroy (GtkObject *object)
-{
- ECardSimple *simple;
- int i;
-
- simple = E_CARD_SIMPLE (object);
-
- if (simple->card)
- gtk_object_unref(GTK_OBJECT(simple->card));
- g_list_foreach(simple->temp_fields, (GFunc) g_free, NULL);
- g_list_free(simple->temp_fields);
- simple->temp_fields = NULL;
-
- for(i = 0; i < E_CARD_SIMPLE_PHONE_ID_LAST; i++)
- g_free(simple->phone[i]);
- for(i = 0; i < E_CARD_SIMPLE_EMAIL_ID_LAST; i++)
- g_free(simple->email[i]);
- for(i = 0; i < E_CARD_SIMPLE_ADDRESS_ID_LAST; i++)
- g_free(simple->address[i]);
-}
-
-
-/* Set_arg handler for the simple */
-static void
-e_card_simple_set_arg (GtkObject *object, GtkArg *arg, guint arg_id)
-{
- ECardSimple *simple;
-
- simple = E_CARD_SIMPLE (object);
-
- switch (arg_id) {
- case ARG_CARD:
- if (simple->card)
- gtk_object_unref(GTK_OBJECT(simple->card));
- g_list_foreach(simple->temp_fields, (GFunc) g_free, NULL);
- g_list_free(simple->temp_fields);
- simple->temp_fields = NULL;
- if (GTK_VALUE_OBJECT(*arg))
- simple->card = E_CARD(GTK_VALUE_OBJECT(*arg));
- else
- simple->card = NULL;
- if(simple->card)
- gtk_object_ref(GTK_OBJECT(simple->card));
- fill_in_info(simple);
- break;
-#if 0
- case ARG_FILE_AS:
- if (simple->file_as)
- g_free(simple->file_as);
- simple->file_as = g_strdup(GTK_VALUE_STRING(*arg));
- break;
- case ARG_FULL_NAME:
- if ( simple->fname )
- g_free(simple->fname);
- simple->fname = g_strdup(GTK_VALUE_STRING(*arg));
- break;
- case ARG_NAME:
- if ( simple->name )
- e_card_simple_name_free(simple->name);
- simple->name = GTK_VALUE_POINTER(*arg);
- break;
- case ARG_BIRTH_DATE:
- if ( simple->bday )
- g_free(simple->bday);
- simple->bday = GTK_VALUE_POINTER(*arg);
- break;
- case ARG_URL:
- if ( simple->url )
- g_free(simple->url);
- simple->url = g_strdup(GTK_VALUE_STRING(*arg));
- break;
- case ARG_ORG:
- if (simple->org)
- g_free(simple->org);
- simple->org = g_strdup(GTK_VALUE_STRING(*arg));
- break;
- case ARG_ORG_UNIT:
- if (simple->org_unit)
- g_free(simple->org_unit);
- simple->org_unit = g_strdup(GTK_VALUE_STRING(*arg));
- break;
- case ARG_OFFICE:
- if (simple->office)
- g_free(simple->office);
- simple->office = g_strdup(GTK_VALUE_STRING(*arg));
- break;
- case ARG_TITLE:
- if ( simple->title )
- g_free(simple->title);
- simple->title = g_strdup(GTK_VALUE_STRING(*arg));
- break;
- case ARG_ROLE:
- if (simple->role)
- g_free(simple->role);
- simple->role = g_strdup(GTK_VALUE_STRING(*arg));
- break;
- case ARG_MANAGER:
- if (simple->manager)
- g_free(simple->manager);
- simple->manager = g_strdup(GTK_VALUE_STRING(*arg));
- break;
- case ARG_ASSISTANT:
- if (simple->assistant)
- g_free(simple->assistant);
- simple->assistant = g_strdup(GTK_VALUE_STRING(*arg));
- break;
- case ARG_NICKNAME:
- if (simple->nickname)
- g_free(simple->nickname);
- simple->nickname = g_strdup(GTK_VALUE_STRING(*arg));
- break;
- case ARG_SPOUSE:
- if (simple->spouse)
- g_free(simple->spouse);
- simple->spouse = g_strdup(GTK_VALUE_STRING(*arg));
- break;
- case ARG_ANNIVERSARY:
- if ( simple->anniversary )
- g_free(simple->anniversary);
- simple->anniversary = GTK_VALUE_POINTER(*arg);
- break;
- case ARG_FBURL:
- if (simple->fburl)
- g_free(simple->fburl);
- simple->fburl = g_strdup(GTK_VALUE_STRING(*arg));
- break;
- case ARG_NOTE:
- if (simple->note)
- g_free (simple->note);
- simple->note = g_strdup(GTK_VALUE_STRING(*arg));
- break;
- case ARG_ID:
- if (simple->id)
- g_free(simple->id);
- simple->id = g_strdup(GTK_VALUE_STRING(*arg));
- break;
-#endif
- default:
- return;
- }
-}
-
-/* Get_arg handler for the simple */
-static void
-e_card_simple_get_arg (GtkObject *object, GtkArg *arg, guint arg_id)
-{
- ECardSimple *simple;
-
- simple = E_CARD_SIMPLE (object);
-
- switch (arg_id) {
- case ARG_CARD:
- e_card_simple_sync_card(simple);
- if (simple->card)
- GTK_VALUE_OBJECT (*arg) = GTK_OBJECT(simple->card);
- else
- GTK_VALUE_OBJECT (*arg) = NULL;
- break;
-#if 0
- case ARG_FILE_AS:
- GTK_VALUE_STRING (*arg);
- break;
- case ARG_FULL_NAME:
- GTK_VALUE_STRING (*arg) = simple->fname;
- break;
- case ARG_NAME:
- GTK_VALUE_POINTER(*arg) = simple->name;
- break;
- case ARG_ADDRESS:
- if (!simple->address)
- simple->address = e_card_simple_list_new((ECardSimpleListCopyFunc) e_card_simple_delivery_address_copy,
- (ECardSimpleListFreeFunc) e_card_simple_delivery_address_free,
- NULL);
- GTK_VALUE_OBJECT(*arg) = GTK_OBJECT(simple->address);
- break;
- case ARG_ADDRESS_LABEL:
- if (!simple->address_label)
- simple->address_label = e_card_simple_list_new((ECardSimpleListCopyFunc) e_card_simple_address_label_copy,
- (ECardSimpleListFreeFunc) e_card_simple_address_label_free,
- NULL);
- GTK_VALUE_OBJECT(*arg) = GTK_OBJECT(simple->address_label);
- break;
- case ARG_PHONE:
- if (!simple->phone)
- simple->phone = e_card_simple_list_new((ECardSimpleListCopyFunc) e_card_simple_phone_copy,
- (ECardSimpleListFreeFunc) e_card_simple_phone_free,
- NULL);
- GTK_VALUE_OBJECT(*arg) = GTK_OBJECT(simple->phone);
- break;
- case ARG_EMAIL:
- if (!simple->email)
- simple->email = e_card_simple_list_new((ECardSimpleListCopyFunc) g_strdup,
- (ECardSimpleListFreeFunc) g_free,
- NULL);
- GTK_VALUE_OBJECT(*arg) = GTK_OBJECT(simple->email);
- break;
- case ARG_BIRTH_DATE:
- GTK_VALUE_POINTER(*arg) = simple->bday;
- break;
- case ARG_URL:
- GTK_VALUE_STRING(*arg) = simple->url;
- break;
- case ARG_ORG:
- GTK_VALUE_STRING(*arg) = simple->org;
- break;
- case ARG_ORG_UNIT:
- GTK_VALUE_STRING(*arg) = simple->org_unit;
- break;
- case ARG_OFFICE:
- GTK_VALUE_STRING(*arg) = simple->office;
- break;
- case ARG_TITLE:
- GTK_VALUE_STRING(*arg) = simple->title;
- break;
- case ARG_ROLE:
- GTK_VALUE_STRING(*arg) = simple->role;
- break;
- case ARG_MANAGER:
- GTK_VALUE_STRING(*arg) = simple->manager;
- break;
- case ARG_ASSISTANT:
- GTK_VALUE_STRING(*arg) = simple->assistant;
- break;
- case ARG_NICKNAME:
- GTK_VALUE_STRING(*arg) = simple->nickname;
- break;
- case ARG_SPOUSE:
- GTK_VALUE_STRING(*arg) = simple->spouse;
- break;
- case ARG_ANNIVERSARY:
- GTK_VALUE_POINTER(*arg) = simple->anniversary;
- break;
- case ARG_FBURL:
- GTK_VALUE_STRING(*arg) = simple->fburl;
- break;
- case ARG_NOTE:
- GTK_VALUE_STRING(*arg) = simple->note;
- break;
- case ARG_ID:
- GTK_VALUE_STRING(*arg) = simple->id;
- break;
-#endif
- default:
- arg->type = GTK_TYPE_INVALID;
- break;
- }
-}
-
-
-/**
- * e_card_simple_init:
- */
-static void
-e_card_simple_init (ECardSimple *simple)
-{
- int i;
- simple->card = NULL;
- for(i = 0; i < E_CARD_SIMPLE_PHONE_ID_LAST; i++)
- simple->phone[i] = NULL;
- for(i = 0; i < E_CARD_SIMPLE_EMAIL_ID_LAST; i++)
- simple->email[i] = NULL;
- for(i = 0; i < E_CARD_SIMPLE_ADDRESS_ID_LAST; i++)
- simple->address[i] = NULL;
- simple->temp_fields = NULL;
-}
-
-static void
-fill_in_info(ECardSimple *simple)
-{
- ECard *card = simple->card;
- if (card) {
- ECardList *address_list;
- ECardList *phone_list;
- ECardList *email_list;
- const ECardPhone *phone;
- const char *email;
- const ECardAddrLabel *address;
- int i;
-
- ECardIterator *iterator;
-
- gtk_object_get(GTK_OBJECT(card),
- "address_label", &address_list,
- "phone", &phone_list,
- "email", &email_list,
- NULL);
- for (i = 0; i < E_CARD_SIMPLE_PHONE_ID_LAST; i++) {
- e_card_phone_free(simple->phone[i]);
- simple->phone[i] = NULL;
- }
- for (iterator = e_card_list_get_iterator(phone_list); e_card_iterator_is_valid(iterator); e_card_iterator_next(iterator)) {
- phone = e_card_iterator_get(iterator);
- for (i = 0; i < E_CARD_SIMPLE_PHONE_ID_LAST; i ++) {
- if (((phone->flags & phone_correspondences[i]) == phone_correspondences[i]) && (simple->phone[i] == NULL)) {
- simple->phone[i] = e_card_phone_copy(phone);
- break;
- }
- }
- }
- gtk_object_unref(GTK_OBJECT(iterator));
-
- for (i = 0; i < E_CARD_SIMPLE_EMAIL_ID_LAST; i++) {
- g_free(simple->email[i]);
- simple->email[i] = NULL;
- }
- for (iterator = e_card_list_get_iterator(email_list); e_card_iterator_is_valid(iterator); e_card_iterator_next(iterator)) {
- email = e_card_iterator_get(iterator);
- for (i = 0; i < E_CARD_SIMPLE_EMAIL_ID_LAST; i ++) {
- if ((simple->email[i] == NULL)) {
- simple->email[i] = g_strdup(email);
- break;
- }
- }
- }
- gtk_object_unref(GTK_OBJECT(iterator));
-
- for (i = 0; i < E_CARD_SIMPLE_ADDRESS_ID_LAST; i++) {
- e_card_address_label_free(simple->address[i]);
- simple->address[i] = NULL;
- }
- for (iterator = e_card_list_get_iterator(address_list); e_card_iterator_is_valid(iterator); e_card_iterator_next(iterator)) {
- address = e_card_iterator_get(iterator);
- for (i = 0; i < E_CARD_SIMPLE_ADDRESS_ID_LAST; i ++) {
- if (((address->flags & addr_correspondences[i]) == addr_correspondences[i]) && (simple->address[i] == NULL)) {
- simple->address[i] = e_card_address_label_copy(address);
- break;
- }
- }
- }
- gtk_object_unref(GTK_OBJECT(iterator));
- }
-}
-
-void
-e_card_simple_sync_card(ECardSimple *simple)
-{
- ECard *card = simple->card;
- if (card) {
- ECardList *address_list;
- ECardList *phone_list;
- ECardList *email_list;
- const ECardPhone *phone;
- const ECardAddrLabel *address;
- const char *email;
- int i;
- int iterator_next = 1;
-
- ECardIterator *iterator;
-
- gtk_object_get(GTK_OBJECT(card),
- "address_label", &address_list,
- "phone", &phone_list,
- "email", &email_list,
- NULL);
-
- for (iterator = e_card_list_get_iterator(phone_list); e_card_iterator_is_valid(iterator); iterator_next ? e_card_iterator_next(iterator) : FALSE ) {
- int i;
- phone = e_card_iterator_get(iterator);
- iterator_next = 1;
- for (i = 0; i < E_CARD_SIMPLE_PHONE_ID_LAST; i ++) {
- if ((phone->flags & phone_correspondences[i]) == phone_correspondences[i]) {
- if (simple->phone[i]) {
- simple->phone[i]->flags = phone_correspondences[i];
- if (simple->phone[i]->number && *simple->phone[i]->number) {
- e_card_iterator_set(iterator, simple->phone[i]);
- } else {
- e_card_iterator_delete(iterator);
- iterator_next = 0;
- }
- e_card_phone_free(simple->phone[i]);
- simple->phone[i] = NULL;
- break;
- }
- }
- }
- }
- gtk_object_unref(GTK_OBJECT(iterator));
- for (i = 0; i < E_CARD_SIMPLE_PHONE_ID_LAST; i ++) {
- if (simple->phone[i]) {
- simple->phone[i]->flags = phone_correspondences[i];
- e_card_list_append(phone_list, simple->phone[i]);
- e_card_phone_free(simple->phone[i]);
- simple->phone[i] = NULL;
- }
- }
-
- for (iterator = e_card_list_get_iterator(email_list); e_card_iterator_is_valid(iterator); iterator_next ? e_card_iterator_next(iterator) : FALSE ) {
- int i;
- email = e_card_iterator_get(iterator);
- iterator_next = 1;
- for (i = 0; i < E_CARD_SIMPLE_EMAIL_ID_LAST; i ++) {
- if (simple->email[i]) {
- if (*simple->email[i]) {
- e_card_iterator_set(iterator, simple->email[i]);
- } else {
- e_card_iterator_delete(iterator);
- iterator_next = 0;
- }
- g_free(simple->email[i]);
- simple->email[i] = NULL;
- break;
- }
- }
- }
- gtk_object_unref(GTK_OBJECT(iterator));
- for (i = 0; i < E_CARD_SIMPLE_EMAIL_ID_LAST; i ++) {
- if (simple->email[i]) {
- e_card_list_append(email_list, simple->email[i]);
- g_free(simple->email[i]);
- simple->email[i] = NULL;
- }
- }
-
- for (iterator = e_card_list_get_iterator(address_list); e_card_iterator_is_valid(iterator); iterator_next ? e_card_iterator_next(iterator) : FALSE ) {
- int i;
- address = e_card_iterator_get(iterator);
- iterator_next = 1;
- for (i = 0; i < E_CARD_SIMPLE_ADDRESS_ID_LAST; i ++) {
- if ((address->flags & addr_correspondences[i]) == addr_correspondences[i]) {
- if (simple->address[i]) {
- simple->address[i]->flags = addr_correspondences[i];
- if (simple->address[i]->data && *simple->address[i]->data) {
- e_card_iterator_set(iterator, simple->address[i]);
- } else {
- e_card_iterator_delete(iterator);
- iterator_next = 0;
- }
- e_card_address_label_free(simple->address[i]);
- simple->address[i] = NULL;
- break;
- }
- }
- }
- }
- gtk_object_unref(GTK_OBJECT(iterator));
- for (i = 0; i < E_CARD_SIMPLE_ADDRESS_ID_LAST; i ++) {
- if (simple->address[i]) {
- simple->address[i]->flags = addr_correspondences[i];
- e_card_list_append(address_list, simple->address[i]);
- e_card_address_label_free(simple->address[i]);
- simple->address[i] = NULL;
- }
- }
- fill_in_info(simple);
- }
-}
-
-const ECardPhone *e_card_simple_get_phone (ECardSimple *simple,
- ECardSimplePhoneId id)
-{
- return simple->phone[id];
-}
-
-const char *e_card_simple_get_email (ECardSimple *simple,
- ECardSimpleEmailId id)
-{
- return simple->email[id];
-}
-
-const ECardAddrLabel *e_card_simple_get_address (ECardSimple *simple,
- ECardSimpleAddressId id)
-{
- return simple->address[id];
-}
-
-void e_card_simple_set_phone (ECardSimple *simple,
- ECardSimplePhoneId id,
- const ECardPhone *phone)
-{
- if (simple->phone[id])
- e_card_phone_free(simple->phone[id]);
- simple->phone[id] = e_card_phone_copy(phone);
-}
-
-void e_card_simple_set_email (ECardSimple *simple,
- ECardSimpleEmailId id,
- const char *email)
-{
- if (simple->email[id])
- g_free(simple->email[id]);
- simple->email[id] = g_strdup(email);
-}
-
-void e_card_simple_set_address (ECardSimple *simple,
- ECardSimpleAddressId id,
- const ECardAddrLabel *address)
-{
- if (simple->address[id])
- e_card_address_label_free(simple->address[id]);
- simple->address[id] = e_card_address_label_copy(address);
-}
-
-const char *e_card_simple_get_const (ECardSimple *simple,
- ECardSimpleField field)
-{
- char *ret_val = e_card_simple_get(simple, field);
- if (ret_val)
- simple->temp_fields = g_list_prepend(simple->temp_fields, ret_val);
- return ret_val;
-}
-
-char *e_card_simple_get (ECardSimple *simple,
- ECardSimpleField field)
-{
- ECardSimpleInternalType type = field_data[field].type;
- const ECardAddrLabel *addr;
- const ECardPhone *phone;
- const char *string;
- ECardDate *date;
- switch(type) {
- case E_CARD_SIMPLE_INTERNAL_TYPE_STRING:
- gtk_object_get(GTK_OBJECT(simple->card),
- field_data[field].ecard_field, &string,
- NULL);
- return g_strdup(string);
- case E_CARD_SIMPLE_INTERNAL_TYPE_DATE:
- gtk_object_get(GTK_OBJECT(simple->card),
- field_data[field].ecard_field, &date,
- NULL);
- return NULL; /* FIXME!!!! */
- case E_CARD_SIMPLE_INTERNAL_TYPE_ADDRESS:
- addr = e_card_simple_get_address(simple,
- field_data[field].list_type_index);
- if (addr)
- return g_strdup(addr->data);
- else
- return NULL;
- case E_CARD_SIMPLE_INTERNAL_TYPE_PHONE:
- phone = e_card_simple_get_phone(simple,
- field_data[field].list_type_index);
- if (phone)
- return g_strdup(phone->number);
- else
- return NULL;
- case E_CARD_SIMPLE_INTERNAL_TYPE_EMAIL:
- string = e_card_simple_get_email(simple,
- field_data[field].list_type_index);
- return g_strdup(string);
- default:
- return NULL;
- }
-}
-
-static char *
-name_to_style(const ECardName *name, char *company, int style)
-{
- char *string;
- char *strings[4], **stringptr;
- char *substring;
- switch (style) {
- case 0:
- stringptr = strings;
- if (name->family && *name->family)
- *(stringptr++) = name->family;
- if (name->given && *name->given)
- *(stringptr++) = name->given;
- *stringptr = NULL;
- string = g_strjoinv(", ", strings);
- break;
- case 1:
- stringptr = strings;
- if (name->given && *name->given)
- *(stringptr++) = name->given;
- if (name->family && *name->family)
- *(stringptr++) = name->family;
- *stringptr = NULL;
- string = g_strjoinv(" ", strings);
- break;
- case 2:
- string = g_strdup(company);
- break;
- case 3: /* Fall Through */
- case 4:
- stringptr = strings;
- if (name->family && *name->family)
- *(stringptr++) = name->family;
- if (name->given && *name->given)
- *(stringptr++) = name->given;
- *stringptr = NULL;
- substring = g_strjoinv(", ", strings);
- if (!(company && *company))
- company = "";
- if (style == 3)
- string = g_strdup_printf("%s (%s)", substring, company);
- else
- string = g_strdup_printf("%s (%s)", company, substring);
- g_free(substring);
- break;
- default:
- string = g_strdup("");
- }
- return string;
-}
-
-static int
-file_as_get_style (ECardSimple *simple)
-{
- char *filestring = e_card_simple_get(simple, E_CARD_SIMPLE_FIELD_FILE_AS);
- char *trystring;
- char *full_name = e_card_simple_get(simple, E_CARD_SIMPLE_FIELD_FULL_NAME);
- char *company = e_card_simple_get(simple, E_CARD_SIMPLE_FIELD_ORG);
- ECardName *name = NULL;
- int i;
- int style;
- style = 0;
- if (!full_name)
- full_name = g_strdup("");
- if (!company)
- company = g_strdup("");
- if (filestring) {
-
- name = e_card_name_from_string(full_name);
-
- if (!name) {
- goto end;
- }
-
- style = -1;
-
- for (i = 0; i < 5; i++) {
- trystring = name_to_style(name, company, i);
- if (!strcmp(trystring, filestring)) {
- g_free(trystring);
- style = i;
- goto end;
- }
- g_free(trystring);
- }
- }
- end:
-
- g_free(filestring);
- g_free(full_name);
- g_free(company);
- if (name)
- e_card_name_free(name);
-
- return style;
-}
-
-static void
-file_as_set_style(ECardSimple *simple, int style)
-{
- if (style != -1) {
- char *string;
- char *full_name = e_card_simple_get(simple, E_CARD_SIMPLE_FIELD_FULL_NAME);
- char *company = e_card_simple_get(simple, E_CARD_SIMPLE_FIELD_ORG);
- ECardName *name;
-
- if (!full_name)
- full_name = g_strdup("");
- if (!company)
- company = g_strdup("");
- name = e_card_name_from_string(full_name);
- if (name) {
- string = name_to_style(name, company, style);
- e_card_simple_set(simple, E_CARD_SIMPLE_FIELD_FILE_AS, string);
- g_free(string);
- }
- g_free(full_name);
- g_free(company);
- e_card_name_free(name);
- }
-}
-
-void e_card_simple_set (ECardSimple *simple,
- ECardSimpleField field,
- const char *data)
-{
- ECardSimpleInternalType type = field_data[field].type;
- ECardAddrLabel *address;
- ECardPhone *phone;
- int style;
- switch (field) {
- case E_CARD_SIMPLE_FIELD_FULL_NAME:
- case E_CARD_SIMPLE_FIELD_ORG:
- style = file_as_get_style(simple);
- gtk_object_set(GTK_OBJECT(simple->card),
- field_data[field].ecard_field, data,
- NULL);
- file_as_set_style(simple, style);
- break;
- default:
- switch(type) {
- case E_CARD_SIMPLE_INTERNAL_TYPE_STRING:
- gtk_object_set(GTK_OBJECT(simple->card),
- field_data[field].ecard_field, data,
- NULL);
- break;
- case E_CARD_SIMPLE_INTERNAL_TYPE_DATE:
- break; /* FIXME!!!! */
- case E_CARD_SIMPLE_INTERNAL_TYPE_ADDRESS:
- address = e_card_address_label_new();
- address->data = (char *) data;
- e_card_simple_set_address(simple,
- field_data[field].list_type_index,
- address);
- address->data = NULL;
- e_card_address_label_free(address);
- break;
- case E_CARD_SIMPLE_INTERNAL_TYPE_PHONE:
- phone = e_card_phone_new();
- phone->number = (char *) data;
- e_card_simple_set_phone(simple,
- field_data[field].list_type_index,
- phone);
- phone->number = NULL;
- e_card_phone_free(phone);
- break;
- case E_CARD_SIMPLE_INTERNAL_TYPE_EMAIL:
- e_card_simple_set_email(simple,
- field_data[field].list_type_index,
- data);
- break;
- }
- break;
- }
-}
-
-ECardSimpleType e_card_simple_type (ECardSimple *simple,
- ECardSimpleField field)
-{
- ECardSimpleInternalType type = field_data[field].type;
- switch(type) {
- case E_CARD_SIMPLE_INTERNAL_TYPE_STRING:
- case E_CARD_SIMPLE_INTERNAL_TYPE_ADDRESS:
- case E_CARD_SIMPLE_INTERNAL_TYPE_PHONE:
- case E_CARD_SIMPLE_INTERNAL_TYPE_EMAIL:
- default:
- return E_CARD_SIMPLE_TYPE_STRING;
- case E_CARD_SIMPLE_INTERNAL_TYPE_DATE:
- return E_CARD_SIMPLE_TYPE_DATE;
- }
-}
-
-const char *e_card_simple_get_name (ECardSimple *simple,
- ECardSimpleField field)
-{
- return field_data[field].name;
-}
-
-const char *e_card_simple_get_short_name (ECardSimple *simple,
- ECardSimpleField field)
-{
- return field_data[field].short_name;
-}
-
-void e_card_simple_arbitrary_foreach (ECardSimple *simple,
- ECardSimpleArbitraryCallback *callback,
- gpointer closure)
-{
- if (simple->card) {
- ECardList *list;
- ECardIterator *iterator;
- gtk_object_get(GTK_OBJECT(simple->card),
- "arbitrary", &list,
- NULL);
- for (iterator = e_card_list_get_iterator(list); e_card_iterator_is_valid(iterator); e_card_iterator_next(iterator)) {
- const ECardArbitrary *arbitrary = e_card_iterator_get(iterator);
- if (callback)
- (*callback) (arbitrary, closure);
- }
- }
-}
-
-const ECardArbitrary *e_card_simple_get_arbitrary (ECardSimple *simple,
- const char *key)
-{
- if (simple->card) {
- ECardList *list;
- ECardIterator *iterator;
- gtk_object_get(GTK_OBJECT(simple->card),
- "arbitrary", &list,
- NULL);
- for (iterator = e_card_list_get_iterator(list); e_card_iterator_is_valid(iterator); e_card_iterator_next(iterator)) {
- const ECardArbitrary *arbitrary = e_card_iterator_get(iterator);
- if (!strcasecmp(arbitrary->key, key))
- return arbitrary;
- }
- }
- return NULL;
-}
-
-/* Any of these except key can be NULL */
-void e_card_simple_set_arbitrary (ECardSimple *simple,
- const char *key,
- const char *type,
- const char *value)
-{
- if (simple->card) {
- ECardArbitrary *new_arb;
- ECardList *list;
- ECardIterator *iterator;
- gtk_object_get(GTK_OBJECT(simple->card),
- "arbitrary", &list,
- NULL);
- for (iterator = e_card_list_get_iterator(list); e_card_iterator_is_valid(iterator); e_card_iterator_next(iterator)) {
- const ECardArbitrary *arbitrary = e_card_iterator_get(iterator);
- if (!strcasecmp(arbitrary->key, key)) {
- new_arb = e_card_arbitrary_new();
- new_arb->key = g_strdup(key);
- new_arb->type = g_strdup(type);
- new_arb->value = g_strdup(value);
- e_card_iterator_set(iterator, new_arb);
- e_card_arbitrary_free(new_arb);
- return;
- }
- }
- new_arb = e_card_arbitrary_new();
- new_arb->key = g_strdup(key);
- new_arb->type = g_strdup(type);
- new_arb->value = g_strdup(value);
- e_card_list_append(list, new_arb);
- e_card_arbitrary_free(new_arb);
- }
-}
-
diff --git a/addressbook/backend/ebook/e-card-simple.h b/addressbook/backend/ebook/e-card-simple.h
deleted file mode 100644
index 9566248387..0000000000
--- a/addressbook/backend/ebook/e-card-simple.h
+++ /dev/null
@@ -1,197 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * Authors:
- * Chris Lahey <clahey@helixcode.com>
- * Arturo Espinosa
- * Nat Friedman (nat@helixcode.com)
- *
- * Copyright (C) 2000 Helix Code, Inc.
- * Copyright (C) 1999 The Free Software Foundation
- */
-
-#ifndef __E_CARD_SIMPLE_H__
-#define __E_CARD_SIMPLE_H__
-
-#include <time.h>
-#include <gtk/gtk.h>
-#include <stdio.h>
-#include <ebook/e-card.h>
-#include <ebook/e-card-types.h>
-#include <ebook/e-card-list.h>
-
-#define E_TYPE_CARD_SIMPLE (e_card_simple_get_type ())
-#define E_CARD_SIMPLE(obj) (GTK_CHECK_CAST ((obj), E_TYPE_CARD_SIMPLE, ECardSimple))
-#define E_CARD_SIMPLE_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), E_TYPE_CARD_SIMPLE, ECardSimpleClass))
-#define E_IS_CARD_SIMPLE(obj) (GTK_CHECK_TYPE ((obj), E_TYPE_CARD_SIMPLE))
-#define E_IS_CARD_SIMPLE_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), E_TYPE_CARD_SIMPLE))
-
-typedef enum _ECardSimplePhoneId ECardSimplePhoneId;
-typedef enum _ECardSimpleEmailId ECardSimpleEmailId;
-typedef enum _ECardSimpleAddressId ECardSimpleAddressId;
-typedef enum _ECardSimpleType ECardSimpleType;
-typedef enum _ECardSimpleField ECardSimpleField;
-
-enum _ECardSimplePhoneId {
- E_CARD_SIMPLE_PHONE_ID_ASSISTANT,
- E_CARD_SIMPLE_PHONE_ID_BUSINESS,
- E_CARD_SIMPLE_PHONE_ID_BUSINESS_2,
- E_CARD_SIMPLE_PHONE_ID_BUSINESS_FAX,
- E_CARD_SIMPLE_PHONE_ID_CALLBACK,
- E_CARD_SIMPLE_PHONE_ID_CAR,
- E_CARD_SIMPLE_PHONE_ID_COMPANY,
- E_CARD_SIMPLE_PHONE_ID_HOME,
- E_CARD_SIMPLE_PHONE_ID_HOME_2,
- E_CARD_SIMPLE_PHONE_ID_HOME_FAX,
- E_CARD_SIMPLE_PHONE_ID_ISDN,
- E_CARD_SIMPLE_PHONE_ID_MOBILE,
- E_CARD_SIMPLE_PHONE_ID_OTHER,
- E_CARD_SIMPLE_PHONE_ID_OTHER_FAX,
- E_CARD_SIMPLE_PHONE_ID_PAGER,
- E_CARD_SIMPLE_PHONE_ID_PRIMARY,
- E_CARD_SIMPLE_PHONE_ID_RADIO,
- E_CARD_SIMPLE_PHONE_ID_TELEX,
- E_CARD_SIMPLE_PHONE_ID_TTYTTD,
- E_CARD_SIMPLE_PHONE_ID_LAST
-};
-
-/* We need HOME and WORK email addresses here. */
-enum _ECardSimpleEmailId {
- E_CARD_SIMPLE_EMAIL_ID_EMAIL,
- E_CARD_SIMPLE_EMAIL_ID_EMAIL_2,
- E_CARD_SIMPLE_EMAIL_ID_EMAIL_3,
- E_CARD_SIMPLE_EMAIL_ID_LAST
-};
-
-/* Should this include (BILLING/SHIPPING)? */
-enum _ECardSimpleAddressId {
- E_CARD_SIMPLE_ADDRESS_ID_BUSINESS,
- E_CARD_SIMPLE_ADDRESS_ID_HOME,
- E_CARD_SIMPLE_ADDRESS_ID_OTHER,
- E_CARD_SIMPLE_ADDRESS_ID_LAST
-};
-
-enum _ECardSimpleType {
- E_CARD_SIMPLE_TYPE_STRING,
- E_CARD_SIMPLE_TYPE_DATE,
-};
-
-enum _ECardSimpleField {
- E_CARD_SIMPLE_FIELD_FILE_AS,
- E_CARD_SIMPLE_FIELD_FULL_NAME,
- E_CARD_SIMPLE_FIELD_EMAIL,
- E_CARD_SIMPLE_FIELD_PHONE_PRIMARY,
- E_CARD_SIMPLE_FIELD_PHONE_BUSINESS,
- E_CARD_SIMPLE_FIELD_PHONE_HOME,
- E_CARD_SIMPLE_FIELD_ORG,
- E_CARD_SIMPLE_FIELD_ADDRESS_BUSINESS,
- E_CARD_SIMPLE_FIELD_ADDRESS_HOME,
- E_CARD_SIMPLE_FIELD_PHONE_MOBILE,
- E_CARD_SIMPLE_FIELD_PHONE_CAR,
- E_CARD_SIMPLE_FIELD_PHONE_BUSINESS_FAX,
- E_CARD_SIMPLE_FIELD_PHONE_HOME_FAX,
- E_CARD_SIMPLE_FIELD_PHONE_BUSINESS_2,
- E_CARD_SIMPLE_FIELD_PHONE_HOME_2,
- E_CARD_SIMPLE_FIELD_PHONE_ISDN,
- E_CARD_SIMPLE_FIELD_PHONE_OTHER,
- E_CARD_SIMPLE_FIELD_PHONE_PAGER,
- E_CARD_SIMPLE_FIELD_ADDRESS_OTHER,
- E_CARD_SIMPLE_FIELD_EMAIL_2,
- E_CARD_SIMPLE_FIELD_EMAIL_3,
- E_CARD_SIMPLE_FIELD_URL,
- E_CARD_SIMPLE_FIELD_ORG_UNIT,
- E_CARD_SIMPLE_FIELD_OFFICE,
- E_CARD_SIMPLE_FIELD_TITLE,
- E_CARD_SIMPLE_FIELD_ROLE,
- E_CARD_SIMPLE_FIELD_MANAGER,
- E_CARD_SIMPLE_FIELD_ASSISTANT,
- E_CARD_SIMPLE_FIELD_NICKNAME,
- E_CARD_SIMPLE_FIELD_SPOUSE,
- E_CARD_SIMPLE_FIELD_NOTE,
- E_CARD_SIMPLE_FIELD_FBURL,
- E_CARD_SIMPLE_FIELD_ANNIVERSARY,
- E_CARD_SIMPLE_FIELD_BIRTH_DATE,
- E_CARD_SIMPLE_FIELD_MAILER,
- E_CARD_SIMPLE_FIELD_LAST
-};
-
-typedef struct _ECardSimple ECardSimple;
-typedef struct _ECardSimpleClass ECardSimpleClass;
-
-struct _ECardSimple {
- GtkObject object;
- ECard *card;
-
- GList *temp_fields;
-
- ECardPhone *phone[E_CARD_SIMPLE_PHONE_ID_LAST];
- char *email[E_CARD_SIMPLE_EMAIL_ID_LAST];
- ECardAddrLabel *address[E_CARD_SIMPLE_ADDRESS_ID_LAST];
-};
-
-struct _ECardSimpleClass {
- GtkObjectClass parent_class;
-};
-
-typedef void (*ECardSimpleArbitraryCallback) (const ECardArbitrary *arbitrary, gpointer closure);
-
-ECardSimple *e_card_simple_new (ECard *card);
-char *e_card_simple_get_id (ECardSimple *simple);
-void e_card_simple_set_id (ECardSimple *simple,
- const gchar *character);
-char *e_card_simple_get_vcard (ECardSimple *simple);
-
-ECardSimple *e_card_simple_duplicate (ECardSimple *simple);
-
-char *e_card_simple_get (ECardSimple *simple,
- ECardSimpleField field);
-const char *e_card_simple_get_const (ECardSimple *simple,
- ECardSimpleField field);
-void e_card_simple_set (ECardSimple *simple,
- ECardSimpleField field,
- const char *data);
-
-ECardSimpleType e_card_simple_type (ECardSimple *simple,
- ECardSimpleField field);
-const char *e_card_simple_get_name (ECardSimple *simple,
- ECardSimpleField field);
-const char *e_card_simple_get_short_name (ECardSimple *simple,
- ECardSimpleField field);
-
-
-/* Use these only if building lists of specific types. It should be
- * easier to use the above if you consider a phone field to be the
- * same as any other field.
- */
-const ECardPhone *e_card_simple_get_phone (ECardSimple *simple,
- ECardSimplePhoneId id);
-const char *e_card_simple_get_email (ECardSimple *simple,
- ECardSimpleEmailId id);
-const ECardAddrLabel *e_card_simple_get_address (ECardSimple *simple,
- ECardSimpleAddressId id);
-void e_card_simple_set_phone (ECardSimple *simple,
- ECardSimplePhoneId id,
- const ECardPhone *phone);
-void e_card_simple_set_email (ECardSimple *simple,
- ECardSimpleEmailId id,
- const char *email);
-void e_card_simple_set_address (ECardSimple *simple,
- ECardSimpleAddressId id,
- const ECardAddrLabel *address);
-
-void e_card_simple_arbitrary_foreach (ECardSimple *simple,
- ECardSimpleArbitraryCallback *callback,
- gpointer closure);
-const ECardArbitrary *e_card_simple_get_arbitrary (ECardSimple *simple,
- const char *key);
-/* Any of these except key can be NULL */
-void e_card_simple_set_arbitrary (ECardSimple *simple,
- const char *key,
- const char *type,
- const char *value);
-
-void e_card_simple_sync_card (ECardSimple *simple);
-
-/* Standard Gtk function */
-GtkType e_card_simple_get_type (void);
-
-#endif /* ! __E_CARD_SIMPLE_H__ */
diff --git a/addressbook/backend/ebook/e-card-types.h b/addressbook/backend/ebook/e-card-types.h
deleted file mode 100644
index 57aed690aa..0000000000
--- a/addressbook/backend/ebook/e-card-types.h
+++ /dev/null
@@ -1,89 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * Authors:
- * Arturo Espinosa
- * Nat Friedman (nat@helixcode.com)
- *
- * Copyright (C) 2000 Helix Code, Inc.
- * Copyright (C) 1999 The Free Software Foundation
- */
-
-#ifndef __E_CARD_TYPES_H__
-#define __E_CARD_TYPES_H__
-
-/* IDENTIFICATION PROPERTIES */
-
-typedef struct {
- char *prefix; /* Mr. */
- char *given; /* John */
- char *additional; /* Quinlan */
- char *family; /* Public */
- char *suffix; /* Esq. */
-} ECardName;
-
-typedef struct {
- int year;
- int month;
- int day;
-} ECardDate;
-
-/* TELECOMMUNICATIONS ADDRESSING PROPERTIES */
-
-typedef enum {
- E_CARD_PHONE_PREF = 1 << 0,
- E_CARD_PHONE_WORK = 1 << 1,
- E_CARD_PHONE_HOME = 1 << 2,
- E_CARD_PHONE_VOICE = 1 << 3,
- E_CARD_PHONE_FAX = 1 << 4,
- E_CARD_PHONE_MSG = 1 << 5,
- E_CARD_PHONE_CELL = 1 << 6,
- E_CARD_PHONE_PAGER = 1 << 7,
- E_CARD_PHONE_BBS = 1 << 8,
- E_CARD_PHONE_MODEM = 1 << 9,
- E_CARD_PHONE_CAR = 1 << 10,
- E_CARD_PHONE_ISDN = 1 << 11,
- E_CARD_PHONE_VIDEO = 1 << 12
-} ECardPhoneFlags;
-
-typedef struct {
- ECardPhoneFlags flags;
- char *number;
-} ECardPhone;
-
-/* DELIVERY ADDRESSING PROPERTIES */
-
-typedef enum {
- E_CARD_ADDR_HOME = 1 << 0,
- E_CARD_ADDR_WORK = 1 << 1,
- E_CARD_ADDR_POSTAL = 1 << 2,
- E_CARD_ADDR_PARCEL = 1 << 3,
- E_CARD_ADDR_DOM = 1 << 4,
- E_CARD_ADDR_INTL = 1 << 5
-} ECardAddressFlags;
-
-typedef struct {
- ECardAddressFlags flags;
-
- char *po;
- char *ext;
- char *street;
- char *city;
- char *region;
- char *code;
- char *country;
-} ECardDeliveryAddress;
-
-typedef struct {
- ECardAddressFlags flags;
- char *data;
-} ECardAddrLabel;
-
-/* ARBITRARY PROPERTIES */
-
-typedef struct {
- char *key;
- char *type;
- char *value;
-} ECardArbitrary;
-
-#endif /* __E_CARD_TYPES_H__ */
diff --git a/addressbook/backend/ebook/e-card.c b/addressbook/backend/ebook/e-card.c
deleted file mode 100644
index b07723073f..0000000000
--- a/addressbook/backend/ebook/e-card.c
+++ /dev/null
@@ -1,3248 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * Authors:
- * Arturo Espinosa (arturo@nuclecu.unam.mx)
- * Nat Friedman (nat@helixcode.com)
- *
- * Copyright (C) 2000 Helix Code, Inc.
- * Copyright (C) 1999 The Free Software Foundation
- */
-
-#include <config.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <gtk/gtk.h>
-
-#include <libversit/vcc.h>
-#include "e-card.h"
-#include "e-card-pairs.h"
-#include "e-name-western.h"
-
-#include <e-util/e-util.h>
-
-#define is_a_prop_of(obj,prop) (isAPropertyOf ((obj),(prop)))
-#define str_val(obj) (the_str = (vObjectValueType (obj))? fakeCString (vObjectUStringZValue (obj)) : calloc (1, 1))
-#define has(obj,prop) (vo = isAPropertyOf ((obj), (prop)))
-
-#define XEV_ARBITRARY "X-EVOLUTION-ARBITRARY"
-
-/* Object argument IDs */
-enum {
- ARG_0,
- ARG_FILE_AS,
- ARG_FULL_NAME,
- ARG_NAME,
- ARG_ADDRESS,
- ARG_ADDRESS_LABEL,
- ARG_PHONE,
- ARG_EMAIL,
- ARG_BIRTH_DATE,
- ARG_URL,
- ARG_ORG,
- ARG_ORG_UNIT,
- ARG_OFFICE,
- ARG_TITLE,
- ARG_ROLE,
- ARG_MANAGER,
- ARG_ASSISTANT,
- ARG_NICKNAME,
- ARG_SPOUSE,
- ARG_ANNIVERSARY,
- ARG_MAILER,
- ARG_FBURL,
- ARG_NOTE,
- ARG_CATEGORIES,
- ARG_CATEGORY_LIST,
- ARG_ARBITRARY,
- ARG_ID
-};
-
-#if 0
-static VObject *card_convert_to_vobject (ECard *crd);
-#endif
-static void parse(ECard *card, VObject *vobj);
-static void e_card_init (ECard *card);
-static void e_card_class_init (ECardClass *klass);
-
-static void e_card_destroy (GtkObject *object);
-static void e_card_set_arg (GtkObject *object, GtkArg *arg, guint arg_id);
-static void e_card_get_arg (GtkObject *object, GtkArg *arg, guint arg_id);
-
-static void assign_string(VObject *vobj, char **string);
-
-char *e_v_object_get_child_value(VObject *vobj, char *name);
-static ECardDate e_card_date_from_string (char *str);
-
-static void parse_bday(ECard *card, VObject *object);
-static void parse_full_name(ECard *card, VObject *object);
-static void parse_file_as(ECard *card, VObject *object);
-static void parse_name(ECard *card, VObject *object);
-static void parse_email(ECard *card, VObject *object);
-static void parse_phone(ECard *card, VObject *object);
-static void parse_address(ECard *card, VObject *object);
-static void parse_address_label(ECard *card, VObject *object);
-static void parse_url(ECard *card, VObject *object);
-static void parse_org(ECard *card, VObject *object);
-static void parse_office(ECard *card, VObject *object);
-static void parse_title(ECard *card, VObject *object);
-static void parse_role(ECard *card, VObject *object);
-static void parse_manager(ECard *card, VObject *object);
-static void parse_assistant(ECard *card, VObject *object);
-static void parse_nickname(ECard *card, VObject *object);
-static void parse_spouse(ECard *card, VObject *object);
-static void parse_anniversary(ECard *card, VObject *object);
-static void parse_mailer(ECard *card, VObject *object);
-static void parse_fburl(ECard *card, VObject *object);
-static void parse_note(ECard *card, VObject *object);
-static void parse_categories(ECard *card, VObject *object);
-static void parse_arbitrary(ECard *card, VObject *object);
-static void parse_id(ECard *card, VObject *object);
-
-static ECardPhoneFlags get_phone_flags (VObject *vobj);
-static void set_phone_flags (VObject *vobj, ECardPhoneFlags flags);
-static ECardAddressFlags get_address_flags (VObject *vobj);
-static void set_address_flags (VObject *vobj, ECardAddressFlags flags);
-
-typedef void (* ParsePropertyFunc) (ECard *card, VObject *object);
-
-struct {
- char *key;
- ParsePropertyFunc function;
-} attribute_jump_array[] =
-{
- { VCFullNameProp, parse_full_name },
- { "X-EVOLUTION-FILE-AS", parse_file_as },
- { VCNameProp, parse_name },
- { VCBirthDateProp, parse_bday },
- { VCEmailAddressProp, parse_email },
- { VCTelephoneProp, parse_phone },
- { VCAdrProp, parse_address },
- { VCDeliveryLabelProp, parse_address_label },
- { VCURLProp, parse_url },
- { VCOrgProp, parse_org },
- { "X-EVOLUTION-OFFICE", parse_office },
- { VCTitleProp, parse_title },
- { VCBusinessRoleProp, parse_role },
- { "X-EVOLUTION-MANAGER", parse_manager },
- { "X-EVOLUTION-ASSISTANT", parse_assistant },
- { "NICKNAME", parse_nickname },
- { "X-EVOLUTION-SPOUSE", parse_spouse },
- { "X-EVOLUTION-ANNIVERSARY", parse_anniversary },
- { VCMailerProp, parse_mailer },
- { "FBURL", parse_fburl },
- { VCNoteProp, parse_note },
- { "CATEGORIES", parse_categories },
- { XEV_ARBITRARY, parse_arbitrary },
- { VCUniqueStringProp, parse_id }
-};
-
-/**
- * e_card_get_type:
- * @void:
- *
- * Registers the &ECard class if necessary, and returns the type ID
- * associated to it.
- *
- * Return value: The type ID of the &ECard class.
- **/
-GtkType
-e_card_get_type (void)
-{
- static GtkType card_type = 0;
-
- if (!card_type) {
- GtkTypeInfo card_info = {
- "ECard",
- sizeof (ECard),
- sizeof (ECardClass),
- (GtkClassInitFunc) e_card_class_init,
- (GtkObjectInitFunc) e_card_init,
- NULL, /* reserved_1 */
- NULL, /* reserved_2 */
- (GtkClassInitFunc) NULL
- };
-
- card_type = gtk_type_unique (gtk_object_get_type (), &card_info);
- }
-
- return card_type;
-}
-
-/**
- * e_card_new:
- * @vcard: a string in vCard format
- *
- * Returns: a new #ECard that wraps the @vcard.
- */
-ECard *
-e_card_new (char *vcard)
-{
- ECard *card = E_CARD(gtk_type_new(e_card_get_type()));
- VObject *vobj = Parse_MIME(vcard, strlen(vcard));
- while(vobj) {
- VObject *next;
- parse(card, vobj);
- next = nextVObjectInList(vobj);
- cleanVObject(vobj);
- vobj = next;
- }
- return card;
-}
-
-ECard *e_card_duplicate(ECard *card)
-{
- char *vcard = e_card_get_vcard(card);
- ECard *new_card = e_card_new(vcard);
- g_free (vcard);
- return new_card;
-}
-
-/**
- * e_card_get_id:
- * @card: an #ECard
- *
- * Returns: a string representing the id of the card, which is unique
- * within its book.
- */
-char *
-e_card_get_id (ECard *card)
-{
- return card->id;
-}
-
-/**
- * e_card_get_id:
- * @card: an #ECard
- * @id: a id in string format
- *
- * Sets the identifier of a card, which should be unique within its
- * book.
- */
-void
-e_card_set_id (ECard *card, const char *id)
-{
- if ( card->id )
- g_free(card->id);
- card->id = g_strdup(id);
-}
-
-/**
- * e_card_get_vcard:
- * @card: an #ECard
- *
- * Returns: a string in vCard format, which is wrapped by the @card.
- */
-char
-*e_card_get_vcard (ECard *card)
-{
- VObject *vobj; /*, *vprop; */
- char *temp, *ret_val;
-
- vobj = newVObject (VCCardProp);
-
- if ( card->file_as && *card->file_as )
- addPropValue(vobj, "X-EVOLUTION-FILE-AS", card->file_as);
- else if (card->file_as)
- addProp(vobj, "X-EVOLUTION-FILE_AS");
-
- if ( card->fname )
- addPropValue(vobj, VCFullNameProp, card->fname);
-
- if ( card->name && (card->name->prefix || card->name->given || card->name->additional || card->name->family || card->name->suffix) ) {
- VObject *nameprop;
- nameprop = addProp(vobj, VCNameProp);
- if ( card->name->prefix )
- addPropValue(nameprop, VCNamePrefixesProp, card->name->prefix);
- if ( card->name->given )
- addPropValue(nameprop, VCGivenNameProp, card->name->given);
- if ( card->name->additional )
- addPropValue(nameprop, VCAdditionalNamesProp, card->name->additional);
- if ( card->name->family )
- addPropValue(nameprop, VCFamilyNameProp, card->name->family);
- if ( card->name->suffix )
- addPropValue(nameprop, VCNameSuffixesProp, card->name->suffix);
- }
-
-
- if ( card->address ) {
- ECardIterator *iterator = e_card_list_get_iterator(card->address);
- for ( ; e_card_iterator_is_valid(iterator) ;e_card_iterator_next(iterator) ) {
- VObject *addressprop;
- ECardDeliveryAddress *address = (ECardDeliveryAddress *) e_card_iterator_get(iterator);
- addressprop = addProp(vobj, VCAdrProp);
-
- set_address_flags (addressprop, address->flags);
- if ( address->po )
- addPropValue(addressprop, VCPostalBoxProp, address->po);
- if ( address->ext )
- addPropValue(addressprop, VCExtAddressProp, address->ext);
- if ( address->street )
- addPropValue(addressprop, VCStreetAddressProp, address->street);
- if ( address->city )
- addPropValue(addressprop, VCCityProp, address->city);
- if ( address->region )
- addPropValue(addressprop, VCRegionProp, address->region);
- if ( address->code )
- addPropValue(addressprop, VCPostalCodeProp, address->code);
- if ( address->country )
- addPropValue(addressprop, VCCountryNameProp, address->country);
- }
- gtk_object_unref(GTK_OBJECT(iterator));
- }
-
- if ( card->address_label ) {
- ECardIterator *iterator = e_card_list_get_iterator(card->address_label);
- for ( ; e_card_iterator_is_valid(iterator) ;e_card_iterator_next(iterator) ) {
- VObject *labelprop;
- ECardAddrLabel *address_label = (ECardAddrLabel *) e_card_iterator_get(iterator);
- if (address_label->data)
- labelprop = addPropValue(vobj, VCDeliveryLabelProp, address_label->data);
- else
- labelprop = addProp(vobj, VCDeliveryLabelProp);
-
- set_address_flags (labelprop, address_label->flags);
- addProp(labelprop, VCQuotedPrintableProp);
- }
- gtk_object_unref(GTK_OBJECT(iterator));
- }
-
- if ( card->phone ) {
- ECardIterator *iterator = e_card_list_get_iterator(card->phone);
- for ( ; e_card_iterator_is_valid(iterator) ;e_card_iterator_next(iterator) ) {
- VObject *phoneprop;
- ECardPhone *phone = (ECardPhone *) e_card_iterator_get(iterator);
- phoneprop = addPropValue(vobj, VCTelephoneProp, phone->number);
-
- set_phone_flags (phoneprop, phone->flags);
- }
- gtk_object_unref(GTK_OBJECT(iterator));
- }
-
- if ( card->email ) {
- ECardIterator *iterator = e_card_list_get_iterator(card->email);
- for ( ; e_card_iterator_is_valid(iterator) ;e_card_iterator_next(iterator) ) {
- VObject *emailprop;
- emailprop = addPropValue(vobj, VCEmailAddressProp, (char *) e_card_iterator_get(iterator));
- addProp (emailprop, VCInternetProp);
- }
- gtk_object_unref(GTK_OBJECT(iterator));
- }
-
- if ( card->bday ) {
- ECardDate date;
- char *value;
- date = *card->bday;
- date.year = MIN(date.year, 9999);
- date.month = MIN(date.month, 12);
- date.day = MIN(date.day, 31);
- value = g_strdup_printf("%04d-%02d-%02d", date.year, date.month, date.day);
- addPropValue(vobj, VCBirthDateProp, value);
- g_free(value);
- }
-
- if (card->url)
- addPropValue(vobj, VCURLProp, card->url);
-
- if (card->org || card->org_unit) {
- VObject *orgprop;
- orgprop = addProp(vobj, VCOrgProp);
-
- if (card->org)
- addPropValue(orgprop, VCOrgNameProp, card->org);
- if (card->org_unit)
- addPropValue(orgprop, VCOrgUnitProp, card->org_unit);
- }
-
- if (card->office)
- addPropValue(vobj, "X-EVOLUTION-OFFICE", card->office);
-
- if (card->title)
- addPropValue(vobj, VCTitleProp, card->title);
-
- if (card->role)
- addPropValue(vobj, VCBusinessRoleProp, card->role);
-
- if (card->manager)
- addPropValue(vobj, "X-EVOLUTION-MANAGER", card->manager);
-
- if (card->assistant)
- addPropValue(vobj, "X-EVOLUTION-ASSISTANT", card->assistant);
-
- if (card->nickname)
- addPropValue(vobj, "NICKNAME", card->nickname);
-
- if (card->spouse)
- addPropValue(vobj, "X-EVOLUTION-SPOUSE", card->spouse);
-
- if ( card->anniversary ) {
- ECardDate date;
- char *value;
- date = *card->anniversary;
- date.year = MIN(date.year, 9999);
- date.month = MIN(date.month, 12);
- date.day = MIN(date.day, 31);
- value = g_strdup_printf("%04d-%02d-%02d", date.year, date.month, date.day);
- addPropValue(vobj, "X-EVOLUTION-ANNIVERSARY", value);
- g_free(value);
- }
-
- if (card->mailer) {
- addPropValue(vobj, VCMailerProp, card->mailer);
- }
-
- if (card->fburl)
- addPropValue(vobj, "FBURL", card->fburl);
-
- if (card->note)
- addPropValue(vobj, VCNoteProp, card->note);
-
- if (card->categories) {
- ECardIterator *iterator;
- int length = 0;
- char *string;
- char *stringptr;
- for (iterator = e_card_list_get_iterator(card->categories); e_card_iterator_is_valid(iterator); e_card_iterator_next(iterator)) {
- length += strlen(e_card_iterator_get(iterator)) + 1;
- }
- string = g_new(char, length + 1);
- stringptr = string;
- *stringptr = 0;
- for (e_card_iterator_reset(iterator); e_card_iterator_is_valid(iterator); e_card_iterator_next(iterator)) {
- strcpy(stringptr, e_card_iterator_get(iterator));
- stringptr += strlen(stringptr);
- *stringptr = ',';
- stringptr++;
- *stringptr = 0;
- }
- if (stringptr > string) {
- stringptr --;
- *stringptr = 0;
- }
- addPropValue (vobj, "CATEGORIES", string);
- g_free(string);
- }
-
- if (card->arbitrary) {
- ECardIterator *iterator;
- for (iterator = e_card_list_get_iterator(card->arbitrary); e_card_iterator_is_valid(iterator); e_card_iterator_next(iterator)) {
- const ECardArbitrary *arbitrary = e_card_iterator_get(iterator);
- VObject *arb_object;
- if (arbitrary->value) {
- arb_object = addPropValue (vobj, XEV_ARBITRARY, arbitrary->value);
- } else {
- arb_object = addProp (vobj, XEV_ARBITRARY);
- }
- if (arbitrary->type) {
- addPropValue (arb_object, "TYPE", arbitrary->type);
- }
- if (arbitrary->key) {
- addProp (arb_object, arbitrary->key);
- }
- }
- }
-
- if (card->id)
- addPropValue (vobj, VCUniqueStringProp, card->id);
-
-#if 0
-
-
- if (crd->photo.prop.used) {
- vprop = addPropSizedValue (vobj, VCPhotoProp,
- crd->photo.data, crd->photo.size);
- add_PhotoType (vprop, crd->photo.type);
- add_CardProperty (vprop, &crd->photo.prop);
- }
-
- if (crd->xtension.l) {
- GList *node;
-
- for (node = crd->xtension.l; node; node = node->next) {
- CardXProperty *xp = (CardXProperty *) node->data;
- addPropValue (vobj, xp->name, xp->data);
- add_CardProperty (vobj, &xp->prop);
- }
- }
-
- if (crd->timezn.prop.used) {
- char *str;
-
- str = card_timezn_str (crd->timezn);
- vprop = addPropValue (vobj, VCTimeZoneProp, str);
- free (str);
- add_CardProperty (vprop, &crd->timezn.prop);
- }
-
- if (crd->geopos.prop.used) {
- char *str;
-
- str = card_geopos_str (crd->geopos);
- vprop = addPropValue (vobj, VCGeoLocationProp, str);
- free (str);
- add_CardProperty (vprop, &crd->geopos.prop);
- }
-
- if (crd->logo.prop.used) {
- vprop = addPropSizedValue (vobj, VCLogoProp,
- crd->logo.data, crd->logo.size);
- add_PhotoType (vprop, crd->logo.type);
- add_CardProperty (vprop, &crd->logo.prop);
- }
-
- if (crd->agent)
- addVObjectProp (vobj, card_convert_to_vobject (crd->agent));
-
- if (crd->sound.prop.used) {
- if (crd->sound.type != SOUND_PHONETIC)
- vprop = addPropSizedValue (vobj, VCPronunciationProp,
- crd->sound.data, crd->sound.size);
- else
- vprop = addPropValue (vobj, VCPronunciationProp,
- crd->sound.data);
-
- add_SoundType (vprop, crd->sound.type);
- add_CardProperty (vprop, &crd->sound.prop);
- }
-
- if (crd->key.prop.used) {
- vprop = addPropValue (vobj, VCPublicKeyProp, crd->key.data);
- add_KeyType (vprop, crd->key.type);
- add_CardProperty (vprop, &crd->key.prop);
- }
-#endif
- temp = writeMemVObject(NULL, NULL, vobj);
- ret_val = g_strdup(temp);
- free(temp);
- cleanVObject(vobj);
- return ret_val;
-}
-
-static void
-parse_file_as(ECard *card, VObject *vobj)
-{
- if ( card->file_as )
- g_free(card->file_as);
- assign_string(vobj, &(card->file_as));
-}
-
-static void
-parse_name(ECard *card, VObject *vobj)
-{
- if ( card->name ) {
- e_card_name_free(card->name);
- }
- card->name = g_new(ECardName, 1);
-
- card->name->family = e_v_object_get_child_value (vobj, VCFamilyNameProp);
- card->name->given = e_v_object_get_child_value (vobj, VCGivenNameProp);
- card->name->additional = e_v_object_get_child_value (vobj, VCAdditionalNamesProp);
- card->name->prefix = e_v_object_get_child_value (vobj, VCNamePrefixesProp);
- card->name->suffix = e_v_object_get_child_value (vobj, VCNameSuffixesProp);
-}
-
-static void
-parse_full_name(ECard *card, VObject *vobj)
-{
- if ( card->fname )
- g_free(card->fname);
- assign_string(vobj, &(card->fname));
-}
-
-static void
-parse_email(ECard *card, VObject *vobj)
-{
- char *next_email;
- ECardList *list;
-
- assign_string(vobj, &next_email);
- gtk_object_get(GTK_OBJECT(card),
- "email", &list,
- NULL);
- e_card_list_append(list, next_email);
- g_free (next_email);
-}
-
-static void
-parse_bday(ECard *card, VObject *vobj)
-{
- if ( vObjectValueType (vobj) ) {
- char *str = fakeCString (vObjectUStringZValue (vobj));
- if ( card->bday )
- g_free(card->bday);
- card->bday = g_new(ECardDate, 1);
- *(card->bday) = e_card_date_from_string(str);
- free(str);
- }
-}
-
-static void
-parse_phone(ECard *card, VObject *vobj)
-{
- ECardPhone *next_phone = g_new(ECardPhone, 1);
- ECardList *list;
-
- assign_string(vobj, &(next_phone->number));
- next_phone->flags = get_phone_flags(vobj);
-
- gtk_object_get(GTK_OBJECT(card),
- "phone", &list,
- NULL);
- e_card_list_append(list, next_phone);
- e_card_phone_free (next_phone);
-}
-
-static void
-parse_address(ECard *card, VObject *vobj)
-{
- ECardDeliveryAddress *next_addr = g_new(ECardDeliveryAddress, 1);
- ECardList *list;
-
- next_addr->flags = get_address_flags (vobj);
- next_addr->po = e_v_object_get_child_value (vobj, VCPostalBoxProp);
- next_addr->ext = e_v_object_get_child_value (vobj, VCExtAddressProp);
- next_addr->street = e_v_object_get_child_value (vobj, VCStreetAddressProp);
- next_addr->city = e_v_object_get_child_value (vobj, VCCityProp);
- next_addr->region = e_v_object_get_child_value (vobj, VCRegionProp);
- next_addr->code = e_v_object_get_child_value (vobj, VCPostalCodeProp);
- next_addr->country = e_v_object_get_child_value (vobj, VCCountryNameProp);
-
- gtk_object_get(GTK_OBJECT(card),
- "address", &list,
- NULL);
- e_card_list_append(list, next_addr);
- e_card_delivery_address_free (next_addr);
-}
-
-static void
-parse_address_label(ECard *card, VObject *vobj)
-{
- ECardAddrLabel *next_addr = g_new(ECardAddrLabel, 1);
- ECardList *list;
-
- next_addr->flags = get_address_flags (vobj);
- assign_string(vobj, &next_addr->data);
-
- gtk_object_get(GTK_OBJECT(card),
- "address_label", &list,
- NULL);
- e_card_list_append(list, next_addr);
- e_card_address_label_free (next_addr);
-}
-
-static void
-parse_url(ECard *card, VObject *vobj)
-{
- if (card->url)
- g_free(card->url);
- assign_string(vobj, &(card->url));
-}
-
-static void
-parse_org(ECard *card, VObject *vobj)
-{
- char *temp;
-
- temp = e_v_object_get_child_value(vobj, VCOrgNameProp);
- if (temp) {
- if (card->org)
- g_free(card->org);
- card->org = temp;
- }
- temp = e_v_object_get_child_value(vobj, VCOrgUnitProp);
- if (temp) {
- if (card->org_unit)
- g_free(card->org_unit);
- card->org_unit = temp;
- }
-}
-
-static void
-parse_office(ECard *card, VObject *vobj)
-{
- if ( card->office )
- g_free(card->office);
- assign_string(vobj, &(card->office));
-}
-
-static void
-parse_title(ECard *card, VObject *vobj)
-{
- if ( card->title )
- g_free(card->title);
- assign_string(vobj, &(card->title));
-}
-
-static void
-parse_role(ECard *card, VObject *vobj)
-{
- if (card->role)
- g_free(card->role);
- assign_string(vobj, &(card->role));
-}
-
-static void
-parse_manager(ECard *card, VObject *vobj)
-{
- if ( card->manager )
- g_free(card->manager);
- assign_string(vobj, &(card->manager));
-}
-
-static void
-parse_assistant(ECard *card, VObject *vobj)
-{
- if ( card->assistant )
- g_free(card->assistant);
- assign_string(vobj, &(card->assistant));
-}
-
-static void
-parse_nickname(ECard *card, VObject *vobj)
-{
- if (card->nickname)
- g_free(card->nickname);
- assign_string(vobj, &(card->nickname));
-}
-
-static void
-parse_spouse(ECard *card, VObject *vobj)
-{
- if ( card->spouse )
- g_free(card->spouse);
- assign_string(vobj, &(card->spouse));
-}
-
-static void
-parse_anniversary(ECard *card, VObject *vobj)
-{
- if ( vObjectValueType (vobj) ) {
- char *str = fakeCString (vObjectUStringZValue (vobj));
- if (card->anniversary)
- g_free(card->anniversary);
- card->anniversary = g_new(ECardDate, 1);
- *(card->anniversary) = e_card_date_from_string(str);
- free(str);
- }
-}
-
-static void
-parse_mailer(ECard *card, VObject *vobj)
-{
- if ( card->mailer )
- g_free(card->mailer);
- assign_string(vobj, &(card->mailer));
-}
-
-static void
-parse_fburl(ECard *card, VObject *vobj)
-{
- g_free(card->fburl);
- assign_string(vobj, &(card->fburl));
-}
-
-static void
-parse_note(ECard *card, VObject *vobj)
-{
- g_free(card->note);
- assign_string(vobj, &(card->note));
-}
-
-static void
-add_list_unique(ECard *card, ECardList *list, char *string)
-{
- char *temp = e_strdup_strip(string);
- ECardIterator *iterator;
-
- if (!*temp) {
- g_free(temp);
- return;
- }
- for ( iterator = e_card_list_get_iterator(list); e_card_iterator_is_valid(iterator); e_card_iterator_next(iterator)) {
- if (!strcmp(e_card_iterator_get(iterator), temp)) {
- break;
- }
- }
- if (!e_card_iterator_is_valid(iterator)) {
- e_card_list_append(list, temp);
- }
- g_free(temp);
- gtk_object_unref(GTK_OBJECT(iterator));
-}
-
-static void
-do_parse_categories(ECard *card, char *str)
-{
- int length = strlen(str);
- char *copy = g_new(char, length + 1);
- int i, j;
- ECardList *list;
- gtk_object_get(GTK_OBJECT(card),
- "category_list", &list,
- NULL);
- for (i = 0, j = 0; str[i]; i++, j++) {
- switch (str[i]) {
- case '\\':
- i++;
- if (str[i]) {
- copy[j] = str[i];
- } else
- i--;
- break;
- case ',':
- copy[j] = 0;
- add_list_unique(card, list, copy);
- j = -1;
- break;
- default:
- copy[j] = str[i];
- break;
- }
- }
- copy[j] = 0;
- add_list_unique(card, list, copy);
- g_free(copy);
-}
-
-static void
-parse_categories(ECard *card, VObject *vobj)
-{
- if ( vObjectValueType (vobj) ) {
- char *str = fakeCString (vObjectUStringZValue (vobj));
- do_parse_categories(card, str);
- free(str);
- }
-}
-
-typedef union ValueItem {
- const char *strs;
- const wchar_t *ustrs;
- unsigned int i;
- unsigned long l;
- void *any;
- VObject *vobj;
-} ValueItem;
-
-struct VObject {
- VObject *next;
- const char *id;
- VObject *prop;
- unsigned short valType;
- ValueItem val;
-};
-
-static void
-parse_arbitrary(ECard *card, VObject *vobj)
-{
- ECardArbitrary *arbitrary = e_card_arbitrary_new();
- VObjectIterator iterator;
- ECardList *list;
- for ( initPropIterator (&iterator, vobj); moreIteration(&iterator); ) {
- VObject *temp = nextVObject(&iterator);
- const char *name = vObjectName(temp);
- if (name && !strcmp(name, "TYPE")) {
- g_free(arbitrary->type);
- assign_string(temp, &(arbitrary->type));
- } else {
- g_free(arbitrary->key);
- arbitrary->key = g_strdup(name);
- }
- }
-
- assign_string(vobj, &(arbitrary->value));
-
- gtk_object_get(GTK_OBJECT(card),
- "arbitrary", &list,
- NULL);
- e_card_list_append(list, arbitrary);
- e_card_arbitrary_free(arbitrary);
-}
-
-static void
-parse_id(ECard *card, VObject *vobj)
-{
- if ( card->id )
- g_free(card->id);
- assign_string(vobj, &(card->id));
-}
-
-static void
-parse_attribute(ECard *card, VObject *vobj)
-{
- ParsePropertyFunc function = g_hash_table_lookup(E_CARD_CLASS(GTK_OBJECT(card)->klass)->attribute_jump_table, vObjectName(vobj));
- if ( function )
- function(card, vobj);
-}
-
-static void
-parse(ECard *card, VObject *vobj)
-{
- VObjectIterator iterator;
- initPropIterator(&iterator, vobj);
- while(moreIteration (&iterator)) {
- parse_attribute(card, nextVObject(&iterator));
- }
- if (!card->name) {
- if (card->fname) {
- card->name = e_card_name_from_string(card->fname);
- }
- }
- if (!card->file_as) {
- if (card->name) {
- ECardName *name = card->name;
- char *strings[3], **stringptr;
- char *string;
- stringptr = strings;
- if (name->family && *name->family)
- *(stringptr++) = name->family;
- if (name->given && *name->given)
- *(stringptr++) = name->given;
- *stringptr = NULL;
- string = g_strjoinv(", ", strings);
- card->file_as = string;
- } else
- card->file_as = g_strdup("");
- }
-}
-
-static void
-e_card_class_init (ECardClass *klass)
-{
- int i;
- GtkObjectClass *object_class;
-
- object_class = GTK_OBJECT_CLASS(klass);
-
- klass->attribute_jump_table = g_hash_table_new(g_str_hash, g_str_equal);
-
- for ( i = 0; i < sizeof(attribute_jump_array) / sizeof(attribute_jump_array[0]); i++ ) {
- g_hash_table_insert(klass->attribute_jump_table, attribute_jump_array[i].key, attribute_jump_array[i].function);
- }
-
- gtk_object_add_arg_type ("ECard::file_as",
- GTK_TYPE_STRING, GTK_ARG_READWRITE, ARG_FILE_AS);
- gtk_object_add_arg_type ("ECard::full_name",
- GTK_TYPE_STRING, GTK_ARG_READWRITE, ARG_FULL_NAME);
- gtk_object_add_arg_type ("ECard::name",
- GTK_TYPE_POINTER, GTK_ARG_READWRITE, ARG_NAME);
- gtk_object_add_arg_type ("ECard::address",
- GTK_TYPE_OBJECT, GTK_ARG_READABLE, ARG_ADDRESS);
- gtk_object_add_arg_type ("ECard::address_label",
- GTK_TYPE_OBJECT, GTK_ARG_READABLE, ARG_ADDRESS_LABEL);
- gtk_object_add_arg_type ("ECard::phone",
- GTK_TYPE_OBJECT, GTK_ARG_READABLE, ARG_PHONE);
- gtk_object_add_arg_type ("ECard::email",
- GTK_TYPE_OBJECT, GTK_ARG_READABLE, ARG_EMAIL);
- gtk_object_add_arg_type ("ECard::birth_date",
- GTK_TYPE_POINTER, GTK_ARG_READWRITE, ARG_BIRTH_DATE);
- gtk_object_add_arg_type ("ECard::url",
- GTK_TYPE_STRING, GTK_ARG_READWRITE, ARG_URL);
- gtk_object_add_arg_type ("ECard::org",
- GTK_TYPE_STRING, GTK_ARG_READWRITE, ARG_ORG);
- gtk_object_add_arg_type ("ECard::org_unit",
- GTK_TYPE_STRING, GTK_ARG_READWRITE, ARG_ORG_UNIT);
- gtk_object_add_arg_type ("ECard::office",
- GTK_TYPE_STRING, GTK_ARG_READWRITE, ARG_OFFICE);
- gtk_object_add_arg_type ("ECard::title",
- GTK_TYPE_STRING, GTK_ARG_READWRITE, ARG_TITLE);
- gtk_object_add_arg_type ("ECard::role",
- GTK_TYPE_STRING, GTK_ARG_READWRITE, ARG_ROLE);
- gtk_object_add_arg_type ("ECard::manager",
- GTK_TYPE_STRING, GTK_ARG_READWRITE, ARG_MANAGER);
- gtk_object_add_arg_type ("ECard::assistant",
- GTK_TYPE_STRING, GTK_ARG_READWRITE, ARG_ASSISTANT);
- gtk_object_add_arg_type ("ECard::nickname",
- GTK_TYPE_STRING, GTK_ARG_READWRITE, ARG_NICKNAME);
- gtk_object_add_arg_type ("ECard::spouse",
- GTK_TYPE_STRING, GTK_ARG_READWRITE, ARG_SPOUSE);
- gtk_object_add_arg_type ("ECard::anniversary",
- GTK_TYPE_POINTER, GTK_ARG_READWRITE, ARG_ANNIVERSARY);
- gtk_object_add_arg_type ("ECard::mailer",
- GTK_TYPE_STRING, GTK_ARG_READWRITE, ARG_MAILER);
- gtk_object_add_arg_type ("ECard::fburl",
- GTK_TYPE_STRING, GTK_ARG_READWRITE, ARG_FBURL);
- gtk_object_add_arg_type ("ECard::note",
- GTK_TYPE_STRING, GTK_ARG_READWRITE, ARG_NOTE);
- gtk_object_add_arg_type ("ECard::categories",
- GTK_TYPE_STRING, GTK_ARG_READWRITE, ARG_CATEGORIES);
- gtk_object_add_arg_type ("ECard::category_list",
- GTK_TYPE_OBJECT, GTK_ARG_READWRITE, ARG_CATEGORY_LIST);
- gtk_object_add_arg_type ("ECard::arbitrary",
- GTK_TYPE_OBJECT, GTK_ARG_READWRITE, ARG_ARBITRARY);
- gtk_object_add_arg_type ("ECard::id",
- GTK_TYPE_STRING, GTK_ARG_READWRITE, ARG_ID);
-
-
- object_class->destroy = e_card_destroy;
- object_class->get_arg = e_card_get_arg;
- object_class->set_arg = e_card_set_arg;
-}
-
-ECardPhone *
-e_card_phone_new (void)
-{
- ECardPhone *newphone = g_new(ECardPhone, 1);
-
- newphone->number = NULL;
- newphone->flags = 0;
-
- return newphone;
-}
-
-void
-e_card_phone_free (ECardPhone *phone)
-{
- if ( phone ) {
- g_free(phone->number);
-
- g_free(phone);
- }
-}
-
-ECardPhone *
-e_card_phone_copy (const ECardPhone *phone)
-{
- if ( phone ) {
- ECardPhone *phone_copy = g_new(ECardPhone, 1);
- phone_copy->number = g_strdup(phone->number);
- phone_copy->flags = phone->flags;
- return phone_copy;
- } else
- return NULL;
-}
-
-ECardDeliveryAddress *
-e_card_delivery_address_new (void)
-{
- ECardDeliveryAddress *newaddr = g_new(ECardDeliveryAddress, 1);
-
- newaddr->po = NULL;
- newaddr->ext = NULL;
- newaddr->street = NULL;
- newaddr->city = NULL;
- newaddr->region = NULL;
- newaddr->code = NULL;
- newaddr->country = NULL;
- newaddr->flags = 0;
-
- return newaddr;
-}
-
-void
-e_card_delivery_address_free (ECardDeliveryAddress *addr)
-{
- if ( addr ) {
- g_free(addr->po);
- g_free(addr->ext);
- g_free(addr->street);
- g_free(addr->city);
- g_free(addr->region);
- g_free(addr->code);
- g_free(addr->country);
-
- g_free(addr);
- }
-}
-
-ECardDeliveryAddress *
-e_card_delivery_address_copy (const ECardDeliveryAddress *addr)
-{
- if ( addr ) {
- ECardDeliveryAddress *addr_copy = g_new(ECardDeliveryAddress, 1);
- addr_copy->po = g_strdup(addr->po );
- addr_copy->ext = g_strdup(addr->ext );
- addr_copy->street = g_strdup(addr->street );
- addr_copy->city = g_strdup(addr->city );
- addr_copy->region = g_strdup(addr->region );
- addr_copy->code = g_strdup(addr->code );
- addr_copy->country = g_strdup(addr->country);
- addr_copy->flags = addr->flags;
- return addr_copy;
- } else
- return NULL;
-}
-
-char *
-e_card_delivery_address_to_string(const ECardDeliveryAddress *addr)
-{
- char *strings[4], **stringptr = strings;
- char *line1, *line22, *line2;
- char *final;
- if (addr->po && *addr->po)
- *(stringptr++) = addr->po;
- if (addr->street && *addr->street)
- *(stringptr++) = addr->street;
- if (addr->ext && *addr->ext)
- *(stringptr++) = addr->ext;
- *stringptr = NULL;
- line1 = g_strjoinv(" ", strings);
- stringptr = strings;
- if (addr->region && *addr->region)
- *(stringptr++) = addr->region;
- if (addr->code && *addr->code)
- *(stringptr++) = addr->code;
- *stringptr = NULL;
- line22 = g_strjoinv(" ", strings);
- stringptr = strings;
- if (addr->city && *addr->city)
- *(stringptr++) = addr->city;
- if (line22 && *line22)
- *(stringptr++) = line22;
- *stringptr = NULL;
- line2 = g_strjoinv(", ", strings);
- stringptr = strings;
- if (line1 && *line1)
- *(stringptr++) = line1;
- if (line2 && *line2)
- *(stringptr++) = line2;
- if (addr->country && *addr->country)
- *(stringptr++) = addr->country;
- *stringptr = NULL;
- final = g_strjoinv("\n", strings);
- g_free(line1);
- g_free(line22);
- g_free(line2);
- return final;
-}
-
-ECardAddrLabel *
-e_card_address_label_new (void)
-{
- ECardAddrLabel *newaddr = g_new(ECardAddrLabel, 1);
-
- newaddr->data = NULL;
- newaddr->flags = 0;
-
- return newaddr;
-}
-
-void
-e_card_address_label_free (ECardAddrLabel *addr)
-{
- if ( addr ) {
- g_free(addr->data);
-
- g_free(addr);
- }
-}
-
-ECardAddrLabel *
-e_card_address_label_copy (const ECardAddrLabel *addr)
-{
- if ( addr ) {
- ECardAddrLabel *addr_copy = g_new(ECardAddrLabel, 1);
- addr_copy->data = g_strdup(addr->data);
- addr_copy->flags = addr->flags;
- return addr_copy;
- } else
- return NULL;
-}
-
-ECardName *e_card_name_new(void)
-{
- ECardName *newname = g_new(ECardName, 1);
-
- newname->prefix = NULL;
- newname->given = NULL;
- newname->additional = NULL;
- newname->family = NULL;
- newname->suffix = NULL;
-
- return newname;
-}
-
-void
-e_card_name_free(ECardName *name)
-{
- if (name) {
- if ( name->prefix )
- g_free(name->prefix);
- if ( name->given )
- g_free(name->given);
- if ( name->additional )
- g_free(name->additional);
- if ( name->family )
- g_free(name->family);
- if ( name->suffix )
- g_free(name->suffix);
- g_free ( name );
- }
-}
-
-ECardName *
-e_card_name_copy(const ECardName *name)
-{
- if (name) {
- ECardName *newname = g_new(ECardName, 1);
-
- newname->prefix = g_strdup(name->prefix);
- newname->given = g_strdup(name->given);
- newname->additional = g_strdup(name->additional);
- newname->family = g_strdup(name->family);
- newname->suffix = g_strdup(name->suffix);
-
- return newname;
- } else
- return NULL;
-}
-
-char *
-e_card_name_to_string(const ECardName *name)
-{
- char *strings[6], **stringptr = strings;
- if (name->prefix && *name->prefix)
- *(stringptr++) = name->prefix;
- if (name->given && *name->given)
- *(stringptr++) = name->given;
- if (name->additional && *name->additional)
- *(stringptr++) = name->additional;
- if (name->family && *name->family)
- *(stringptr++) = name->family;
- if (name->suffix && *name->suffix)
- *(stringptr++) = name->suffix;
- *stringptr = NULL;
- return g_strjoinv(" ", strings);
-}
-
-ECardName *
-e_card_name_from_string(const char *full_name)
-{
- ECardName *name = g_new(ECardName, 1);
- ENameWestern *western = e_name_western_parse (full_name);
-
- name->prefix = g_strdup (western->prefix);
- name->given = g_strdup (western->first );
- name->additional = g_strdup (western->middle);
- name->family = g_strdup (western->last );
- name->suffix = g_strdup (western->suffix);
-
- e_name_western_free(western);
-
- return name;
-}
-
-ECardArbitrary *
-e_card_arbitrary_new(void)
-{
- ECardArbitrary *arbitrary = g_new(ECardArbitrary, 1);
- arbitrary->key = NULL;
- arbitrary->type = NULL;
- arbitrary->value = NULL;
- return arbitrary;
-}
-
-ECardArbitrary *
-e_card_arbitrary_copy(const ECardArbitrary *arbitrary)
-{
- if (arbitrary) {
- ECardArbitrary *arb_copy = g_new(ECardArbitrary, 1);
- arb_copy->key = g_strdup(arbitrary->key);
- arb_copy->type = g_strdup(arbitrary->type);
- arb_copy->value = g_strdup(arbitrary->value);
- return arb_copy;
- } else
- return NULL;
-}
-
-void
-e_card_arbitrary_free(ECardArbitrary *arbitrary)
-{
- if (arbitrary) {
- g_free(arbitrary->key);
- g_free(arbitrary->type);
- g_free(arbitrary->value);
- }
- g_free(arbitrary);
-}
-
-/*
- * ECard lifecycle management and vCard loading/saving.
- */
-
-static void
-e_card_destroy (GtkObject *object)
-{
- ECard *card = E_CARD(object);
- g_free(card->id);
- g_free(card->file_as);
- g_free(card->fname);
- if ( card->name )
- e_card_name_free(card->name);
- g_free(card->bday);
-
- g_free(card->url);
- g_free(card->org);
- g_free(card->org_unit);
- g_free(card->office);
- g_free(card->title);
- g_free(card->role);
- g_free(card->manager);
- g_free(card->assistant);
- g_free(card->nickname);
- g_free(card->spouse);
- g_free(card->anniversary);
- g_free(card->fburl);
- g_free(card->note);
-
- if (card->categories)
- gtk_object_unref(GTK_OBJECT(card->categories));
- if (card->email)
- gtk_object_unref(GTK_OBJECT(card->email));
- if (card->phone)
- gtk_object_unref(GTK_OBJECT(card->phone));
- if (card->address)
- gtk_object_unref(GTK_OBJECT(card->address));
- if (card->address_label)
- gtk_object_unref(GTK_OBJECT(card->address_label));
-}
-
-
-/* Set_arg handler for the card */
-static void
-e_card_set_arg (GtkObject *object, GtkArg *arg, guint arg_id)
-{
- ECard *card;
-
- card = E_CARD (object);
-
- switch (arg_id) {
- case ARG_FILE_AS:
- g_free(card->file_as);
- card->file_as = g_strdup(GTK_VALUE_STRING(*arg));
- break;
- case ARG_FULL_NAME:
- g_free(card->fname);
- card->fname = g_strdup(GTK_VALUE_STRING(*arg));
- break;
- case ARG_NAME:
- if ( card->name )
- e_card_name_free(card->name);
- card->name = GTK_VALUE_POINTER(*arg);
- break;
- case ARG_CATEGORIES:
- if (card->categories)
- gtk_object_unref(GTK_OBJECT(card->categories));
- card->categories = NULL;
- if (GTK_VALUE_STRING(*arg))
- do_parse_categories(card, GTK_VALUE_STRING(*arg));
- break;
- case ARG_CATEGORY_LIST:
- if (card->categories)
- gtk_object_unref(GTK_OBJECT(card->categories));
- card->categories = E_CARD_LIST(GTK_VALUE_OBJECT(*arg));
- if (card->categories)
- gtk_object_ref(GTK_OBJECT(card->categories));
- break;
- case ARG_BIRTH_DATE:
- g_free(card->bday);
- card->bday = GTK_VALUE_POINTER(*arg);
- break;
- case ARG_URL:
- g_free(card->url);
- card->url = g_strdup(GTK_VALUE_STRING(*arg));
- break;
- case ARG_ORG:
- g_free(card->org);
- card->org = g_strdup(GTK_VALUE_STRING(*arg));
- break;
- case ARG_ORG_UNIT:
- g_free(card->org_unit);
- card->org_unit = g_strdup(GTK_VALUE_STRING(*arg));
- break;
- case ARG_OFFICE:
- g_free(card->office);
- card->office = g_strdup(GTK_VALUE_STRING(*arg));
- break;
- case ARG_TITLE:
- g_free(card->title);
- card->title = g_strdup(GTK_VALUE_STRING(*arg));
- break;
- case ARG_ROLE:
- g_free(card->role);
- card->role = g_strdup(GTK_VALUE_STRING(*arg));
- break;
- case ARG_MANAGER:
- g_free(card->manager);
- card->manager = g_strdup(GTK_VALUE_STRING(*arg));
- break;
- case ARG_ASSISTANT:
- g_free(card->assistant);
- card->assistant = g_strdup(GTK_VALUE_STRING(*arg));
- break;
- case ARG_NICKNAME:
- g_free(card->nickname);
- card->nickname = g_strdup(GTK_VALUE_STRING(*arg));
- break;
- case ARG_SPOUSE:
- g_free(card->spouse);
- card->spouse = g_strdup(GTK_VALUE_STRING(*arg));
- break;
- case ARG_ANNIVERSARY:
- g_free(card->anniversary);
- card->anniversary = GTK_VALUE_POINTER(*arg);
- break;
- case ARG_MAILER:
- g_free(card->mailer);
- card->mailer = g_strdup(GTK_VALUE_STRING(*arg));
- break;
- case ARG_FBURL:
- g_free(card->fburl);
- card->fburl = g_strdup(GTK_VALUE_STRING(*arg));
- break;
- case ARG_NOTE:
- g_free (card->note);
- card->note = g_strdup(GTK_VALUE_STRING(*arg));
- break;
- case ARG_ARBITRARY:
- if (card->arbitrary)
- gtk_object_unref(GTK_OBJECT(card->arbitrary));
- card->arbitrary = E_CARD_LIST(GTK_VALUE_OBJECT(*arg));
- if (card->arbitrary)
- gtk_object_ref(GTK_OBJECT(card->arbitrary));
- break;
- case ARG_ID:
- g_free(card->id);
- card->id = g_strdup(GTK_VALUE_STRING(*arg));
- break;
- default:
- return;
- }
-}
-
-/* Get_arg handler for the card */
-static void
-e_card_get_arg (GtkObject *object, GtkArg *arg, guint arg_id)
-{
- ECard *card;
-
- card = E_CARD (object);
-
- switch (arg_id) {
- case ARG_FILE_AS:
- GTK_VALUE_STRING (*arg) = card->file_as;
- break;
- case ARG_FULL_NAME:
- GTK_VALUE_STRING (*arg) = card->fname;
- break;
- case ARG_NAME:
- GTK_VALUE_POINTER(*arg) = card->name;
- break;
- case ARG_ADDRESS:
- if (!card->address)
- card->address = e_card_list_new((ECardListCopyFunc) e_card_delivery_address_copy,
- (ECardListFreeFunc) e_card_delivery_address_free,
- NULL);
- GTK_VALUE_OBJECT(*arg) = GTK_OBJECT(card->address);
- break;
- case ARG_ADDRESS_LABEL:
- if (!card->address_label)
- card->address_label = e_card_list_new((ECardListCopyFunc) e_card_address_label_copy,
- (ECardListFreeFunc) e_card_address_label_free,
- NULL);
- GTK_VALUE_OBJECT(*arg) = GTK_OBJECT(card->address_label);
- break;
- case ARG_PHONE:
- if (!card->phone)
- card->phone = e_card_list_new((ECardListCopyFunc) e_card_phone_copy,
- (ECardListFreeFunc) e_card_phone_free,
- NULL);
- GTK_VALUE_OBJECT(*arg) = GTK_OBJECT(card->phone);
- break;
- case ARG_EMAIL:
- if (!card->email)
- card->email = e_card_list_new((ECardListCopyFunc) g_strdup,
- (ECardListFreeFunc) g_free,
- NULL);
- GTK_VALUE_OBJECT(*arg) = GTK_OBJECT(card->email);
- break;
- case ARG_CATEGORIES:
- {
- int i;
- char ** strs;
- int length;
- ECardIterator *iterator;
- if (!card->categories)
- card->categories = e_card_list_new((ECardListCopyFunc) g_strdup,
- (ECardListFreeFunc) g_free,
- NULL);
- length = e_card_list_length(card->categories);
- strs = g_new(char *, length + 1);
- for (iterator = e_card_list_get_iterator(card->categories), i = 0; e_card_iterator_is_valid(iterator); e_card_iterator_next(iterator), i++) {
- strs[i] = (char *)e_card_iterator_get(iterator);
- }
- strs[i] = 0;
- GTK_VALUE_STRING(*arg) = g_strjoinv(", ", strs);
- g_free(strs);
- }
- break;
- case ARG_CATEGORY_LIST:
- if (!card->categories)
- card->categories = e_card_list_new((ECardListCopyFunc) g_strdup,
- (ECardListFreeFunc) g_free,
- NULL);
- GTK_VALUE_OBJECT(*arg) = GTK_OBJECT(card->categories);
- break;
- case ARG_BIRTH_DATE:
- GTK_VALUE_POINTER(*arg) = card->bday;
- break;
- case ARG_URL:
- GTK_VALUE_STRING(*arg) = card->url;
- break;
- case ARG_ORG:
- GTK_VALUE_STRING(*arg) = card->org;
- break;
- case ARG_ORG_UNIT:
- GTK_VALUE_STRING(*arg) = card->org_unit;
- break;
- case ARG_OFFICE:
- GTK_VALUE_STRING(*arg) = card->office;
- break;
- case ARG_TITLE:
- GTK_VALUE_STRING(*arg) = card->title;
- break;
- case ARG_ROLE:
- GTK_VALUE_STRING(*arg) = card->role;
- break;
- case ARG_MANAGER:
- GTK_VALUE_STRING(*arg) = card->manager;
- break;
- case ARG_ASSISTANT:
- GTK_VALUE_STRING(*arg) = card->assistant;
- break;
- case ARG_NICKNAME:
- GTK_VALUE_STRING(*arg) = card->nickname;
- break;
- case ARG_SPOUSE:
- GTK_VALUE_STRING(*arg) = card->spouse;
- break;
- case ARG_ANNIVERSARY:
- GTK_VALUE_POINTER(*arg) = card->anniversary;
- break;
- case ARG_MAILER:
- GTK_VALUE_STRING(*arg) = card->mailer;
- break;
- case ARG_FBURL:
- GTK_VALUE_STRING(*arg) = card->fburl;
- break;
- case ARG_NOTE:
- GTK_VALUE_STRING(*arg) = card->note;
- break;
- case ARG_ARBITRARY:
- if (!card->arbitrary)
- card->arbitrary = e_card_list_new((ECardListCopyFunc) e_card_arbitrary_copy,
- (ECardListFreeFunc) e_card_arbitrary_free,
- NULL);
-
- GTK_VALUE_OBJECT(*arg) = GTK_OBJECT(card->arbitrary);
- break;
- case ARG_ID:
- GTK_VALUE_STRING(*arg) = card->id;
- break;
- default:
- arg->type = GTK_TYPE_INVALID;
- break;
- }
-}
-
-
-/**
- * e_card_init:
- */
-static void
-e_card_init (ECard *card)
-{
- card->id = g_strdup("");
-
- card->file_as = NULL;
- card->fname = NULL;
- card->name = NULL;
- card->bday = NULL;
- card->email = NULL;
- card->phone = NULL;
- card->address = NULL;
- card->address_label = NULL;
- card->url = NULL;
- card->org = NULL;
- card->org_unit = NULL;
- card->office = NULL;
- card->title = NULL;
- card->role = NULL;
- card->manager = NULL;
- card->assistant = NULL;
- card->nickname = NULL;
- card->spouse = NULL;
- card->anniversary = NULL;
- card->mailer = NULL;
- card->fburl = NULL;
- card->note = NULL;
- card->categories = NULL;
- card->arbitrary = NULL;
-#if 0
-
- c = g_new0 (ECard, 1);
-
- c->fname =
- c->mailer =
- c->role =
- c->comment =
- c->categories =
- c->uid = e_card_prop_str_empty ();
-
- c->photo.type = PHOTO_JPEG;
- c->logo.type = PHOTO_JPEG;
- c->rev.utc = -1;
- c->sound.type = SOUND_PHONETIC;
- c->key.type = KEY_PGP;
-
- c->categories.prop.encod = ENC_QUOTED_PRINTABLE;
- c->comment.prop.encod = ENC_QUOTED_PRINTABLE;
-
- c->name.prop = c->photo.prop = c->bday.prop = c->timezn.prop =
- c->geopos.prop = c->logo.prop = c->org.prop = c->rev.prop =
- c->sound.prop = c->key.prop = c->deladdr.prop = c->dellabel.prop =
- c->phone.prop = c->email.prop = c->xtension.prop = c->prop = e_card_prop_empty ();
-
- c->prop.type = PROP_CARD;
- c->fname.prop.type = PROP_FNAME;
- c->name.prop.type = PROP_NAME;
- c->photo.prop.type = PROP_PHOTO;
- c->bday.prop.type = PROP_BDAY;
-
- c->deladdr.prop.type = PROP_DELADDR_LIST;
- c->dellabel.prop.type = PROP_DELLABEL_LIST;
- c->phone.prop.type = PROP_PHONE_LIST;
- c->email.prop.type = PROP_EMAIL_LIST;
- c->xtension.prop.type = PROP_XTENSION_LIST;
- c->mailer.prop.type = PROP_MAILER;
- c->timezn.prop.type = PROP_TIMEZN;
- c->geopos.prop.type = PROP_GEOPOS;
- c->role.prop.type = PROP_ROLE;
- c->logo.prop.type = PROP_LOGO;
- c->org.prop.type = PROP_ORG;
- c->categories.prop.type = PROP_CATEGORIES;
- c->comment.prop.type = PROP_COMMENT;
- c->rev.prop.type = PROP_REV;
- c->sound.prop.type = PROP_SOUND;
- c->uid.prop.type = PROP_UID;
- c->key.prop.type = PROP_KEY;
-
- return c;
-#endif
-}
-
-static void
-assign_string(VObject *vobj, char **string)
-{
- int type = vObjectValueType(vobj);
- char *str;
-
- switch(type) {
- case VCVT_STRINGZ:
- *string = g_strdup (vObjectStringZValue(vobj));
- break;
- case VCVT_USTRINGZ:
- str = (vObjectValueType (vobj) ? fakeCString (vObjectUStringZValue (vobj)) : calloc(1, 1));
- *string = g_strdup(str);
- free(str);
- break;
- default:
- *string = g_strdup("");
- break;
- }
-}
-
-#if 0
-static void
-e_card_str_free (CardStrProperty *sp)
-{
- g_free (sp->str);
-
- e_card_prop_free (sp->prop);
-}
-
-static void
-e_card_photo_free (CardPhoto *photo)
-{
- g_free (photo->data);
-
- e_card_prop_free (photo->prop);
-}
-
-/**
- * e_card_free:
- */
-void
-e_card_free (ECard *card)
-{
- GList *l;
-
- g_return_if_fail (card != NULL);
-
- e_card_name_free (& card->name);
- e_card_str_free (& card->fname);
-
- e_card_photo_free (card->photo);
-
- e_card_logo_free (card->logo);
- e_card_org_free (card->org);
- e_card_key_free (card->key);
- e_card_sound_free (card->sound);
-
- e_card_prop_str_free (& card->mailer);
- e_card_prop_str_free (& card->role);
- e_card_prop_str_free (& card->categories);
- e_card_prop_str_free (& card->comment);
- e_card_prop_str_free (& card->uid);
-
- /* address is a little more complicated */
- card_prop_free (card->deladdr.prop);
- while ((l = card->deladdr.l)) {
-
- e_card_deladdr_free ((CardDelAddr *) l->data);
-
- card->deladdr.l = g_list_remove_link (card->deladdr.l, l);
- g_list_free (l);
- }
-
- g_free (card);
-}
-
-typedef struct
-{
- char c;
- int id;
-
- GList *sons;
-} tree;
-
-extern CardProperty
-e_card_prop_empty (void)
-{
- CardProperty prop;
-
- prop.used = FALSE;
-
- prop.type = PROP_NONE;
- prop.encod = ENC_7BIT;
- prop.value = VAL_INLINE;
- prop.charset = NULL;
- prop.lang = NULL;
- prop.grp = NULL;
- prop.xtension = NULL;
-
- prop.user_data = NULL;
-
- return prop;
-}
-
-static CardStrProperty
-e_card_prop_str_empty (void)
-{
- CardStrProperty strprop;
-
- strprop.prop = card_prop_empty ();
- strprop.str = NULL;
-
- return strprop;
-}
-
-/* Intended to check asserts. */
-extern int card_check_prop (ECardProperty prop)
-{
- if (((prop.used == FALSE) || (prop.used == TRUE)) &&
- ((prop.type >= PROP_NONE) && (prop.type <= PROP_LAST)) &&
- ((prop.encod >= ENC_NONE) && (prop.encod <= ENC_LAST)) &&
- ((prop.value >= VAL_NONE) && (prop.value <= VAL_LAST)))
- return TRUE;
-
- return FALSE;
-}
-
-extern void
-card_prop_free (CardProperty prop)
-{
- GList *l;
-
- g_free (prop.charset);
- g_free (prop.lang);
-
- for (l = prop.xtension; l; l = l->next) {
- CardXAttribute *xa = (CardXAttribute *) l->data;
- g_free (xa->name);
- g_free (xa->data);
- }
-
- g_list_free (l);
-
- prop.used = FALSE;
-}
-
-e_card_deladdr_free (ECardDelAddr *c)
-{
- card_prop_free (c->prop);
-
- g_free (p->pobox);
- g_free (p->ext);
- g_free (p->street);
- g_free (p->city);
- g_free (p->region);
- g_free (p->code);
- g_free (p->country);
-}
-
-void
-card_free (Card *crd)
-{
-}
-
-static tree *
-new_tree (char c, int id)
-{
- tree *t;
-
- t = malloc (sizeof (tree));
- t->c = c;
- t->id = id;
- t->sons = NULL;
-
- return t;
-}
-
-static void
-add_branch (tree *t, char *str, int id)
-{
- tree *tmp;
- char *end;
-
- end = str + strlen (str) + 1;
-
- while (str != end) {
- tmp = new_tree (*str, id);
- t->sons = g_list_append (t->sons, (gpointer) tmp);
- t = tmp;
-
- str ++;
- }
-}
-
-static tree *
-add_to_tree (tree *t, struct pair p)
-{
- GList *node;
- char *c, *end;
- tree *tmp;
-
- c = p.str;
- end = c + strlen (c) + 1;
- tmp = t;
-
- while (c != end) {
- for (node = tmp->sons; node; node = node->next)
- if (((tree *) node->data)->c == *c) {
- break;
- }
-
- if (node) {
- tmp = (tree *) node->data;
- tmp->id = 0;
- c++;
- }
- else {
- add_branch (tmp, c, p.id);
- break;
- }
- }
-
- return t;
-}
-
-static tree *
-create_search_tree (void)
-{
- tree *t;
- int i;
-
- t = new_tree (0, 0);
- for (i = 0; prop_lookup[i].str; i++)
- t = add_to_tree (t, prop_lookup[i]);
-
- return t;
-}
-
-static int
-card_lookup_name (const char *c)
-{
- static tree *search_tree = NULL;
- GList *node;
- tree *tmp;
- const char *end;
-
- if (!search_tree)
- search_tree = create_search_tree ();
-
- tmp = search_tree;
- end = c + strlen (c) + 1;
-
- while (tmp->id == 0 && c != end) {
- for (node = tmp->sons; node; node = node->next)
- if (((tree *) node->data)->c == *c) {
- break;
- }
-
- if (node) {
- tmp = (tree *) node->data;
- c++;
- }
- else
- return 0;
- }
-
- return tmp->id;
-}
-
-static enum PhotoType
-get_photo_type (VObject *o)
-{
- VObject *vo;
- int i;
-
- for (i = 0; photo_pairs[i].str; i++)
- if (has (o, photo_pairs[i].str))
- return photo_pairs[i].id;
-
- g_warning ("? < No PhotoType for Photo property. Falling back to JPEG.");
- return PHOTO_JPEG;
-}
-
-static CardProperty
-get_CardProperty (VObject *o)
-{
- VObjectIterator i;
- CardProperty prop;
-
- prop = card_prop_empty ();
- prop.used = TRUE;
-
- initPropIterator (&i, o);
- while (moreIteration (&i)) {
- VObject *vo = nextVObject (&i);
- const char *n = vObjectName (vo);
- int propid;
-
- propid = card_lookup_name (n);
-
- switch (propid) {
-
- case PROP_VALUE:
-
- if (has (vo, VCContentIDProp))
- prop.value = VAL_CID;
- break;
-
- case PROP_ENCODING:
- if (has (vo, VCQuotedPrintableProp))
- prop.encod = ENC_QUOTED_PRINTABLE;
- else if (has (vo, VC8bitProp))
- prop.encod = ENC_8BIT;
- else if (has (vo, VCBase64Prop))
- prop.encod = ENC_BASE64;
- break;
-
- case PROP_QUOTED_PRINTABLE:
- prop.encod = ENC_QUOTED_PRINTABLE;
- break;
-
- case PROP_8BIT:
- prop.encod = ENC_8BIT;
- break;
-
- case PROP_BASE64:
- prop.encod = ENC_BASE64;
- break;
-
- case PROP_LANG:
- if (vObjectValueType (vo)) {
- prop.lang =
- g_strdup (vObjectStringZValue (vo));
- } else
- g_warning ("? < No value for LANG attribute.");
- break;
-
- case PROP_CHARSET:
- if (vObjectValueType (vo)) {
- prop.charset =
- g_strdup (vObjectStringZValue (vo));
- g_warning (prop.charset);
- } else
- g_warning ("? < No value for CHARSET attribute.");
- break;
- default:
- {
- CardXAttribute *c;
-
- c = malloc (sizeof (CardXAttribute));
- c->name = g_strdup (n);
-
- if (vObjectValueType (vo))
- c->data =
- g_strdup (vObjectStringZValue (vo));
- else
- c->data = NULL;
-
- prop.xtension =
- g_list_append (prop.xtension, c);
- }
- }
- }
-
- return prop;
-}
-
-static gboolean
-e_card_prop_has (VObject *o,
- const char *id)
-{
- g_assert (o != NULL);
- g_assert (id != NULL);
-
- if (isAPropertyOf (o, id) == NULL)
- return FALSE;
-
- return TRUE;
-}
-
-static const char *
-e_card_prop_get_str (VObject *o,
- const char *id)
-{
- VObject *strobj;
-
- g_assert (o != NULL);
- g_assert (id != NULL);
-
- strobj = isAPropertyOf (o, id);
-
- if (strobj == NULL)
- return g_strdup ("");
-
- if (vObjectValueType (strobj) != NULL) {
- char *str;
- char *g_str;
-
- str = fakeCString (vObjectStringZValue (strobj));
- g_str = g_strdup (str);
- free (str);
-
- return g_str;
- }
-
- return g_strdup ("");
-}
-
-static ECardName *
-e_card_get_name (VObject *o)
-{
- CardName *name;
- VObject *vo;
- char *the_str;
-
- name = g_new0 (ECardName, 1);
-
- name->family = e_card_prop_get_substr (o, VCFamilyNameProp);
- name->given = e_card_prop_get_substr (o, VCGivenNameProp);
- name->additional = e_card_prop_get_substr (o, VCAdditionalNamesProp);
- name->prefix = e_card_prop_get_substr (o, VCNamePrefixesProp);
- name->suffix = e_card_prop_get_substr (o, VCNameSuffixesProp);
-
- return name;
-}
-
-static CardDelLabel *
-get_CardDelLabel (VObject *o)
-{
- CardDelLabel *dellabel;
- char *the_str;
-
- dellabel = malloc (sizeof (CardDelLabel));
-
- dellabel->type = get_addr_type (o);
- dellabel->data = g_strdup (str_val (o));
-
- free (the_str);
- return dellabel;
-}
-
-static CardPhone *
-get_CardPhone (VObject *o)
-{
- CardPhone *ret;
- char *the_str;
-
- ret = malloc (sizeof (CardPhone));
- ret->type = get_phone_type (o);
- ret->data = g_strdup (str_val (o));
-
- free (the_str);
-
- return ret;
-}
-
-static CardEMail *
-get_CardEMail (VObject *o)
-{
- CardEMail *ret;
- char *the_str;
-
- ret = malloc (sizeof (CardEMail));
- ret->type = get_email_type (o);
- ret->data = g_strdup (str_val (o));
-
- free (the_str);
-
- return ret;
-}
-
-static CardTimeZone
-strtoCardTimeZone (char *str)
-{
- char s[3];
- CardTimeZone tz;
-
- if (*str == '-') {
- tz.sign = -1;
- str++;
- } else
- tz.sign = 1;
-
- tz.hours = 0;
- tz.mins = 0;
-
- s[2] = 0;
- if (strlen (str) > 2) {
- s[0] = str[0];
- s[1] = str[1];
- tz.hours = atoi (s);
- } else {
- g_warning ("? < TimeZone value is too short.");
- return tz;
- }
-
- str += 2;
- if (*str == ':')
- str++;
-
- if (strlen (str) >= 2) {
- s[0] = str[0];
- s[1] = str[1];
- tz.mins = atoi (s);
- } else {
- g_warning ("? < TimeZone value is too short.");
- return tz;
- }
-
- if (strlen (str) > 3)
- g_warning ("? < TimeZone value is too long.");
-
- return tz;
-}
-
-static CardGeoPos
-strtoCardGeoPos (char *str)
-{
- CardGeoPos gp;
- char *s;
-
- gp.lon = 0;
- gp.lat = 0;
-
- s = strchr (str, ',');
-
- if (! s) {
- g_warning ("? < Bad format for GeoPos property.");
- return gp;
- }
-
- *s = 0;
- s++;
-
- gp.lon = atof (str);
- gp.lat = atof (s);
-
- return gp;
-}
-
-static CardOrg *
-e_card_vobject_to_org (VObject *o)
-{
- VObject *vo;
- char *the_str;
- CardOrg *org;
-
- org = g_new0 (CardOrg, 1);
-
- if (has (o, VCOrgNameProp)) {
- org.name = g_strdup (str_val (vo));
- free (the_str);
- }
- if (has (o, VCOrgUnitProp)) {
- org.unit1 = g_strdup (str_val (vo));
- free (the_str);
- }
- if (has (o, VCOrgUnit2Prop)) {
- org.unit2 = g_strdup (str_val (vo));
- free (the_str);
- }
- if (has (o, VCOrgUnit3Prop)) {
- org.unit3 = g_strdup (str_val (vo));
- free (the_str);
- }
- if (has (o, VCOrgUnit4Prop)) {
- org.unit4 = g_strdup (str_val (vo));
- free (the_str);
- }
-
- return org;
-}
-
-static CardXProperty *
-get_XProp (VObject *o)
-{
- char *the_str;
- CardXProperty *ret;
-
- ret = malloc (sizeof (CardXProperty));
- ret->name = g_strdup (vObjectName (o));
- ret->data = g_strdup (str_val (o));
- free (the_str);
-
- return ret;
-}
-
-static CardRev
-strtoCardRev (char *str)
-{
- char s[3], *t, *ss;
- int len, i;
- CardRev rev;
-
- rev.utc = 0;
- len = strlen (str);
-
- if (str[len] == 'Z') { /* Is it UTC? */
- rev.utc = 1;
- str[len] = 0;
- }
-
- s[2] = 0;
- t = strchr (str, 'T');
- if (t) { /* Take the Time */
- *t = 0;
- t++;
- if (strlen (t) > 2) {
- s[0] = t[0];
- s[1] = t[1];
- rev.tm.tm_hour = atoi (s);
- } else {
- g_warning ("? < Rev value is too short.");
- return rev;
- }
-
- t += 2;
- if (*t == ':') /* Ignore ':' separator */
- t++;
-
- if (strlen (t) > 2) {
- s[0] = t[0];
- s[1] = t[1];
- rev.tm.tm_min = atoi (s);
- } else {
- g_warning ("? < Rev value is too short.");
- return rev;
- }
-
- t += 2;
- if (*t == ':')
- t++;
-
- if (strlen (t) > 2) {
- s[0] = t[0];
- s[1] = t[1];
- rev.tm.tm_sec = atoi (s);
- } else {
- g_warning ("? < Rev value is too short.");
- return rev;
- }
-
- if (strlen (str) > 3)
- g_warning ("? < Rev value is too long.");
-
- } else {
- g_warning ("? < No time value for Rev property.");
- }
-
- /* Now the date (the part before the T) */
-
- if (strchr (str, '-')) { /* extended iso 8601 */
- for (ss = strtok (str, "-"), i = 0; ss;
- ss = strtok (NULL, "-"), i++)
- switch (i) {
- case 0:
- rev.tm.tm_year = atoi (ss);
- break;
- case 1:
- rev.tm.tm_mon = atoi (ss);
- break;
- case 2:
- rev.tm.tm_mday = atoi (ss);
- break;
- default:
- g_warning ("? < Too many values for Rev property.");
- }
-
- if (i < 2)
- g_warning ("? < Too few values for Rev property.");
- } else {
- if (strlen (str) >= 8) { /* short representation */
- rev.tm.tm_mday = atoi (str + 6);
- str[6] = 0;
- rev.tm.tm_mon = atoi (str + 4);
- str[4] = 0;
- rev.tm.tm_year = atoi (str);
- } else
- g_warning ("? < Bad format for Rev property.");
- }
-
- return rev;
-}
-
-static enum KeyType
-get_key_type (VObject *o)
-{
- VObject *vo;
- int i;
-
- for (i = 0; key_pairs[i].str; i++)
- if (has (o, key_pairs[i].str))
- return key_pairs[i].id;
-
- g_warning ("? < No KeyType for Key property. Falling back to PGP.");
- return KEY_PGP;
-}
-
-static CardPhoto
-get_CardPhoto (VObject *o)
-{
- VObject *vo;
- char *the_str;
- CardPhoto photo;
-
- photo.type = get_photo_type (o);
-
- if (has (o, VCDataSizeProp)) {
- photo.size = vObjectIntegerValue (vo);
- photo.data = malloc (photo.size);
- memcpy (photo.data, vObjectAnyValue (o), photo.size);
- } else {
- photo.size = strlen (str_val (o)) + 1;
- photo.data = g_strdup (the_str);
- free (the_str);
- }
-
- return photo;
-}
-
-static enum SoundType
-get_sound_type (VObject *o)
-{
- VObject *vo;
- int i;
-
- for (i = 0; sound_pairs[i].str; i++)
- if (has (o, sound_pairs[i].str))
- return sound_pairs[i].id;
-
- return SOUND_PHONETIC;
-}
-
-static CardSound
-get_CardSound (VObject *o)
-{
- VObject *vo;
- char *the_str;
- CardSound sound;
-
- sound.type = get_sound_type (o);
-
- if (has (o, VCDataSizeProp)) {
- sound.size = vObjectIntegerValue (vo);
- sound.data = malloc (sound.size);
- memcpy (sound.data, vObjectAnyValue (o), sound.size);
- } else {
- sound.size = strlen (str_val (o));
- sound.data = g_strdup (the_str);
- free (the_str);
- }
-
- return sound;
-}
-
-/* Loads our card contents from a VObject */
-static ECard *
-e_card_construct_from_vobject (ECard *card,
- VObject *vcrd)
-{
- VObjectIterator i;
- Card *crd;
- char *the_str;
-
- initPropIterator (&i, vcrd);
- crd = card_new ();
-
- while (moreIteration (&i)) {
- VObject *o = nextVObject (&i);
- const char *n = vObjectName (o);
- int propid;
- CardProperty *prop = NULL;
-
- propid = card_lookup_name (n);
-
- switch (propid) {
- case PROP_FNAME:
- prop = &crd->fname.prop;
- crd->fname.str = g_strdup (str_val (o));
- free (the_str);
- break;
- case PROP_NAME:
- prop = &crd->name.prop;
- crd->name = e_card_get_name (o);
- break;
- case PROP_PHOTO:
- prop = &crd->photo.prop;
- crd->photo = get_CardPhoto (o);
- break;
- case PROP_BDAY:
- prop = &crd->bday.prop;
- crd->bday = strtoCardBDay (str_val (o));
- free (the_str);
- break;
- case PROP_DELADDR:
- {
- CardDelAddr *c;
- c = get_CardDelAddr (o);
- prop = &c->prop;
- crd->deladdr.l = g_list_append (crd->deladdr.l, c);
- }
- break;
- case PROP_DELLABEL:
- {
- CardDelLabel *c;
- c = get_CardDelLabel (o);
- prop = &c->prop;
- crd->dellabel.l = g_list_append (crd->dellabel.l, c);
- }
- break;
- case PROP_PHONE:
- {
- CardPhone *c;
-
- c = get_CardPhone (o);
- prop = &c->prop;
- crd->phone.l = g_list_append (crd->phone.l, c);
- }
- break;
- case PROP_EMAIL:
- {
- CardEMail *c;
-
- c = get_CardEMail (o);
- prop = &c->prop;
- crd->email.l = g_list_append (crd->email.l, c);
- }
- break;
- case PROP_MAILER:
- prop = &crd->mailer.prop;
- crd->mailer.str = g_strdup (str_val (o));
- free (the_str);
- break;
- case PROP_TIMEZN:
- prop = &crd->timezn.prop;
- crd->timezn = strtoCardTimeZone (str_val (o));
- free (the_str);
- break;
- case PROP_GEOPOS:
- prop = &crd->geopos.prop;
- crd->geopos = strtoCardGeoPos (str_val (o));
- break;
- case PROP_ROLE:
- prop = &crd->role.prop;
- crd->role.str = g_strdup (str_val (o));
- free (the_str);
- break;
- case PROP_LOGO:
- prop = &crd->logo.prop;
- crd->logo = get_CardPhoto (o);
- break;
- case PROP_AGENT:
- crd->agent = card_create_from_vobject (o);
- break;
- case PROP_ORG:
- prop = &crd->org.prop;
- crd->org = get_CardOrg (o);
- break;
- case PROP_CATEGORIES:
- prop = &crd->categories.prop;
- crd->categories.str = g_strdup (str_val (o));
- crd->categories.prop.encod = ENC_QUOTED_PRINTABLE;
- free (the_str);
- break;
- case PROP_COMMENT:
- prop = &crd->comment.prop;
- crd->comment.str = g_strdup (str_val (o));
- crd->comment.prop.encod = ENC_QUOTED_PRINTABLE;
- free (the_str);
- break;
- case PROP_REV:
- prop = &crd->rev.prop;
- crd->rev = strtoCardRev (str_val (o));
- free (the_str);
- break;
- case PROP_SOUND:
- prop = &crd->sound.prop;
- crd->sound = get_CardSound (o);
- break;
- case PROP_VERSION:
- {
- char *str;
- str = str_val (o);
- if (strcmp (str, "2.1"))
- g_warning ("? < Version doesn't match.");
- free (the_str);
- }
- break;
- case PROP_KEY:
- prop = &crd->key.prop;
- crd->key.type = get_key_type (o);
- crd->key.data = g_strdup (str_val (o));
- free (the_str);
- break;
- default:
- {
- CardXProperty *c;
-
- c = get_XProp (o);
- prop = &c->prop;
- crd->xtension.l = g_list_append (crd->xtension.l, c);
- }
- break;
- }
-
- if (prop) {
- *prop = get_CardProperty (o);
- prop->type = propid;
- }
- }
-
- return crd;
-}
-
-/* Loads a card from a file */
-GList *
-card_load (GList *crdlist, char *fname)
-{
- VObject *vobj, *tmp;
-
- vobj = Parse_MIME_FromFileName (fname);
- if (!vobj) {
- g_warning ("Could not load the cardfile");
- return NULL;
- }
-
- while (vobj) {
- const char *n = vObjectName (vobj);
-
- if (strcmp (n, VCCardProp) == 0) {
- crdlist = g_list_append (crdlist, (gpointer)
- card_create_from_vobject (vobj));
- }
- tmp = vobj;
- vobj = nextVObjectInList (vobj);
- cleanVObject (tmp);
- }
-
- cleanVObject (vobj);
- cleanStrTbl ();
- return crdlist;
-}
-
-static VObject *
-add_strProp (VObject *o, const char *id, char *val)
-{
- VObject *vo = NULL;
-
- if (val)
- vo = addPropValue (o, id, val);
-
- return vo;
-}
-
-static VObject *
-add_CardProperty (VObject *o, CardProperty *prop)
-{
- GList *node;
-
- switch (prop->encod) {
- case ENC_BASE64:
- addProp (o, VCBase64Prop);
- break;
- case ENC_QUOTED_PRINTABLE:
- addProp (o, VCQuotedPrintableProp);
- break;
- case ENC_8BIT:
- addProp (o, VC8bitProp);
- break;
- case ENC_7BIT:
- /* Do nothing: 7BIT is the default. Avoids file clutter. */
- break;
- default:
- g_warning ("? < Card had invalid encoding type.");
- }
-
- switch (prop->value) {
- case VAL_CID:
- addProp (o, VCContentIDProp);
- break;
- case VAL_INLINE:
- /* Do nothing: INLINE is the default. Avoids file clutter. */
- break;
- default:
- g_warning ("? < Card had invalid value type.");
- }
-
- for (node = prop->xtension; node; node = node->next) {
- CardXAttribute *xa = (CardXAttribute *) node->data;
- if (xa->data)
- addPropValue (o, xa->name, xa->data);
- else
- addProp (o, xa->name);
- }
-
- add_strProp (o, VCCharSetProp, prop->charset);
- add_strProp (o, VCLanguageProp, prop->lang);
-
- return o;
-}
-
-static VObject *
-add_CardStrProperty (VObject *vobj, const char *id, CardStrProperty *strprop)
-{
- VObject *vprop;
-
- if (strprop->prop.used) {
- vprop = add_strProp (vobj, id, strprop->str);
- add_CardProperty (vprop, &strprop->prop);
- }
-
- return vobj;
-}
-
-static VObject *
-add_PhotoType (VObject *o, enum PhotoType photo_type)
-{
- int i;
-
- for (i = 0; photo_pairs[i].str; i++)
- if (photo_type == photo_pairs[i].id) {
- addProp (o, photo_pairs[i].str);
- return o;
- }
-
- g_warning ("? > No PhotoType for Photo property. Falling back to JPEG.");
- addProp (o, VCJPEGProp);
-
- return o;
-}
-
-static VObject *
-add_AddrType (VObject *o, int addr_type)
-{
- int i;
-
- for (i = 0; addr_pairs[i].str; i++)
- if (addr_type & addr_pairs[i].id)
- addProp (o, addr_pairs[i].str);
-
- return o;
-}
-
-static void
-add_strAddrType (GString *string, int addr_type)
-{
- int i, first = 1;
- char *str;
-
- if (addr_type) {
- g_string_append (string, " (");
-
- for (i = 0; addr_pairs[i].str; i++)
- if (addr_type & addr_pairs[i].id) {
- if (!first)
- g_string_append (string, ", ");
- first = 0;
- str = my_cap (addr_pairs[i].str);
- g_string_append (string, str);
- g_free (str);
- }
-
- g_string_append_c (string, ')');
- }
-}
-
-static VObject *
-add_PhoneType (VObject *o, int phone_type)
-{
- int i;
-
- for (i = 0; phone_pairs[i].str; i++)
- if (phone_type & phone_pairs[i].id)
- addProp (o, phone_pairs[i].str);
-
- return o;
-}
-
-static void
-add_strPhoneType (GString *string, int phone_type)
-{
- int i, first = 1;
- char *str;
-
- if (phone_type) {
- g_string_append (string, " (");
-
- for (i = 0; phone_pairs[i].str; i++)
- if (phone_type & phone_pairs[i].id) {
- if (!first)
- g_string_append (string, ", ");
- first = 0;
- str = my_cap (phone_pairs[i].str);
- g_string_append (string, str);
- g_free (str);
- }
-
- g_string_append_c (string, ')');
- }
-}
-
-static VObject *
-add_EMailType (VObject *o, enum EMailType email_type)
-{
- int i;
-
- for (i = 0; email_pairs[i].str; i++)
- if (email_type == email_pairs[i].id) {
- addProp (o, email_pairs[i].str);
- return o;
- }
-
- g_warning ("? > No EMailType for EMail property. Falling back to INET.");
- addProp (o, VCInternetProp);
-
- return o;
-}
-
-static void
-add_strEMailType (GString *string, int email_type)
-{
- int i;
- char *str;
-
- if (email_type) {
- g_string_append (string, " (");
-
- for (i = 0; email_pairs[i].str; i++)
- if (email_type == email_pairs[i].id) {
- str = my_cap (email_pairs[i].str);
- g_string_append (string, str);
- g_free (str);
- break;
- }
-
- g_string_append_c (string, ')');
- }
-}
-
-static VObject *
-add_KeyType (VObject *o, enum KeyType key_type)
-{
- int i;
-
- for (i = 0; key_pairs[i].str; i++)
- if (key_type == key_pairs[i].id) {
- addProp (o, key_pairs[i].str);
- return o;
- }
-
- g_warning ("? > No KeyType for Key property. Falling back to PGP.");
- addProp (o, VCPGPProp);
-
- return o;
-}
-
-static void
-add_strKeyType (GString *string, int key_type)
-{
- int i;
- char *str;
-
- if (key_type) {
- g_string_append (string, " (");
-
- for (i = 0; key_pairs[i].str; i++)
- if (key_type == key_pairs[i].id) {
- str = my_cap (key_pairs[i].str);
- g_string_append (string, str);
- g_free (str);
- break;
- }
-
- g_string_append_c (string, ')');
- }
-}
-
-static VObject *
-add_SoundType (VObject *o, enum SoundType sound_type)
-{
- int i;
-
- for (i = 0; sound_pairs[i].str; i++)
- if (sound_type == sound_pairs[i].id) {
- addProp (o, sound_pairs[i].str);
- return o;
- }
-
- return o;
-}
-
-char *card_timezn_str (CardTimeZone timezn)
-{
- char *str;
-
- str = malloc (7);
- snprintf (str, 7, (timezn.sign == -1)? "-%02d:%02d" : "%02d:%02d",
- timezn.hours, timezn.mins);
- return str;
-}
-
-char *card_geopos_str (CardGeoPos geopos)
-{
- char *str;
-
- str = malloc (15);
- snprintf (str, 15, "%03.02f,%03.02f", geopos.lon, geopos.lat);
- return str;
-}
-
-static void add_CardStrProperty_to_string (GString *string, char *prop_name,
- CardStrProperty *strprop)
-{
- if (strprop->prop.used) {
- if (prop_name)
- g_string_append (string, prop_name);
-
- g_string_append (string, strprop->str);
- }
-}
-
-static void add_strProp_to_string (GString *string, char *prop_name, char *val)
-{
- if (val) {
- if (prop_name)
- g_string_append (string, prop_name);
-
- g_string_append (string, val);
- }
-}
-
-static void addProp_to_string (GString *string, char *prop_name)
-{
- if (prop_name)
- g_string_append (string, prop_name);
-}
-
-char *
-card_to_string (Card *crd)
-{
- GString *string;
- char *ret;
-
- string = g_string_new ("");
-
- add_CardStrProperty_to_string (string, _ ("Card: "), &crd->fname);
- if (crd->name.prop.used) {
- addProp_to_string (string, _ ("\nName: "));
- add_strProp_to_string (string, _ ("\n Prefix: "), crd->name.prefix);
- add_strProp_to_string (string, _ ("\n Given: "), crd->name.given);
- add_strProp_to_string (string, _ ("\n Additional: "), crd->name.additional);
- add_strProp_to_string (string, _ ("\n Family: "), crd->name.family);
- add_strProp_to_string (string, _ ("\n Suffix: "), crd->name.suffix);
- g_string_append_c (string, '\n');
- }
-
-/* if (crd->photo.prop.used) {
- addPropSizedValue (string, _ ("\nPhoto: "),
- crd->photo.data, crd->photo.size);
- add_PhotoType (string, crd->photo.type);
- }*/
-
- if (crd->bday.prop.used) {
- char *date_str;
-
- date_str = card_bday_str (crd->bday);
- add_strProp_to_string (string, _ ("\nBirth Date: "), date_str);
- free (date_str);
- }
-
- if (crd->deladdr.l) {
- GList *node;
-
- for (node = crd->deladdr.l; node; node = node->next) {
- CardDelAddr *deladdr = (CardDelAddr *) node->data;
-
- if (deladdr->prop.used) {
- addProp_to_string (string, _ ("\nAddress:"));
- add_strAddrType (string, deladdr->type);
- add_strProp_to_string (string, _ ("\n Postal Box: "), deladdr->po);
- add_strProp_to_string (string, _ ("\n Ext: "),deladdr->ext);
- add_strProp_to_string (string, _ ("\n Street: "),deladdr->street);
- add_strProp_to_string (string, _ ("\n City: "), deladdr->city);
- add_strProp_to_string (string, _ ("\n Region: "), deladdr->region);
- add_strProp_to_string (string, _ ("\n Postal Code: "), deladdr->code);
- add_strProp_to_string (string, _ ("\n Country: "), deladdr->country);
- }
- }
-
- g_string_append_c (string, '\n');
- }
-
- if (crd->dellabel.l) {
- GList *node;
-
- for (node = crd->dellabel.l; node; node = node->next) {
- CardDelLabel *dellabel = (CardDelLabel *) node->data;
-
- add_strProp_to_string (string, _ ("\nDelivery Label: "),
- dellabel->data);
- add_strAddrType (string, dellabel->type);
- }
- }
-
- if (crd->phone.l) {
- GList *node;
- char *sep;
-
- if (crd->phone.l->next) {
- sep = " ";
- g_string_append (string, _ ("\nTelephones:\n"));
- } else {
- sep = " ";
- g_string_append (string, _ ("\nTelephone:"));
- }
-
- for (node = crd->phone.l; node; node = node->next) {
- CardPhone *phone = (CardPhone *) node->data;
-
- if (phone->prop.used) {
- g_string_append (string, sep);
- g_string_append (string, phone->data);
- add_strPhoneType (string, phone->type);
- g_string_append_c (string, '\n');
- }
- }
-
- if (crd->phone.l->next)
- g_string_append_c (string, '\n');
- }
-
- if (crd->email.l) {
- GList *node;
- char *sep;
-
- if (crd->email.l->next) {
- sep = " ";
- g_string_append (string, _ ("\nE-mail:\n"));
- } else {
- sep = " ";
- g_string_append (string, _ ("\nE-mail:"));
- }
-
-
- for (node = crd->email.l; node; node = node->next) {
- CardEMail *email = (CardEMail *) node->data;
-
- if (email->prop.used) {
- g_string_append (string, sep);
- g_string_append (string, email->data);
- add_strEMailType (string, email->type);
- g_string_append_c (string, '\n');
- }
- }
-
- if (crd->email.l->next)
- g_string_append_c (string, '\n');
- }
-
- add_CardStrProperty_to_string (string, _ ("\nMailer: "), &crd->mailer);
-
- if (crd->timezn.prop.used) {
- char *str;
-
- str = card_timezn_str (crd->timezn);
- add_strProp_to_string (string, _ ("\nTime Zone: "), str);
- free (str);
- }
-
- if (crd->geopos.prop.used) {
- char *str;
-
- str = card_geopos_str (crd->geopos);
- add_strProp_to_string (string, _ ("\nGeo Location: "), str);
- free (str);
- }
-
- add_CardStrProperty_to_string (string, _ ("\nBusiness Role: "), &crd->role);
-
-/* if (crd->logo.prop.used) {
- addPropSizedValue (string, _ ("\nLogo: "),
- crd->logo.data, crd->logo.size);
- add_PhotoType (string, crd->logo.type);
- }*/
-
-/* if (crd->agent)
- addstringectProp (string, card_convert_to_stringect (crd->agent));*/
-
- if (crd->org.prop.used) {
- addProp_to_string (string, _ ("\nOrg: "));
- add_strProp_to_string (string, _ ("\n Name: "), crd->org.name);
- add_strProp_to_string (string, _ ("\n Unit: "), crd->org.unit1);
- add_strProp_to_string (string, _ ("\n Unit2: "), crd->org.unit2);
- add_strProp_to_string (string, _ ("\n Unit3: "), crd->org.unit3);
- add_strProp_to_string (string, _ ("\n Unit4: "), crd->org.unit4);
- g_string_append_c (string, '\n');
- }
-
- add_CardStrProperty_to_string (string, _ ("\nCategories: "), &crd->categories);
- add_CardStrProperty_to_string (string, _ ("\nComment: "), &crd->comment);
-
-/* if (crd->sound.prop.used) {
- if (crd->sound.type != SOUND_PHONETIC)
- addPropSizedValue (string, _ ("\nPronunciation: "),
- crd->sound.data, crd->sound.size);
- else
- add_strProp_to_string (string, _ ("\nPronunciation: "),
- crd->sound.data);
-
- add_SoundType (string, crd->sound.type);
- }*/
-
- add_CardStrProperty_to_string (string, _ ("\nUnique String: "), &crd->uid);
-
- if (crd->key.prop.used) {
- add_strProp_to_string (string, _ ("\nPublic Key: "), crd->key.data);
- add_strKeyType (string, crd->key.type);
- }
-
- ret = g_strdup (string->str);
- g_string_free (string, TRUE);
-
- return ret;
-}
-
-char *
-card_to_vobj_string (Card *crd)
-{
- VObject *object;
- char *data, *ret_val;
-
- g_assert (crd != NULL);
-
- object = card_convert_to_vobject (crd);
- data = writeMemVObject (0, 0, object);
- ret_val = g_strdup (data);
- free (data);
-
- cleanVObject (object);
-
- return ret_val;
-}
-
-void
-card_save (Card *crd, FILE *fp)
-{
- VObject *object;
-
- g_return_if_fail (crd != NULL);
-
- object = card_convert_to_vobject (crd);
- writeVObject (fp, object);
- cleanVObject (object);
-}
-#endif
-
-static ECardDate
-e_card_date_from_string (char *str)
-{
- ECardDate date;
- int length;
-
- date.year = 0;
- date.month = 0;
- date.day = 0;
-
- length = strlen(str);
-
- if (length == 10 ) {
- date.year = str[0] * 1000 + str[1] * 100 + str[2] * 10 + str[3] - '0' * 1111;
- date.month = str[5] * 10 + str[6] - '0' * 11;
- date.day = str[8] * 10 + str[9] - '0' * 11;
- } else if ( length == 8 ) {
- date.year = str[0] * 1000 + str[1] * 100 + str[2] * 10 + str[3] - '0' * 1111;
- date.month = str[4] * 10 + str[5] - '0' * 11;
- date.day = str[6] * 10 + str[7] - '0' * 11;
- }
-
- return date;
-}
-
-char *
-e_v_object_get_child_value(VObject *vobj, char *name)
-{
- char *ret_val;
- VObjectIterator iterator;
- initPropIterator(&iterator, vobj);
- while(moreIteration (&iterator)) {
- VObject *attribute = nextVObject(&iterator);
- const char *id = vObjectName(attribute);
- if ( ! strcmp(id, name) ) {
- assign_string(attribute, &ret_val);
- return ret_val;
- }
- }
- ret_val = g_new(char, 1);
- *ret_val = 0;
- return ret_val;
-}
-
-static ECardPhoneFlags
-get_phone_flags (VObject *vobj)
-{
- ECardPhoneFlags ret = 0;
- int i;
-
- struct {
- char *id;
- ECardPhoneFlags flag;
- } phone_pairs[] = {
- { VCPreferredProp, E_CARD_PHONE_PREF },
- { VCWorkProp, E_CARD_PHONE_WORK },
- { VCHomeProp, E_CARD_PHONE_HOME },
- { VCVoiceProp, E_CARD_PHONE_VOICE },
- { VCFaxProp, E_CARD_PHONE_FAX },
- { VCMessageProp, E_CARD_PHONE_MSG },
- { VCCellularProp, E_CARD_PHONE_CELL },
- { VCPagerProp, E_CARD_PHONE_PAGER },
- { VCBBSProp, E_CARD_PHONE_BBS },
- { VCModemProp, E_CARD_PHONE_MODEM },
- { VCCarProp, E_CARD_PHONE_CAR },
- { VCISDNProp, E_CARD_PHONE_ISDN },
- { VCVideoProp, E_CARD_PHONE_VIDEO },
- };
-
- for (i = 0; i < sizeof(phone_pairs) / sizeof(phone_pairs[0]); i++) {
- if (isAPropertyOf (vobj, phone_pairs[i].id)) {
- ret |= phone_pairs[i].flag;
- }
- }
-
- return ret;
-}
-
-static void
-set_phone_flags (VObject *vobj, ECardPhoneFlags flags)
-{
- int i;
-
- struct {
- char *id;
- ECardPhoneFlags flag;
- } phone_pairs[] = {
- { VCPreferredProp, E_CARD_PHONE_PREF },
- { VCWorkProp, E_CARD_PHONE_WORK },
- { VCHomeProp, E_CARD_PHONE_HOME },
- { VCVoiceProp, E_CARD_PHONE_VOICE },
- { VCFaxProp, E_CARD_PHONE_FAX },
- { VCMessageProp, E_CARD_PHONE_MSG },
- { VCCellularProp, E_CARD_PHONE_CELL },
- { VCPagerProp, E_CARD_PHONE_PAGER },
- { VCBBSProp, E_CARD_PHONE_BBS },
- { VCModemProp, E_CARD_PHONE_MODEM },
- { VCCarProp, E_CARD_PHONE_CAR },
- { VCISDNProp, E_CARD_PHONE_ISDN },
- { VCVideoProp, E_CARD_PHONE_VIDEO },
- };
-
- for (i = 0; i < sizeof(phone_pairs) / sizeof(phone_pairs[0]); i++) {
- if (flags & phone_pairs[i].flag) {
- addProp (vobj, phone_pairs[i].id);
- }
- }
-}
-
-static ECardAddressFlags
-get_address_flags (VObject *vobj)
-{
- ECardAddressFlags ret = 0;
- int i;
-
- struct {
- char *id;
- ECardAddressFlags flag;
- } addr_pairs[] = {
- { VCDomesticProp, E_CARD_ADDR_DOM },
- { VCInternationalProp, E_CARD_ADDR_INTL },
- { VCPostalProp, E_CARD_ADDR_POSTAL },
- { VCParcelProp, E_CARD_ADDR_PARCEL },
- { VCHomeProp, E_CARD_ADDR_HOME },
- { VCWorkProp, E_CARD_ADDR_WORK },
- };
-
- for (i = 0; i < sizeof(addr_pairs) / sizeof(addr_pairs[0]); i++) {
- if (isAPropertyOf (vobj, addr_pairs[i].id)) {
- ret |= addr_pairs[i].flag;
- }
- }
-
- return ret;
-}
-
-static void
-set_address_flags (VObject *vobj, ECardAddressFlags flags)
-{
- int i;
-
- struct {
- char *id;
- ECardAddressFlags flag;
- } addr_pairs[] = {
- { VCDomesticProp, E_CARD_ADDR_DOM },
- { VCInternationalProp, E_CARD_ADDR_INTL },
- { VCPostalProp, E_CARD_ADDR_POSTAL },
- { VCParcelProp, E_CARD_ADDR_PARCEL },
- { VCHomeProp, E_CARD_ADDR_HOME },
- { VCWorkProp, E_CARD_ADDR_WORK },
- };
-
- for (i = 0; i < sizeof(addr_pairs) / sizeof(addr_pairs[0]); i++) {
- if (flags & addr_pairs[i].flag) {
- addProp (vobj, addr_pairs[i].id);
- }
- }
-}
diff --git a/addressbook/backend/ebook/e-card.h b/addressbook/backend/ebook/e-card.h
deleted file mode 100644
index 9f10a984ed..0000000000
--- a/addressbook/backend/ebook/e-card.h
+++ /dev/null
@@ -1,137 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * Authors:
- * Chris Lahey <clahey@helixcode.com>
- * Arturo Espinosa
- * Nat Friedman (nat@helixcode.com)
- *
- * Copyright (C) 2000 Helix Code, Inc.
- * Copyright (C) 1999 The Free Software Foundation
- */
-
-#ifndef __E_CARD_H__
-#define __E_CARD_H__
-
-#include <time.h>
-#include <gtk/gtk.h>
-#include <stdio.h>
-#include <ebook/e-card-types.h>
-#include <ebook/e-card-list.h>
-
-#define E_TYPE_CARD (e_card_get_type ())
-#define E_CARD(obj) (GTK_CHECK_CAST ((obj), E_TYPE_CARD, ECard))
-#define E_CARD_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), E_TYPE_CARD, ECardClass))
-#define E_IS_CARD(obj) (GTK_CHECK_TYPE ((obj), E_TYPE_CARD))
-#define E_IS_CARD_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), E_TYPE_CARD))
-
-typedef struct _ECard ECard;
-typedef struct _ECardClass ECardClass;
-
-struct _ECard {
- GtkObject object;
- char *id;
-
- char *file_as; /* The File As field. */
- char *fname; /* The full name. */
- ECardName *name; /* The structured name. */
- ECardList *address; /* Delivery addresses (ECardDeliveryAddress *) */
- ECardList *address_label; /* Delivery address labels
- * (ECardAddrLabel *) */
-
- ECardList *phone; /* Phone numbers (ECardPhone *) */
- ECardList *email; /* Email addresses (char *) */
- char *url; /* The person's web page. */
-
- ECardDate *bday; /* The person's birthday. */
-
- char *note;
-
-
- char *org; /* The person's organization. */
- char *org_unit; /* The person's organization unit. */
- char *office; /* The person's office. */
- char *role; /* The person's role w/in his org */
- char *title; /* The person's title w/in his org */
-
- char *manager;
- char *assistant;
-
- char *nickname; /* The person's nickname */
-
- char *spouse; /* The person's spouse. */
- ECardDate *anniversary; /* The person's anniversary. */
-
- char *mailer; /* Mailer */
-
- char *fburl; /* Free Busy URL */
-
- ECardList *categories; /* Categories. */
-
- ECardList *arbitrary; /* Arbitrary fields. */
-
-#if 0
- ECardPhoto *logo; /* This person's org's logo. */
-
- ECardPhoto *photo; /* A photo of the person. */
-
- ECard *agent; /* A person who sereves as this
- guy's agent/secretary/etc. */
-
-
- char *categories; /* A list of the categories to which
- this card belongs. */
-
- ECardSound *sound;
-
- ECardKey *key; /* The person's public key. */
- ECardTimeZone *timezn; /* The person's time zone. */
- ECardGeoPos *geopos; /* The person's long/lat. */
-
- ECardRev *rev; /* The time this card was last
- modified. */
-
- ECardList xtension;
-#endif
-};
-
-struct _ECardClass {
- GtkObjectClass parent_class;
- GHashTable *attribute_jump_table;
-};
-
-
-ECard *e_card_new ( char *vcard);
-char *e_card_get_id ( ECard *card);
-void e_card_set_id ( ECard *card,
- const char *character);
-char *e_card_get_vcard ( ECard *card);
-ECard *e_card_duplicate ( ECard *card);
-
-ECardPhone *e_card_phone_new (void);
-ECardPhone *e_card_phone_copy (const ECardPhone *phone);
-void e_card_phone_free ( ECardPhone *phone);
-
-ECardDeliveryAddress *e_card_delivery_address_new (void);
-ECardDeliveryAddress *e_card_delivery_address_copy (const ECardDeliveryAddress *addr);
-void e_card_delivery_address_free ( ECardDeliveryAddress *addr);
-char *e_card_delivery_address_to_string (const ECardDeliveryAddress *addr);
-ECardDeliveryAddress *e_card_delivery_address_from_string (const char *full_addr);
-
-ECardAddrLabel *e_card_address_label_new (void);
-ECardAddrLabel *e_card_address_label_copy (const ECardAddrLabel *addr);
-void e_card_address_label_free ( ECardAddrLabel *addr);
-
-ECardName *e_card_name_new (void);
-ECardName *e_card_name_copy (const ECardName *name);
-void e_card_name_free ( ECardName *name);
-char *e_card_name_to_string (const ECardName *name);
-ECardName *e_card_name_from_string (const char *full_name);
-
-ECardArbitrary *e_card_arbitrary_new (void);
-ECardArbitrary *e_card_arbitrary_copy (const ECardArbitrary *arbitrary);
-void e_card_arbitrary_free ( ECardArbitrary *arbitrary);
-
-/* Standard Gtk function */
-GtkType e_card_get_type (void);
-
-#endif /* ! __E_CARD_H__ */
diff --git a/addressbook/backend/ebook/load-pine-addressbook.c b/addressbook/backend/ebook/load-pine-addressbook.c
deleted file mode 100644
index 8837a11a9a..0000000000
--- a/addressbook/backend/ebook/load-pine-addressbook.c
+++ /dev/null
@@ -1,147 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-#include <config.h>
-#include <bonobo.h>
-#include <gnome.h>
-#include <stdio.h>
-
-#include <e-book.h>
-
-static CORBA_Environment ev;
-
-#ifdef USING_OAF
-
-#include <liboaf/liboaf.h>
-
-static void
-init_corba (int *argc, char **argv)
-{
- gnome_init_with_popt_table("blah", "0.0", *argc, argv, NULL, 0, NULL);
-
- oaf_init (*argc, argv);
-}
-
-#else
-
-#include <libgnorba/gnorba.h>
-
-static void
-init_corba (int *argc, char **argv)
-{
- gnome_CORBA_init_with_popt_table (
- "blah", "0.0",
- argc, argv, NULL, 0, NULL, GNORBA_INIT_SERVER_FUNC, &ev);
-}
-
-#endif
-
-static void
-init_bonobo (int argc, char **argv)
-{
- if (bonobo_init (CORBA_OBJECT_NIL, CORBA_OBJECT_NIL, CORBA_OBJECT_NIL) == FALSE)
- g_error (_("Could not initialize Bonobo"));
-}
-
-static void
-add_card_cb (EBook *book, EBookStatus status, const gchar *id, gpointer closure)
-{
- ECard *card = E_CARD(closure);
- char *vcard = e_card_get_vcard(card);
- g_print ("Saved card: %s\n", vcard);
- g_free(vcard);
- gtk_object_unref(GTK_OBJECT(card));
-}
-
-static void
-book_open_cb (EBook *book, EBookStatus status, gpointer closure)
-{
- FILE *fp = fopen (".addressbook", "r");
- char line[1024];
- while(fgets(line, 1024, fp)) {
- int length = strlen(line);
- char **strings;
- ECardName *name;
- ECard *card;
- ECardList *list;
- if (line[length - 1] == '\n')
- line[--length] = 0;
-
- card = e_card_new("");
- strings = g_strsplit(line, "\t", 3);
- name = e_card_name_from_string(strings[1]);
- gtk_object_set(GTK_OBJECT(card),
- "nickname", strings[0],
- "full_name", strings[1],
- "name", name,
- NULL);
- gtk_object_get(GTK_OBJECT(card),
- "email", &list,
- NULL);
- e_card_list_append(list, strings[2]);
- g_strfreev(strings);
- e_book_add_card(book, card, add_card_cb, card);
- }
-}
-
-static guint
-ebook_create (void)
-{
- EBook *book;
-
- book = e_book_new ();
-
- if (!book) {
- printf ("%s: %s(): Couldn't create EBook, bailing.\n",
- __FILE__,
- __FUNCTION__);
- return FALSE;
- }
-
-
- if (! e_book_load_uri (book, "file:/tmp/test.db", book_open_cb, NULL)) {
- printf ("error calling load_uri!\n");
- }
-
-
- return FALSE;
-}
-
-#if 0
-static char *
-read_file (char *name)
-{
- int len;
- char buff[65536];
- char line[1024];
- FILE *f;
-
- f = fopen (name, "r");
- if (f == NULL)
- g_error ("Unable to open %s!\n", name);
-
- len = 0;
- while (fgets (line, sizeof (line), f) != NULL) {
- strcpy (buff + len, line);
- len += strlen (line);
- }
-
- fclose (f);
-
- return g_strdup (buff);
-}
-#endif
-
-int
-main (int argc, char **argv)
-{
-
- CORBA_exception_init (&ev);
-
- init_corba (&argc, argv);
- init_bonobo (argc, argv);
-
- gtk_idle_add ((GtkFunction) ebook_create, NULL);
-
- bonobo_main ();
-
- return 0;
-}
diff --git a/addressbook/backend/ebook/test-card.c b/addressbook/backend/ebook/test-card.c
deleted file mode 100644
index c6ee6e9ff1..0000000000
--- a/addressbook/backend/ebook/test-card.c
+++ /dev/null
@@ -1,194 +0,0 @@
-#include <gnome.h>
-#include "e-card.h"
-
-#define TEST_VCARD \
-"BEGIN:VCARD
-" \
-"FN:Nat
-" \
-"N:Friedman;Nat;D;Mr.
-" \
-"ORG:Helix Code, Inc.
-" \
-"TITLE:Head Geek
-" \
-"ROLE:Programmer/Executive
-" \
-"BDAY:1977-08-06
-" \
-"TEL;WORK:617 679 1984
-" \
-"TEL;CELL:123 456 7890
-" \
-"EMAIL;INTERNET:nat@nat.org
-" \
-"EMAIL;INTERNET:nat@helixcode.com
-" \
-"ADR;WORK;POSTAL:P.O. Box 101;;;Any Town;CA;91921-1234;
-" \
-"ADR;HOME;POSTAL;INTL:P.O. Box 202;;;Any Town 2;MI;12344-4321;USA
-" \
-"END:VCARD
-" \
-"
-"
-
-static char *
-read_file (char *name)
-{
- int len;
- char buff[65536];
- char line[1024];
- FILE *f;
-
- f = fopen (name, "r");
- if (f == NULL)
- g_error ("Unable to open %s!\n", name);
-
- len = 0;
- while (fgets (line, sizeof (line), f) != NULL) {
- strcpy (buff + len, line);
- len += strlen (line);
- }
-
- fclose (f);
-
- return g_strdup (buff);
-}
-
-
-
-int
-main (int argc, char **argv)
-{
- char *cardstr;
- ECard *card;
-
- /* Fields */
- char *fname;
- char *org;
- char *org_unit;
- char *title;
- char *role;
- char *nickname;
- char *fburl;
- ECardName *name;
- ECardList *address;
- ECardList *phone;
- ECardList *email;
- ECardIterator *iterator;
- ECardDate *bday;
-
- gnome_init ("TestCard", "0.0", argc, argv);
-
- cardstr = NULL;
- if (argc == 2)
- cardstr = read_file (argv [1]);
-
- if (cardstr == NULL)
- cardstr = TEST_VCARD;
-#if 0
- {
- int i;
- for ( i = 0; i < 100000; i++ ) {
- card = e_card_new (cardstr);
-
- gtk_object_unref (GTK_OBJECT (card));
- }
- }
-#endif
- card = e_card_new (cardstr);
- gtk_object_get(GTK_OBJECT(card),
- "full_name", &fname,
- "name", &name,
- "address", &address,
- "phone", &phone,
- "email", &email,
- "org", &org,
- "org_unit", &org_unit,
- "title", &title,
- "role", &role,
- "nickname", &nickname,
- "fburl", &fburl,
- "birth_date", &bday,
- NULL);
- if ( fname ) {
- printf("Name : %s\n", fname);
- g_free(fname);
- }
- if ( name ) {
- printf("Full Name:\n");
- if ( name->prefix )
- printf(" prefix : %s\n", name->prefix);
- if ( name->given )
- printf(" given : %s\n", name->given);
- if ( name->additional )
- printf(" additional : %s\n", name->additional);
- if ( name->family )
- printf(" family : %s\n", name->family);
- if ( name->suffix )
- printf(" suffix : %s\n", name->suffix);
- }
- if ( org ) {
- printf("Company : %s\n", org);
- }
- if ( org_unit ) {
- printf("Department : %s\n", org_unit);
- }
- if ( title ) {
- printf("Title : %s\n", title);
- }
- if ( role ) {
- printf("Profession : %s\n", role);
- }
- if ( nickname ) {
- printf("Nickname : %s\n", nickname);
- }
- if ( fburl ) {
- printf("Free Busy URL : %s\n", fburl);
- }
- if ( bday ) {
- printf("BDay : %4d-%02d-%02d\n", bday->year, bday->month, bday->day);
- }
- if ( email ) {
- iterator = e_card_list_get_iterator(address);
- for (; e_card_iterator_is_valid(iterator); e_card_iterator_next(iterator)) {
- printf("Email : %s\n", (char *) e_card_iterator_get(iterator));
- }
- gtk_object_unref(GTK_OBJECT(iterator));
- }
- if ( phone ) {
- iterator = e_card_list_get_iterator(address);
- for (; e_card_iterator_is_valid(iterator); e_card_iterator_next(iterator)) {
- ECardPhone *e_card_phone = (ECardPhone *) e_card_iterator_get(iterator);
- printf("Phone ; %d : %s\n", e_card_phone->flags, e_card_phone->number);
- }
- gtk_object_unref(GTK_OBJECT(iterator));
- }
- if ( address ) {
- iterator = e_card_list_get_iterator(address);
- for (; e_card_iterator_is_valid(iterator); e_card_iterator_next(iterator)) {
- ECardDeliveryAddress *del_address = (ECardDeliveryAddress *) e_card_iterator_get(iterator);
- printf("Address ; %d:\n", del_address->flags);
- if ( del_address->po )
- printf(" Po : %s\n", del_address->po);
- if ( del_address->ext )
- printf(" Ext : %s\n", del_address->ext);
- if ( del_address->street )
- printf(" Street : %s\n", del_address->street);
- if ( del_address->city )
- printf(" City : %s\n", del_address->city);
- if ( del_address->region )
- printf(" Region : %s\n", del_address->region);
- if ( del_address->code )
- printf(" Code : %s\n", del_address->code);
- if ( del_address->country )
- printf(" Country : %s\n", del_address->country);
- }
- gtk_object_unref(GTK_OBJECT(iterator));
- }
- printf("%s", e_card_get_vcard(card));
- gtk_object_unref (GTK_OBJECT (card));
-
- return 0;
-}
diff --git a/addressbook/backend/ebook/test-client-list.c b/addressbook/backend/ebook/test-client-list.c
deleted file mode 100644
index e492323310..0000000000
--- a/addressbook/backend/ebook/test-client-list.c
+++ /dev/null
@@ -1,82 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-#include <config.h>
-#include <bonobo.h>
-#include <gnome.h>
-
-#ifdef USING_OAF
-#include <liboaf/liboaf.h>
-#else
-#include <libgnorba/gnorba.h>
-#endif
-
-#include "e-book.h"
-
-CORBA_Environment ev;
-
-static void
-init_bonobo (int argc, char **argv)
-{
-#ifdef USING_OAF
- gnome_init ("blah", "0.0", argc, argv);
- oaf_init (argc, argv);
-#else
- gnome_CORBA_init_with_popt_table (
- "blah", "0.0",
- &argc, argv, NULL, 0, NULL, GNORBA_INIT_SERVER_FUNC, &ev);
-#endif
-
- if (bonobo_init (CORBA_OBJECT_NIL, CORBA_OBJECT_NIL, CORBA_OBJECT_NIL) == FALSE)
- g_error (_("Could not initialize Bonobo"));
-}
-
-static void
-get_cursor_cb (EBook *book, EBookStatus status, ECardCursor *cursor, gpointer closure)
-{
- long length = e_card_cursor_get_length(cursor);
- long i;
-
- printf ("Length: %d\n", (int) length);
- for ( i = 0; i < length; i++ ) {
- ECard *card = e_card_cursor_get_nth(cursor, i);
- char *vcard = e_card_get_vcard(card);
- printf("[%s]\n", vcard);
- g_free(vcard);
- gtk_object_unref(GTK_OBJECT(card));
- }
-}
-
-static void
-book_open_cb (EBook *book, EBookStatus status, gpointer closure)
-{
- printf ("Book opened.\n");
- e_book_get_cursor(book, "", get_cursor_cb, NULL);
-}
-
-static guint
-ebook_create (void)
-{
- EBook *book;
-
- book = e_book_new ();
-
- if (! e_book_load_uri (book, "file:/tmp/test.db", book_open_cb, NULL)) {
- printf ("error calling load_uri!\n");
- }
-
-
- return FALSE;
-}
-
-int
-main (int argc, char **argv)
-{
-
- CORBA_exception_init (&ev);
- init_bonobo (argc, argv);
-
- gtk_idle_add ((GtkFunction) ebook_create, NULL);
-
- bonobo_main ();
-
- return 0;
-}
diff --git a/addressbook/backend/ebook/test-client.c b/addressbook/backend/ebook/test-client.c
deleted file mode 100644
index ef13c1ab96..0000000000
--- a/addressbook/backend/ebook/test-client.c
+++ /dev/null
@@ -1,190 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-#include <config.h>
-#include <bonobo.h>
-#include <gnome.h>
-
-#include <e-book.h>
-
-#define TEST_VCARD \
-"BEGIN:VCARD
-" \
-"FN:Nat
-" \
-"N:Friedman;Nat;D;Mr.
-" \
-"BDAY:1977-08-06
-" \
-"TEL;WORK:617 679 1984
-" \
-"TEL;CELL:123 456 7890
-" \
-"EMAIL;INTERNET:nat@nat.org
-" \
-"EMAIL;INTERNET:nat@helixcode.com
-" \
-"ADR;WORK;POSTAL:P.O. Box 101;;;Any Town;CA;91921-1234;
-" \
-"END:VCARD
-" \
-"
-"
-
-static CORBA_Environment ev;
-static char *cardstr;
-
-#ifdef USING_OAF
-
-#include <liboaf/liboaf.h>
-
-static void
-init_corba (int *argc, char **argv)
-{
- gnome_init_with_popt_table("blah", "0.0", *argc, argv, NULL, 0, NULL);
-
- oaf_init (*argc, argv);
-}
-
-#else
-
-#include <libgnorba/gnorba.h>
-
-static void
-init_corba (int *argc, char **argv)
-{
- gnome_CORBA_init_with_popt_table (
- "blah", "0.0",
- argc, argv, NULL, 0, NULL, GNORBA_INIT_SERVER_FUNC, &ev);
-}
-
-#endif
-
-static void
-init_bonobo (int argc, char **argv)
-{
- if (bonobo_init (CORBA_OBJECT_NIL, CORBA_OBJECT_NIL, CORBA_OBJECT_NIL) == FALSE)
- g_error (_("Could not initialize Bonobo"));
-}
-
-static void
-get_cursor_cb (EBook *book, EBookStatus status, ECardCursor *cursor, gpointer closure)
-{
- long length = e_card_cursor_get_length(cursor);
- long i;
-
- /* we just added a card, so the length should be >1 */
- printf ("\n%s: %s(): Number of cards is %ld\n",
- __FILE__, __FUNCTION__, length);
- if (length < 1)
- printf ("*** Why isn't this above zero?? ***\n\n");
-
- for ( i = 0; i < length; i++ ) {
- ECard *card = e_card_cursor_get_nth(cursor, i);
- char *vcard = e_card_get_vcard(card);
- printf("Get all cards callback: [%s]\n", vcard);
- g_free(vcard);
- gtk_object_unref(GTK_OBJECT(card));
- }
-}
-
-static void
-add_card_cb (EBook *book, EBookStatus status, const gchar *id, gpointer closure)
-{
- char *vcard;
- ECard *card;
- GTimer *timer;
-
- printf ("Status: %d\n", status);
-
- printf ("Id: %s\n", id);
-
- timer = g_timer_new ();
- g_timer_start (timer);
- card = e_book_get_card (book, id);
- g_timer_stop (timer);
-
- vcard = e_card_get_vcard(card);
- printf ("%g\n", g_timer_elapsed (timer, NULL));
- printf ("Card added: [%s]\n", vcard);
- g_free(vcard);
- gtk_object_unref(GTK_OBJECT(card));
-
- printf ("Getting cards..\n");
- e_book_get_cursor(book, "", get_cursor_cb, NULL);
- printf ("Done getting all cards.\n");
-}
-
-static void
-book_open_cb (EBook *book, EBookStatus status, gpointer closure)
-{
- e_book_add_vcard(book, cardstr, add_card_cb, NULL);
-}
-
-static guint
-ebook_create (void)
-{
- EBook *book;
-
- book = e_book_new ();
-
- if (!book) {
- printf ("%s: %s(): Couldn't create EBook, bailing.\n",
- __FILE__,
- __FUNCTION__);
- return FALSE;
- }
-
-
- if (! e_book_load_uri (book, "file:/tmp/test.db", book_open_cb, NULL)) {
- printf ("error calling load_uri!\n");
- }
-
-
- return FALSE;
-}
-
-static char *
-read_file (char *name)
-{
- int len;
- char buff[65536];
- char line[1024];
- FILE *f;
-
- f = fopen (name, "r");
- if (f == NULL)
- g_error ("Unable to open %s!\n", name);
-
- len = 0;
- while (fgets (line, sizeof (line), f) != NULL) {
- strcpy (buff + len, line);
- len += strlen (line);
- }
-
- fclose (f);
-
- return g_strdup (buff);
-}
-
-
-int
-main (int argc, char **argv)
-{
-
- CORBA_exception_init (&ev);
-
- init_corba (&argc, argv);
- init_bonobo (argc, argv);
-
- cardstr = NULL;
- if (argc == 2)
- cardstr = read_file (argv [1]);
-
- if (cardstr == NULL)
- cardstr = TEST_VCARD;
-
- gtk_idle_add ((GtkFunction) ebook_create, NULL);
-
- bonobo_main ();
-
- return 0;
-}