diff options
-rw-r--r-- | wombat/.cvsignore | 4 | ||||
-rw-r--r-- | wombat/ChangeLog | 18 | ||||
-rw-r--r-- | wombat/GNOME_Evolution_WombatLDAP.server.in (renamed from wombat/GNOME_Evolution_WombatLDAP.oaf.in) | 0 | ||||
-rw-r--r-- | wombat/GNOME_Evolution_WombatNOLDAP.server.in (renamed from wombat/GNOME_Evolution_WombatNOLDAP.oaf.in) | 0 | ||||
-rw-r--r-- | wombat/Makefile.am | 26 | ||||
-rw-r--r-- | wombat/wombat-moniker.c | 159 | ||||
-rw-r--r-- | wombat/wombat-moniker.h | 11 | ||||
-rw-r--r-- | wombat/wombat-private-moniker.c | 171 | ||||
-rw-r--r-- | wombat/wombat-private-moniker.h | 11 | ||||
-rw-r--r-- | wombat/wombat.c | 115 |
10 files changed, 57 insertions, 458 deletions
diff --git a/wombat/.cvsignore b/wombat/.cvsignore index 8f01d12584..70eb086bfb 100644 --- a/wombat/.cvsignore +++ b/wombat/.cvsignore @@ -11,5 +11,5 @@ wombat-common.c wombat.h wombat wombat.pure -GNOME_Evolution_Wombat.oaf -GNOME_Evolution_Wombat.oaf.in +GNOME_Evolution_Wombat.server +GNOME_Evolution_Wombat.server.in diff --git a/wombat/ChangeLog b/wombat/ChangeLog index a01b4af975..d9536c2e91 100644 --- a/wombat/ChangeLog +++ b/wombat/ChangeLog @@ -1,3 +1,21 @@ +2002-11-05 Chris Toshok <toshok@ximian.com> + + * Makefile.am: change over from .oaf files to .server files and + remove the moniker stuff from the build. + + * wombat.c: port over to gnome2, and nuke all the config moniker + stuff. + + * wombat-moniker.[ch]: remove + + * wombat-private-moniker.[ch]: remove + + * GNOME_Evolution_WombatLDAP.server.in: rename the oaf.in file to this. + + * GNOME_Evolution_WombatNOLDAP.server.in: rename the oaf.in file to this. + + * .cvsignore: s/oaf/server + 2002-08-01 Chris Toshok <toshok@ximian.com> * wombat.c (last_calendar_gone_cb): remove the annoying fprintf diff --git a/wombat/GNOME_Evolution_WombatLDAP.oaf.in b/wombat/GNOME_Evolution_WombatLDAP.server.in index 9fc4ec2602..9fc4ec2602 100644 --- a/wombat/GNOME_Evolution_WombatLDAP.oaf.in +++ b/wombat/GNOME_Evolution_WombatLDAP.server.in diff --git a/wombat/GNOME_Evolution_WombatNOLDAP.oaf.in b/wombat/GNOME_Evolution_WombatNOLDAP.server.in index 88671c411e..88671c411e 100644 --- a/wombat/GNOME_Evolution_WombatNOLDAP.oaf.in +++ b/wombat/GNOME_Evolution_WombatNOLDAP.server.in diff --git a/wombat/Makefile.am b/wombat/Makefile.am index 46438d7f2d..a360e76e85 100644 --- a/wombat/Makefile.am +++ b/wombat/Makefile.am @@ -1,5 +1,9 @@ INCLUDES = \ -DG_LOG_DOMAIN=\"wombat\" \ + -DPREFIX=\"$(prefix)\" \ + -DSYSCONFDIR=\"$(sysconfdir)\" \ + -DDATADIR=\"$(datadir)\" \ + -DLIBDIR=\"$(libdir)\" \ -I$(top_srcdir)/e-util \ -I$(top_srcdir) \ -I$(top_srcdir)/addressbook/backend \ @@ -17,10 +21,6 @@ bin_PROGRAMS = \ wombat wombat_SOURCES = \ - wombat-moniker.c \ - wombat-moniker.h \ - wombat-private-moniker.c \ - wombat-private-moniker.h \ wombat.c if ENABLE_LDAP @@ -47,28 +47,28 @@ wombat_LDADD = \ $(top_builddir)/libwombat/libwombat.la \ $(WOMBAT_LIBS) -oafdir = $(datadir)/oaf +serversdir = $(libdir)/bonobo/servers if ENABLE_LDAP -OAF_IN_FILE=GNOME_Evolution_WombatLDAP.oaf.in +SERVER_IN_FILE=GNOME_Evolution_WombatLDAP.server.in else -OAF_IN_FILE=GNOME_Evolution_WombatNOLDAP.oaf.in +SERVER_IN_FILE=GNOME_Evolution_WombatNOLDAP.server.in endif -GNOME_Evolution_Wombat.oaf.in: $(OAF_IN_FILE) +GNOME_Evolution_Wombat.server.in: $(SERVER_IN_FILE) cp $< $@ -oaf_in_files = GNOME_Evolution_Wombat.oaf.in -oaf_DATA = $(oaf_in_files:.oaf.in=.oaf) +server_in_files = GNOME_Evolution_Wombat.server.in +servers_DATA = $(server_in_files:.server.in=.server) -@XML_I18N_MERGE_OAF_RULE@ +@INTLTOOL_SERVER_RULE@ idldir = $(datadir)/idl idl_DATA = Evolution-Wombat.idl -EXTRA_DIST = $(oaf_DATA) $(oaf_in_files) $(idl_DATA) \ - GNOME_Evolution_WombatLDAP.oaf.in GNOME_Evolution_WombatNOLDAP.oaf.in +EXTRA_DIST = $(servers_DATA) $(server_in_files) $(idl_DATA) \ + GNOME_Evolution_WombatLDAP.server.in GNOME_Evolution_WombatNOLDAP.server.in if ENABLE_PURIFY PLINK = $(LIBTOOL) --mode=link $(PURIFY) $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ diff --git a/wombat/wombat-moniker.c b/wombat/wombat-moniker.c deleted file mode 100644 index e53cb94758..0000000000 --- a/wombat/wombat-moniker.c +++ /dev/null @@ -1,159 +0,0 @@ -#include <config.h> - -#include <bonobo/bonobo-moniker-simple.h> -#include <bonobo/bonobo-moniker-util.h> -#include <bonobo/bonobo-exception.h> -#include <bonobo/bonobo-storage.h> -#include "wombat-moniker.h" - -#define DEFAULT_DB_URL "xmldb:" EVOLUTION_DATADIR "/evolution/config.xmldb" -#define USER_DB_URL "xmldb:~/evolution/config.xmldb" - -#define DB_URL (DEFAULT_DB_URL "#" USER_DB_URL) - -static Bonobo_Storage -wombat_root_storage (CORBA_Environment *ev) -{ - static BonoboStorage *root = NULL; - char *path; - - if (!root) { - path = g_strconcat (g_get_home_dir (), "/evolution/config", - NULL); - - root = bonobo_storage_open_full (BONOBO_IO_DRIVER_FS, path, - Bonobo_Storage_CREATE, 0664, - ev); - - g_free (path); - - if (BONOBO_EX (ev) || !root) - return CORBA_OBJECT_NIL; - } - - return BONOBO_OBJREF (root); -} - -static Bonobo_Storage -wombat_lookup_storage (const char *name, - CORBA_Environment *ev) -{ - Bonobo_Storage root; - - if ((root = wombat_root_storage (ev)) == CORBA_OBJECT_NIL) - return CORBA_OBJECT_NIL; - - if (!strcmp (name, "")) - return bonobo_object_dup_ref (root, ev); - - return Bonobo_Storage_openStorage (root, name, Bonobo_Storage_CREATE, - ev); -} - -static Bonobo_Storage -wombat_lookup_stream (const char *name, - CORBA_Environment *ev) -{ - Bonobo_Storage root; - - if (!strcmp (name, "")) { - bonobo_exception_set (ev, ex_Bonobo_Storage_NotFound); - return CORBA_OBJECT_NIL; - } - - if ((root = wombat_root_storage (ev)) == CORBA_OBJECT_NIL) - return CORBA_OBJECT_NIL; - - - return Bonobo_Storage_openStream (root, name, Bonobo_Storage_CREATE, - ev); -} - -static CORBA_Object -wombat_lookup_db (CORBA_Environment *ev) -{ - static CORBA_Object db = CORBA_OBJECT_NIL; - - if (db == CORBA_OBJECT_NIL) - db = bonobo_get_object (DB_URL, - "IDL:Bonobo/ConfigDatabase:1.0", ev); - - bonobo_object_dup_ref (db, ev); - - return db; -} - -static Bonobo_Unknown -wombat_moniker_resolve (BonoboMoniker *moniker, - const Bonobo_ResolveOptions *options, - const CORBA_char *interface, - CORBA_Environment *ev) -{ - CORBA_Object db; - Bonobo_Moniker parent; - const gchar *name; - Bonobo_Storage storage; - Bonobo_Stream stream; - - parent = bonobo_moniker_get_parent (moniker, ev); - if (BONOBO_EX (ev)) - return CORBA_OBJECT_NIL; - - name = bonobo_moniker_get_name (moniker); - - if (parent != CORBA_OBJECT_NIL) { - - g_warning ("wombat: parent moniker are not supproted"); - - bonobo_object_release_unref (parent, ev); - - bonobo_exception_set (ev, ex_Bonobo_Moniker_InterfaceNotFound); - - return CORBA_OBJECT_NIL; - } - - if (!strcmp (interface, "IDL:Bonobo/Storage:1.0")) { - - storage = wombat_lookup_storage (name, ev); - - return storage; - } - - if (!strcmp (interface, "IDL:Bonobo/Stream:1.0")) { - - stream = wombat_lookup_stream (name, ev); - - return stream; - } - - if (!strcmp (interface, "IDL:Bonobo/ConfigDatabase:1.0")) { - - if (strcmp (name, "")) - g_warning ("wombat: unused moniker name"); - - if ((db = wombat_lookup_db (ev)) != CORBA_OBJECT_NIL) - return db; - } - - bonobo_exception_set (ev, ex_Bonobo_Moniker_InterfaceNotFound); - return CORBA_OBJECT_NIL; -} - -BonoboObject * -wombat_moniker_factory (BonoboGenericFactory *this, - const char *object_id, - void *data) -{ - g_return_val_if_fail (object_id != NULL, NULL); - - if (!strcmp (object_id, "OAFIID:Bonobo_Moniker_wombat")) - - return BONOBO_OBJECT (bonobo_moniker_simple_new ( - "wombat:", wombat_moniker_resolve)); - - else - g_warning ("Failing to manufacture a '%s'", object_id); - - return NULL; -} - diff --git a/wombat/wombat-moniker.h b/wombat/wombat-moniker.h deleted file mode 100644 index 46ebcf79c8..0000000000 --- a/wombat/wombat-moniker.h +++ /dev/null @@ -1,11 +0,0 @@ -#ifndef _MONIKER_WOMBAT_H_ -#define _MONIKER_WOMBAT_H_ - -#include <bonobo/bonobo-generic-factory.h> - -BonoboObject * -wombat_moniker_factory (BonoboGenericFactory *this, - const char *object_id, - void *data); - -#endif diff --git a/wombat/wombat-private-moniker.c b/wombat/wombat-private-moniker.c deleted file mode 100644 index ae790f39ed..0000000000 --- a/wombat/wombat-private-moniker.c +++ /dev/null @@ -1,171 +0,0 @@ -#include <config.h> - -#include <sys/types.h> -#include <sys/stat.h> - -#include <bonobo/bonobo-moniker-simple.h> -#include <bonobo/bonobo-moniker-util.h> -#include <bonobo/bonobo-exception.h> -#include <bonobo/bonobo-storage.h> -#include "wombat-private-moniker.h" - -#define USER_DB_URL "xmldb:~/evolution/private/config.xmldb" - -#define DB_URL (USER_DB_URL) - -static Bonobo_Storage -wombat_private_root_storage (CORBA_Environment *ev) -{ - static BonoboStorage *root = NULL; - char *path; - - if (!root) { - path = g_strconcat (g_get_home_dir (), "/evolution/private/config", - NULL); - - root = bonobo_storage_open_full (BONOBO_IO_DRIVER_FS, path, - Bonobo_Storage_CREATE, 0664, - ev); - - g_free (path); - - if (BONOBO_EX (ev) || !root) - return CORBA_OBJECT_NIL; - } - - return BONOBO_OBJREF (root); -} - -static Bonobo_Storage -wombat_private_lookup_storage (const char *name, - CORBA_Environment *ev) -{ - Bonobo_Storage root; - - if ((root = wombat_private_root_storage (ev)) == CORBA_OBJECT_NIL) - return CORBA_OBJECT_NIL; - - if (!strcmp (name, "")) - return bonobo_object_dup_ref (root, ev); - - return Bonobo_Storage_openStorage (root, name, Bonobo_Storage_CREATE, - ev); -} - -static Bonobo_Storage -wombat_private_lookup_stream (const char *name, - CORBA_Environment *ev) -{ - Bonobo_Storage root; - - if (!strcmp (name, "")) { - bonobo_exception_set (ev, ex_Bonobo_Storage_NotFound); - return CORBA_OBJECT_NIL; - } - - if ((root = wombat_private_root_storage (ev)) == CORBA_OBJECT_NIL) - return CORBA_OBJECT_NIL; - - - return Bonobo_Storage_openStream (root, name, Bonobo_Storage_CREATE, - ev); -} - -static CORBA_Object -wombat_private_lookup_db (CORBA_Environment *ev) -{ - static CORBA_Object db = CORBA_OBJECT_NIL; - - /* kinda crappy, but make sure permissions for the directory - are correct whenever someone new opens the db. */ - char *private_dir_path; - - private_dir_path = g_strconcat (g_get_home_dir (), - "/evolution/private", - NULL); - chmod (private_dir_path, 0700); - g_free (private_dir_path); - - if (db == CORBA_OBJECT_NIL) - db = bonobo_get_object (DB_URL, - "IDL:Bonobo/ConfigDatabase:1.0", ev); - - bonobo_object_dup_ref (db, ev); - - return db; -} - -static Bonobo_Unknown -wombat_private_moniker_resolve (BonoboMoniker *moniker, - const Bonobo_ResolveOptions *options, - const CORBA_char *interface, - CORBA_Environment *ev) -{ - CORBA_Object db; - Bonobo_Moniker parent; - const gchar *name; - Bonobo_Storage storage; - Bonobo_Stream stream; - - parent = bonobo_moniker_get_parent (moniker, ev); - if (BONOBO_EX (ev)) - return CORBA_OBJECT_NIL; - - name = bonobo_moniker_get_name (moniker); - - if (parent != CORBA_OBJECT_NIL) { - - g_warning ("wombat: parent moniker are not supproted"); - - bonobo_object_release_unref (parent, ev); - - bonobo_exception_set (ev, ex_Bonobo_Moniker_InterfaceNotFound); - - return CORBA_OBJECT_NIL; - } - - if (!strcmp (interface, "IDL:Bonobo/Storage:1.0")) { - - storage = wombat_private_lookup_storage (name, ev); - - return storage; - } - - if (!strcmp (interface, "IDL:Bonobo/Stream:1.0")) { - - stream = wombat_private_lookup_stream (name, ev); - - return stream; - } - - if (!strcmp (interface, "IDL:Bonobo/ConfigDatabase:1.0")) { - - if (strcmp (name, "")) - g_warning ("wombat: unused moniker name"); - - if ((db = wombat_private_lookup_db (ev)) != CORBA_OBJECT_NIL) - return db; - } - - bonobo_exception_set (ev, ex_Bonobo_Moniker_InterfaceNotFound); - return CORBA_OBJECT_NIL; -} - -BonoboObject * -wombat_private_moniker_factory (BonoboGenericFactory *this, - const char *object_id, - void *data) -{ - g_return_val_if_fail (object_id != NULL, NULL); - - if (!strcmp (object_id, "OAFIID:Bonobo_Moniker_wombat_private")) - - return BONOBO_OBJECT (bonobo_moniker_simple_new ( - "wombat-private:", wombat_private_moniker_resolve)); - - else - g_warning ("Failing to manufacture a '%s'", object_id); - - return NULL; -} - diff --git a/wombat/wombat-private-moniker.h b/wombat/wombat-private-moniker.h deleted file mode 100644 index 2c2bbbca8e..0000000000 --- a/wombat/wombat-private-moniker.h +++ /dev/null @@ -1,11 +0,0 @@ -#ifndef _MONIKER_WOMBAT_PRIVATE_H_ -#define _MONIKER_WOMBAT_PRIVATE_H_ - -#include <bonobo/bonobo-generic-factory.h> - -BonoboObject * -wombat_private_moniker_factory (BonoboGenericFactory *this, - const char *object_id, - void *data); - -#endif 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); |