From 9483369aa04a5d2c4dc5c0034a3e4431153d9c99 Mon Sep 17 00:00:00 2001 From: Ettore Perazzoli Date: Fri, 28 Apr 2000 04:23:19 +0000 Subject: Made Evolution OAF-compatible. svn path=/trunk/; revision=2673 --- ChangeLog | 8 ++ acconfig.h | 5 +- addressbook/ChangeLog | 33 ++++++ addressbook/backend/ebook/Makefile.am | 18 +-- addressbook/backend/ebook/e-book-view.c | 2 +- addressbook/backend/ebook/e-book.c | 14 ++- addressbook/backend/ebook/test-client-list.c | 17 ++- addressbook/backend/ebook/test-client.c | 32 ++++-- addressbook/backend/pas/pas-book-factory.c | 86 ++++++++++---- addressbook/ename/Makefile.am | 8 +- .../component/GNOME_Evolution_Addressbook.oaf.in | 30 +++++ .../component/GNOME_Evolution_Addressbook.oafinfo | 30 +++++ addressbook/gui/component/Makefile.am | 9 ++ addressbook/gui/component/addressbook-factory.c | 39 +++++-- addressbook/gui/component/addressbook.c | 14 ++- addressbook/gui/component/addressbook.oafinfo | 30 +++++ calendar/ChangeLog | 24 ++++ calendar/cal-client/cal-client.c | 14 ++- calendar/cal-client/client-test.c | 36 ++++-- .../gui/GNOME_Evolution_Calendar_Control.oaf.in | 28 +++++ .../gui/GNOME_Evolution_Calendar_Control.oafinfo | 28 +++++ calendar/gui/Makefile.am | 9 ++ calendar/gui/calendar-control.oafinfo | 28 +++++ calendar/gui/evolution-calendar-control.c | 33 ++++-- calendar/gui/gnomecal.oafinfo | 27 +++++ calendar/gui/main.c | 26 +++-- calendar/pcs/cal-factory.h | 3 +- camel/ChangeLog | 8 ++ camel/providers/pop3/Makefile.am | 9 +- camel/providers/sendmail/Makefile.am | 6 +- camel/providers/smtp/Makefile.am | 9 +- configure.in | 42 ++++++- e-util/ename/Makefile.am | 8 +- mail/ChangeLog | 24 ++++ mail/GNOME_Evolution_Mail.oaf.in | 28 +++++ mail/GNOME_Evolution_Mail.oafinfo | 28 +++++ mail/Makefile.am | 14 ++- mail/evolution-mail.oafinfo | 28 +++++ mail/folder-browser-factory.c | 13 ++- mail/main.c | 35 ++++-- mail/test-mail.c | 46 +++++--- shell/ChangeLog | 13 +++ shell/e-shell-view.c | 30 +++-- shell/main.c | 37 +++++- wombat/ChangeLog | 11 ++ wombat/GNOME_Evolution_Wombat.oaf.in | 30 +++++ wombat/GNOME_Evolution_Wombat.oafinfo | 30 +++++ wombat/Makefile.am | 9 ++ wombat/wombat.c | 127 ++++++++++++++++----- wombat/wombat.oafinfo | 30 +++++ 50 files changed, 1066 insertions(+), 180 deletions(-) create mode 100644 addressbook/gui/component/GNOME_Evolution_Addressbook.oaf.in create mode 100644 addressbook/gui/component/GNOME_Evolution_Addressbook.oafinfo create mode 100644 addressbook/gui/component/addressbook.oafinfo create mode 100644 calendar/gui/GNOME_Evolution_Calendar_Control.oaf.in create mode 100644 calendar/gui/GNOME_Evolution_Calendar_Control.oafinfo create mode 100644 calendar/gui/calendar-control.oafinfo create mode 100644 calendar/gui/gnomecal.oafinfo create mode 100644 mail/GNOME_Evolution_Mail.oaf.in create mode 100644 mail/GNOME_Evolution_Mail.oafinfo create mode 100644 mail/evolution-mail.oafinfo create mode 100644 wombat/GNOME_Evolution_Wombat.oaf.in create mode 100644 wombat/GNOME_Evolution_Wombat.oafinfo create mode 100644 wombat/wombat.oafinfo diff --git a/ChangeLog b/ChangeLog index 116493cebf..c71971f004 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2000-04-27 Ettore Perazzoli + + * acconfig.h: New configured #define `USING_OAF'. + + * configure.in: Added `--enable-oaf' option and corresponding + `OAF_LIBS' and `OAF_FLAGS' variables. Code friendly provided by + Maciej Stachowiak . + 2000-04-27 NotZed * tests/test10.c: Fix for removal of camelmimebodypart, and changes diff --git a/acconfig.h b/acconfig.h index 8bb80e1307..e0a4419a23 100644 --- a/acconfig.h +++ b/acconfig.h @@ -12,8 +12,9 @@ #undef SENDMAIL_PATH #undef SYSTEM_MAIL_DIR #undef HAVE_LDAP +#undef HAVE_TIMEZONE +#undef HAVE_TM_GMTOFF +#undef USING_OAF /* Define this if you want to build against the development gtk */ #undef HAVE_DEVGTK -#undef HAVE_TIMEZONE -#undef HAVE_TM_GMTOFF diff --git a/addressbook/ChangeLog b/addressbook/ChangeLog index 9d84cc1100..e197a8ae11 100644 --- a/addressbook/ChangeLog +++ b/addressbook/ChangeLog @@ -1,3 +1,36 @@ +2000-04-27 Ettore Perazzoli + + * ename/Makefile.am + (gnome_libs): Use `BONOBO_GNOME_LIBS'. + (INCLUDES): Add `-I$(srcdir)/..'. + + * backend/pas/pas-book-factory.c + (register_factory): New function to register the factory. + Implementation different according to `USING_OAF'. + (pas_book_factory_activate): Use `register_factory()'. + + * gui/component/addressbook.c: New #define `CONTROL_FACTORY_ID', + varying depending on whether we are `USING_OAF'. + (addressbook_factory_init): Use `CONTROL_FACTORY_ID'. + + * backend/ebook/test-client.c (init_corba): New function, + implemented differently according to the `USING_OAF' #define. + + * backend/ebook/e-book.c: New #define `CARDSERVER_OAF_ID'. + (e_book_construct): Work with OAF #if `USING_OAF'. + + * backend/ebook/Makefile.am (gnome_libs): Removed. + (corbadir): Removed. + (ebook_libs): Removed. + (test_client_LDADD): Just add `libebook.la'. + (test_card_LDADD): Likewise. + (test_client_list_LDADD): Likewise. + + * gui/component/addressbook-factory.c + (init_corba): New helper function, implemented differently + according to `USING_OAF'. + (main): Call `init_corba()'. + 2000-04-27 Christopher James Lahey * backend/ebook/e-card.c, backend/ebook/e-card.h: Added file as, diff --git a/addressbook/backend/ebook/Makefile.am b/addressbook/backend/ebook/Makefile.am index 3dfe72fec4..dd213e1ab7 100644 --- a/addressbook/backend/ebook/Makefile.am +++ b/addressbook/backend/ebook/Makefile.am @@ -1,7 +1,5 @@ noinst_PROGRAMS = test-card test-client test-client-list -corbadir = $(sysconfdir)/CORBA/servers - CORBA_SOURCE = \ addressbook.h \ addressbook-common.c \ @@ -24,16 +22,6 @@ INCLUDES = \ -I$(top_builddir)/addressbook/backend \ $(BONOBO_GNOME_CFLAGS) -gnome_libs = \ - $(GNOME_LIBDIR) \ - $(GNOMEUI_LIBS) \ - $(GNOMEGNORBA_LIBS) \ - $(INTLLIBS) - -ebook_libs = \ - libebook.la \ - $(gnome_libs) - lib_LTLIBRARIES = libebook.la libebook_la_SOURCES = \ @@ -65,24 +53,24 @@ test_client_SOURCES = \ test-client.c test_client_LDADD = \ + libebook.la \ $(BONOBO_GNOME_LIBS) \ - $(ebook_libs) \ $(top_builddir)/libversit/libversit.la test_client_list_SOURCES = \ test-client-list.c test_client_list_LDADD = \ + libebook.la \ $(BONOBO_GNOME_LIBS) \ - $(ebook_libs) \ $(top_builddir)/libversit/libversit.la test_card_SOURCES = \ test-card.c test_card_LDADD = \ + libebook.la \ $(BONOBO_GNOME_LIBS) \ - $(ebook_libs) \ $(top_builddir)/libversit/libversit.la BUILT_SOURCES = $(CORBA_SOURCE) diff --git a/addressbook/backend/ebook/e-book-view.c b/addressbook/backend/ebook/e-book-view.c index db7e1b9e67..65a90b8ede 100644 --- a/addressbook/backend/ebook/e-book-view.c +++ b/addressbook/backend/ebook/e-book-view.c @@ -9,9 +9,9 @@ */ #include -#include #include #include + #include "addressbook.h" #include "e-card-cursor.h" #include "e-book-view-listener.h" diff --git a/addressbook/backend/ebook/e-book.c b/addressbook/backend/ebook/e-book.c index 1b6411ae0a..e3301233a6 100644 --- a/addressbook/backend/ebook/e-book.c +++ b/addressbook/backend/ebook/e-book.c @@ -9,9 +9,9 @@ */ #include -#include #include #include + #include "addressbook.h" #include "e-card-cursor.h" #include "e-book-listener.h" @@ -19,7 +19,13 @@ GtkObjectClass *e_book_parent_class; +#ifdef USING_OAF +#include +#define CARDSERVER_OAF_ID "OAFIID:evolution:addressbook-server:0fbc844d-c721-4615-98d0-d67eacf42d80" +#else +#include #define CARDSERVER_GOAD_ID "evolution:addressbook-server" +#endif typedef enum { URINotLoaded, @@ -426,8 +432,14 @@ e_book_construct (EBook *book) /* * Connect to the Personal Addressbook Server. */ + +#ifdef USING_OAF + book->priv->book_factory = (Evolution_BookFactory) + oaf_activate_from_id (CARDSERVER_OAF_ID, 0, NULL, NULL); +#else book->priv->book_factory = (Evolution_BookFactory) goad_server_activate_with_id (NULL, CARDSERVER_GOAD_ID, 0, NULL); +#endif if (book->priv->book_factory == CORBA_OBJECT_NIL) { g_warning ("e_book_construct: Could not obtain a handle " diff --git a/addressbook/backend/ebook/test-client-list.c b/addressbook/backend/ebook/test-client-list.c index eaa6e41c94..e492323310 100644 --- a/addressbook/backend/ebook/test-client-list.c +++ b/addressbook/backend/ebook/test-client-list.c @@ -2,26 +2,31 @@ #include #include #include + +#ifdef USING_OAF +#include +#else #include +#endif #include "e-book.h" CORBA_Environment ev; -CORBA_ORB orb; static void init_bonobo (int argc, char **argv) { - +#ifdef USING_OAF + gnome_init ("blah", "0.0", argc, argv); + oaf_init (argc, argv); +#else gnome_CORBA_init_with_popt_table ( "blah", "0.0", &argc, argv, NULL, 0, NULL, GNORBA_INIT_SERVER_FUNC, &ev); +#endif - orb = gnome_CORBA_ORB (); - - if (bonobo_init (orb, NULL, NULL) == FALSE) + if (bonobo_init (CORBA_OBJECT_NIL, CORBA_OBJECT_NIL, CORBA_OBJECT_NIL) == FALSE) g_error (_("Could not initialize Bonobo")); - } static void diff --git a/addressbook/backend/ebook/test-client.c b/addressbook/backend/ebook/test-client.c index 15c5410146..ef13c1ab96 100644 --- a/addressbook/backend/ebook/test-client.c +++ b/addressbook/backend/ebook/test-client.c @@ -2,7 +2,6 @@ #include #include #include -#include #include @@ -31,22 +30,39 @@ " static CORBA_Environment ev; -static CORBA_ORB orb; static char *cardstr; +#ifdef USING_OAF + +#include + static void -init_bonobo (int argc, char **argv) +init_corba (int *argc, char **argv) { + gnome_init_with_popt_table("blah", "0.0", *argc, argv, NULL, 0, NULL); + + oaf_init (*argc, argv); +} + +#else + +#include +static void +init_corba (int *argc, char **argv) +{ gnome_CORBA_init_with_popt_table ( "blah", "0.0", - &argc, argv, NULL, 0, NULL, GNORBA_INIT_SERVER_FUNC, &ev); + argc, argv, NULL, 0, NULL, GNORBA_INIT_SERVER_FUNC, &ev); +} - orb = gnome_CORBA_ORB (); +#endif - if (bonobo_init (orb, NULL, NULL) == FALSE) +static void +init_bonobo (int argc, char **argv) +{ + if (bonobo_init (CORBA_OBJECT_NIL, CORBA_OBJECT_NIL, CORBA_OBJECT_NIL) == FALSE) g_error (_("Could not initialize Bonobo")); - } static void @@ -155,6 +171,8 @@ main (int argc, char **argv) { CORBA_exception_init (&ev); + + init_corba (&argc, argv); init_bonobo (argc, argv); cardstr = NULL; diff --git a/addressbook/backend/pas/pas-book-factory.c b/addressbook/backend/pas/pas-book-factory.c index 6542ffc48b..651f17523d 100644 --- a/addressbook/backend/pas/pas-book-factory.c +++ b/addressbook/backend/pas/pas-book-factory.c @@ -8,11 +8,17 @@ #include #include -#include + #include "addressbook.h" #include "pas-book-factory.h" +#ifdef USING_OAF +#include +#define PAS_BOOK_FACTORY_OAF_ID "OAFIID:evolution:addressbook-server:0fbc844d-c721-4615-98d0-d67eacf42d80" +#else +#include #define PAS_BOOK_FACTORY_GOAD_ID "evolution:addressbook-server" +#endif static BonoboObjectClass *pas_book_factory_parent_class; POA_Evolution_BookFactory__vepv pas_book_factory_vepv; @@ -301,25 +307,43 @@ pas_book_factory_new (void) return factory; } -/** - * pas_book_factory_activate: - */ -void -pas_book_factory_activate (PASBookFactory *factory) +#ifdef USING_OAF + +static gboolean +register_factory (CORBA_Object obj) { - CORBA_Environment ev; - int ret; + OAF_RegistrationResult result; - g_return_if_fail (factory != NULL); - g_return_if_fail (PAS_IS_BOOK_FACTORY (factory)); + puts ("about to register addressbook"); + + result = oaf_active_server_register (PAS_BOOK_FACTORY_OAF_ID, obj); + switch (result) { + case OAF_REG_SUCCESS: + return TRUE; + case OAF_REG_NOT_LISTED: + g_message ("Error registering the PAS factory: not listed"); + return FALSE; + case OAF_REG_ALREADY_ACTIVE: + g_message ("Error registering the PAS factory: already active"); + return FALSE; + case OAF_REG_ERROR: + default: + g_message ("Error registering the PAS factory: generic error"); + return FALSE; + } +} + +#else + +static gboolean +register_factory (CORBA_Object obj) +{ + CORBA_Environment ev; CORBA_exception_init (&ev); + int ret; - ret = goad_server_register ( - NULL, - bonobo_object_corba_objref (BONOBO_OBJECT (factory)), - PAS_BOOK_FACTORY_GOAD_ID, "server", - &ev); + ret = goad_server_register (NULL, obj, PAS_BOOK_FACTORY_GOAD_ID, "server", &ev); if (ev._major != CORBA_NO_EXCEPTION) { g_message ("pas_book_factory_activate: Exception " @@ -330,22 +354,34 @@ pas_book_factory_activate (PASBookFactory *factory) CORBA_exception_free (&ev); - if (ret == -1) { + switch (ret) { + case 0: + return TRUE; + case -2: + g_message ("pas_book_factory_activate: Another " + "PASBookFactory is already running.\n"); + return FALSE; + case -1: + default: g_message ("pas_book_factory_activate: Error " "registering PASBookFactory!\n"); - return; + return FALSE; } +} - if (ret == -2) { - g_message ("pas_book_factory_activate: Another " - "PASBookFactory is already running.\n"); - return; - - } +#endif - return; -} +/** + * pas_book_factory_activate: + */ +void +pas_book_factory_activate (PASBookFactory *factory) +{ + g_return_if_fail (factory != NULL); + g_return_if_fail (PAS_IS_BOOK_FACTORY (factory)); + register_factory (bonobo_object_corba_objref (BONOBO_OBJECT (factory))); +} static void pas_book_factory_init (PASBookFactory *factory) diff --git a/addressbook/ename/Makefile.am b/addressbook/ename/Makefile.am index 17a542d9c5..6b63d7dfaf 100644 --- a/addressbook/ename/Makefile.am +++ b/addressbook/ename/Makefile.am @@ -1,7 +1,9 @@ INCLUDES = \ -DGNOMELOCALEDIR=\""$(datadir)/locale"\" \ -DG_LOG_DOMAIN=\"EName\" \ - -I$(srcdir) -I$(top_srcdir) \ + -I$(srcdir) \ + -I$(srcdir)/.. \ + -I$(top_srcdir) \ -I. \ -I.. \ -I$(top_builddir) \ @@ -9,9 +11,7 @@ INCLUDES = \ $(GNOME_INCLUDEDIR) gnome_libs = \ - $(GNOME_LIBDIR) \ - $(GNOMEUI_LIBS) \ - $(GNOMEGNORBA_LIBS) \ + $(BONOBO_GNOME_LIBS) \ $(INTLLIBS) ename_libs = \ diff --git a/addressbook/gui/component/GNOME_Evolution_Addressbook.oaf.in b/addressbook/gui/component/GNOME_Evolution_Addressbook.oaf.in new file mode 100644 index 0000000000..8f51a1f07a --- /dev/null +++ b/addressbook/gui/component/GNOME_Evolution_Addressbook.oaf.in @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/addressbook/gui/component/GNOME_Evolution_Addressbook.oafinfo b/addressbook/gui/component/GNOME_Evolution_Addressbook.oafinfo new file mode 100644 index 0000000000..8f51a1f07a --- /dev/null +++ b/addressbook/gui/component/GNOME_Evolution_Addressbook.oafinfo @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/addressbook/gui/component/Makefile.am b/addressbook/gui/component/Makefile.am index c20864912b..9e72319d03 100644 --- a/addressbook/gui/component/Makefile.am +++ b/addressbook/gui/component/Makefile.am @@ -35,5 +35,14 @@ evolution_addressbook_LDADD = \ evolution_addressbook_LDFLAGS = `gnome-config --libs gdk_pixbuf` +if USING_OAF +oafdir = $(datadir)/oaf +oaf_DATA = addressbook.oafinfo +else gnorbadir = $(sysconfdir)/CORBA/servers gnorba_DATA = addressbook.gnorba +endif + +EXTRA_DIST = \ + addressbook.gnorba \ + addressbook.oafinfo diff --git a/addressbook/gui/component/addressbook-factory.c b/addressbook/gui/component/addressbook-factory.c index 83257b1189..aa6214786c 100644 --- a/addressbook/gui/component/addressbook-factory.c +++ b/addressbook/gui/component/addressbook-factory.c @@ -10,25 +10,48 @@ #include #include -#include #include #include + #include "addressbook.h" -CORBA_Environment ev; -CORBA_ORB orb; +#ifdef USING_OAF + +#include static void -init_bonobo (int argc, char **argv) +init_corba (int *argc, char **argv) { + gnome_init_with_popt_table ("evolution-addressbook", "0.0", + *argc, argv, oaf_popt_options, 0, NULL); + + oaf_init (*argc, argv); +} + +#else + +#include + +static void +init_corba (int *argc, char **argv) +{ + CORBA_Environment ev; + + CORBA_exception_init (&ev); gnome_CORBA_init_with_popt_table ( "evolution-addressbook", "0.0", - &argc, argv, NULL, 0, NULL, GNORBA_INIT_SERVER_FUNC, &ev); + argc, argv, NULL, 0, NULL, GNORBA_INIT_SERVER_FUNC, &ev); + + CORBA_exception_free (&ev); +} - orb = gnome_CORBA_ORB (); +#endif - if (bonobo_init (orb, NULL, NULL) == FALSE) +static void +init_bonobo (int argc, char **argv) +{ + if (bonobo_init (CORBA_OBJECT_NIL, CORBA_OBJECT_NIL, CORBA_OBJECT_NIL) == FALSE) g_error (_("Could not initialize Bonobo")); glade_gnome_init (); @@ -37,7 +60,7 @@ init_bonobo (int argc, char **argv) int main (int argc, char **argv) { - CORBA_exception_init (&ev); + init_corba (&argc, argv); init_bonobo (argc, argv); diff --git a/addressbook/gui/component/addressbook.c b/addressbook/gui/component/addressbook.c index bb4b20406f..d634d5a926 100644 --- a/addressbook/gui/component/addressbook.c +++ b/addressbook/gui/component/addressbook.c @@ -9,6 +9,7 @@ */ #include + #include #include #include @@ -20,6 +21,12 @@ #include "e-minicard-view.h" #include "e-contact-editor.h" +#ifdef USING_OAF +#define CONTROL_FACTORY_ID "OAFIID:control-factory:addressbook:3e10597b-0591-4d45-b082-d781b7aa6e17" +#else +#define CONTROL_FACTORY_ID "control-factory:addressbook" +#endif + static void control_deactivate (BonoboControl *control, BonoboUIHandler *uih) { @@ -451,10 +458,9 @@ addressbook_factory_init (void) if (addressbook_control_factory != NULL) return; - addressbook_control_factory = - bonobo_generic_factory_new ( - "control-factory:addressbook", - addressbook_factory, NULL); + addressbook_control_factory = bonobo_generic_factory_new (CONTROL_FACTORY_ID, + addressbook_factory, + NULL); if (addressbook_control_factory == NULL) { g_error ("I could not register a Addressbook factory."); diff --git a/addressbook/gui/component/addressbook.oafinfo b/addressbook/gui/component/addressbook.oafinfo new file mode 100644 index 0000000000..8f51a1f07a --- /dev/null +++ b/addressbook/gui/component/addressbook.oafinfo @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/calendar/ChangeLog b/calendar/ChangeLog index 5e5d9c1876..fa05cff137 100644 --- a/calendar/ChangeLog +++ b/calendar/ChangeLog @@ -1,3 +1,27 @@ +2000-04-27 Ettore Perazzoli + + * gui/evolution-calendar-control.c + (init_bonobo): OAFized. + + * gui/main.c (main): Initialize with OAF if `USING_OAF'. + + * gui/evolution-calendar-control.c: New #define + `CONTROL_FACTORY_ID', varying according to whether we are + `USING_OAF'. + (calendar_factory_init): Use `CONTROL_FACTORY_ID'. + + * gui/Makefile.am: Updated for OAF. + + * pcs/cal-factory.h: Explicitly #include + "calendar/pcs/evolution-calendar.h" instead of just + "evolution-calendar.h". + + * cal-client/cal-client.c (cal_client_construct) [USING_OAF]: Use + OAF. + + * cal-client/client-test.c (init_corba): New function, implemented + differently depending on `USING_OAF'. + 2000-04-27 * pcs/cal-backend.c (cal_backend_load): fix memory leak diff --git a/calendar/cal-client/cal-client.c b/calendar/cal-client/cal-client.c index 34192387b4..bffa12ac65 100644 --- a/calendar/cal-client/cal-client.c +++ b/calendar/cal-client/cal-client.c @@ -22,7 +22,13 @@ #include #include + +#ifdef USING_OAF +#include +#else #include +#endif + #include "cal-client.h" #include "cal-listener.h" @@ -375,18 +381,24 @@ cal_client_construct (CalClient *client) CORBA_Environment ev; int result; + CORBA_exception_init (&ev); g_return_val_if_fail (client != NULL, NULL); g_return_val_if_fail (IS_CAL_CLIENT (client), NULL); priv = client->priv; +#ifdef USING_OAF + factory = (Evolution_Calendar_CalFactory) oaf_activate_from_id ( + "OAFIID:evolution:calendar-factory:1c915858-ece3-4a6f-9d81-ea0f108a9554", + OAF_FLAG_NO_LOCAL, NULL, &ev); +#else factory = (Evolution_Calendar_CalFactory) goad_server_activate_with_id ( NULL, "evolution:calendar-factory", GOAD_ACTIVATE_REMOTE, NULL); +#endif - CORBA_exception_init (&ev); result = CORBA_Object_is_nil (factory, &ev); if (ev._major != CORBA_NO_EXCEPTION) { g_message ("cal_client_construct(): could not see if the factory is NIL"); diff --git a/calendar/cal-client/client-test.c b/calendar/cal-client/client-test.c index fa8316707d..f4b847eb65 100644 --- a/calendar/cal-client/client-test.c +++ b/calendar/cal-client/client-test.c @@ -1,8 +1,7 @@ #include -#include #include +#include #include - static CalClient *client1; static CalClient *client2; @@ -145,13 +144,25 @@ client_destroy_cb (GtkObject *object, gpointer data) gtk_main_quit (); } -int -main (int argc, char **argv) +#ifdef USING_OAF + +#include + +static void +init_corba (int *argc, char **argv) { - CORBA_Environment ev; + gnome_init ("tl-test", VERSION, *argc, argv); + oaf_init (*argc, argv); +} - bindtextdomain (PACKAGE, GNOMELOCALEDIR); - textdomain (PACKAGE); +#else + +#include + +static void +init_corba (int *argc, char **argv) +{ + CORBA_Environment ev; CORBA_exception_init (&ev); gnome_CORBA_init ("tl-test", VERSION, &argc, argv, 0, &ev); @@ -161,6 +172,17 @@ main (int argc, char **argv) exit (1); } CORBA_exception_free (&ev); +} + +#endif + +int +main (int argc, char **argv) +{ + bindtextdomain (PACKAGE, GNOMELOCALEDIR); + textdomain (PACKAGE); + + init_corba (&argc, argv); if (!bonobo_init (CORBA_OBJECT_NIL, CORBA_OBJECT_NIL, CORBA_OBJECT_NIL)) { g_message ("main(): could not initialize Bonobo"); diff --git a/calendar/gui/GNOME_Evolution_Calendar_Control.oaf.in b/calendar/gui/GNOME_Evolution_Calendar_Control.oaf.in new file mode 100644 index 0000000000..fb0f138caf --- /dev/null +++ b/calendar/gui/GNOME_Evolution_Calendar_Control.oaf.in @@ -0,0 +1,28 @@ + + + + + + + + + + + + + + + + + + + + + + diff --git a/calendar/gui/GNOME_Evolution_Calendar_Control.oafinfo b/calendar/gui/GNOME_Evolution_Calendar_Control.oafinfo new file mode 100644 index 0000000000..fb0f138caf --- /dev/null +++ b/calendar/gui/GNOME_Evolution_Calendar_Control.oafinfo @@ -0,0 +1,28 @@ + + + + + + + + + + + + + + + + + + + + + + diff --git a/calendar/gui/Makefile.am b/calendar/gui/Makefile.am index 07e8ca1531..fa15a9286e 100644 --- a/calendar/gui/Makefile.am +++ b/calendar/gui/Makefile.am @@ -81,8 +81,17 @@ evolution_calendar_LDADD = \ evolution_calendar_LDFLAGS = `gnome-config --libs gdk_pixbuf` +if USING_OAF +oafdir = $(datadir)/oaf +oaf_DATA = calendar-control.oafinfo +else gnorbadir = $(sysconfdir)/CORBA/servers gnorba_DATA = calendar-control.gnorba +endif + +EXTRA_DIST = \ + calendar-control.gnorba \ + calendar-control.oafinfo #calendar_pilot_sync_SOURCES = \ # GnomeCal-common.c \ diff --git a/calendar/gui/calendar-control.oafinfo b/calendar/gui/calendar-control.oafinfo new file mode 100644 index 0000000000..fb0f138caf --- /dev/null +++ b/calendar/gui/calendar-control.oafinfo @@ -0,0 +1,28 @@ + + + + + + + + + + + + + + + + + + + + + + diff --git a/calendar/gui/evolution-calendar-control.c b/calendar/gui/evolution-calendar-control.c index c8c419d471..54ac148889 100644 --- a/calendar/gui/evolution-calendar-control.c +++ b/calendar/gui/evolution-calendar-control.c @@ -2,10 +2,14 @@ #include #include -#include #include #include +#ifdef USING_OAF +#include +#else +#include +#endif #include #include @@ -17,6 +21,11 @@ #define PROPERTY_CALENDAR_URI_IDX 1 +#ifdef USING_OAF +#define CONTROL_FACTORY_ID "OAFIID:control-factory:calendar:f4f90989-0f50-4af2-ad94-8bbdf331f0bc" +#else +#define CONTROL_FACTORY_ID "control-factory:calendar" +#endif CORBA_Environment ev; CORBA_ORB orb; @@ -36,15 +45,21 @@ control_activate_cb (BonoboControl *control, static void -init_bonobo (int argc, char **argv) +init_bonobo (int *argc, char **argv) { +#ifdef USING_OAF + /* FIXME: VERSION instead of "0.0". */ + gnome_init_with_popt_table ("evolution-calendar", "0.0", + *argc, argv, oaf_popt_options, + 0, NULL); + oaf_init (*argc, argv); +#else gnome_CORBA_init_with_popt_table ( "evolution-calendar", "0.0", - &argc, argv, NULL, 0, NULL, GNORBA_INIT_SERVER_FUNC, &ev); + argc, argv, NULL, 0, NULL, GNORBA_INIT_SERVER_FUNC, &ev); +#endif - orb = gnome_CORBA_ORB (); - - if (bonobo_init (orb, NULL, NULL) == FALSE) + if (bonobo_init (CORBA_OBJECT_NIL, CORBA_OBJECT_NIL, CORBA_OBJECT_NIL) == FALSE) g_error (_("Could not initialize Bonobo")); } @@ -144,8 +159,10 @@ calendar_factory_init (void) if (calendar_control_factory != NULL) return; + puts ("XXXXXX - initializing calendar factory!!!"); + calendar_control_factory = - bonobo_generic_factory_new ("control-factory:calendar", + bonobo_generic_factory_new (CONTROL_FACTORY_ID, calendar_factory, NULL); if (calendar_control_factory == NULL) { @@ -164,7 +181,7 @@ main (int argc, char **argv) CORBA_exception_init (&ev); - init_bonobo (argc, argv); + init_bonobo (&argc, argv); calendar_factory_init (); diff --git a/calendar/gui/gnomecal.oafinfo b/calendar/gui/gnomecal.oafinfo new file mode 100644 index 0000000000..c4b91b9dd8 --- /dev/null +++ b/calendar/gui/gnomecal.oafinfo @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/calendar/gui/main.c b/calendar/gui/main.c index 904868513e..46f4c31e3e 100644 --- a/calendar/gui/main.c +++ b/calendar/gui/main.c @@ -9,6 +9,7 @@ */ #include + #include #include #include @@ -325,22 +326,31 @@ int main (int argc, char **argv) { GnomeClient *client; - CORBA_Environment ev; GtkWidget *cal_window; GnomeCalendar *cal_frame; bindtextdomain (PACKAGE, GNOMELOCALEDIR); textdomain (PACKAGE); - CORBA_exception_init (&ev); - gnome_CORBA_init_with_popt_table ("calendar", VERSION, &argc, argv, - options, 0, NULL, 0, &ev); - if (ev._major != CORBA_NO_EXCEPTION) { - g_message ("main(): could not initialize the ORB"); +#ifdef USING_OAF + gnome_init_with_popt_table ("calendar", VERSION, argc, argv, oaf_popt_options, + 0, NULL); + oaf_init (argc, argv); +#else + { + CORBA_Environment ev; + + CORBA_exception_init (&ev); + gnome_CORBA_init_with_popt_table ("calendar", VERSION, &argc, argv, + options, 0, NULL, 0, &ev); + if (ev._major != CORBA_NO_EXCEPTION) { + g_message ("main(): could not initialize the ORB"); + CORBA_exception_free (&ev); + exit (EXIT_FAILURE); + } CORBA_exception_free (&ev); - exit (EXIT_FAILURE); } - CORBA_exception_free (&ev); +#endif if (!bonobo_init (CORBA_OBJECT_NIL, CORBA_OBJECT_NIL, CORBA_OBJECT_NIL)) { g_message ("main(): could not initialize Bonobo"); diff --git a/calendar/pcs/cal-factory.h b/calendar/pcs/cal-factory.h index 85435e45ae..03b2cc8dc3 100644 --- a/calendar/pcs/cal-factory.h +++ b/calendar/pcs/cal-factory.h @@ -24,7 +24,8 @@ #include #include -#include "evolution-calendar.h" + +#include "calendar/pcs/evolution-calendar.h" BEGIN_GNOME_DECLS diff --git a/camel/ChangeLog b/camel/ChangeLog index e6d7a081a3..65aef6ccc4 100644 --- a/camel/ChangeLog +++ b/camel/ChangeLog @@ -1,3 +1,11 @@ +2000-04-27 Ettore Perazzoli + + * providers/pop3/Makefile.am (INCLUDES): Add `-I$(srcdir)/../../..' + to pick the Camel includes. + * providers/sendmail/Makefile.am (INCLUDES): Likewise. + + * camel.h: Don't #include anymore. + 2000-04-27 NotZed * camel-mime-utils.c (check_header): Dont try and check a NULL diff --git a/camel/providers/pop3/Makefile.am b/camel/providers/pop3/Makefile.am index c587983ffc..202320b3f0 100644 --- a/camel/providers/pop3/Makefile.am +++ b/camel/providers/pop3/Makefile.am @@ -8,9 +8,14 @@ providerdir = $(pkglibdir)/camel-providers/$(VERSION) provider_LTLIBRARIES = libcamelpop3.la -INCLUDES = -I.. -I$(srcdir)/.. -I$(includedir) \ +INCLUDES = \ + -I.. \ + -I$(srcdir)/.. \ + -I$(srcdir)/../../.. \ + -I$(includedir) \ -I$(top_srcdir)/intl \ - $(GTK_INCLUDEDIR) -I$(top_srcdir)/camel \ + $(GTK_INCLUDEDIR) \ + -I$(top_srcdir)/camel \ -I$(srcdir)/../mbox libcamelpop3_la_SOURCES = \ diff --git a/camel/providers/sendmail/Makefile.am b/camel/providers/sendmail/Makefile.am index aada24aee7..9c9c3f356b 100644 --- a/camel/providers/sendmail/Makefile.am +++ b/camel/providers/sendmail/Makefile.am @@ -9,7 +9,11 @@ providerdir = $(pkglibdir)/camel-providers/$(VERSION) provider_LTLIBRARIES = libcamelsendmail.la -INCLUDES = -I.. -I$(srcdir)/.. -I$(includedir) \ +INCLUDES = \ + -I.. \ + -I$(srcdir)/.. \ + -I$(srcdir)/../../.. \ + -I$(includedir) \ -I$(top_srcdir)/intl \ $(GTK_INCLUDEDIR) -I$(top_srcdir)/camel diff --git a/camel/providers/smtp/Makefile.am b/camel/providers/smtp/Makefile.am index 25ee71b3c0..dee3a50abb 100644 --- a/camel/providers/smtp/Makefile.am +++ b/camel/providers/smtp/Makefile.am @@ -8,9 +8,14 @@ providerdir = $(pkglibdir)/camel-providers/$(VERSION) provider_LTLIBRARIES = libcamelsmtp.la -INCLUDES = -I.. -I$(srcdir)/.. -I$(includedir) \ +INCLUDES = \ + -I.. \ + -I$(srcdir)/.. \ + -I$(srcdir)/../../.. \ + -I$(includedir) \ -I$(top_srcdir)/intl \ - $(GTK_INCLUDEDIR) -I$(top_srcdir)/camel + $(GTK_INCLUDEDIR) \ + -I$(top_srcdir)/camel libcamelsmtp_la_SOURCES = \ camel-smtp-provider.c \ diff --git a/configure.in b/configure.in index 1c54b13b4e..f58fc88426 100644 --- a/configure.in +++ b/configure.in @@ -166,6 +166,7 @@ dnl ****************************** AC_MSG_CHECKING(for Bonobo > 0.5) if gnome-config --libs bonobo > /dev/null 2>&1; then vers=`gnome-config --modversion bonobo` + echo $vers case $vers in bonobo-0.[[012345]]) bonobo_ok=false ;; @@ -299,7 +300,7 @@ AC_SUBST(BONOBO_VFS_GNOME_CFLAGS) dnl ****************************** dnl Pilot checking dnl ****************************** -GNOME_PILOT_CHECK +dnl GNOME_PILOT_CHECK dnl ****** @@ -321,7 +322,44 @@ AC_DEFINE_UNQUOTED(CAMEL_HARD_LOG_LEVEL, $camel_hard_log_level) AC_CONFIG_SUBDIRS(libical) AC_SUBST(CAPPLET_LIBS) - + +dnl ****************************** +dnl Whether to use OAF +dnl ****************************** + +AC_ARG_ENABLE(oaf, + [ --enable-oaf=[no/yes] Use OAF instead of GOAD.],,enable_oaf=no) + +if test "x$enable_oaf" = "xyes"; then + AC_PATH_PROG(OAF_CONFIG,oaf-config,no) + if test x$OAF_CONFIG = xno; then + AC_MSG_ERROR("You enabled OAF support but oaf-config was not found") + else + OAF_LIBS=`$OAF_CONFIG --libs` + OAF_CFLAGS=`$OAF_CONFIG --cflags` + GNORBA_LIBNAME= + fi +else + OAF_LIBS= + OAF_CFLAGS= + GNORBA_LIBNAME=gnorba +fi + +AC_SUBST(OAF_LIBS) +AC_SUBST(OAF_CFLAGS) + +AM_CONDITIONAL(USING_OAF, test "x$enable_oaf" = "xyes") + +if test "x$enable_oaf" = "xyes"; then + AC_DEFINE(USING_OAF) + BONOBO_GNOME_LIBS="`oaf-config --libs` $BONOBO_GNOME_LIBS" + BONOBO_GNOME_CFLAGS="`oaf-config --cflags ` $BONOBO_GNOME_CFLAGS" +fi + +dnl ****************************** +dnl Makefiles +dnl ****************************** + AC_OUTPUT([ Makefile macros/Makefile diff --git a/e-util/ename/Makefile.am b/e-util/ename/Makefile.am index 17a542d9c5..6b63d7dfaf 100644 --- a/e-util/ename/Makefile.am +++ b/e-util/ename/Makefile.am @@ -1,7 +1,9 @@ INCLUDES = \ -DGNOMELOCALEDIR=\""$(datadir)/locale"\" \ -DG_LOG_DOMAIN=\"EName\" \ - -I$(srcdir) -I$(top_srcdir) \ + -I$(srcdir) \ + -I$(srcdir)/.. \ + -I$(top_srcdir) \ -I. \ -I.. \ -I$(top_builddir) \ @@ -9,9 +11,7 @@ INCLUDES = \ $(GNOME_INCLUDEDIR) gnome_libs = \ - $(GNOME_LIBDIR) \ - $(GNOMEUI_LIBS) \ - $(GNOMEGNORBA_LIBS) \ + $(BONOBO_GNOME_LIBS) \ $(INTLLIBS) ename_libs = \ diff --git a/mail/ChangeLog b/mail/ChangeLog index af7b74ab6c..b119e9a18e 100644 --- a/mail/ChangeLog +++ b/mail/ChangeLog @@ -1,3 +1,27 @@ +2000-04-27 Ettore Perazzoli + + * folder-browser-factory.c: New macro `CONTROL_FACTORY_ID', which + is #defined to a different value according to whether we are + `USING_OAF' or not. + (folder_browser_factory_init): Use `CONTROL_FACTORY_ID'. + + * test-mail.c + (init_corba): New helper function, implemented differently + according to `USING_OAF'. + (main): Use `init_corba()'. + + * main.c + (init_corba): New helper function, implemented differently + according to `USING_OAF'. + (init_bonobo): Use `init_corba()'. + + * Makefile.am: Install OAF stuff if `USING_OAF'. Add + `-I$(datadir)/idl' to the `orbit-idl' command-line so that we can + use Bonobo IDL files installed under our prefix as well. Also, + use `$(ORBIT_IDL)' instead of hardcoded `orbit-idl'. + + * evolution-mail.oafinfo: New file. + 2000-04-27 Dan Winship * mail-format.c: Move text_to_html to e-util. diff --git a/mail/GNOME_Evolution_Mail.oaf.in b/mail/GNOME_Evolution_Mail.oaf.in new file mode 100644 index 0000000000..6c284ece5c --- /dev/null +++ b/mail/GNOME_Evolution_Mail.oaf.in @@ -0,0 +1,28 @@ + + + + + + + + + + + + + + + + + + + + + + diff --git a/mail/GNOME_Evolution_Mail.oafinfo b/mail/GNOME_Evolution_Mail.oafinfo new file mode 100644 index 0000000000..6c284ece5c --- /dev/null +++ b/mail/GNOME_Evolution_Mail.oafinfo @@ -0,0 +1,28 @@ + + + + + + + + + + + + + + + + + + + + + + diff --git a/mail/Makefile.am b/mail/Makefile.am index 4c2193330f..283333d2a4 100644 --- a/mail/Makefile.am +++ b/mail/Makefile.am @@ -63,13 +63,21 @@ test_mail_LDADD = \ $(BONOBO_HTML_GNOME_LIBS) +GOAD_FILES = evolution-mail.gnorba +OAF_FILES = evolution-mail.oafinfo + +if USING_OAF +oafdir = $(datadir)/oaf +oaf_DATA = $(OAF_FILES) +else gnorbadir = $(sysconfdir)/CORBA/servers -gnorba_DATA = evolution-mail.gnorba +gnorba_DATA = $(GOAD_FILES) +endif $(EVOLUTION_MAIL_CORBA_GENERATED): Mail.idl - orbit-idl -I`$(GNOME_CONFIG) --datadir`/idl -I$(srcdir) $(srcdir)/Mail.idl + $(ORBIT_IDL) -I$(datadir)/idl -I`$(GNOME_CONFIG) --datadir`/idl -I$(srcdir) $(srcdir)/Mail.idl -EXTRA_DIST = Mail.idl evolution-mail.gnorba +EXTRA_DIST = Mail.idl $(GOAD_FILES) $(OAF_FILES) dist-hook: -mkdir $(distdir)/pixmaps diff --git a/mail/evolution-mail.oafinfo b/mail/evolution-mail.oafinfo new file mode 100644 index 0000000000..6c284ece5c --- /dev/null +++ b/mail/evolution-mail.oafinfo @@ -0,0 +1,28 @@ + + + + + + + + + + + + + + + + + + + + + + diff --git a/mail/folder-browser-factory.c b/mail/folder-browser-factory.c index 0f438a7118..a485df29d9 100644 --- a/mail/folder-browser-factory.c +++ b/mail/folder-browser-factory.c @@ -23,6 +23,11 @@ #include #include "mail-ops.h" +#ifdef USING_OAF +#define CONTROL_FACTORY_ID "OAFIID:control-factory:evolution-mail:25902062-543b-4f44-8702-d90145fcdbf2" +#else +#define CONTROL_FACTORY_ID "control-factory:evolution-mail" +#endif static void folder_browser_set_shell (EvolutionServiceRepository *sr, @@ -252,14 +257,12 @@ folder_browser_factory_init (void) { static BonoboGenericFactory *bonobo_folder_browser_factory = NULL; - if (bonobo_folder_browser_factory != NULL) return; - bonobo_folder_browser_factory = - bonobo_generic_factory_new ( - "control-factory:evolution-mail", - folder_browser_factory, NULL); + bonobo_folder_browser_factory = bonobo_generic_factory_new (CONTROL_FACTORY_ID, + folder_browser_factory, + NULL); if (bonobo_folder_browser_factory == NULL){ e_notice (NULL, GNOME_MESSAGE_BOX_ERROR, diff --git a/mail/main.c b/mail/main.c index 953f424a79..2102a153ff 100644 --- a/mail/main.c +++ b/mail/main.c @@ -8,7 +8,6 @@ */ #include #include -#include #include #include #include "e-util/e-gui-utils.h" @@ -16,28 +15,48 @@ #include "main.h" #include "session.h" -CORBA_ORB orb; +#ifdef USING_OAF + +#include static void -init_bonobo (int argc, char **argv) +init_corba (int argc, char *argv []) +{ + gnome_init_with_popt_table ("evolution-mail-component", VERSION, argc, argv, + oaf_popt_options, 0, NULL); + oaf_init (argc, argv); +} + +#else /* USING_OAF */ + +#include + +static void +init_corba (int *argc, char *argv []) { CORBA_Environment ev; CORBA_exception_init (&ev); - gnome_CORBA_init_with_popt_table ( + gnome_CORBA_init_with_popt_table ( "evolution-mail-component", "1.0", &argc, argv, NULL, 0, NULL, GNORBA_INIT_SERVER_FUNC, &ev); - orb = gnome_CORBA_ORB (); + CORBA_exception_free (&ev); +} + +#endif /* USING_OAF */ - if (bonobo_init (orb, NULL, NULL) == FALSE){ +static void +init_bonobo (int argc, char **argv) +{ + init_corba (argc, argv); + + if (bonobo_init (CORBA_OBJECT_NIL, CORBA_OBJECT_NIL, CORBA_OBJECT_NIL) == FALSE){ e_notice (NULL, GNOME_MESSAGE_BOX_ERROR, _("Mail Component: I could not initialize Bonobo")); exit (1); } - - CORBA_exception_free (&ev); } int diff --git a/mail/test-mail.c b/mail/test-mail.c index 94102da1d3..4d6707c711 100644 --- a/mail/test-mail.c +++ b/mail/test-mail.c @@ -6,10 +6,41 @@ * * (C) 2000 Helix Code, Inc. */ + +#include + #include #include + +#ifdef USING_OAF + +#include + +static void +init_corba (int *argc, char *argv[]) +{ + gnome_init ("sample-control-container", "1.0", *argc, argv); + oaf_init (*argc, argv); +} + +#else /* USING_OAF */ + #include +static void +init_corba (int *argc, char *argv []) +{ + CORBA_Environment ev; + + CORBA_exception_init (&ev); + + gnome_CORBA_init ("sample-control-container", "1.0", argc, argv, 0, &ev); + + CORBA_exception_free (&ev); +} + +#endif /* USING_OAF */ + static guint create_container (void) { @@ -46,21 +77,10 @@ create_container (void) int main (int argc, char *argv []) { - CORBA_Environment ev; - CORBA_ORB orb; - - CORBA_exception_init (&ev); - - gnome_CORBA_init ("sample-control-container", "1.0", &argc, argv, 0, &ev); - - CORBA_exception_free (&ev); + init_corba (&argc, argv); - orb = gnome_CORBA_ORB (); - - if (bonobo_init (orb, NULL, NULL) == FALSE) + if (bonobo_init (CORBA_OBJECT_NIL, CORBA_OBJECT_NIL, CORBA_OBJECT_NIL) == FALSE) g_error ("Could not initialize Bonobo\n"); - - gtk_idle_add ((GtkFunction) create_container, NULL); diff --git a/shell/ChangeLog b/shell/ChangeLog index 8f4a622cc5..d680b9eb22 100644 --- a/shell/ChangeLog +++ b/shell/ChangeLog @@ -1,3 +1,16 @@ +2000-04-27 Ettore Perazzoli + + * e-shell-view.c: OAFized. + (get_view): If `bonobo_widget_new_control()' fails for the + calendar, don't try to get the property bag and stuff and thus + prevent a segfault. + + * main.c + (corba_init): Removed Bonobo initialization. Implemented OAF + version for the case in which `USING_OAF' is #defined. + (init_bonob): New function. + (main): Call `init_bonobo()'. + 2000-04-26 Matt Loper * e-shell-view.c (bonobo_widget_is_dead): Helper function to see diff --git a/shell/e-shell-view.c b/shell/e-shell-view.c index 838bc6ccb8..b6d74276e5 100644 --- a/shell/e-shell-view.c +++ b/shell/e-shell-view.c @@ -21,12 +21,25 @@ #include #include +#ifdef USING_OAF + +# define MAIL_CONTROL_ID "OAFIID:control:evolution-mail:833d5a71-a201-4a0e-b7e6-5475c5c4cb45" +# define ADDRESSBOOK_CONTROL_ID "OAFIID:control:addressbook:851f883b-2fe7-4c94-a1e3-a1f2a7a03c49" +# define CALENDAR_CONTROL_ID "OAFIID:control:calendar:dd34ddae-25c6-486b-a8a8-3e8f0286b54c" + +#else + +# define MAIL_CONTROL_ID "control:evolution-mail" +# define ADDRESSBOOK_CONTROL_ID "control:addressbook" +# define CALENDAR_CONTROL_ID "control:calendar" + +#endif + #define PARENT_TYPE gnome_app_get_type () static GtkObjectClass *parent_class; -struct _EShellViewPrivate -{ +struct _EShellViewPrivate { /* a hashtable of e-folders -> widgets */ GHashTable *folder_views; GtkWidget *notebook; @@ -150,11 +163,11 @@ get_view (EShellView *eshell_view, EFolder *efolder, Bonobo_UIHandler uih) switch (e_folder_type) { case E_FOLDER_MAIL : - w = bonobo_widget_new_control ("control:evolution-mail", uih); + w = bonobo_widget_new_control (MAIL_CONTROL_ID, uih); break; case E_FOLDER_CONTACTS : - w = bonobo_widget_new_control ("control:addressbook", uih); + w = bonobo_widget_new_control (ADDRESSBOOK_CONTROL_ID, uih); break; case E_FOLDER_CALENDAR : { @@ -162,7 +175,7 @@ get_view (EShellView *eshell_view, EFolder *efolder, Bonobo_UIHandler uih) BonoboPropertyBagClient *pbc; BonoboControlFrame *cf; - w = bonobo_widget_new_control ("control:calendar", uih); + w = bonobo_widget_new_control (CALENDAR_CONTROL_ID, uih); if (w) { cf = bonobo_widget_get_control_frame (BONOBO_WIDGET (w)); @@ -191,8 +204,7 @@ get_view (EShellView *eshell_view, EFolder *efolder, Bonobo_UIHandler uih) return NULL; } - if (w) - { + if (w) { Evolution_ServiceRepository corba_sr; BonoboObjectClient *server = bonobo_widget_get_server (BONOBO_WIDGET (w)); @@ -347,8 +359,10 @@ e_shell_view_set_view (EShellView *eshell_view, EFolder *efolder) int new_page_index; folder_view = get_view (eshell_view, efolder, uih); - if (!folder_view) + if (!folder_view) { + /* FIXME: Report failure. */ return; + } gtk_notebook_append_page (notebook, folder_view, NULL); new_page_index = gtk_notebook_page_num (notebook, diff --git a/shell/main.c b/shell/main.c index d03c925b44..9fa59a6ee0 100644 --- a/shell/main.c +++ b/shell/main.c @@ -5,15 +5,23 @@ * Miguel de Icaza (miguel@helixcode.com) * */ + #include + #include -#include #include #include #include #include /* for e_setup_base_dir */ #include #include + +#ifdef USING_OAF +#include +#else +#include +#endif + #include "e-shell.h" #include "e-shell-view.h" @@ -29,6 +37,21 @@ const struct poptOption shell_popt_options [] = { { NULL, '\0', 0, NULL, 0 } }; +#ifdef USING_OAF + +static void +corba_init (int *argc, char *argv []) +{ + gnomelib_register_popt_table (shell_popt_options, "Evolution shell options"); + + gnome_init_with_popt_table ("Evolution", VERSION, *argc, argv, + oaf_popt_options, 0, NULL); + + oaf_init (*argc, argv); +} + +#else /* USING_OAF */ + static void corba_init (int *argc, char *argv []) { @@ -39,8 +62,14 @@ corba_init (int *argc, char *argv []) "Evolution", VERSION, argc, argv, shell_popt_options, 0, &ctx, GNORBA_INIT_SERVER_FUNC, &ev); CORBA_exception_free (&ev); - - if (bonobo_init (gnome_CORBA_ORB (), NULL, NULL) == FALSE){ +} + +#endif /* USING_OAF */ + +static void +init_bonobo (void) +{ + if (bonobo_init (CORBA_OBJECT_NIL, CORBA_OBJECT_NIL, CORBA_OBJECT_NIL) == FALSE){ e_notice (NULL, GNOME_MESSAGE_BOX_ERROR, _("Failed to initialize the Bonobo component system")); exit (1); @@ -96,6 +125,8 @@ main (int argc, char *argv []) textdomain (PACKAGE); corba_init (&argc, argv); + init_bonobo (); + gui_init (); evolution_boot (); diff --git a/wombat/ChangeLog b/wombat/ChangeLog index 704b27d1b6..150aa26e46 100644 --- a/wombat/ChangeLog +++ b/wombat/ChangeLog @@ -1,3 +1,14 @@ +2000-04-27 Ettore Perazzoli + + * wombat.c + (register_pcs): New function for registering into the name + service. Varies according on whether we are `USING_OAF' or not. + (init_corba): New function for initializing the CORBA stuff. + Implementation depends on `USING_OAF'. + (init_bonobo): Use `init_corba'. + + * Makefile.am: Updated for OAF. + 2000-04-25 Federico Mena Quintero * wombat.c (cal_factory pas_book_factory): New module-wide diff --git a/wombat/GNOME_Evolution_Wombat.oaf.in b/wombat/GNOME_Evolution_Wombat.oaf.in new file mode 100644 index 0000000000..1109cc0df6 --- /dev/null +++ b/wombat/GNOME_Evolution_Wombat.oaf.in @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/wombat/GNOME_Evolution_Wombat.oafinfo b/wombat/GNOME_Evolution_Wombat.oafinfo new file mode 100644 index 0000000000..1109cc0df6 --- /dev/null +++ b/wombat/GNOME_Evolution_Wombat.oafinfo @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/wombat/Makefile.am b/wombat/Makefile.am index 0c690991f6..94118eef9c 100644 --- a/wombat/Makefile.am +++ b/wombat/Makefile.am @@ -31,5 +31,14 @@ wombat_LDADD = \ wombat_LDFLAGS = `gnome-config --libs gnorba` +if USING_OAF +oafdir = $(datadir)/oaf +oaf_DATA = wombat.oafinfo +else gnorbadir = $(sysconfdir)/CORBA/servers gnorba_DATA = wombat.gnorba +endif + +EXTRA_DIST = \ + wombat.gnorba \ + wombat.oafinfo diff --git a/wombat/wombat.c b/wombat/wombat.c index 6ced8d2682..43ee72d886 100644 --- a/wombat/wombat.c +++ b/wombat/wombat.c @@ -9,16 +9,13 @@ #include #include #include +#include + #ifdef HAVE_LDAP #include #endif -#include -#include -#include "calendar/pcs/cal-factory.h" - - -static CORBA_ORB orb; +#include "calendar/pcs/cal-factory.h" /* The and addressbook calendar factories */ @@ -89,24 +86,50 @@ last_calendar_gone_cb (CalFactory *factory, gpointer data) queue_termination (); } -/* Creates the calendar factory object and registers it with GOAD */ -static void -setup_pcs (int argc, char **argv) -{ - CORBA_Object object; - CORBA_Environment ev; - int result; +#ifdef USING_OAF - cal_factory = cal_factory_new (); +/* (For the OAF popt stuff, which otherwise does not get in.) */ +#include - if (!cal_factory) { - g_message ("setup_pcs(): Could not create the calendar factory"); - return; +#include + +static gboolean +register_pcs (CORBA_Object obj) +{ + OAF_RegistrationResult result; + + result = oaf_active_server_register + ("OAFIID:evolution:calendar-factory:1c915858-ece3-4a6f-9d81-ea0f108a9554", + 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; } +} - object = bonobo_object_corba_objref (BONOBO_OBJECT (cal_factory)); +#else /* USING_OAF */ + +#include + +static gboolean +register_pcs (CORBA_Object object) +{ + CORBA_Environment ev; + int result; CORBA_exception_init (&ev); + result = goad_server_register (CORBA_OBJECT_NIL, object, "evolution:calendar-factory", @@ -117,23 +140,47 @@ setup_pcs (int argc, char **argv) if (ev._major != CORBA_NO_EXCEPTION || result == -1) { g_message ("setup_pcs(): could not register the calendar factory"); - bonobo_object_unref (BONOBO_OBJECT (cal_factory)); - cal_factory = NULL; CORBA_exception_free (&ev); - return; - } else if (result == -2) { + return FALSE; + } + + if (result == -2) { g_message ("setup_pcs(): a calendar factory is already registered"); + CORBA_exception_free (&ev); + return FALSE; + } + + CORBA_exception_free (&ev); + return TRUE; +} + +#endif /* USING_OAF */ + +/* Creates the calendar factory object and registers it with GOAD */ +static void +setup_pcs (int argc, char **argv) +{ + CORBA_Object object; + + cal_factory = cal_factory_new (); + + if (!cal_factory) { + g_message ("setup_pcs(): Could not create the calendar factory"); + return; + } + + object = bonobo_object_corba_objref (BONOBO_OBJECT (cal_factory)); + + if (! register_pcs (object)) { bonobo_object_unref (BONOBO_OBJECT (cal_factory)); cal_factory = NULL; - CORBA_exception_free (&ev); return; } - gtk_signal_connect (GTK_OBJECT (cal_factory), "last_calendar_gone", + gtk_signal_connect (GTK_OBJECT (cal_factory), + "last_calendar_gone", GTK_SIGNAL_FUNC (last_calendar_gone_cb), NULL); - - CORBA_exception_free (&ev); } @@ -154,8 +201,20 @@ setup_vfs (int argc, char **argv) +#ifdef USING_OAF + +static void +init_corba (int *argc, char **argv) +{ + gnome_init_with_popt_table ("Personal Addressbook Server", "0.0", + *argc, argv, oaf_popt_options, 0, NULL); + oaf_init (*argc, argv); +} + +#else + static void -init_bonobo (int argc, char **argv) +init_corba (int *argc, char **argv) { CORBA_Environment ev; @@ -163,7 +222,7 @@ init_bonobo (int argc, char **argv) gnome_CORBA_init_with_popt_table ( "Personal Addressbook Server", "0.0", - &argc, argv, NULL, 0, NULL, GNORBA_INIT_SERVER_FUNC, &ev); + argc, argv, NULL, 0, NULL, GNORBA_INIT_SERVER_FUNC, &ev); if (ev._major != CORBA_NO_EXCEPTION) { g_message ("init_bonobo(): could not initialize GOAD"); @@ -172,10 +231,16 @@ init_bonobo (int argc, char **argv) } CORBA_exception_free (&ev); +} - orb = gnome_CORBA_ORB (); +#endif + +static void +init_bonobo (int *argc, char **argv) +{ + init_corba (argc, argv); - if (!bonobo_init (orb, NULL, NULL)) { + if (!bonobo_init (CORBA_OBJECT_NIL, CORBA_OBJECT_NIL, CORBA_OBJECT_NIL)) { g_message ("init_bonobo(): could not initialize Bonobo"); exit (EXIT_FAILURE); } @@ -184,7 +249,7 @@ init_bonobo (int argc, char **argv) int main (int argc, char **argv) { - init_bonobo (argc, argv); + init_bonobo (&argc, argv); setup_vfs (argc, argv); setup_pas (argc, argv); diff --git a/wombat/wombat.oafinfo b/wombat/wombat.oafinfo new file mode 100644 index 0000000000..1109cc0df6 --- /dev/null +++ b/wombat/wombat.oafinfo @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + + + + + + + + + + -- cgit v1.2.3