From a056c8466d7bb0dfaef2170a983b7d43398b086f Mon Sep 17 00:00:00 2001 From: Federico Mena Quintero Date: Tue, 20 Feb 2001 22:35:49 +0000 Subject: Unref the factories if we failed to initialize anything. (setup_pcs): Call 2001-02-16 Federico Mena Quintero * wombat.c (main): Unref the factories if we failed to initialize anything. (setup_pcs): Call cal_factory_oaf_register(). Removed the OAF registration code from here; now it is in the CalFactory itself. svn path=/trunk/; revision=8309 --- wombat/ChangeLog | 7 +++++++ wombat/wombat.c | 44 +++++++++++++------------------------------- 2 files changed, 20 insertions(+), 31 deletions(-) (limited to 'wombat') diff --git a/wombat/ChangeLog b/wombat/ChangeLog index e05e509123..9eb9dea30e 100644 --- a/wombat/ChangeLog +++ b/wombat/ChangeLog @@ -1,3 +1,10 @@ +2001-02-16 Federico Mena Quintero + + * wombat.c (main): Unref the factories if we failed to initialize + anything. + (setup_pcs): Call cal_factory_oaf_register(). Removed the OAF + registration code from here; now it is in the CalFactory itself. + 2001-02-12 Kjartan Maraas * Makefile.am: xml-i18n-tools setup. diff --git a/wombat/wombat.c b/wombat/wombat.c index 83a442acc7..fb3bfc5ab2 100644 --- a/wombat/wombat.c +++ b/wombat/wombat.c @@ -111,37 +111,10 @@ last_calendar_gone_cb (CalFactory *factory, gpointer data) queue_termination (); } -static gboolean -register_pcs (CORBA_Object obj) -{ - OAF_RegistrationResult result; - - result = oaf_active_server_register - ("OAFIID:GNOME_Evolution_Wombat_CalendarFactory", - obj); - - switch (result) { - case OAF_REG_SUCCESS: - return TRUE; /* Wooho! */ - case OAF_REG_NOT_LISTED: - g_message ("Cannot register the PCS because not listed"); - return FALSE; - case OAF_REG_ALREADY_ACTIVE: - g_message ("Cannot register the PCS because already active"); - return FALSE; - case OAF_REG_ERROR: - default: - g_message ("Cannot register the PCS because we suck"); - return FALSE; - } -} - /* Creates the calendar factory object and registers it */ static gboolean setup_pcs (int argc, char **argv) { - CORBA_Object object; - cal_factory = cal_factory_new (); if (!cal_factory) { @@ -151,9 +124,7 @@ setup_pcs (int argc, char **argv) cal_factory_register_method (cal_factory, "file", CAL_BACKEND_FILE_TYPE); - object = bonobo_object_corba_objref (BONOBO_OBJECT (cal_factory)); - - if (!register_pcs (object)) { + if (!cal_factory_oaf_register (cal_factory)) { bonobo_object_unref (BONOBO_OBJECT (cal_factory)); cal_factory = NULL; return FALSE; @@ -225,7 +196,18 @@ main (int argc, char **argv) if (!(setup_pas (argc, argv) && setup_pcs (argc, argv) && setup_config (argc, argv))) { - g_message ("main(): could not initialize all of the Wombat services"); + g_message ("main(): could not initialize all of the Wombat services; terminating"); + + if (pas_book_factory) { + bonobo_object_unref (BONOBO_OBJECT (pas_book_factory)); + pas_book_factory = NULL; + } + + if (cal_factory) { + bonobo_object_unref (BONOBO_OBJECT (cal_factory)); + cal_factory = NULL; + } + exit (EXIT_FAILURE); } -- cgit v1.2.3