aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Toshok <toshok@ximian.com>2003-01-16 04:52:44 +0800
committerChris Toshok <toshok@src.gnome.org>2003-01-16 04:52:44 +0800
commit01b8e380164a9f8505b81811e28e68351f5168be (patch)
treef80bd3114c72cf2171f4491da047e5cc52ae2af6
parent55437c198f3d46f82617ee512d1b4da360066460 (diff)
downloadgsoc2013-evolution-01b8e380164a9f8505b81811e28e68351f5168be.tar.gz
gsoc2013-evolution-01b8e380164a9f8505b81811e28e68351f5168be.tar.zst
gsoc2013-evolution-01b8e380164a9f8505b81811e28e68351f5168be.zip
reenable all the importers/loaders.
2003-01-15 Chris Toshok <toshok@ximian.com> * backend/ebook/Makefile.am (bin_PROGRAMS): reenable all the importers/loaders. * backend/ebook/evolution-ldif-importer.c, backend/ebook/evolution-vcard-importer.c: Finish gnome2 port issues, and get these to compile. * backend/ebook/load-gnomecard-addressbook.c, backend/ebook/load-pine-addressbook.c: same. svn path=/trunk/; revision=19485
-rw-r--r--addressbook/backend/ebook/Makefile.am107
-rw-r--r--addressbook/backend/ebook/evolution-ldif-importer.c66
-rw-r--r--addressbook/backend/ebook/evolution-vcard-importer.c63
-rw-r--r--addressbook/backend/ebook/load-gnomecard-addressbook.c20
-rw-r--r--addressbook/backend/ebook/load-pine-addressbook.c20
5 files changed, 101 insertions, 175 deletions
diff --git a/addressbook/backend/ebook/Makefile.am b/addressbook/backend/ebook/Makefile.am
index 3c8f4186fe..b0a452dee7 100644
--- a/addressbook/backend/ebook/Makefile.am
+++ b/addressbook/backend/ebook/Makefile.am
@@ -1,10 +1,9 @@
noinst_PROGRAMS = test-card test-client test-client-list
-# PENDING_PORT_WORK
-# bin_PROGRAMS = evolution-vcard-importer \
-# evolution-ldif-importer \
-# load-pine-addressbook \
-# load-gnomecard-addressbook
+bin_PROGRAMS = evolution-vcard-importer \
+ evolution-ldif-importer \
+ load-pine-addressbook \
+ load-gnomecard-addressbook
CORBA_SOURCE = \
addressbook.h \
@@ -24,6 +23,10 @@ $(CORBA_SOURCE): $(idls)
$(ORBIT_IDL) -I $(srcdir) $(IDL_INCLUDES) $(idls)
INCLUDES = \
+ -DPREFIX=\"$(prefix)\" \
+ -DSYSCONFDIR=\"$(sysconfdir)\" \
+ -DDATADIR=\"$(datadir)\" \
+ -DLIBDIR=\"$(libdir)\" \
-DGNOMELOCALEDIR=\""$(localedir)"\" \
-DG_LOG_DOMAIN=\"EBook\" \
-I$(top_srcdir) \
@@ -126,53 +129,53 @@ test_card_LDADD = \
$(top_builddir)/libversit/libversit.a \
$(top_builddir)/e-util/libeutil.la
-# evolution_vcard_importer_SOURCES = \
-# evolution-vcard-importer.c
-
-# evolution_vcard_importer_LDADD = \
-# libebook.la \
-# $(EVOLUTION_ADDRESSBOOK_LIBS) \
-# $(top_builddir)/camel/libcamel.la \
-# $(top_builddir)/shell/importer/libevolution-importer.la \
-# $(DB3_LDADD) \
-# $(top_builddir)/e-util/ename/libename.la \
-# $(top_builddir)/libversit/libversit.a \
-# $(top_builddir)/e-util/libeutil.la
-
-# evolution_ldif_importer_SOURCES = \
-# evolution-ldif-importer.c
-
-# evolution_ldif_importer_LDADD = \
-# libebook.la \
-# $(EVOLUTION_ADDRESSBOOK_LIBS) \
-# $(top_builddir)/camel/libcamel.la \
-# $(top_builddir)/shell/importer/libevolution-importer.la \
-# $(DB3_LDADD) \
-# $(top_builddir)/e-util/ename/libename.la \
-# $(top_builddir)/libversit/libversit.a \
-# $(top_builddir)/e-util/libeutil.la
-
-# load_pine_addressbook_SOURCES = \
-# load-pine-addressbook.c
-
-# load_pine_addressbook_LDADD = \
-# libebook.la \
-# $(EVOLUTION_ADDRESSBOOK_LIBS) \
-# $(top_builddir)/camel/libcamel.la \
-# $(top_builddir)/e-util/ename/libename.la \
-# $(top_builddir)/libversit/libversit.a \
-# $(top_builddir)/e-util/libeutil.la
-
-# load_gnomecard_addressbook_SOURCES = \
-# load-gnomecard-addressbook.c
-
-# load_gnomecard_addressbook_LDADD = \
-# libebook.la \
-# $(EVOLUTION_ADDRESSBOOK_LIBS) \
-# $(top_builddir)/camel/libcamel.la \
-# $(top_builddir)/e-util/ename/libename.la \
-# $(top_builddir)/libversit/libversit.a \
-# $(top_builddir)/e-util/libeutil.la
+evolution_vcard_importer_SOURCES = \
+ evolution-vcard-importer.c
+
+evolution_vcard_importer_LDADD = \
+ libebook.la \
+ $(EVOLUTION_ADDRESSBOOK_LIBS) \
+ $(top_builddir)/camel/libcamel.la \
+ $(top_builddir)/shell/importer/libevolution-importer.la \
+ $(DB3_LDADD) \
+ $(top_builddir)/e-util/ename/libename.la \
+ $(top_builddir)/libversit/libversit.a \
+ $(top_builddir)/e-util/libeutil.la
+
+evolution_ldif_importer_SOURCES = \
+ evolution-ldif-importer.c
+
+evolution_ldif_importer_LDADD = \
+ libebook.la \
+ $(EVOLUTION_ADDRESSBOOK_LIBS) \
+ $(top_builddir)/camel/libcamel.la \
+ $(top_builddir)/shell/importer/libevolution-importer.la \
+ $(DB3_LDADD) \
+ $(top_builddir)/e-util/ename/libename.la \
+ $(top_builddir)/libversit/libversit.a \
+ $(top_builddir)/e-util/libeutil.la
+
+load_pine_addressbook_SOURCES = \
+ load-pine-addressbook.c
+
+load_pine_addressbook_LDADD = \
+ libebook.la \
+ $(EVOLUTION_ADDRESSBOOK_LIBS) \
+ $(top_builddir)/camel/libcamel.la \
+ $(top_builddir)/e-util/ename/libename.la \
+ $(top_builddir)/libversit/libversit.a \
+ $(top_builddir)/e-util/libeutil.la
+
+load_gnomecard_addressbook_SOURCES = \
+ load-gnomecard-addressbook.c
+
+load_gnomecard_addressbook_LDADD = \
+ libebook.la \
+ $(EVOLUTION_ADDRESSBOOK_LIBS) \
+ $(top_builddir)/camel/libcamel.la \
+ $(top_builddir)/e-util/ename/libename.la \
+ $(top_builddir)/libversit/libversit.a \
+ $(top_builddir)/e-util/libeutil.la
BUILT_SOURCES = $(CORBA_SOURCE) $(MARSHAL_GENERATED)
diff --git a/addressbook/backend/ebook/evolution-ldif-importer.c b/addressbook/backend/ebook/evolution-ldif-importer.c
index e0a85e685c..6f4a3ac957 100644
--- a/addressbook/backend/ebook/evolution-ldif-importer.c
+++ b/addressbook/backend/ebook/evolution-ldif-importer.c
@@ -15,17 +15,20 @@
#include <config.h>
#include <stdio.h>
#include <ctype.h>
+#include <string.h>
#include <e-book.h>
#include <e-card-simple.h>
#include <e-destination.h>
+#include <libgnome/gnome-init.h>
+#include <bonobo/bonobo-generic-factory.h>
+
#include <importer/evolution-importer.h>
#include <importer/GNOME_Evolution_Importer.h>
#define COMPONENT_FACTORY_IID "OAFIID:GNOME_Evolution_Addressbook_LDIF_ImporterFactory"
-
-static BonoboGenericFactory *factory = NULL;
+#define COMPONENT_IID "OAFIID:GNOME_Evolution_Addressbook_LDIF_Importer"
static GHashTable *dn_card_hash;
@@ -546,10 +549,10 @@ support_format_fn (EvolutionImporter *importer,
}
static void
-importer_destroy_cb (GObject *object,
- LDIFImporter *gci)
+importer_destroy_cb (gpointer data,
+ GObject *where_object_was)
{
- g_main_quit ();
+ bonobo_main_quit ();
}
static gboolean
@@ -572,55 +575,26 @@ load_file_fn (EvolutionImporter *importer,
static BonoboObject *
factory_fn (BonoboGenericFactory *_factory,
+ const char *component_id,
void *closure)
{
EvolutionImporter *importer;
LDIFImporter *gci;
- gci = g_new (LDIFImporter, 1);
- importer = evolution_importer_new (support_format_fn, load_file_fn,
- process_item_fn, NULL, gci);
+ if (!strcmp (component_id, COMPONENT_IID)) {
+ gci = g_new (LDIFImporter, 1);
+ importer = evolution_importer_new (support_format_fn, load_file_fn,
+ process_item_fn, NULL, gci);
- g_signal_connect (importer, "destroy",
- G_CALLBACK (importer_destroy_cb), gci);
+ g_object_weak_ref (G_OBJECT (importer),
+ importer_destroy_cb, gci);
- return BONOBO_OBJECT (importer);
-}
-
-static void
-importer_init (void)
-{
- if (factory != NULL)
- return;
-
- factory = bonobo_generic_factory_new (COMPONENT_FACTORY_IID,
- factory_fn, NULL);
-
- if (factory == NULL) {
- g_error ("Unable to create factory");
+ return BONOBO_OBJECT (importer);
}
-
- bonobo_running_context_auto_exit_unref (BONOBO_OBJECT (factory));
-}
-
-int
-main (int argc,
- char **argv)
-{
- CORBA_ORB orb;
-
- gnome_init_with_popt_table ("Evolution-LDIF-Importer",
- "0.0", argc, argv, oaf_popt_options, 0,
- NULL);
- orb = bonobo_activation_init (argc, argv);
- if (bonobo_init_full (&argc, argv, orb, CORBA_OBJECT_NIL, CORBA_OBJECT_NIL) == FALSE) {
- g_error ("Could not initialize Bonobo.");
+ else {
+ g_warning (COMPONENT_FACTORY_IID, ": Don't know what to do with %s", component_id);
+ return NULL;
}
-
- importer_init ();
- bonobo_main ();
-
- return 0;
}
-
+BONOBO_ACTIVATION_FACTORY (COMPONENT_FACTORY_IID, "Evolution LDIF Importer Factory", VERSION, factory_fn, NULL);
diff --git a/addressbook/backend/ebook/evolution-vcard-importer.c b/addressbook/backend/ebook/evolution-vcard-importer.c
index e18173ab87..a3b8d873bb 100644
--- a/addressbook/backend/ebook/evolution-vcard-importer.c
+++ b/addressbook/backend/ebook/evolution-vcard-importer.c
@@ -1,6 +1,7 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
#include <config.h>
#include <stdio.h>
+#include <string.h>
#include <bonobo/bonobo-context.h>
#include <bonobo/bonobo-generic-factory.h>
@@ -14,8 +15,7 @@
#include <e-util/e-path.h>
#define COMPONENT_FACTORY_IID "OAFIID:GNOME_Evolution_Addressbook_VCard_ImporterFactory"
-
-static BonoboGenericFactory *factory = NULL;
+#define COMPONENT_IID "OAFIID:GNOME_Evolution_Addressbook_VCard_Importer"
typedef struct {
char *filename;
@@ -180,10 +180,10 @@ support_format_fn (EvolutionImporter *importer,
}
static void
-importer_destroy_cb (GObject *object,
- VCardImporter *gci)
+importer_destroy_cb (gpointer data,
+ GObject *where_object_was)
{
- g_main_quit ();
+ bonobo_main_quit ();
}
static gboolean
@@ -211,55 +211,24 @@ load_file_fn (EvolutionImporter *importer,
static BonoboObject *
factory_fn (BonoboGenericFactory *_factory,
+ const char *component_id,
void *closure)
{
EvolutionImporter *importer;
VCardImporter *gci;
- gci = g_new (VCardImporter, 1);
- importer = evolution_importer_new (support_format_fn, load_file_fn,
- process_item_fn, NULL, gci);
-
- g_signal_connect (importer, "destroy",
- G_CALLBACK (importer_destroy_cb), gci);
+ if (!strcmp (component_id, COMPONENT_IID)) {
+ gci = g_new (VCardImporter, 1);
+ importer = evolution_importer_new (support_format_fn, load_file_fn,
+ process_item_fn, NULL, gci);
- return BONOBO_OBJECT (importer);
-}
-
-static void
-importer_init (void)
-{
- if (factory != NULL)
- return;
-
- factory = bonobo_generic_factory_new (COMPONENT_FACTORY_IID,
- factory_fn, NULL);
-
- if (factory == NULL) {
- g_error ("Unable to create factory");
+ g_object_weak_ref (G_OBJECT (importer),
+ importer_destroy_cb, gci);
}
-
- bonobo_running_context_auto_exit_unref (BONOBO_OBJECT (factory));
-}
-
-int
-main (int argc,
- char **argv)
-{
- CORBA_ORB orb;
-
- gnome_init_with_popt_table ("Evolution-VCard-Importer",
- PACKAGE, argc, argv, oaf_popt_options, 0,
- NULL);
- orb = bonobo_activation_init (argc, argv);
- if (bonobo_init_full (&argc, argv, orb, CORBA_OBJECT_NIL, CORBA_OBJECT_NIL) == FALSE) {
- g_error ("Could not initialize Bonobo.");
+ else {
+ g_warning (COMPONENT_FACTORY_IID, ": Don't know what to do with %s", component_id);
+ return NULL;
}
-
- importer_init ();
- bonobo_main ();
-
- return 0;
}
-
+BONOBO_ACTIVATION_FACTORY (COMPONENT_FACTORY_IID, "Evolution VCard Importer Factory", VERSION, factory_fn, NULL);
diff --git a/addressbook/backend/ebook/load-gnomecard-addressbook.c b/addressbook/backend/ebook/load-gnomecard-addressbook.c
index 0e26c2d101..30f4f5a5f2 100644
--- a/addressbook/backend/ebook/load-gnomecard-addressbook.c
+++ b/addressbook/backend/ebook/load-gnomecard-addressbook.c
@@ -5,18 +5,10 @@
#include <bonobo/bonobo-i18n.h>
#include <bonobo/bonobo-main.h>
+#include <libgnome/gnome-init.h>
#include "e-book.h"
-static CORBA_Environment ev;
-
-static void
-init_bonobo (int *argc, char **argv)
-{
- if (bonobo_init (argc, argv) == FALSE)
- g_error (_("Could not initialize Bonobo"));
-}
-
static void
add_card_cb (EBook *book, EBookStatus status, const gchar *id, gpointer closure)
{
@@ -73,13 +65,11 @@ ebook_create (gpointer data)
int
main (int argc, char **argv)
{
+ GnomeProgram *program;
- CORBA_exception_init (&ev);
-
- gnome_init_with_popt_table("blah", "0.0", argc, argv, NULL, 0, NULL);
-
- bonobo_activation_init (argc, argv);
- init_bonobo (&argc, argv);
+ program = gnome_program_init ("load-gnomecard-addressbook", VERSION, LIBGNOME_MODULE, argc, argv,
+ GNOME_PROGRAM_STANDARD_PROPERTIES,
+ NULL);
g_idle_add (ebook_create, NULL);
diff --git a/addressbook/backend/ebook/load-pine-addressbook.c b/addressbook/backend/ebook/load-pine-addressbook.c
index b7bc394e55..38f3817d0f 100644
--- a/addressbook/backend/ebook/load-pine-addressbook.c
+++ b/addressbook/backend/ebook/load-pine-addressbook.c
@@ -5,18 +5,10 @@
#include <glib.h>
#include <bonobo/bonobo-i18n.h>
#include <bonobo/bonobo-main.h>
+#include <libgnome/gnome-init.h>
#include "e-book.h"
-static CORBA_Environment ev;
-
-static void
-init_bonobo (int *argc, char **argv)
-{
- if (bonobo_init (argc, argv) == FALSE)
- g_error (_("Could not initialize Bonobo"));
-}
-
static void
add_card_cb (EBook *book, EBookStatus status, const gchar *id, gpointer closure)
{
@@ -154,13 +146,11 @@ read_file (char *name)
int
main (int argc, char **argv)
{
+ GnomeProgram *program;
- CORBA_exception_init (&ev);
-
- gnome_init_with_popt_table("blah", "0.0", argc, argv, NULL, 0, NULL);
-
- bonobo_activation_init (argc, argv);
- init_bonobo (&argc, argv);
+ program = gnome_program_init ("load-pine-addressbook", VERSION, LIBGNOME_MODULE, argc, argv,
+ GNOME_PROGRAM_STANDARD_PROPERTIES,
+ NULL);
g_idle_add (ebook_create, NULL);