aboutsummaryrefslogtreecommitdiffstats
path: root/addressbook/backend/ebook/evolution-ldif-importer.c
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 /addressbook/backend/ebook/evolution-ldif-importer.c
parent55437c198f3d46f82617ee512d1b4da360066460 (diff)
downloadgsoc2013-evolution-01b8e380164a9f8505b81811e28e68351f5168be.tar
gsoc2013-evolution-01b8e380164a9f8505b81811e28e68351f5168be.tar.gz
gsoc2013-evolution-01b8e380164a9f8505b81811e28e68351f5168be.tar.bz2
gsoc2013-evolution-01b8e380164a9f8505b81811e28e68351f5168be.tar.lz
gsoc2013-evolution-01b8e380164a9f8505b81811e28e68351f5168be.tar.xz
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
Diffstat (limited to 'addressbook/backend/ebook/evolution-ldif-importer.c')
-rw-r--r--addressbook/backend/ebook/evolution-ldif-importer.c66
1 files changed, 20 insertions, 46 deletions
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);