diff options
Diffstat (limited to 'wombat/wombat.c')
-rw-r--r-- | wombat/wombat.c | 115 |
1 files changed, 24 insertions, 91 deletions
diff --git a/wombat/wombat.c b/wombat/wombat.c index 80ca51513f..c2ae20afc9 100644 --- a/wombat/wombat.c +++ b/wombat/wombat.c @@ -17,13 +17,13 @@ #ifdef DEBUG_BACKENDS #include <sys/signal.h> #endif + #include <glib.h> -#include <libgnome/gnome-defs.h> -#include <libgnome/gnome-i18n.h> -#include <libgnomeui/gnome-init.h> -#include <liboaf/liboaf.h> +#include <libgnome/gnome-init.h> +#include <bonobo-activation/bonobo-activation.h> #include <libgnomevfs/gnome-vfs-init.h> #include <bonobo/bonobo-main.h> +#include <bonobo/bonobo-i18n.h> #include "pas/pas-book-factory.h" #include "pas/pas-backend-file.h" @@ -35,15 +35,13 @@ #include "pas/pas-backend-ldap.h" #endif -#include "wombat-moniker.h" -#include "wombat-private-moniker.h" - #define CAL_FACTORY_OAF_ID "OAFIID:GNOME_Evolution_Wombat_CalendarFactory" #define PAS_BOOK_FACTORY_OAF_ID "OAFIID:GNOME_Evolution_Wombat_ServerFactory" /* The and addressbook calendar factories */ static CalFactory *cal_factory; + static PASBookFactory *pas_book_factory; /* Timeout interval in milliseconds for termination */ @@ -62,8 +60,9 @@ static guint termination_handler_id; static gboolean termination_handler (gpointer data) { - if (cal_factory_get_n_backends (cal_factory) == 0 - && pas_book_factory_get_n_backends (pas_book_factory) == 0) { + if ( + cal_factory_get_n_backends (cal_factory) == 0 && + pas_book_factory_get_n_backends (pas_book_factory) == 0) { fprintf (stderr, "termination_handler(): Terminating the Wombat. Have a nice day.\n"); gtk_main_quit (); } @@ -106,13 +105,13 @@ setup_pas (int argc, char **argv) pas_book_factory, "ldap", pas_backend_ldap_new); #endif - gtk_signal_connect (GTK_OBJECT (pas_book_factory), - "last_book_gone", - GTK_SIGNAL_FUNC (last_book_gone_cb), - NULL); + g_signal_connect (pas_book_factory, + "last_book_gone", + G_CALLBACK (last_book_gone_cb), + NULL); if (!pas_book_factory_activate (pas_book_factory, PAS_BOOK_FACTORY_OAF_ID)) { - bonobo_object_unref (BONOBO_OBJECT (pas_book_factory)); + bonboo_object_unref (BONOBO_OBJECT (pas_book_factory)); pas_book_factory = NULL; return FALSE; } @@ -160,72 +159,6 @@ setup_pcs (int argc, char **argv) -static gboolean -setup_config (int argc, char **argv) -{ - BonoboGenericFactory *factory; - char *oafiid = "OAFIID:Bonobo_Moniker_wombat_Factory"; - - factory = bonobo_generic_factory_new_multi (oafiid, - wombat_moniker_factory, - NULL); - - // bonobo_running_context_auto_exit_unref (BONOBO_OBJECT (factory)); - - - return TRUE; -} - -static gboolean -setup_private (int argc, char **argv) -{ - BonoboGenericFactory *factory; - char *oafiid = "OAFIID:Bonobo_Moniker_wombat_private_Factory"; - - factory = bonobo_generic_factory_new_multi (oafiid, - wombat_private_moniker_factory, - NULL); - - // bonobo_running_context_auto_exit_unref (BONOBO_OBJECT (factory)); - - - return TRUE; -} - -static void -setup_vfs (int argc, char **argv) -{ - if (!gnome_vfs_init ()) { - g_message (_("setup_vfs(): could not initialize GNOME-VFS")); - exit (EXIT_FAILURE); - } -} - - - -static void -init_corba (int *argc, char **argv) -{ - if (gnome_init_with_popt_table ("wombat", VERSION, - *argc, argv, oaf_popt_options, 0, NULL) != 0) { - g_message (_("init_corba(): could not initialize GNOME")); - exit (EXIT_FAILURE); - } - - oaf_init (*argc, argv); -} - -static void -init_bonobo (int *argc, char **argv) -{ - init_corba (argc, argv); - - if (!bonobo_init (CORBA_OBJECT_NIL, CORBA_OBJECT_NIL, CORBA_OBJECT_NIL)) { - g_message (_("init_bonobo(): could not initialize Bonobo")); - exit (EXIT_FAILURE); - } -} - #ifdef DEBUG_BACKENDS static void dump_backends (int signal) @@ -238,7 +171,7 @@ dump_backends (int signal) int main (int argc, char **argv) { - gboolean did_pas=FALSE, did_pcs=FALSE, did_config=FALSE, did_private=FALSE; + gboolean did_pas=FALSE, did_pcs=FALSE; bindtextdomain (PACKAGE, EVOLUTION_LOCALEDIR); textdomain (PACKAGE); @@ -249,8 +182,15 @@ main (int argc, char **argv) signal (SIGUSR2, dump_backends); #endif - init_bonobo (&argc, argv); - setup_vfs (argc, argv); + gnome_program_init ("Wombat", VERSION, + LIBGNOME_MODULE, + argc, argv, + GNOME_PROGRAM_STANDARD_PROPERTIES, NULL); + + bonobo_init_full (&argc, argv, + bonobo_activation_orb_get(), + CORBA_OBJECT_NIL, + CORBA_OBJECT_NIL); /*g_log_set_always_fatal (G_LOG_LEVEL_ERROR | G_LOG_LEVEL_CRITICAL | @@ -258,10 +198,7 @@ main (int argc, char **argv) if (!( (did_pas = setup_pas (argc, argv)) && (did_pcs = setup_pcs (argc, argv)) - && (did_private = setup_private (argc, argv)) - /* WARNING: Do not change the order here. `setup_config()' must - come last, to work around an OAF race condition. */ - && (did_config = setup_config (argc, argv)))) { + )) { const gchar *failed = NULL; @@ -269,10 +206,6 @@ main (int argc, char **argv) failed = "PAS"; else if (!did_pcs) failed = "PCS"; - else if (!did_config) - failed = "Config"; - else if (!did_private) - failed = "Private Config"; g_message ("main(): could not initialize Wombat service \"%s\"; terminating", failed); |