aboutsummaryrefslogtreecommitdiffstats
path: root/addressbook/backend/ebook/evolution-vcard-importer.c
diff options
context:
space:
mode:
Diffstat (limited to 'addressbook/backend/ebook/evolution-vcard-importer.c')
-rw-r--r--addressbook/backend/ebook/evolution-vcard-importer.c63
1 files changed, 16 insertions, 47 deletions
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);