aboutsummaryrefslogtreecommitdiffstats
path: root/addressbook/conduit
diff options
context:
space:
mode:
authornobody <nobody@localhost>2000-11-07 05:40:14 +0800
committernobody <nobody@localhost>2000-11-07 05:40:14 +0800
commit7ff5a358e591e3babf755052f6ea2ef5d849e6a2 (patch)
tree786145ed8b82796d89e41d2ed37058c0097ace13 /addressbook/conduit
parentb4c61eba8055f666fd8a2270879a6f9722faa2b3 (diff)
downloadgsoc2013-evolution-BEFORE_UI_REFACTOR.tar
gsoc2013-evolution-BEFORE_UI_REFACTOR.tar.gz
gsoc2013-evolution-BEFORE_UI_REFACTOR.tar.bz2
gsoc2013-evolution-BEFORE_UI_REFACTOR.tar.lz
gsoc2013-evolution-BEFORE_UI_REFACTOR.tar.xz
gsoc2013-evolution-BEFORE_UI_REFACTOR.tar.zst
gsoc2013-evolution-BEFORE_UI_REFACTOR.zip
This commit was manufactured by cvs2svn to create tagBEFORE_UI_REFACTOR
'BEFORE_UI_REFACTOR'. svn path=/tags/BEFORE_UI_REFACTOR/; revision=6432
Diffstat (limited to 'addressbook/conduit')
-rw-r--r--addressbook/conduit/.cvsignore8
-rw-r--r--addressbook/conduit/Makefile.am72
-rw-r--r--addressbook/conduit/address-conduit-config.h120
-rw-r--r--addressbook/conduit/address-conduit-control-applet.c341
-rw-r--r--addressbook/conduit/address-conduit.c959
-rw-r--r--addressbook/conduit/address-conduit.h75
-rw-r--r--addressbook/conduit/e-address-conduit-control-applet.desktop18
-rw-r--r--addressbook/conduit/e-address.conduit.in8
8 files changed, 0 insertions, 1601 deletions
diff --git a/addressbook/conduit/.cvsignore b/addressbook/conduit/.cvsignore
deleted file mode 100644
index 67db02346b..0000000000
--- a/addressbook/conduit/.cvsignore
+++ /dev/null
@@ -1,8 +0,0 @@
-.deps
-.libs
-*.lo
-Makefile.in
-Makefile
-libeaddress_conduit.la
-e-address-conduit-control-applet
-e-address.conduit \ No newline at end of file
diff --git a/addressbook/conduit/Makefile.am b/addressbook/conduit/Makefile.am
deleted file mode 100644
index 368a50e477..0000000000
--- a/addressbook/conduit/Makefile.am
+++ /dev/null
@@ -1,72 +0,0 @@
-INCLUDES = \
- -I$(top_srcdir) \
- -I$(top_srcdir)/addressbook \
- -I$(top_srcdir)/addressbook/backend \
- -I$(top_builddir)/e-util \
- $(BONOBO_VFS_GNOME_CFLAGS) \
- $(GNOME_PILOT_CFLAGS)
-
-# Address Capplet
-bin_PROGRAMS = e-address-conduit-control-applet
-
-e_address_conduit_control_applet_SOURCES = address-conduit-control-applet.c
-
-e_address_conduit_control_applet_LDADD = \
- $(CAPPLET_LIBS) \
- $(GNOME_LIBDIR) \
- $(GNOME_PILOT_LIBS) \
- $(PISOCK_LIBDIR) $(PISOCK_LIBS) \
- $(GNOME_CAPPLET_LIBS) \
- $(BONOBO_VFS_GNOME_LIBS) \
- $(GNOME_XML_LIB) \
- $(GNOMEUI_LIBS) \
- $(INTLLIBS)
-
-
-# Address Conduit
-e_address_conduitsdir=$(libdir)/gnome-pilot/conduits
-e_address_conduits_LTLIBRARIES = libeaddress_conduit.la
-
-libeaddress_conduit_la_SOURCES = \
- address-conduit.c \
- address-conduit.h \
- address-conduit-config.h
-
-libeaddress_conduit_la_LIBADD = \
- $(top_builddir)/addressbook/backend/ebook/libebook-static.la \
- $(top_builddir)/e-util/libeutil-static.la \
- $(top_builddir)/libversit/libversit.la \
- $(top_builddir)/e-util/libeconduit-static.la \
- $(BONOBO_VFS_GNOME_LIBS) \
- $(PISOCK_LIBDIR) $(PISOCK_LIBS) \
- $(GNOME_LIBDIR) \
- $(GNOME_LIBS)
-
-e-address.conduit: e-address.conduit.in Makefile
- sed -e 's^\@prefix\@^$(prefix)^g' < $(srcdir)/e-address.conduit.in > e-address.conduit.tmp \
- && mv e-address.conduit.tmp e-address.conduit
-
-
-ccenterdir = $(datadir)/control-center
-ccenterPalmPilotdir = $(ccenterdir)/Peripherals
-ccenterConduitsdir = $(ccenterPalmPilotdir)/Conduits
-ccenterConduits_DATA = e-address-conduit-control-applet.desktop
-
-panelConduitsdir = $(datadir)/gnome/apps/Settings/Peripherals/Conduits
-panelConduits_DATA = $(ccenterConduits_DATA)
-
-Conduitdir = $(datadir)/gnome-pilot/conduits/
-Conduit_DATA = e-address.conduit
-
-EXTRA_DIST = \
- e-address.conduit.in \
- $(ccenterConduits_DATA)
-
-install-data-local:
- $(mkinstalldirs) $(ccenterConduitsdir)
- $(mkinstalldirs) $(Conduitdir)
-
-
-
-
-
diff --git a/addressbook/conduit/address-conduit-config.h b/addressbook/conduit/address-conduit-config.h
deleted file mode 100644
index 1afa8cef4b..0000000000
--- a/addressbook/conduit/address-conduit-config.h
+++ /dev/null
@@ -1,120 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* Evolution calendar - ToDo Conduit Configuration
- *
- * Copyright (C) 1998 Free Software Foundation
- * Copyright (C) 2000 Helix Code, Inc.
- *
- * Authors: Eskil Heyn Olsen <deity@eskil.dk>
- * JP Rosevear <jpr@helixcode.com>
- *
- * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
- */
-
-#ifndef __ADDR_CONDUIT_CONFIG_H__
-#define __ADDR_CONDUIT_CONFIG_H__
-
-#include <gnome.h>
-#include <libgpilotdCM/gnome-pilot-conduit-management.h>
-#include <libgpilotdCM/gnome-pilot-conduit-config.h>
-
-/* Configuration info */
-typedef struct _EAddrConduitCfg EAddrConduitCfg;
-struct _EAddrConduitCfg {
- gboolean open_secret;
- guint32 pilot_id;
- GnomePilotConduitSyncType sync_type; /* only used by capplet */
-};
-
-#ifdef ADDR_CONFIG_LOAD
-/* Loads the configuration data */
-static void
-addrconduit_load_configuration (EAddrConduitCfg **c, guint32 pilot_id)
-{
- gchar prefix[256];
- g_snprintf (prefix, 255, "/gnome-pilot.d/e-todo-conduit/Pilot_%u/",
- pilot_id);
-
- *c = g_new0 (EAddrConduitCfg,1);
- g_assert (*c != NULL);
-
- gnome_config_push_prefix (prefix);
- (*c)->open_secret = gnome_config_get_bool ("open_secret=FALSE");
-
- /* set in capplets main */
- (*c)->sync_type = GnomePilotConduitSyncTypeCustom;
- gnome_config_pop_prefix ();
-
- (*c)->pilot_id = pilot_id;
-}
-#endif
-
-#ifdef ADDR_CONFIG_SAVE
-/* Saves the configuration data. */
-static void
-addrconduit_save_configuration (EAddrConduitCfg *c)
-{
- gchar prefix[256];
-
- g_snprintf (prefix, 255, "/gnome-pilot.d/e-todo-conduit/Pilot_%u/",
- c->pilot_id);
-
- gnome_config_push_prefix (prefix);
- gnome_config_set_bool ("open_secret", c->open_secret);
- gnome_config_pop_prefix ();
-
- gnome_config_sync ();
- gnome_config_drop_all ();
-}
-#endif
-
-#ifdef ADDR_CONFIG_DUPE
-/* Creates a duplicate of the configuration data */
-static EAddrConduitCfg*
-addrconduit_dupe_configuration (EAddrConduitCfg *c)
-{
- EAddrConduitCfg *retval;
-
- g_return_val_if_fail (c != NULL, NULL);
-
- retval = g_new0 (EAddrConduitCfg, 1);
- retval->sync_type = c->sync_type;
- retval->open_secret = c->open_secret;
- retval->pilot_id = c->pilot_id;
-
- return retval;
-}
-#endif
-
-#ifdef ADDR_CONFIG_DESTROY
-/* Destroy a configuration */
-static void
-addrconduit_destroy_configuration (EAddrConduitCfg **c)
-{
- g_return_if_fail (c != NULL);
- g_return_if_fail (*c != NULL);
-
- g_free (*c);
- *c = NULL;
-}
-#endif
-
-#endif __ADDR_CONDUIT_CONFIG_H__
-
-
-
-
-
-
-
diff --git a/addressbook/conduit/address-conduit-control-applet.c b/addressbook/conduit/address-conduit-control-applet.c
deleted file mode 100644
index 3cbdbf8976..0000000000
--- a/addressbook/conduit/address-conduit-control-applet.c
+++ /dev/null
@@ -1,341 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* Evolution addressbook - Address Conduit Capplet
- *
- * Copyright (C) 1998 Free Software Foundation
- * Copyright (C) 2000 Helix Code, Inc.
- *
- * Authors: Eskil Heyn Olsen <deity@eskil.dk>
- * JP Rosevear <jpr@helixcode.com>
- *
- * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
- */
-
-#include <pwd.h>
-#include <sys/types.h>
-#include <signal.h>
-#include <gnome.h>
-
-#include <config.h>
-#include <capplet-widget.h>
-
-#include <gpilotd/gnome-pilot-client.h>
-
-#define ADDR_CONFIG_LOAD 1
-#define ADDR_CONFIG_SAVE 1
-#define ADDR_CONFIG_DUPE 1
-#define ADDR_CONFIG_DESTROY 1
-#include <address-conduit-config.h>
-#undef ADDR_CONFIG_LOAD
-#undef ADDR_CONFIG_SAVE
-#undef ADDR_CONFIG_DUPE
-#undef ADDR_CONFIG_DESTROY
-
-/* tell changes callbacks to ignore changes or not */
-static gboolean ignore_changes=FALSE;
-
-/* capplet widget */
-static GtkWidget *capplet=NULL;
-
-/* host/device/pilot configuration windows */
-GtkWidget *cfgOptionsWindow=NULL;
-GtkWidget *cfgStateWindow=NULL;
-GtkWidget *dialogWindow=NULL;
-
-gboolean activated,org_activation_state;
-GnomePilotConduitManagement *conduit;
-GnomePilotConduitConfig *conduit_config;
-EAddrConduitCfg *origState = NULL;
-EAddrConduitCfg *curState = NULL;
-
-static void doTrySettings(GtkWidget *widget, EAddrConduitCfg *c);
-static void doRevertSettings(GtkWidget *widget, EAddrConduitCfg *c);
-static void doSaveSettings(GtkWidget *widget, EAddrConduitCfg *c);
-
-static void setStateCfg (GtkWidget *w, EAddrConduitCfg *c);
-
-gint pilotId;
-static GnomePilotClient *gpc;
-
-
-
-/* This array must be in the same order as enumerations
- in GnomePilotConduitSyncType as they are used as index.
- Custom type implies Disabled state.
-*/
-static gchar* sync_options[] ={ N_("Disabled"),
- N_("Synchronize"),
- N_("Copy From Pilot"),
- N_("Copy To Pilot"),
- N_("Merge From Pilot"),
- N_("Merge To Pilot")};
-#define SYNC_OPTIONS_COUNT 6
-
-static void
-doTrySettings (GtkWidget *widget, EAddrConduitCfg *c)
-{
- if (c->sync_type != GnomePilotConduitSyncTypeCustom)
- gnome_pilot_conduit_config_enable_with_first_sync (conduit_config,
- c->sync_type,
- c->sync_type,
- TRUE);
- else
- gnome_pilot_conduit_config_disable (conduit_config);
-
- addrconduit_save_configuration (c);
-}
-
-static void
-doRevertSettings (GtkWidget *widget, EAddrConduitCfg *c)
-{
- activated = org_activation_state;
- *c = *origState;
- setStateCfg (cfgStateWindow, c);
- doTrySettings (widget, c);
-}
-
-static void
-doSaveSettings (GtkWidget *widget, EAddrConduitCfg *c)
-{
- *origState = *c;
- doTrySettings (widget, c);
-}
-
-
-static void
-doHelp (GtkWidget *widget, gpointer data)
-{
- GtkWidget *about;
- const gchar *authors[] = {
- _("JP Rosevear <jpr@helixcode.com>"),
- "", _("Original Author:"),
- _("Eskil Heyn Olsen <deity@eskil.dk>"),
- NULL};
-
- about = gnome_about_new (
- _("Evolution Addressbook Conduit"), VERSION,
- _("(C) 1998-2000 the Free Software Foundation and Helix Code"),
- authors,
- _("Configuration utility for the evolution addressbook conduit.\n"),
- _("gnome-unknown.xpm"));
- gtk_widget_show (about);
-
- return;
-}
-
-
-/* called by the sync_type GtkOptionMenu */
-static void
-activate_sync_type (GtkMenuItem *widget, gpointer data)
-{
- curState->sync_type = GPOINTER_TO_INT (data);
- if (!ignore_changes)
- capplet_widget_state_changed (CAPPLET_WIDGET (capplet), TRUE);
-}
-
-
-static GtkWidget *
-createStateCfgWindow(void)
-{
- GtkWidget *vbox, *table;
- GtkWidget *label;
- GtkWidget *optionMenu,*menuItem;
- GtkMenu *menu;
- gint i;
-
- vbox = gtk_vbox_new(FALSE, GNOME_PAD);
-
- table = gtk_hbox_new(FALSE, 0);
- gtk_box_pack_start(GTK_BOX(vbox), table, FALSE, FALSE, GNOME_PAD);
-
- label = gtk_label_new(_("Synchronize Action"));
- gtk_box_pack_start(GTK_BOX(table), label, FALSE, FALSE, GNOME_PAD);
-
- optionMenu=gtk_option_menu_new();
- gtk_object_set_data(GTK_OBJECT(vbox), "conduit_state", optionMenu);
- menu = GTK_MENU(gtk_menu_new());
-
- for (i=0; i<SYNC_OPTIONS_COUNT;i++) {
- sync_options[i]=_(sync_options[i]);
- menuItem = gtk_menu_item_new_with_label(sync_options[i]);
- gtk_widget_show(menuItem);
- gtk_signal_connect(GTK_OBJECT(menuItem),"activate",
- GTK_SIGNAL_FUNC(activate_sync_type),
- GINT_TO_POINTER(i));
- gtk_menu_append(menu,menuItem);
- }
-
- gtk_option_menu_set_menu(GTK_OPTION_MENU(optionMenu),GTK_WIDGET(menu));
- gtk_box_pack_start(GTK_BOX(table), optionMenu, FALSE, FALSE, 0);
-
- return vbox;
-}
-
-
-static void
-setStateCfg (GtkWidget *w, EAddrConduitCfg *c)
-{
- GtkOptionMenu *optionMenu;
- GtkMenu *menu;
-
- optionMenu = gtk_object_get_data (GTK_OBJECT(w), "conduit_state");
- g_assert (optionMenu != NULL);
- menu = GTK_MENU (gtk_option_menu_get_menu (optionMenu));
-
- ignore_changes = TRUE;
- /* Here were are relying on the items in menu being the same
- order as in GnomePilotConduitSyncType. */
- gtk_option_menu_set_history (optionMenu, (int) c->sync_type);
- ignore_changes = FALSE;
-}
-
-static void
-pilot_capplet_setup(void)
-{
- GtkWidget *frame, *table;
-
- capplet = capplet_widget_new();
-
- table = gtk_table_new(1, 2, FALSE);
- gtk_container_border_width(GTK_CONTAINER(table), GNOME_PAD);
- gtk_container_add(GTK_CONTAINER(capplet), table);
-
- frame = gtk_frame_new(_("Conduit state"));
- gtk_container_border_width(GTK_CONTAINER(frame), GNOME_PAD_SMALL);
- gtk_table_attach_defaults(GTK_TABLE(table), frame, 0, 1, 0, 1);
- cfgStateWindow = createStateCfgWindow();
- gtk_container_add(GTK_CONTAINER(frame), cfgStateWindow);
-
- gtk_signal_connect(GTK_OBJECT(capplet), "try",
- GTK_SIGNAL_FUNC(doTrySettings), curState);
- gtk_signal_connect(GTK_OBJECT(capplet), "revert",
- GTK_SIGNAL_FUNC(doRevertSettings), curState);
- gtk_signal_connect(GTK_OBJECT(capplet), "ok",
- GTK_SIGNAL_FUNC(doSaveSettings), curState);
- gtk_signal_connect(GTK_OBJECT(capplet), "help",
- GTK_SIGNAL_FUNC(doHelp), NULL);
-
-
- setStateCfg (cfgStateWindow, curState);
-
- gtk_widget_show_all (capplet);
-}
-
-
-static void
-run_error_dialog(gchar *mesg,...)
-{
- char tmp[80];
- va_list ap;
-
- va_start(ap,mesg);
- vsnprintf(tmp,79,mesg,ap);
- dialogWindow = gnome_message_box_new(mesg,GNOME_MESSAGE_BOX_ERROR,GNOME_STOCK_BUTTON_OK,NULL);
- gnome_dialog_run_and_close(GNOME_DIALOG(dialogWindow));
- va_end(ap);
-}
-
-
-static gint
-get_pilot_id_from_gpilotd()
-{
- GList *pilots=NULL;
- gint pilot;
- int i,err;
-
- i=0;
- /* we don't worry about leaking here, so pilots isn't freed */
- switch(err = gnome_pilot_client_get_pilots(gpc,&pilots)) {
- case GPILOTD_OK: {
- if(pilots) {
- for(i=0;i<g_list_length(pilots);i++) {
- g_message("pilot %d = \"%s\"",i,(gchar*)g_list_nth(pilots,i)->data);
- }
- if(i==0) {
- run_error_dialog(_("No pilot configured, please choose the\n'Pilot Link Properties' capplet first."));
- return -1;
- } else {
- gnome_pilot_client_get_pilot_id_by_name(gpc,
- pilots->data, /* this is the first pilot */
- &pilot);
- if(i>1) {
- g_message("too many pilots...");
- /* need a choose here */
- }
- return pilot;
- }
- } else {
- run_error_dialog(_("No pilot configured, please choose the\n'Pilot Link Properties' capplet first."));
- return -1;
- }
- break;
- }
- case GPILOTD_ERR_NOT_CONNECTED:
- run_error_dialog(_("Not connected to the gnome-pilot daemon"));
- return -1;
- break;
- default:
- g_warning("gnome_pilot_client_get_pilot_ids(...) = %d",err);
- run_error_dialog(_("An error occured when trying to fetch\npilot list from the gnome-pilot daemon"));
- return -1;
- break;
- }
-}
-
-
-int
-main (int argc, char *argv[])
-{
- g_log_set_always_fatal (G_LOG_LEVEL_ERROR |
- G_LOG_LEVEL_CRITICAL |
- G_LOG_LEVEL_WARNING);
-
- /* Init capplet */
- gnome_capplet_init ("Evolution Address conduit control applet",
- NULL, argc, argv,
- NULL, 0, NULL);
-
- /* Setup Client */
- gpc = gnome_pilot_client_new ();
- gnome_pilot_client_connect_to_daemon (gpc);
- pilotId = get_pilot_id_from_gpilotd ();
- if (!pilotId)
- return -1;
-
-
- /* Put all code to set things up in here */
- conduit = gnome_pilot_conduit_management_new ("e_address_conduit", GNOME_PILOT_CONDUIT_MGMT_ID);
- if (conduit == NULL)
- return -1;
-
- addrconduit_load_configuration (&origState, pilotId);
- conduit_config = gnome_pilot_conduit_config_new (conduit, pilotId);
- org_activation_state = activated =
- gnome_pilot_conduit_config_is_enabled (conduit_config,
- &origState->sync_type);
-
- curState = addrconduit_dupe_configuration (origState);
-
- pilot_capplet_setup ();
-
- /* Done setting up, now run main loop */
- capplet_gtk_main();
-
- /* Clean up */
- gnome_pilot_conduit_management_destroy (conduit);
- addrconduit_destroy_configuration (&origState);
- addrconduit_destroy_configuration (&curState);
-
- return 0;
-}
diff --git a/addressbook/conduit/address-conduit.c b/addressbook/conduit/address-conduit.c
deleted file mode 100644
index 048422cb7b..0000000000
--- a/addressbook/conduit/address-conduit.c
+++ /dev/null
@@ -1,959 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* Evolution addressbook - Address Conduit
- *
- * Copyright (C) 1998 Free Software Foundation
- * Copyright (C) 2000 Helix Code, Inc.
- *
- * Authors: Eskil Heyn Olsen <deity@eskil.dk>
- * JP Rosevear <jpr@helixcode.com>
- *
- * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
- */
-
-#include <config.h>
-#include <sys/stat.h>
-#include <utime.h>
-#include <unistd.h>
-#include <pwd.h>
-#include <signal.h>
-#include <errno.h>
-
-#include <liboaf/liboaf.h>
-#include <bonobo.h>
-#include <gnome-xml/parser.h>
-#include <pi-source.h>
-#include <pi-socket.h>
-#include <pi-file.h>
-#include <pi-dlp.h>
-#include <pi-version.h>
-#include <ebook/e-book.h>
-#include <ebook/e-card-cursor.h>
-#include <ebook/e-card.h>
-#include <ebook/e-card-simple.h>
-
-#define ADDR_CONFIG_LOAD 1
-#define ADDR_CONFIG_DESTROY 1
-#include <address-conduit-config.h>
-#undef ADDR_CONFIG_LOAD
-#undef ADDR_CONFIG_DESTROY
-
-#include <address-conduit.h>
-
-GnomePilotConduit * conduit_get_gpilot_conduit (guint32);
-void conduit_destroy_gpilot_conduit (GnomePilotConduit*);
-
-#define CONDUIT_VERSION "0.1.0"
-#ifdef G_LOG_DOMAIN
-#undef G_LOG_DOMAIN
-#endif
-#define G_LOG_DOMAIN "eaddrconduit"
-
-#define DEBUG_CONDUIT 1
-/* #undef DEBUG_CONDUIT */
-
-#ifdef DEBUG_CONDUIT
-#define LOG(e...) g_log (G_LOG_DOMAIN, G_LOG_LEVEL_MESSAGE, e)
-#else
-#define LOG(e...)
-#endif
-
-#define WARN(e...) g_log (G_LOG_DOMAIN, G_LOG_LEVEL_WARNING, e)
-#define INFO(e...) g_log (G_LOG_DOMAIN, G_LOG_LEVEL_MESSAGE, e)
-
-typedef struct {
- EBookStatus status;
- char *id;
-} add_card_cons;
-
-/* debug spew DELETE ME */
-static char *
-print_local (EAddrLocalRecord *local)
-{
- static char buff[ 4096 ];
-
- if (local == NULL) {
- sprintf (buff, "[NULL]");
- return buff;
- }
-
-/* if (local->addr && local->addr->description) { */
-/* sprintf (buff, "[%d %ld %d %d '%s' '%s']", */
-/* local->todo->indefinite, */
-/* mktime (& local->todo->due), */
-/* local->todo->priority, */
-/* local->todo->complete, */
-/* local->todo->description, */
-/* local->todo->note); */
-/* return buff; */
-/* } */
-
- return "";
-}
-
-
-/* debug spew DELETE ME */
-static char *print_remote (GnomePilotRecord *remote)
-{
- static char buff[ 4096 ];
- struct Address addr;
-
- if (remote == NULL) {
- sprintf (buff, "[NULL]");
- return buff;
- }
-
- memset (&addr, 0, sizeof (struct Address));
- unpack_Address (&addr, remote->record, remote->length);
-
- sprintf (buff, "Hi");
-/* sprintf (buff, "[%d %ld %d %d '%s' '%s']", */
-/* todo.indefinite, */
-/* mktime (& todo.due), */
-/* todo.priority, */
-/* todo.complete, */
-/* todo.description, */
-/* todo.note); */
-
- return buff;
-}
-
-/* Context Routines */
-static void
-e_addr_context_new (EAddrConduitContext **ctxt, guint32 pilot_id)
-{
- *ctxt = g_new0 (EAddrConduitContext,1);
- g_assert (ctxt!=NULL);
-
- addrconduit_load_configuration (&(*ctxt)->cfg, pilot_id);
-}
-
-static void
-e_addr_context_destroy (EAddrConduitContext **ctxt)
-{
- g_return_if_fail (ctxt!=NULL);
- g_return_if_fail (*ctxt!=NULL);
-
- if ((*ctxt)->cfg != NULL)
- addrconduit_destroy_configuration (&(*ctxt)->cfg);
-
- g_free (*ctxt);
- *ctxt = NULL;
-}
-
-/* Addressbok Server routines */
-static void
-add_card_cb (EBook *ebook, EBookStatus status, const char *id, gpointer closure)
-{
- add_card_cons *cons = (add_card_cons*)closure;
-
- cons->status = status;
- cons->id = g_strdup (id);
-
- gtk_main_quit();
-}
-
-static void
-status_cb (EBook *ebook, EBookStatus status, gpointer closure)
-{
- (*(EBookStatus*)closure) = status;
- gtk_main_quit();
-}
-
-static void
-cursor_cb (EBook *book, EBookStatus status, ECardCursor *cursor, gpointer closure)
-{
- EAddrConduitContext *ctxt = (EAddrConduitContext*)closure;
-
- if (status == E_BOOK_STATUS_SUCCESS) {
- long length;
- int i;
-
- ctxt->address_load_success = TRUE;
-
- length = e_card_cursor_get_length (cursor);
- ctxt->cards = NULL;
- for (i = 0; i < length; i ++)
- ctxt->cards = g_list_append (ctxt->cards, e_card_cursor_get_nth (cursor, i));
-
- gtk_main_quit(); /* end the sub event loop */
- }
- else {
- WARN (_("Cursor could not be loaded\n"));
- gtk_main_quit(); /* end the sub event loop */
- }
-}
-
-static void
-book_open_cb (EBook *book, EBookStatus status, gpointer closure)
-{
- EAddrConduitContext *ctxt = (EAddrConduitContext*)closure;
-
- if (status == E_BOOK_STATUS_SUCCESS) {
- e_book_get_cursor (book, "(contains \"full_name\" \"\")", cursor_cb, ctxt);
- } else {
- WARN (_("EBook not loaded\n"));
- gtk_main_quit(); /* end the sub event loop */
- }
-}
-
-static int
-start_addressbook_server (EAddrConduitContext *ctxt)
-{
- gchar *uri, *path;
-
- g_return_val_if_fail(ctxt!=NULL,-2);
-
- ctxt->ebook = e_book_new ();
-
- path = g_concat_dir_and_file (g_get_home_dir (),
- "evolution/local/Contacts/addressbook.db");
- uri = g_strdup_printf ("file://%s", path);
- g_free (path);
-
- e_book_load_uri (ctxt->ebook, uri, book_open_cb, ctxt);
-
- /* run a sub event loop to turn ebook's async loading into a
- synchronous call */
- gtk_main ();
-
- g_free (uri);
-
- if (ctxt->address_load_success)
- return 0;
-
- return -1;
-}
-
-/* Utility routines */
-static char *
-map_name (EAddrConduitContext *ctxt)
-{
- char *filename = NULL;
-
- filename = g_strdup_printf ("%s/evolution/local/Contacts/pilot-map-%d.xml", g_get_home_dir (), ctxt->cfg->pilot_id);
-
- return filename;
-}
-
-static void
-compute_status (EAddrConduitContext *ctxt, EAddrLocalRecord *local, const char *uid)
-{
- local->local.archived = FALSE;
- local->local.secret = FALSE;
- local->local.attr = GnomePilotRecordNothing;
-}
-
-static GnomePilotRecord *
-local_record_to_pilot_record (EAddrLocalRecord *local,
- EAddrConduitContext *ctxt)
-{
- GnomePilotRecord *p = NULL;
-
- g_return_val_if_fail (local != NULL, NULL);
- g_assert (local->addr != NULL );
-
- LOG ("local_record_to_remote_record\n");
-
- p = g_new0 (GnomePilotRecord, 1);
-
- p->ID = local->local.ID;
- p->category = 0;
- p->attr = local->local.attr;
- p->archived = local->local.archived;
- p->secret = local->local.secret;
-
- /* Generate pilot record structure */
- p->record = g_new0 (char,0xffff);
- p->length = pack_Address (local->addr, p->record, 0xffff);
-
- return p;
-}
-
-static void
-local_record_from_ecard (EAddrLocalRecord *local, ECard *ecard, EAddrConduitContext *ctxt)
-{
- ECardSimple *simple;
- const ECardDeliveryAddress *delivery;
-
- g_return_if_fail (local != NULL);
- g_return_if_fail (ecard != NULL);
-
- local->ecard = ecard;
- simple = e_card_simple_new (ecard);
-
- local->local.ID = e_pilot_map_lookup_pid (ctxt->map, ecard->id);
-
- compute_status (ctxt, local, ecard->id);
-
- local->addr = g_new0 (struct Address, 1);
-
- local->addr->entry[entryFirstname] = strdup (ecard->name->given);
- local->addr->entry[entryLastname] = strdup (ecard->name->family);
- local->addr->entry[entryCompany] = strdup (ecard->org);
- local->addr->entry[entryTitle] = strdup (ecard->title);
-
- delivery = e_card_simple_get_delivery_address (simple, E_CARD_SIMPLE_ADDRESS_ID_HOME);
- local->addr->entry[entryAddress] = strdup (delivery->street);
- local->addr->entry[entryCity] = strdup (delivery->city);
- local->addr->entry[entryState] = strdup (delivery->region);
- local->addr->entry[entryZip] = strdup (delivery->code);
- local->addr->entry[entryCountry] = strdup (delivery->country);
-
- /* FIX ME Phone numbers */
-
- gtk_object_unref (GTK_OBJECT (simple));
-}
-
-static void
-local_record_from_uid (EAddrLocalRecord *local,
- char *uid,
- EAddrConduitContext *ctxt)
-{
- ECard *ecard;
-
- g_assert(local!=NULL);
-
- ecard = e_book_get_card (ctxt->ebook, uid);
-
- if (ecard != NULL) {
- local_record_from_ecard (local, ecard, ctxt);
- } else {
- ecard = e_card_new (NULL);
- local_record_from_ecard (local, ecard, ctxt);
- }
-}
-
-static ECard *
-ecard_from_remote_record(EAddrConduitContext *ctxt,
- GnomePilotRecord *remote,
- ECard *in_card)
-{
- struct Address address;
- ECard *ecard;
- ECardSimple *simple;
- int i;
- char *string;
- char *stringparts[4];
- char *commaparts[3];
- char *spaceparts[3];
- char *commastring, *spacestring;
-
- g_return_val_if_fail(remote!=NULL,NULL);
- memset (&address, 0, sizeof (struct Address));
- unpack_Address (&address, remote->record, remote->length);
-
- if (in_card == NULL) {
- ecard = e_card_new("");
- } else {
- ecard = e_card_duplicate (in_card);
- }
- simple = e_card_simple_new (ecard);
-
-#define get(pilotprop) \
- (address.entry [(pilotprop)])
-#define check(pilotprop) \
- (address.entry [(pilotprop)] && *address.entry [(pilotprop)])
-
- i = 0;
- if (check(entryFirstname))
- stringparts[i++] = get(entryFirstname);
- if (check(entryLastname))
- stringparts[i++] = get(entryLastname);
- stringparts[i] = NULL;
- string = g_strjoinv(" ", stringparts);
- e_card_simple_set(simple, E_CARD_SIMPLE_FIELD_FULL_NAME, string);
- g_free(string);
-
- i = 0;
- if (check (entryAddress))
- spaceparts[i++] = get (entryAddress);
- if (check (entryZip))
- spaceparts[i++] = get (entryZip);
- spaceparts[i] = 0;
- spacestring = g_strjoinv(" ", spaceparts);
-
- i = 0;
- if (check (entryCity))
- commaparts[i++] = get (entryCity);
- if (spacestring && *spacestring)
- commaparts[i++] = spacestring;
- commaparts[i] = 0;
- commastring = g_strjoinv(", ", commaparts);
-
- i = 0;
- if (check (entryAddress))
- stringparts[i++] = get (entryAddress);
- if (commastring && *commastring)
- stringparts[i++] = commastring;
- if (check (entryCountry))
- stringparts[i++] = get (entryCountry);
- stringparts[i] = NULL;
- string = g_strjoinv("\n", stringparts);
- e_card_simple_set(simple, E_CARD_SIMPLE_FIELD_ADDRESS_HOME, string);
-
- g_free(spacestring);
- g_free(commastring);
- g_free(string);
-
- if (check (entryTitle))
- e_card_simple_set(simple, E_CARD_SIMPLE_FIELD_TITLE, get (entryTitle));
-
- if (check (entryCompany))
- e_card_simple_set(simple, E_CARD_SIMPLE_FIELD_ORG, get (entryCompany));
-
- for (i = entryPhone1; i <= entryPhone5; i ++) {
- if (address.entry [i] && *(address.entry [i])) {
- char *phonelabel = ctxt->ai.phoneLabels[address.phoneLabel[i - entryPhone1]];
- if (!strcmp (phonelabel, "E-mail"))
- e_card_simple_set(simple, E_CARD_SIMPLE_FIELD_EMAIL, address.entry[i]);
- else if (!strcmp (phonelabel, "Home"))
- e_card_simple_set(simple, E_CARD_SIMPLE_FIELD_PHONE_HOME, address.entry[i]);
- else if (!strcmp (phonelabel, "Work"))
- e_card_simple_set(simple, E_CARD_SIMPLE_FIELD_PHONE_BUSINESS, address.entry[i]);
- else if (!strcmp (phonelabel, "Fax"))
- e_card_simple_set(simple, E_CARD_SIMPLE_FIELD_PHONE_BUSINESS_FAX, address.entry[i]);
- else if (!strcmp (phonelabel, "Other"))
- e_card_simple_set(simple, E_CARD_SIMPLE_FIELD_PHONE_OTHER, address.entry[i]);
- else if (!strcmp (phonelabel, "Main"))
- e_card_simple_set(simple, E_CARD_SIMPLE_FIELD_PHONE_PRIMARY, address.entry[i]);
- else if (!strcmp (phonelabel, "Pager"))
- e_card_simple_set(simple, E_CARD_SIMPLE_FIELD_PHONE_PAGER, address.entry[i]);
- else if (!strcmp (phonelabel, "Mobile"))
- e_card_simple_set(simple, E_CARD_SIMPLE_FIELD_PHONE_MOBILE, address.entry[i]);
- }
- }
-#undef get
-#undef set
-
- free_Address(&address);
-
- gtk_object_unref(GTK_OBJECT(simple));
-
- return ecard;
-}
-
-static void
-check_for_slow_setting (GnomePilotConduit *c, EAddrConduitContext *ctxt)
-{
- int count, map_count;
-
- count = g_list_length (ctxt->cards);
- count = 0;
-
- map_count = g_hash_table_size (ctxt->map->pid_map);
-
- /* If there are no objects or objects but no log */
- if ((count == 0) || (count > 0 && map_count == 0)) {
- GnomePilotConduitStandard *conduit;
- LOG (" doing slow sync\n");
- conduit = GNOME_PILOT_CONDUIT_STANDARD (c);
- gnome_pilot_conduit_standard_set_slow (conduit);
- } else {
- LOG (" doing fast sync\n");
- }
-}
-
-/* Pilot syncing callbacks */
-static gint
-pre_sync (GnomePilotConduit *conduit,
- GnomePilotDBInfo *dbi,
- EAddrConduitContext *ctxt)
-{
- GnomePilotConduitSyncAbs *abs_conduit;
-/* GList *l; */
- int len;
- unsigned char *buf;
- char *filename;
-/* gint num_records; */
-
- abs_conduit = GNOME_PILOT_CONDUIT_SYNC_ABS (conduit);
-
- LOG ("---------------------------------------------------------\n");
- LOG ("pre_sync: Addressbook Conduit v.%s", CONDUIT_VERSION);
- g_message ("Addressbook Conduit v.%s", CONDUIT_VERSION);
-
- ctxt->ebook = NULL;
-
- if (start_addressbook_server (ctxt) != 0) {
- WARN(_("Could not start wombat server"));
- gnome_pilot_conduit_error (conduit, _("Could not start wombat"));
- return -1;
- }
-
- /* Load the uid <--> pilot id mappings */
- filename = map_name (ctxt);
- e_pilot_map_read (filename, &ctxt->map);
- g_free (filename);
-
- /* Set the count information */
-/* num_records = cal_client_get_n_objects (ctxt->client, CALOBJ_TYPE_TODO); */
-/* gnome_pilot_conduit_sync_abs_set_num_local_records(abs_conduit, num_records); */
-/* num_records = g_hash_table_size (ctxt->added); */
-/* gnome_pilot_conduit_sync_abs_set_num_new_local_records (abs_conduit, num_records); */
-/* num_records = g_hash_table_size (ctxt->modified); */
-/* gnome_pilot_conduit_sync_abs_set_num_updated_local_records (abs_conduit, num_records); */
-/* num_records = g_hash_table_size (ctxt->deleted); */
-/* gnome_pilot_conduit_sync_abs_set_num_deleted_local_records(abs_conduit, num_records); */
-
- gtk_object_set_data (GTK_OBJECT (conduit), "dbinfo", dbi);
-
- buf = (unsigned char*)g_malloc (0xffff);
- len = dlp_ReadAppBlock (dbi->pilot_socket, dbi->db_handle, 0,
- (unsigned char *)buf, 0xffff);
-
- if (len < 0) {
- WARN (_("Could not read pilot's Address application block"));
- WARN ("dlp_ReadAppBlock(...) = %d", len);
- gnome_pilot_conduit_error (conduit,
- _("Could not read pilot's Address application block"));
- return -1;
- }
- unpack_AddressAppInfo (&(ctxt->ai), buf, len);
- g_free (buf);
-
- check_for_slow_setting (conduit, ctxt);
-
- return 0;
-}
-
-static gint
-post_sync (GnomePilotConduit *conduit,
- GnomePilotDBInfo *dbi,
- EAddrConduitContext *ctxt)
-{
- gchar *filename;
-
- LOG ("post_sync: Address Conduit v.%s", CONDUIT_VERSION);
- LOG ("---------------------------------------------------------\n");
-
- filename = map_name (ctxt);
- e_pilot_map_write (filename, ctxt->map);
- g_free (filename);
-
- return 0;
-}
-
-static gint
-set_pilot_id (GnomePilotConduitSyncAbs *conduit,
- EAddrLocalRecord *local,
- guint32 ID,
- EAddrConduitContext *ctxt)
-{
- LOG ("set_pilot_id: setting to %d\n", ID);
-
- e_pilot_map_insert (ctxt->map, ID, local->ecard->id, FALSE);
-
- return 0;
-}
-
-static gint
-set_status_cleared (GnomePilotConduitSyncAbs *conduit,
- EAddrLocalRecord *local,
- EAddrConduitContext *ctxt)
-{
- LOG ("set_status_cleared: clearing status\n");
-
- return 0;
-}
-
-static gint
-for_each (GnomePilotConduitSyncAbs *conduit,
- EAddrLocalRecord **local,
- EAddrConduitContext *ctxt)
-{
- static GList *cards, *iterator;
- static int count;
-
- g_return_val_if_fail (local != NULL, -1);
-
- if (*local == NULL) {
- LOG ("beginning for_each");
-
- cards = ctxt->cards;
- count = 0;
-
- if (cards != NULL) {
- LOG ("iterating over %d records", g_list_length (cards));
-
- *local = g_new0 (EAddrLocalRecord, 1);
-/* local_record_from_uid (*local, uids->data, ctxt) */;
-
- iterator = cards;
- } else {
- LOG ("no events");
- (*local) = NULL;
- return 0;
- }
- } else {
- count++;
- if (g_list_next (iterator)) {
- iterator = g_list_next (iterator);
-
- *local = g_new0 (EAddrLocalRecord, 1);
- local_record_from_uid (*local, iterator->data, ctxt);
- } else {
- LOG ("for_each ending");
-
- /* Tell the pilot the iteration is over */
- *local = NULL;
-
- return 0;
- }
- }
-
- return 0;
-}
-
-static gint
-for_each_modified (GnomePilotConduitSyncAbs *conduit,
- EAddrLocalRecord **local,
- EAddrConduitContext *ctxt)
-{
-/* static GList *changes, *iterator; */
-/* static int count; */
-
-/* g_return_val_if_fail (local != NULL, 0); */
-
-/* if (*local == NULL) { */
-/* LOG ("beginning for_each_modified: beginning\n"); */
-
-/* changes = ctxt->changed; */
-
-/* count = 0; */
-
-/* if (changes != NULL) { */
-/* CalObjChange *coc = changes->data; */
-
-/* LOG ("iterating over %d records", g_list_length (changes)); */
-
-/* *local = g_new0 (EAddrLocalRecord, 1); */
-/* local_record_from_uid (*local, coc->uid, ctxt); */
-
-/* iterator = changes; */
-/* } else { */
-/* LOG ("no events"); */
-/* (*local) = NULL; */
-/* return 0; */
-/* } */
-/* } else { */
-/* count++; */
-/* if (g_list_next (iterator)) { */
-/* CalObjChange *coc; */
-
-/* iterator = g_list_next (iterator); */
-/* coc = iterator->data; */
-
-/* *local = g_new0 (EAddrLocalRecord, 1); */
-/* local_record_from_uid (*local, coc->uid, ctxt); */
-/* } else { */
-/* LOG ("for_each_modified ending"); */
-
- /* Tell the pilot the iteration is over */
-/* (*local) = NULL; */
-
-/* return 0; */
-/* } */
-/* } */
-
- return 0;
-}
-
-static gint
-compare (GnomePilotConduitSyncAbs *conduit,
- EAddrLocalRecord *local,
- GnomePilotRecord *remote,
- EAddrConduitContext *ctxt)
-{
- /* used by the quick compare */
- GnomePilotRecord *local_pilot = NULL;
- int retval = 0;
-
- LOG ("compare: local=%s remote=%s...\n",
- print_local (local), print_remote (remote));
-
- g_return_val_if_fail (local!=NULL,-1);
- g_return_val_if_fail (remote!=NULL,-1);
-
-/* local_pilot = local_record_to_pilot_record (local, ctxt); */
- if (!local_pilot)
- return -1;
-
- if (remote->length != local_pilot->length
- || memcmp (local_pilot->record, remote->record, remote->length))
- retval = 1;
-
- if (retval == 0)
- LOG (" equal");
- else
- LOG (" not equal");
-
- g_free (local_pilot);
-
- return retval;
-}
-
-static gint
-add_record (GnomePilotConduitSyncAbs *conduit,
- GnomePilotRecord *remote,
- EAddrConduitContext *ctxt)
-{
- ECard *ecard;
- add_card_cons cons;
- int retval = 0;
-
- g_return_val_if_fail (remote != NULL, -1);
-
- LOG ("add_record: adding %s to desktop\n", print_remote (remote));
-
- ecard = ecard_from_remote_record (ctxt, remote, NULL);
-
- /* add the ecard to the server */
- e_book_add_card (ctxt->ebook, ecard, add_card_cb, &cons);
-
- gtk_main(); /* enter sub mainloop */
-
- if (cons.status != E_BOOK_STATUS_SUCCESS) {
- WARN ("add_record: failed to add card to ebook\n");
- return -1;
- }
-
- ctxt->cards = g_list_append (ctxt->cards,
- e_book_get_card (ctxt->ebook, cons.id));
- g_free (cons.id);
-
- e_pilot_map_insert (ctxt->map, remote->ID, ecard->id, FALSE);
-
- return retval;
-}
-
-static gint
-replace_record (GnomePilotConduitSyncAbs *conduit,
- EAddrLocalRecord *local,
- GnomePilotRecord *remote,
- EAddrConduitContext *ctxt)
-{
- ECard *new_ecard;
- EBookStatus commit_status;
- int retval = 0;
-
- g_return_val_if_fail (remote != NULL, -1);
-
- LOG ("replace_record: replace %s with %s\n",
- print_local (local), print_remote (remote));
-
- new_ecard = ecard_from_remote_record (ctxt, remote, local->ecard);
- gtk_object_unref (GTK_OBJECT (local->ecard));
- local->ecard = new_ecard;
-
- e_book_commit_card (ctxt->ebook, local->ecard, status_cb, &commit_status);
-
- gtk_main (); /* enter sub mainloop */
-
- if (commit_status != E_BOOK_STATUS_SUCCESS)
- WARN ("replace_record: failed to update card in ebook\n");
-
- gtk_object_unref (GTK_OBJECT (new_ecard));
-
- return retval;
-}
-
-static gint
-delete_record (GnomePilotConduitSyncAbs *conduit,
- EAddrLocalRecord *local,
- EAddrConduitContext *ctxt)
-{
-/* const char *uid; */
-
-/* g_return_val_if_fail (local != NULL, -1); */
-/* g_assert (local->comp != NULL); */
-
-/* cal_component_get_uid (local->comp, &uid); */
-
-/* LOG ("delete_record: deleting %s\n", uid); */
-
-/* cal_client_remove_object (ctxt->client, uid); */
-
- return 0;
-}
-
-static gint
-archive_record (GnomePilotConduitSyncAbs *conduit,
- EAddrLocalRecord *local,
- gboolean archive,
- EAddrConduitContext *ctxt)
-{
- int retval = 0;
-
- g_return_val_if_fail (local != NULL, -1);
-
- LOG ("archive_record: %s\n", archive ? "yes" : "no");
-
- return retval;
-}
-
-static gint
-match (GnomePilotConduitSyncAbs *conduit,
- GnomePilotRecord *remote,
- EAddrLocalRecord **local,
- EAddrConduitContext *ctxt)
-{
-/* char *uid; */
-
- LOG ("match: looking for local copy of %s\n",
- print_remote (remote));
-
- g_return_val_if_fail (local != NULL, -1);
- g_return_val_if_fail (remote != NULL, -1);
-
-/* *local = NULL; */
-/* uid = g_hash_table_lookup (ctxt->map->pid_map, &remote->ID); */
-
-/* if (!uid) */
-/* return 0; */
-
-/* LOG (" matched\n"); */
-
-/* *local = g_new0 (EAddrLocalRecord, 1); */
-/* local_record_from_uid (*local, uid, ctxt); */
-
- return 0;
-}
-
-static gint
-free_match (GnomePilotConduitSyncAbs *conduit,
- EAddrLocalRecord *local,
- EAddrConduitContext *ctxt)
-{
- LOG ("free_match: freeing\n");
-
- g_return_val_if_fail (local != NULL, -1);
-
-/* gtk_object_unref (GTK_OBJECT (local->comp)); */
- g_free (local);
-
- return 0;
-}
-
-static gint
-prepare (GnomePilotConduitSyncAbs *conduit,
- EAddrLocalRecord *local,
- GnomePilotRecord **remote,
- EAddrConduitContext *ctxt)
-{
- LOG ("prepare: encoding local %s\n", print_local (local));
-
-/* *remote = local_record_to_pilot_record (local, ctxt); */
-
-/* if (!*remote) */
-/* return -1; */
-
- return 0;
-}
-
-static gint
-free_prepare (GnomePilotConduitSyncAbs *conduit,
- EAddrLocalRecord *local,
- GnomePilotRecord **remote,
- EAddrConduitContext *ctxt)
-{
- LOG ("free_prepare: freeing\n");
-
- g_return_val_if_fail (local != NULL, -1);
- g_return_val_if_fail (remote != NULL, -1);
-
- g_free (*remote);
- *remote = NULL;
-
- return 0;
-}
-
-static ORBit_MessageValidationResult
-accept_all_cookies (CORBA_unsigned_long request_id,
- CORBA_Principal *principal,
- CORBA_char *operation)
-{
- /* allow ALL cookies */
- return ORBIT_MESSAGE_ALLOW_ALL;
-}
-
-
-GnomePilotConduit *
-conduit_get_gpilot_conduit (guint32 pilot_id)
-{
- GtkObject *retval;
- EAddrConduitContext *ctxt;
-
- LOG ("in address's conduit_get_gpilot_conduit\n");
-
- /* we need to find wombat with oaf, so make sure oaf
- is initialized here. once the desktop is converted
- to oaf and gpilotd is built with oaf, this can go away */
- if (!oaf_is_initialized ()) {
- char *argv[ 1 ] = {"hi"};
- oaf_init (1, argv);
-
- if (bonobo_init (CORBA_OBJECT_NIL,
- CORBA_OBJECT_NIL,
- CORBA_OBJECT_NIL) == FALSE)
- g_error (_("Could not initialize Bonobo"));
-
- ORBit_set_request_validation_handler (accept_all_cookies);
- }
-
- retval = gnome_pilot_conduit_sync_abs_new ("AddressDB", 0x61646472);
- g_assert (retval != NULL);
-
- gnome_pilot_conduit_construct (GNOME_PILOT_CONDUIT (retval),
- "e_addr_conduit");
-
- e_addr_context_new (&ctxt, pilot_id);
- gtk_object_set_data (GTK_OBJECT (retval), "addrconduit_context", ctxt);
-
- gtk_signal_connect (retval, "pre_sync", (GtkSignalFunc) pre_sync, ctxt);
- gtk_signal_connect (retval, "post_sync", (GtkSignalFunc) post_sync, ctxt);
-
- gtk_signal_connect (retval, "set_pilot_id", (GtkSignalFunc) set_pilot_id, ctxt);
- gtk_signal_connect (retval, "set_status_cleared", (GtkSignalFunc) set_status_cleared, ctxt);
-
- gtk_signal_connect (retval, "for_each", (GtkSignalFunc) for_each, ctxt);
- gtk_signal_connect (retval, "for_each_modified", (GtkSignalFunc) for_each_modified, ctxt);
- gtk_signal_connect (retval, "compare", (GtkSignalFunc) compare, ctxt);
-
- gtk_signal_connect (retval, "add_record", (GtkSignalFunc) add_record, ctxt);
- gtk_signal_connect (retval, "replace_record", (GtkSignalFunc) replace_record, ctxt);
- gtk_signal_connect (retval, "delete_record", (GtkSignalFunc) delete_record, ctxt);
- gtk_signal_connect (retval, "archive_record", (GtkSignalFunc) archive_record, ctxt);
-
- gtk_signal_connect (retval, "match", (GtkSignalFunc) match, ctxt);
- gtk_signal_connect (retval, "free_match", (GtkSignalFunc) free_match, ctxt);
-
- gtk_signal_connect (retval, "prepare", (GtkSignalFunc) prepare, ctxt);
- gtk_signal_connect (retval, "free_prepare", (GtkSignalFunc) free_prepare, ctxt);
-
- return GNOME_PILOT_CONDUIT (retval);
-}
-
-void
-conduit_destroy_gpilot_conduit (GnomePilotConduit *conduit)
-{
- EAddrConduitContext *ctxt;
-
- ctxt = gtk_object_get_data (GTK_OBJECT (conduit),
- "addrconduit_context");
-
- e_addr_context_destroy (&ctxt);
-
- gtk_object_destroy (GTK_OBJECT (conduit));
-}
diff --git a/addressbook/conduit/address-conduit.h b/addressbook/conduit/address-conduit.h
deleted file mode 100644
index 141ec1b53c..0000000000
--- a/addressbook/conduit/address-conduit.h
+++ /dev/null
@@ -1,75 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* Evolution calendar - ToDo Conduit Capplet
- *
- * Copyright (C) 1998 Free Software Foundation
- * Copyright (C) 2000 Helix Code, Inc.
- *
- * Authors: Eskil Heyn Olsen <deity@eskil.dk>
- * JP Rosevear <jpr@helixcode.com>
- *
- * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
- */
-
-#ifndef __ADDR_CONDUIT_H__
-#define __ADDR_CONDUIT_H__
-
-#include <sys/types.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include <gnome.h>
-#include <pi-address.h>
-#include <gpilotd/gnome-pilot-conduit.h>
-#include <gpilotd/gnome-pilot-conduit-sync-abs.h>
-#include <e-pilot-map.h>
-
-/* This is the local record structure for the Evolution ToDo conduit. */
-typedef struct _EAddrLocalRecord EAddrLocalRecord;
-struct _EAddrLocalRecord {
- /* The stuff from gnome-pilot-conduit-standard-abs.h
- Must be first in the structure, or instances of this
- structure cannot be used by gnome-pilot-conduit-standard-abs.
- */
- GnomePilotDesktopRecord local;
-
- /* The corresponding ECard object */
- ECard *ecard;
-
- /* pilot-link todo structure, used for implementing Transmit. */
- struct Address *addr;
-};
-
-/* This is the context for all the GnomeCal conduit methods. */
-typedef struct _EAddrConduitContext EAddrConduitContext;
-struct _EAddrConduitContext {
- EAddrConduitCfg *cfg;
-
- struct AddressAppInfo ai;
-
- EBook *ebook;
- GList *cards;
-
- gboolean address_load_tried;
- gboolean address_load_success;
-
- EPilotMap *map;
-};
-
-#endif __ADDR_CONDUIT_H__
-
-
-
-
-
-
diff --git a/addressbook/conduit/e-address-conduit-control-applet.desktop b/addressbook/conduit/e-address-conduit-control-applet.desktop
deleted file mode 100644
index 25b4c591f6..0000000000
--- a/addressbook/conduit/e-address-conduit-control-applet.desktop
+++ /dev/null
@@ -1,18 +0,0 @@
-[Desktop Entry]
-Name=Evolution Address conduit
-Name[da]=Udstående
-Name[es]=Enlace del libro de direcciones de Evolution
-Name[fr]=Conduit Adresses
-Name[no]=Oppgaver
-Name[sv]=Adresser
-Name[tr]=Adres parçasý
-Comment=Configure the address conduit
-Comment[da]=Konfigurér Udstående
-Comment[es]=Configura el enlace del libro de direcciones
-Comment[fr]=Configuration du conduit Adresses
-Comment[no]=Konfigurér oppgavelisten
-Comment[sv]=Konfigurera adresskanalen
-Comment[tr]=Adres parçasýnýn ayarlarý
-Exec=e-address-conduit-control-applet --cap-id=1
-Terminal=0
-Type=Application
diff --git a/addressbook/conduit/e-address.conduit.in b/addressbook/conduit/e-address.conduit.in
deleted file mode 100644
index 1aa78a180e..0000000000
--- a/addressbook/conduit/e-address.conduit.in
+++ /dev/null
@@ -1,8 +0,0 @@
-<gnome-pilot-conduit version="1.0">
-<conduit id="e_address_conduit" type="shlib" location="@prefix@/lib/gnome-pilot/conduits/libeaddress_conduit.so"/>
-<name value="EAddress"/>
-<conduit-attribute name="description" value="Synchronizes Addressbook with Evolution"/>
-<conduit-attribute name="default-synctype" value="synchronize"/>
-<conduit-attribute name="icon" value="@prefix@/share/pixmaps/gnome-calendar-conduit.png"/>
-<conduit-attribute name="settings" value="TRUE"/>
-</gnome-pilot-conduit>