diff options
Diffstat (limited to 'addressbook')
-rw-r--r-- | addressbook/ChangeLog | 33 | ||||
-rw-r--r-- | addressbook/backend/ebook/Makefile.am | 18 | ||||
-rw-r--r-- | addressbook/backend/ebook/e-book-view.c | 2 | ||||
-rw-r--r-- | addressbook/backend/ebook/e-book.c | 14 | ||||
-rw-r--r-- | addressbook/backend/ebook/test-client-list.c | 17 | ||||
-rw-r--r-- | addressbook/backend/ebook/test-client.c | 32 | ||||
-rw-r--r-- | addressbook/backend/pas/pas-book-factory.c | 86 | ||||
-rw-r--r-- | addressbook/ename/Makefile.am | 8 | ||||
-rw-r--r-- | addressbook/gui/component/GNOME_Evolution_Addressbook.oaf.in | 30 | ||||
-rw-r--r-- | addressbook/gui/component/GNOME_Evolution_Addressbook.oafinfo | 30 | ||||
-rw-r--r-- | addressbook/gui/component/Makefile.am | 9 | ||||
-rw-r--r-- | addressbook/gui/component/addressbook-factory.c | 39 | ||||
-rw-r--r-- | addressbook/gui/component/addressbook.c | 14 | ||||
-rw-r--r-- | addressbook/gui/component/addressbook.oafinfo | 30 |
14 files changed, 291 insertions, 71 deletions
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 <ettore@helixcode.com> + + * 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 <clahey@helixcode.com> * 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 <config.h> -#include <libgnorba/gnorba.h> #include <gtk/gtksignal.h> #include <gtk/gtkmarshal.h> + #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 <config.h> -#include <libgnorba/gnorba.h> #include <gtk/gtksignal.h> #include <gtk/gtkmarshal.h> + #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 <liboaf/liboaf.h> +#define CARDSERVER_OAF_ID "OAFIID:evolution:addressbook-server:0fbc844d-c721-4615-98d0-d67eacf42d80" +#else +#include <libgnorba/gnorba.h> #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 <config.h> #include <bonobo.h> #include <gnome.h> + +#ifdef USING_OAF +#include <liboaf/liboaf.h> +#else #include <libgnorba/gnorba.h> +#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 <config.h> #include <bonobo.h> #include <gnome.h> -#include <libgnorba/gnorba.h> #include <e-book.h> @@ -31,22 +30,39 @@ " static CORBA_Environment ev; -static CORBA_ORB orb; static char *cardstr; +#ifdef USING_OAF + +#include <liboaf/liboaf.h> + 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 <libgnorba/gnorba.h> +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 <config.h> #include <ctype.h> -#include <libgnorba/gnorba.h> + #include "addressbook.h" #include "pas-book-factory.h" +#ifdef USING_OAF +#include <liboaf/liboaf.h> +#define PAS_BOOK_FACTORY_OAF_ID "OAFIID:evolution:addressbook-server:0fbc844d-c721-4615-98d0-d67eacf42d80" +#else +#include <libgnorba/gnorba.h> #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 @@ +<oaf_info> + +<oaf_server iid="OAFIID:control-factory:addressbook:3e10597b-0591-4d45-b082-d781b7aa6e17" + type="exe" + location="evolution-addressbook"> + + <oaf_attribute name="repo_ids" type="stringv"> + <item value="IDL:GNOME/GenericFactory:1.0"/> + </oaf_attribute> + + <oaf_attribute name="description" type="string" + value="Factory for the sample Addressbook control"/> + +</oaf_server> + +<oaf_server iid="OAFIID:control:addressbook:851f883b-2fe7-4c94-a1e3-a1f2a7a03c49" + type="factory" + location="OAFIID:control-factory:addressbook:3e10597b-0591-4d45-b082-d781b7aa6e17"> + + <oaf_attribute name="repo_ids" type="stringv"> + <item value="IDL:BonoboControl/addressbook-control:1.0"/> + <item value="IDL:GNOME/Control:1.0"/> + </oaf_attribute> + + <oaf_attribute name="description" type="string" + value="A sample Bonobo control which displays an addressbook."/> + +</oaf_server> + +</oaf_info> 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 @@ +<oaf_info> + +<oaf_server iid="OAFIID:control-factory:addressbook:3e10597b-0591-4d45-b082-d781b7aa6e17" + type="exe" + location="evolution-addressbook"> + + <oaf_attribute name="repo_ids" type="stringv"> + <item value="IDL:GNOME/GenericFactory:1.0"/> + </oaf_attribute> + + <oaf_attribute name="description" type="string" + value="Factory for the sample Addressbook control"/> + +</oaf_server> + +<oaf_server iid="OAFIID:control:addressbook:851f883b-2fe7-4c94-a1e3-a1f2a7a03c49" + type="factory" + location="OAFIID:control-factory:addressbook:3e10597b-0591-4d45-b082-d781b7aa6e17"> + + <oaf_attribute name="repo_ids" type="stringv"> + <item value="IDL:BonoboControl/addressbook-control:1.0"/> + <item value="IDL:GNOME/Control:1.0"/> + </oaf_attribute> + + <oaf_attribute name="description" type="string" + value="A sample Bonobo control which displays an addressbook."/> + +</oaf_server> + +</oaf_info> 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 <config.h> #include <gnome.h> -#include <libgnorba/gnorba.h> #include <bonobo.h> #include <glade/glade.h> + #include "addressbook.h" -CORBA_Environment ev; -CORBA_ORB orb; +#ifdef USING_OAF + +#include <liboaf/liboaf.h> 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 <libgnorba/gnorba.h> + +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 <config.h> + #include <gnome.h> #include <libgnorba/gnorba.h> #include <bonobo.h> @@ -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 @@ +<oaf_info> + +<oaf_server iid="OAFIID:control-factory:addressbook:3e10597b-0591-4d45-b082-d781b7aa6e17" + type="exe" + location="evolution-addressbook"> + + <oaf_attribute name="repo_ids" type="stringv"> + <item value="IDL:GNOME/GenericFactory:1.0"/> + </oaf_attribute> + + <oaf_attribute name="description" type="string" + value="Factory for the sample Addressbook control"/> + +</oaf_server> + +<oaf_server iid="OAFIID:control:addressbook:851f883b-2fe7-4c94-a1e3-a1f2a7a03c49" + type="factory" + location="OAFIID:control-factory:addressbook:3e10597b-0591-4d45-b082-d781b7aa6e17"> + + <oaf_attribute name="repo_ids" type="stringv"> + <item value="IDL:BonoboControl/addressbook-control:1.0"/> + <item value="IDL:GNOME/Control:1.0"/> + </oaf_attribute> + + <oaf_attribute name="description" type="string" + value="A sample Bonobo control which displays an addressbook."/> + +</oaf_server> + +</oaf_info> |