diff options
author | Chris Toshok <toshok@ximian.com> | 2002-11-05 20:16:52 +0800 |
---|---|---|
committer | Chris Toshok <toshok@src.gnome.org> | 2002-11-05 20:16:52 +0800 |
commit | 3a40fbaf60d50b477999335406df0d7bcf0ca84c (patch) | |
tree | ab059a8c48f355a8fd31633b9189300ab6217186 /addressbook/backend/pas | |
parent | bca61092c2a89aa993abd6302b5c372df099e361 (diff) | |
download | gsoc2013-evolution-3a40fbaf60d50b477999335406df0d7bcf0ca84c.tar gsoc2013-evolution-3a40fbaf60d50b477999335406df0d7bcf0ca84c.tar.gz gsoc2013-evolution-3a40fbaf60d50b477999335406df0d7bcf0ca84c.tar.bz2 gsoc2013-evolution-3a40fbaf60d50b477999335406df0d7bcf0ca84c.tar.lz gsoc2013-evolution-3a40fbaf60d50b477999335406df0d7bcf0ca84c.tar.xz gsoc2013-evolution-3a40fbaf60d50b477999335406df0d7bcf0ca84c.tar.zst gsoc2013-evolution-3a40fbaf60d50b477999335406df0d7bcf0ca84c.zip |
g_date_* => g_date_get_*, fixes G_DISABLE_DEPRECATED build.
2002-11-05 Chris Toshok <toshok@ximian.com>
* backend/ebook/e-card.c: g_date_* => g_date_get_*, fixes
G_DISABLE_DEPRECATED build.
* backend/ebook/e-book-listener.[ch]: remove the servant crap i'd
c&p'ed and put in here.
* backend/ebook/e-book-view-listener.[ch]: remove the servant crap
i'd c&p'ed and put in here.
* backend/pas/pas-book-factory.[ch]: subclass from BonoboObject,
and remove the servant crap from here too. whee.
* backend/pas/pas-card-cursor.[ch]: remove the servant crap i'd
c&p'ed and put in here.
* backend/pas/pas-book.[ch]: remove the servant crap i'd c&p'ed
and put in here.
* backend/pas/pas-book-view.[ch]: remove the servant crap i'd
c&p'ed and put in here.
svn path=/trunk/; revision=18548
Diffstat (limited to 'addressbook/backend/pas')
-rw-r--r-- | addressbook/backend/pas/pas-book-factory.c | 153 | ||||
-rw-r--r-- | addressbook/backend/pas/pas-book-factory.h | 17 | ||||
-rw-r--r-- | addressbook/backend/pas/pas-book-view.c | 91 | ||||
-rw-r--r-- | addressbook/backend/pas/pas-book-view.h | 12 | ||||
-rw-r--r-- | addressbook/backend/pas/pas-book.c | 137 | ||||
-rw-r--r-- | addressbook/backend/pas/pas-book.h | 12 | ||||
-rw-r--r-- | addressbook/backend/pas/pas-card-cursor.c | 122 | ||||
-rw-r--r-- | addressbook/backend/pas/pas-card-cursor.h | 12 |
8 files changed, 66 insertions, 490 deletions
diff --git a/addressbook/backend/pas/pas-book-factory.c b/addressbook/backend/pas/pas-book-factory.c index 3bca69cf59..dd80c470db 100644 --- a/addressbook/backend/pas/pas-book-factory.c +++ b/addressbook/backend/pas/pas-book-factory.c @@ -19,7 +19,6 @@ #define DEFAULT_PAS_BOOK_FACTORY_OAF_ID "OAFIID:GNOME_Evolution_Wombat_ServerFactory" static BonoboObjectClass *pas_book_factory_parent_class; -POA_GNOME_Evolution_Addressbook_BookFactory__vepv pas_book_factory_vepv; typedef struct { char *uri; @@ -27,9 +26,6 @@ typedef struct { } PASBookFactoryQueuedRequest; struct _PASBookFactoryPrivate { - PASBookFactoryServant *servant; - GNOME_Evolution_Addressbook_BookFactory corba_objref; - gint idle_id; GHashTable *backends; GHashTable *active_server_map; @@ -388,22 +384,13 @@ pas_book_factory_queue_request (PASBookFactory *factory, } } -static PASBookFactory * -factory_from_servant (PortableServer_Servant servant) -{ - PASBookFactoryServant *my_servant; - - my_servant = (PASBookFactoryServant *) servant; - return my_servant->object; -} - static void impl_GNOME_Evolution_Addressbook_BookFactory_openBook (PortableServer_Servant servant, const CORBA_char *uri, const GNOME_Evolution_Addressbook_BookListener listener, CORBA_Environment *ev) { - PASBookFactory *factory = factory_from_servant (servant); + PASBookFactory *factory = PAS_BOOK_FACTORY (bonobo_object (servant)); PASBackendFactoryFn backend_factory; backend_factory = pas_book_factory_lookup_backend_factory (factory, uri); @@ -421,71 +408,10 @@ impl_GNOME_Evolution_Addressbook_BookFactory_openBook (PortableServer_Servant pas_book_factory_queue_request (factory, uri, listener); } -void -pas_book_factory_construct (PASBookFactory *factory, - GNOME_Evolution_Addressbook_BookListener corba_objref) -{ - PASBookFactoryPrivate *priv; - - g_return_if_fail (factory != NULL); - g_return_if_fail (corba_objref != CORBA_OBJECT_NIL); - - priv = factory->priv; - - g_return_if_fail (priv->corba_objref == CORBA_OBJECT_NIL); - - priv->corba_objref = corba_objref; -} - - -static PASBookFactoryServant * -create_servant (PASBookFactory *factory) +static void +pas_book_factory_construct (PASBookFactory *factory) { - PASBookFactoryServant *servant; - POA_GNOME_Evolution_Addressbook_BookFactory *corba_servant; - CORBA_Environment ev; - - CORBA_exception_init (&ev); - - servant = g_new0 (PASBookFactoryServant, 1); - corba_servant = (POA_GNOME_Evolution_Addressbook_BookFactory *) servant; - - corba_servant->vepv = &pas_book_factory_vepv; - POA_GNOME_Evolution_Addressbook_BookFactory__init ((PortableServer_Servant) corba_servant, &ev); - if (ev._major != CORBA_NO_EXCEPTION) { - g_free (servant); - CORBA_exception_free (&ev); - return NULL; - } - - servant->object = factory; - - CORBA_exception_free (&ev); - - return servant; -} - -static GNOME_Evolution_Addressbook_BookFactory -activate_servant (PASBookFactory *factory, - POA_GNOME_Evolution_Addressbook_BookFactory *servant) -{ - GNOME_Evolution_Addressbook_BookFactory corba_object; - CORBA_Environment ev; - - CORBA_exception_init (&ev); - - CORBA_free (PortableServer_POA_activate_object (bonobo_poa (), servant, &ev)); - - corba_object = PortableServer_POA_servant_to_reference (bonobo_poa(), servant, &ev); - - if (ev._major == CORBA_NO_EXCEPTION && ! CORBA_Object_is_nil (corba_object, &ev)) { - CORBA_exception_free (&ev); - return corba_object; - } - - CORBA_exception_free (&ev); - - return CORBA_OBJECT_NIL; + /* nothing to do here.. */ } /** @@ -495,16 +421,10 @@ PASBookFactory * pas_book_factory_new (void) { PASBookFactory *factory; - PASBookFactoryPrivate *priv; - GNOME_Evolution_Addressbook_BookFactory corba_objref; factory = g_object_new (PAS_TYPE_BOOK_FACTORY, NULL); - priv = factory->priv; - - priv->servant = create_servant (factory); - corba_objref = activate_servant (factory, (POA_GNOME_Evolution_Addressbook_BookFactory*)priv->servant); - pas_book_factory_construct (factory, corba_objref); + pas_book_factory_construct (factory); return factory; } @@ -533,7 +453,7 @@ pas_book_factory_activate (PASBookFactory *factory, const char *iid) else tmp_iid = g_strdup (DEFAULT_PAS_BOOK_FACTORY_OAF_ID); - result = bonobo_activation_active_server_register (tmp_iid, priv->corba_objref); + result = bonobo_activation_active_server_register (tmp_iid, bonobo_object_corba_objref (BONOBO_OBJECT (factory))); switch (result) { case Bonobo_ACTIVATION_REG_SUCCESS: @@ -625,7 +545,7 @@ pas_book_factory_dispose (GObject *object) priv->backends = NULL; if (priv->registered) { - bonobo_activation_active_server_unregister (priv->iid, priv->corba_objref); + bonobo_activation_active_server_unregister (priv->iid, bonobo_object_corba_objref (BONOBO_OBJECT (factory))); priv->registered = FALSE; } @@ -637,33 +557,12 @@ pas_book_factory_dispose (GObject *object) } static void -corba_class_init (void) -{ - POA_GNOME_Evolution_Addressbook_BookFactory__vepv *vepv; - POA_GNOME_Evolution_Addressbook_BookFactory__epv *epv; - PortableServer_ServantBase__epv *base_epv; - - base_epv = g_new0 (PortableServer_ServantBase__epv, 1); - base_epv->_private = NULL; - base_epv->finalize = NULL; - base_epv->default_POA = NULL; - - - epv = g_new0 (POA_GNOME_Evolution_Addressbook_BookFactory__epv, 1); - - epv->openBook = impl_GNOME_Evolution_Addressbook_BookFactory_openBook; - - vepv = &pas_book_factory_vepv; - vepv->_base_epv = base_epv; - vepv->GNOME_Evolution_Addressbook_BookFactory_epv = epv; -} - -static void pas_book_factory_class_init (PASBookFactoryClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); + POA_GNOME_Evolution_Addressbook_BookFactory__epv *epv; - pas_book_factory_parent_class = g_type_class_ref (G_TYPE_OBJECT); + pas_book_factory_parent_class = g_type_class_ref (BONOBO_TYPE_OBJECT); object_class->dispose = pas_book_factory_dispose; @@ -676,32 +575,14 @@ pas_book_factory_class_init (PASBookFactoryClass *klass) pas_marshal_NONE__NONE, G_TYPE_NONE, 0); - corba_class_init (); -} -/** - * pas_book_factory_get_type: - */ -GType -pas_book_factory_get_type (void) -{ - static GType type = 0; - - if (! type) { - GTypeInfo info = { - sizeof (PASBookFactoryClass), - NULL, /* base_class_init */ - NULL, /* base_class_finalize */ - (GClassInitFunc) pas_book_factory_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (PASBookFactory), - 0, /* n_preallocs */ - (GInstanceInitFunc) pas_book_factory_init - }; - - type = g_type_register_static (G_TYPE_OBJECT, "PASBookFactory", &info, 0); - } + epv = &klass->epv; - return type; + epv->openBook = impl_GNOME_Evolution_Addressbook_BookFactory_openBook; } + +BONOBO_TYPE_FUNC_FULL ( + PASBookFactory, + GNOME_Evolution_Addressbook_BookFactory, + BONOBO_TYPE_OBJECT, + pas_book_factory); diff --git a/addressbook/backend/pas/pas-book-factory.h b/addressbook/backend/pas/pas-book-factory.h index fd8683907c..9d099a6f2c 100644 --- a/addressbook/backend/pas/pas-book-factory.h +++ b/addressbook/backend/pas/pas-book-factory.h @@ -20,30 +20,21 @@ G_BEGIN_DECLS typedef struct _PASBookFactoryPrivate PASBookFactoryPrivate; typedef struct { - GObject parent_object; + BonoboObject parent_object; PASBookFactoryPrivate *priv; } PASBookFactory; typedef struct { - GObjectClass parent_class; + BonoboObjectClass parent_class; + + POA_GNOME_Evolution_Addressbook_BookFactory__epv epv; /* Notification signals */ void (* last_book_gone) (PASBookFactory *factory); } PASBookFactoryClass; - -struct _PASBookFactoryServant { - POA_GNOME_Evolution_Addressbook_BookFactory servant_placeholder; - PASBookFactory *object; -}; -typedef struct _PASBookFactoryServant PASBookFactoryServant; - - - PASBookFactory *pas_book_factory_new (void); -void pas_book_factory_construct (PASBookFactory *factory, - GNOME_Evolution_Addressbook_BookListener corba_objref); void pas_book_factory_register_backend (PASBookFactory *factory, const char *proto, diff --git a/addressbook/backend/pas/pas-book-view.c b/addressbook/backend/pas/pas-book-view.c index 19458d29a3..392291726f 100644 --- a/addressbook/backend/pas/pas-book-view.c +++ b/addressbook/backend/pas/pas-book-view.c @@ -11,12 +11,8 @@ #include "pas-book-view.h" static BonoboObjectClass *pas_book_view_parent_class; -POA_GNOME_Evolution_Addressbook_BookView__vepv pas_book_view_vepv; struct _PASBookViewPrivate { - PASBookViewServant *servant; - GNOME_Evolution_Addressbook_BookView corba_objref; - GNOME_Evolution_Addressbook_BookViewListener listener; }; @@ -165,24 +161,18 @@ pas_book_view_notify_status_message (PASBookView *book_view, CORBA_exception_free (&ev); } -void +static void pas_book_view_construct (PASBookView *book_view, - GNOME_Evolution_Addressbook_BookView corba_objref, GNOME_Evolution_Addressbook_BookViewListener listener) { PASBookViewPrivate *priv; CORBA_Environment ev; g_return_if_fail (book_view != NULL); - g_return_if_fail (corba_objref != CORBA_OBJECT_NIL); g_return_if_fail (listener != CORBA_OBJECT_NIL); priv = book_view->priv; - g_return_if_fail (priv->corba_objref == CORBA_OBJECT_NIL); - - priv->corba_objref = corba_objref; - CORBA_exception_init (&ev); bonobo_object_dup_ref (listener, &ev); @@ -197,56 +187,6 @@ pas_book_view_construct (PASBookView *book_view, priv->listener = listener; } -static PASBookViewServant * -create_servant (PASBookView *factory) -{ - PASBookViewServant *servant; - POA_GNOME_Evolution_Addressbook_BookView *corba_servant; - CORBA_Environment ev; - - CORBA_exception_init (&ev); - - servant = g_new0 (PASBookViewServant, 1); - corba_servant = (POA_GNOME_Evolution_Addressbook_BookView *) servant; - - corba_servant->vepv = &pas_book_view_vepv; - POA_GNOME_Evolution_Addressbook_BookView__init ((PortableServer_Servant) corba_servant, &ev); - if (ev._major != CORBA_NO_EXCEPTION) { - g_free (servant); - CORBA_exception_free (&ev); - return NULL; - } - - servant->object = factory; - - CORBA_exception_free (&ev); - - return servant; -} - -static GNOME_Evolution_Addressbook_BookView -activate_servant (PASBookView *factory, - POA_GNOME_Evolution_Addressbook_BookView *servant) -{ - GNOME_Evolution_Addressbook_BookView corba_object; - CORBA_Environment ev; - - CORBA_exception_init (&ev); - - CORBA_free (PortableServer_POA_activate_object (bonobo_poa (), servant, &ev)); - - corba_object = PortableServer_POA_servant_to_reference (bonobo_poa(), servant, &ev); - - if (ev._major == CORBA_NO_EXCEPTION && ! CORBA_Object_is_nil (corba_object, &ev)) { - CORBA_exception_free (&ev); - return corba_object; - } - - CORBA_exception_free (&ev); - - return CORBA_OBJECT_NIL; -} - /** * pas_book_view_new: */ @@ -254,16 +194,11 @@ PASBookView * pas_book_view_new (GNOME_Evolution_Addressbook_BookViewListener listener) { PASBookView *book_view; - PASBookViewPrivate *priv; GNOME_Evolution_Addressbook_BookView corba_objref; book_view = g_object_new (PAS_TYPE_BOOK_VIEW, NULL); - priv = book_view->priv; - - priv->servant = create_servant (book_view); - corba_objref = activate_servant (book_view, (POA_GNOME_Evolution_Addressbook_BookView*)priv->servant); - pas_book_view_construct (book_view, corba_objref, listener); + pas_book_view_construct (book_view, listener); return book_view; } @@ -289,26 +224,6 @@ pas_book_view_dispose (GObject *object) } static void -corba_class_init (PASBookViewClass *klass) -{ - POA_GNOME_Evolution_Addressbook_BookView__vepv *vepv; - POA_GNOME_Evolution_Addressbook_BookView__epv *epv; - PortableServer_ServantBase__epv *base_epv; - - base_epv = g_new0 (PortableServer_ServantBase__epv, 1); - base_epv->_private = NULL; - base_epv->finalize = NULL; - base_epv->default_POA = NULL; - - - epv = &klass->epv; - - vepv = &pas_book_view_vepv; - vepv->_base_epv = base_epv; - vepv->GNOME_Evolution_Addressbook_BookView_epv = epv; -} - -static void pas_book_view_class_init (PASBookViewClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); @@ -316,8 +231,6 @@ pas_book_view_class_init (PASBookViewClass *klass) pas_book_view_parent_class = g_object_new (BONOBO_TYPE_OBJECT, NULL); object_class->dispose = pas_book_view_dispose; - - corba_class_init (klass); } static void diff --git a/addressbook/backend/pas/pas-book-view.h b/addressbook/backend/pas/pas-book-view.h index 7948baf1ea..ec6517e394 100644 --- a/addressbook/backend/pas/pas-book-view.h +++ b/addressbook/backend/pas/pas-book-view.h @@ -40,19 +40,7 @@ struct _PASBookViewClass { }; - -struct _PASBookViewServant { - POA_GNOME_Evolution_Addressbook_BookView servant_placeholder; - PASBookView *object; -}; -typedef struct _PASBookViewServant PASBookViewServant; - - - PASBookView *pas_book_view_new (GNOME_Evolution_Addressbook_BookViewListener listener); -void pas_book_view_construct (PASBookView *book_view, - GNOME_Evolution_Addressbook_BookView corba_objref, - GNOME_Evolution_Addressbook_BookViewListener listener); void pas_book_view_notify_change (PASBookView *book_view, const GList *cards); diff --git a/addressbook/backend/pas/pas-book.c b/addressbook/backend/pas/pas-book.c index 2d8f41cf98..f43c73da64 100644 --- a/addressbook/backend/pas/pas-book.c +++ b/addressbook/backend/pas/pas-book.c @@ -22,9 +22,6 @@ enum { static guint pas_book_signals [LAST_SIGNAL]; struct _PASBookPrivate { - PASBookServant *servant; - GNOME_Evolution_Addressbook_Book corba_objref; - PASBackend *backend; GNOME_Evolution_Addressbook_BookListener listener; @@ -245,7 +242,7 @@ impl_GNOME_Evolution_Addressbook_Book_getVCard (PortableServer_Servant servant, const CORBA_char *id, CORBA_Environment *ev) { - PASBook *book = PAS_BOOK (bonobo_object_from_servant (servant)); + PASBook *book = PAS_BOOK (bonobo_object (servant)); pas_book_queue_get_vcard (book, id); } @@ -257,7 +254,7 @@ impl_GNOME_Evolution_Addressbook_Book_authenticateUser (PortableServer_Servant s const char* auth_method, CORBA_Environment *ev) { - PASBook *book = PAS_BOOK (bonobo_object_from_servant (servant)); + PASBook *book = PAS_BOOK (bonobo_object (servant)); pas_book_queue_authenticate_user (book, user, passwd, auth_method); } @@ -267,7 +264,7 @@ impl_GNOME_Evolution_Addressbook_Book_addCard (PortableServer_Servant servant, const CORBA_char *vcard, CORBA_Environment *ev) { - PASBook *book = PAS_BOOK (bonobo_object_from_servant (servant)); + PASBook *book = PAS_BOOK (bonobo_object (servant)); pas_book_queue_create_card (book, (const char *) vcard); } @@ -277,7 +274,7 @@ impl_GNOME_Evolution_Addressbook_Book_removeCard (PortableServer_Servant servant const CORBA_char *id, CORBA_Environment *ev) { - PASBook *book = PAS_BOOK (bonobo_object_from_servant (servant)); + PASBook *book = PAS_BOOK (bonobo_object (servant)); pas_book_queue_remove_card (book, (const char *) id); } @@ -287,7 +284,7 @@ impl_GNOME_Evolution_Addressbook_Book_modifyCard (PortableServer_Servant servant const CORBA_char *vcard, CORBA_Environment *ev) { - PASBook *book = PAS_BOOK (bonobo_object_from_servant (servant)); + PASBook *book = PAS_BOOK (bonobo_object (servant)); pas_book_queue_modify_card (book, (const char *) vcard); } @@ -297,7 +294,7 @@ impl_GNOME_Evolution_Addressbook_Book_getCursor (PortableServer_Servant servant, const CORBA_char *search, CORBA_Environment *ev) { - PASBook *book = PAS_BOOK (bonobo_object_from_servant (servant)); + PASBook *book = PAS_BOOK (bonobo_object (servant)); pas_book_queue_get_cursor (book, search); } @@ -308,7 +305,7 @@ impl_GNOME_Evolution_Addressbook_Book_getBookView (PortableServer_Servant servan const CORBA_char *search, CORBA_Environment *ev) { - PASBook *book = PAS_BOOK (bonobo_object_from_servant (servant)); + PASBook *book = PAS_BOOK (bonobo_object (servant)); pas_book_queue_get_book_view (book, listener, search); } @@ -320,7 +317,7 @@ impl_GNOME_Evolution_Addressbook_Book_getCompletionView (PortableServer_Servant const CORBA_char *search, CORBA_Environment *ev) { - PASBook *book = PAS_BOOK (bonobo_object_from_servant (servant)); + PASBook *book = PAS_BOOK (bonobo_object (servant)); pas_book_queue_get_completion_view (book, listener, search); } @@ -331,7 +328,7 @@ impl_GNOME_Evolution_Addressbook_Book_getChanges (PortableServer_Servant servant const CORBA_char *change_id, CORBA_Environment *ev) { - PASBook *book = PAS_BOOK (bonobo_object_from_servant (servant)); + PASBook *book = PAS_BOOK (bonobo_object (servant)); pas_book_queue_get_changes (book, listener, change_id); } @@ -340,7 +337,7 @@ static void impl_GNOME_Evolution_Addressbook_Book_checkConnection (PortableServer_Servant servant, CORBA_Environment *ev) { - PASBook *book = PAS_BOOK (bonobo_object_from_servant (servant)); + PASBook *book = PAS_BOOK (bonobo_object (servant)); pas_book_queue_check_connection (book); } @@ -349,7 +346,7 @@ static char * impl_GNOME_Evolution_Addressbook_Book_getStaticCapabilities (PortableServer_Servant servant, CORBA_Environment *ev) { - PASBook *book = PAS_BOOK (bonobo_object_from_servant (servant)); + PASBook *book = PAS_BOOK (bonobo_object (servant)); char *temp; char *ret_val; @@ -363,7 +360,7 @@ static void impl_GNOME_Evolution_Addressbook_Book_getSupportedFields (PortableServer_Servant servant, CORBA_Environment *ev) { - PASBook *book = PAS_BOOK (bonobo_object_from_servant (servant)); + PASBook *book = PAS_BOOK (bonobo_object (servant)); pas_book_queue_get_supported_fields (book); } @@ -758,9 +755,8 @@ pas_book_report_writable (PASBook *book, CORBA_exception_free (&ev); } -void +static void pas_book_construct (PASBook *book, - GNOME_Evolution_Addressbook_Book corba_objref, PASBackend *backend, GNOME_Evolution_Addressbook_BookListener listener) { @@ -768,13 +764,9 @@ pas_book_construct (PASBook *book, CORBA_Environment ev; g_return_if_fail (book != NULL); - g_return_if_fail (corba_objref != CORBA_OBJECT_NIL); priv = book->priv; - g_return_if_fail (priv->corba_objref == CORBA_OBJECT_NIL); - - priv->corba_objref = corba_objref; priv->backend = backend; CORBA_exception_init (&ev); @@ -791,56 +783,6 @@ pas_book_construct (PASBook *book, priv->listener = listener; } -static PASBookServant * -create_servant (PASBook *book) -{ - PASBookServant *servant; - POA_GNOME_Evolution_Addressbook_Book *corba_servant; - CORBA_Environment ev; - - CORBA_exception_init (&ev); - - servant = g_new0 (PASBookServant, 1); - corba_servant = (POA_GNOME_Evolution_Addressbook_Book *) servant; - - corba_servant->vepv = &pas_book_vepv; - POA_GNOME_Evolution_Addressbook_Book__init ((PortableServer_Servant) corba_servant, &ev); - if (ev._major != CORBA_NO_EXCEPTION) { - g_free (servant); - CORBA_exception_free (&ev); - return NULL; - } - - servant->object = book; - - CORBA_exception_free (&ev); - - return servant; -} - -static GNOME_Evolution_Addressbook_Book -activate_servant (PASBook *book, - POA_GNOME_Evolution_Addressbook_Book *servant) -{ - GNOME_Evolution_Addressbook_Book corba_object; - CORBA_Environment ev; - - CORBA_exception_init (&ev); - - CORBA_free (PortableServer_POA_activate_object (bonobo_poa (), servant, &ev)); - - corba_object = PortableServer_POA_servant_to_reference (bonobo_poa(), servant, &ev); - - if (ev._major == CORBA_NO_EXCEPTION && ! CORBA_Object_is_nil (corba_object, &ev)) { - CORBA_exception_free (&ev); - return corba_object; - } - - CORBA_exception_free (&ev); - - return CORBA_OBJECT_NIL; -} - /** * pas_book_new: */ @@ -849,16 +791,10 @@ pas_book_new (PASBackend *backend, GNOME_Evolution_Addressbook_BookListener listener) { PASBook *book; - PASBookPrivate *priv; - GNOME_Evolution_Addressbook_Book corba_objref; book = g_object_new (PAS_TYPE_BOOK, NULL); - priv = book->priv; - priv->servant = create_servant (book); - corba_objref = activate_servant (book, (POA_GNOME_Evolution_Addressbook_Book*)priv->servant); - - pas_book_construct (book, corba_objref, backend, listener); + pas_book_construct (book, backend, listener); return book; } @@ -966,17 +902,23 @@ pas_book_dispose (GObject *object) } static void -corba_class_init (PASBookClass *klass) +pas_book_class_init (PASBookClass *klass) { - POA_GNOME_Evolution_Addressbook_Book__vepv *vepv; + GObjectClass *object_class = G_OBJECT_CLASS (klass); POA_GNOME_Evolution_Addressbook_Book__epv *epv; - PortableServer_ServantBase__epv *base_epv; - base_epv = g_new0 (PortableServer_ServantBase__epv, 1); - base_epv->_private = NULL; - base_epv->finalize = NULL; - base_epv->default_POA = NULL; + pas_book_parent_class = g_type_class_peek_parent (klass); + + pas_book_signals [REQUESTS_QUEUED] = + g_signal_new ("requests_queued", + G_OBJECT_CLASS_TYPE(object_class), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (PASBookClass, requests_queued), + NULL, NULL, + pas_marshal_NONE__NONE, + G_TYPE_NONE, 0); + object_class->dispose = pas_book_dispose; epv = &klass->epv; @@ -992,31 +934,6 @@ corba_class_init (PASBookClass *klass) epv->getBookView = impl_GNOME_Evolution_Addressbook_Book_getBookView; epv->getCompletionView = impl_GNOME_Evolution_Addressbook_Book_getCompletionView; epv->getChanges = impl_GNOME_Evolution_Addressbook_Book_getChanges; - - vepv = &pas_book_vepv; - vepv->_base_epv = base_epv; - vepv->GNOME_Evolution_Addressbook_Book_epv = epv; -} - -static void -pas_book_class_init (PASBookClass *klass) -{ - GObjectClass *object_class = G_OBJECT_CLASS (klass); - - pas_book_parent_class = g_type_class_peek_parent (klass); - - pas_book_signals [REQUESTS_QUEUED] = - g_signal_new ("requests_queued", - G_OBJECT_CLASS_TYPE(object_class), - G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (PASBookClass, requests_queued), - NULL, NULL, - pas_marshal_NONE__NONE, - G_TYPE_NONE, 0); - - object_class->dispose = pas_book_dispose; - - corba_class_init (klass); } static void diff --git a/addressbook/backend/pas/pas-book.h b/addressbook/backend/pas/pas-book.h index 6f053c85ed..2ed87ff799 100644 --- a/addressbook/backend/pas/pas-book.h +++ b/addressbook/backend/pas/pas-book.h @@ -133,24 +133,12 @@ typedef struct { void (*requests_queued) (void); } PASBookClass; - -struct _PASBookServant { - POA_GNOME_Evolution_Addressbook_Book servant_placeholder; - PASBook *object; -}; -typedef struct _PASBookServant PASBookServant; - - typedef gboolean (*PASBookCanWriteFn) (PASBook *book); typedef gboolean (*PASBookCanWriteCardFn) (PASBook *book, const char *id); PASBook *pas_book_new (PASBackend *backend, GNOME_Evolution_Addressbook_BookListener listener); -void pas_book_construct (PASBook *book, - GNOME_Evolution_Addressbook_Book corba_objref, - PASBackend *backend, - GNOME_Evolution_Addressbook_BookListener listener); PASBackend *pas_book_get_backend (PASBook *book); GNOME_Evolution_Addressbook_BookListener pas_book_get_listener (PASBook *book); int pas_book_check_pending (PASBook *book); diff --git a/addressbook/backend/pas/pas-card-cursor.c b/addressbook/backend/pas/pas-card-cursor.c index 68230eca52..c9e6df4e80 100644 --- a/addressbook/backend/pas/pas-card-cursor.c +++ b/addressbook/backend/pas/pas-card-cursor.c @@ -12,8 +12,6 @@ #include "pas-card-cursor.h" struct _PASCardCursorPrivate { - PASCardCursorServant *servant; - GNOME_Evolution_Addressbook_CardCursor corba_cursor; long (*get_length) (PASCardCursor *cursor, gpointer data); char * (*get_nth) (PASCardCursor *cursor, long n, gpointer data); gpointer data; @@ -25,11 +23,6 @@ struct _PASCardCursorPrivate { static BonoboObjectClass *parent_class; /* - * The VEPV for the CardCursor object - */ -static POA_GNOME_Evolution_Addressbook_CardCursor__vepv pas_card_cursor_vepv; - -/* * Implemented GObject::dispose */ static void @@ -50,7 +43,7 @@ static CORBA_long impl_pas_card_cursor_get_length (PortableServer_Servant servant, CORBA_Environment *ev) { - PASCardCursor *cursor = PAS_CARD_CURSOR (bonobo_object_from_servant (servant)); + PASCardCursor *cursor = PAS_CARD_CURSOR (bonobo_object (servant)); if ( cursor->priv->get_length ) return cursor->priv->get_length( cursor, cursor->priv->data ); else @@ -65,7 +58,7 @@ impl_pas_card_cursor_get_nth (PortableServer_Servant servant, const CORBA_long n, CORBA_Environment *ev) { - PASCardCursor *cursor = PAS_CARD_CURSOR (bonobo_object_from_servant (servant)); + PASCardCursor *cursor = PAS_CARD_CURSOR (bonobo_object (servant)); if ( cursor->priv->get_nth ) { char *vcard = cursor->priv->get_nth( cursor, n, cursor->priv->data ); char *retval = CORBA_string_dup (vcard); @@ -75,60 +68,34 @@ impl_pas_card_cursor_get_nth (PortableServer_Servant servant, return CORBA_string_dup (""); } - -static void -corba_class_init (PASCardCursorClass *klass) -{ - POA_GNOME_Evolution_Addressbook_CardCursor__vepv *vepv; - POA_GNOME_Evolution_Addressbook_CardCursor__epv *epv; - PortableServer_ServantBase__epv *base_epv; - - base_epv = g_new0 (PortableServer_ServantBase__epv, 1); - base_epv->_private = NULL; - base_epv->finalize = NULL; - base_epv->default_POA = NULL; - - epv = &klass->epv; - - epv->count = impl_pas_card_cursor_get_length; - epv->getNth = impl_pas_card_cursor_get_nth; - - vepv = &pas_card_cursor_vepv; - vepv->_base_epv = base_epv; - vepv->GNOME_Evolution_Addressbook_CardCursor_epv = epv; -} - static void pas_card_cursor_class_init (PASCardCursorClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); + POA_GNOME_Evolution_Addressbook_CardCursor__epv *epv; parent_class = g_type_class_ref (BONOBO_TYPE_OBJECT); object_class->dispose = pas_card_cursor_dispose; - corba_class_init (klass); + + epv = &klass->epv; + + epv->count = impl_pas_card_cursor_get_length; + epv->getNth = impl_pas_card_cursor_get_nth; } static void pas_card_cursor_init (PASCardCursor *cursor) { - cursor->priv = g_new(PASCardCursorPrivate, 1); - cursor->priv->corba_cursor = CORBA_OBJECT_NIL; + cursor->priv = g_new0(PASCardCursorPrivate, 1); cursor->priv->get_length = NULL; cursor->priv->get_nth = NULL; cursor->priv->data = NULL; } -BONOBO_TYPE_FUNC_FULL ( - PASCardCursor, - GNOME_Evolution_Addressbook_CardCursor, - BONOBO_TYPE_OBJECT, - pas_card_cursor); - -void +static void pas_card_cursor_construct (PASCardCursor *cursor, - GNOME_Evolution_Addressbook_CardCursor corba_cursor, PASCardCursorLengthFunc get_length, PASCardCursorNthFunc get_nth, gpointer data) @@ -137,88 +104,31 @@ pas_card_cursor_construct (PASCardCursor *cursor, g_return_if_fail (cursor != NULL); g_return_if_fail (PAS_IS_CARD_CURSOR (cursor)); - g_return_if_fail (corba_cursor != CORBA_OBJECT_NIL); - priv = cursor->priv; - - g_return_if_fail (priv->corba_cursor == CORBA_OBJECT_NIL); - - priv->corba_cursor = corba_cursor; priv->get_length = get_length; priv->get_nth = get_nth; priv->data = data; } -static PASCardCursorServant * -create_servant (PASCardCursor *cursor) -{ - PASCardCursorServant *servant; - POA_GNOME_Evolution_Addressbook_CardCursor *corba_servant; - CORBA_Environment ev; - - CORBA_exception_init (&ev); - - servant = g_new0 (PASCardCursorServant, 1); - corba_servant = (POA_GNOME_Evolution_Addressbook_CardCursor *) servant; - - corba_servant->vepv = &pas_card_cursor_vepv; - POA_GNOME_Evolution_Addressbook_CardCursor__init ((PortableServer_Servant) corba_servant, &ev); - if (ev._major != CORBA_NO_EXCEPTION) { - g_free (servant); - CORBA_exception_free (&ev); - return NULL; - } - - servant->object = cursor; - - CORBA_exception_free (&ev); - - return servant; -} - -static GNOME_Evolution_Addressbook_CardCursor -activate_servant (PASCardCursor *cursor, - POA_GNOME_Evolution_Addressbook_CardCursor *servant) -{ - GNOME_Evolution_Addressbook_CardCursor corba_object; - CORBA_Environment ev; - - CORBA_exception_init (&ev); - - CORBA_free (PortableServer_POA_activate_object (bonobo_poa (), servant, &ev)); - - corba_object = PortableServer_POA_servant_to_reference (bonobo_poa(), servant, &ev); - - if (ev._major == CORBA_NO_EXCEPTION && ! CORBA_Object_is_nil (corba_object, &ev)) { - CORBA_exception_free (&ev); - return corba_object; - } - - CORBA_exception_free (&ev); - - return CORBA_OBJECT_NIL; -} - PASCardCursor * pas_card_cursor_new (PASCardCursorLengthFunc get_length, PASCardCursorNthFunc get_nth, gpointer data) { PASCardCursor *cursor; - PASCardCursorPrivate *priv; - GNOME_Evolution_Addressbook_CardCursor corba_cursor; cursor = g_object_new (PAS_TYPE_CARD_CURSOR, NULL); - priv = cursor->priv; - - priv->servant = create_servant (cursor); - corba_cursor = activate_servant (cursor, (POA_GNOME_Evolution_Addressbook_CardCursor*)priv->servant); pas_card_cursor_construct (cursor, - corba_cursor, get_length, get_nth, data); return cursor; } + +BONOBO_TYPE_FUNC_FULL ( + PASCardCursor, + GNOME_Evolution_Addressbook_CardCursor, + BONOBO_TYPE_OBJECT, + pas_card_cursor); diff --git a/addressbook/backend/pas/pas-card-cursor.h b/addressbook/backend/pas/pas-card-cursor.h index 880632decd..db5b05c0c2 100644 --- a/addressbook/backend/pas/pas-card-cursor.h +++ b/addressbook/backend/pas/pas-card-cursor.h @@ -41,23 +41,11 @@ struct _PASCardCursorClass { }; -struct _PASCardCursorServant { - POA_GNOME_Evolution_Addressbook_CardCursor servant_placeholder; - PASCardCursor *object; -}; -typedef struct _PASCardCursorServant PASCardCursorServant; - - /* Creating a new addressbook. */ PASCardCursor *pas_card_cursor_new (PASCardCursorLengthFunc get_length, PASCardCursorNthFunc get_nth, gpointer data); -void pas_card_cursor_construct (PASCardCursor *cursor, - GNOME_Evolution_Addressbook_CardCursor corba_cursor, - PASCardCursorLengthFunc get_length, - PASCardCursorNthFunc get_nth, - gpointer data); GType pas_card_cursor_get_type (void); POA_GNOME_Evolution_Addressbook_CardCursor__epv * |