From 01b8e380164a9f8505b81811e28e68351f5168be Mon Sep 17 00:00:00 2001 From: Chris Toshok Date: Wed, 15 Jan 2003 20:52:44 +0000 Subject: reenable all the importers/loaders. 2003-01-15 Chris Toshok * 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 --- .../backend/ebook/evolution-ldif-importer.c | 66 +++++++--------------- 1 file changed, 20 insertions(+), 46 deletions(-) (limited to 'addressbook/backend/ebook/evolution-ldif-importer.c') 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 #include #include +#include #include #include #include +#include +#include + #include #include #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); -- cgit v1.2.3