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 --- 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 +- 11 files changed, 231 insertions(+), 25 deletions(-) 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 (limited to 'calendar') 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 -- cgit