aboutsummaryrefslogtreecommitdiffstats
path: root/addressbook/backend/pas
diff options
context:
space:
mode:
authorEttore Perazzoli <ettore@src.gnome.org>2000-04-28 12:23:19 +0800
committerEttore Perazzoli <ettore@src.gnome.org>2000-04-28 12:23:19 +0800
commit9483369aa04a5d2c4dc5c0034a3e4431153d9c99 (patch)
treeb52233be1d2618e4af4a919800422774133b4998 /addressbook/backend/pas
parent02ed4a60f394f53de32b10459c959ad6a1f7b887 (diff)
downloadgsoc2013-evolution-9483369aa04a5d2c4dc5c0034a3e4431153d9c99.tar
gsoc2013-evolution-9483369aa04a5d2c4dc5c0034a3e4431153d9c99.tar.gz
gsoc2013-evolution-9483369aa04a5d2c4dc5c0034a3e4431153d9c99.tar.bz2
gsoc2013-evolution-9483369aa04a5d2c4dc5c0034a3e4431153d9c99.tar.lz
gsoc2013-evolution-9483369aa04a5d2c4dc5c0034a3e4431153d9c99.tar.xz
gsoc2013-evolution-9483369aa04a5d2c4dc5c0034a3e4431153d9c99.tar.zst
gsoc2013-evolution-9483369aa04a5d2c4dc5c0034a3e4431153d9c99.zip
Made Evolution OAF-compatible.
svn path=/trunk/; revision=2673
Diffstat (limited to 'addressbook/backend/pas')
-rw-r--r--addressbook/backend/pas/pas-book-factory.c86
1 files changed, 61 insertions, 25 deletions
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)