diff options
Diffstat (limited to 'addressbook/backend')
-rw-r--r-- | addressbook/backend/ebook/e-book-listener.c | 151 | ||||
-rw-r--r-- | addressbook/backend/ebook/e-book-listener.h | 10 | ||||
-rw-r--r-- | addressbook/backend/ebook/e-book-view-listener.c | 122 | ||||
-rw-r--r-- | addressbook/backend/ebook/e-book-view-listener.h | 11 | ||||
-rw-r--r-- | addressbook/backend/ebook/e-card.c | 8 | ||||
-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 |
13 files changed, 116 insertions, 742 deletions
diff --git a/addressbook/backend/ebook/e-book-listener.c b/addressbook/backend/ebook/e-book-listener.c index df27e3092a..ffcd1fe127 100644 --- a/addressbook/backend/ebook/e-book-listener.c +++ b/addressbook/backend/ebook/e-book-listener.c @@ -24,12 +24,8 @@ enum { static guint e_book_listener_signals [LAST_SIGNAL]; static BonoboObjectClass *parent_class; -POA_GNOME_Evolution_Addressbook_BookListener__vepv e_book_listener_vepv; struct _EBookListenerPrivate { - EBookListenerServant *servant; - GNOME_Evolution_Addressbook_BookListener corba_objref; - GList *response_queue; gint timeout_id; @@ -379,7 +375,7 @@ impl_BookListener_respond_create_card (PortableServer_Servant const CORBA_char* id, CORBA_Environment *ev) { - EBookListener *listener = E_BOOK_LISTENER (bonobo_object_from_servant (servant)); + EBookListener *listener = E_BOOK_LISTENER (bonobo_object (servant)); e_book_listener_queue_create_card_response ( listener, @@ -392,7 +388,7 @@ impl_BookListener_respond_remove_card (PortableServer_Servant servant, const GNOME_Evolution_Addressbook_BookListener_CallStatus status, CORBA_Environment *ev) { - EBookListener *listener = E_BOOK_LISTENER (bonobo_object_from_servant (servant)); + EBookListener *listener = E_BOOK_LISTENER (bonobo_object (servant)); e_book_listener_queue_generic_response ( listener, RemoveCardResponse, @@ -404,7 +400,7 @@ impl_BookListener_respond_modify_card (PortableServer_Servant servant, const GNOME_Evolution_Addressbook_BookListener_CallStatus status, CORBA_Environment *ev) { - EBookListener *listener = E_BOOK_LISTENER (bonobo_object_from_servant (servant)); + EBookListener *listener = E_BOOK_LISTENER (bonobo_object (servant)); e_book_listener_queue_generic_response ( listener, ModifyCardResponse, @@ -417,7 +413,7 @@ impl_BookListener_respond_get_vcard (PortableServer_Servant servant, const CORBA_char* card, CORBA_Environment *ev) { - EBookListener *listener = E_BOOK_LISTENER (bonobo_object_from_servant (servant)); + EBookListener *listener = E_BOOK_LISTENER (bonobo_object (servant)); e_book_listener_queue_get_vcard_response ( listener, @@ -431,7 +427,7 @@ impl_BookListener_respond_get_cursor (PortableServer_Servant servant, const GNOME_Evolution_Addressbook_CardCursor cursor, CORBA_Environment *ev) { - EBookListener *listener = E_BOOK_LISTENER (bonobo_object_from_servant (servant)); + EBookListener *listener = E_BOOK_LISTENER (bonobo_object (servant)); GNOME_Evolution_Addressbook_CardCursor cursor_copy; cursor_copy = bonobo_object_dup_ref (cursor, ev); @@ -453,7 +449,7 @@ impl_BookListener_respond_get_view (PortableServer_Servant servant, const GNOME_Evolution_Addressbook_BookView book_view, CORBA_Environment *ev) { - EBookListener *listener = E_BOOK_LISTENER (bonobo_object_from_servant (servant)); + EBookListener *listener = E_BOOK_LISTENER (bonobo_object (servant)); GNOME_Evolution_Addressbook_BookView book_view_copy; book_view_copy = bonobo_object_dup_ref (book_view, ev); @@ -475,7 +471,7 @@ impl_BookListener_respond_get_changes (PortableServer_Servant servant, const GNOME_Evolution_Addressbook_BookView book_view, CORBA_Environment *ev) { - EBookListener *listener = E_BOOK_LISTENER (bonobo_object_from_servant (servant)); + EBookListener *listener = E_BOOK_LISTENER (bonobo_object (servant)); GNOME_Evolution_Addressbook_BookView book_view_copy; book_view_copy = bonobo_object_dup_ref (book_view, ev); @@ -497,7 +493,7 @@ impl_BookListener_respond_open_book (PortableServer_Servant servant, const GNOME_Evolution_Addressbook_Book book, CORBA_Environment *ev) { - EBookListener *listener = E_BOOK_LISTENER (bonobo_object_from_servant (servant)); + EBookListener *listener = E_BOOK_LISTENER (bonobo_object (servant)); GNOME_Evolution_Addressbook_Book book_copy; book_copy = bonobo_object_dup_ref (book, ev); @@ -519,7 +515,7 @@ impl_BookListener_report_open_book_progress (PortableServer_Servant servant, const CORBA_short percent, CORBA_Environment *ev) { - EBookListener *listener = E_BOOK_LISTENER (bonobo_object_from_servant (servant)); + EBookListener *listener = E_BOOK_LISTENER (bonobo_object (servant)); e_book_listener_queue_open_progress ( listener, status_message, percent); @@ -530,7 +526,7 @@ impl_BookListener_respond_authentication_result (PortableServer_Servant servant, const GNOME_Evolution_Addressbook_BookListener_CallStatus status, CORBA_Environment *ev) { - EBookListener *listener = E_BOOK_LISTENER (bonobo_object_from_servant (servant)); + EBookListener *listener = E_BOOK_LISTENER (bonobo_object (servant)); e_book_listener_queue_authentication_response ( listener, status); @@ -542,7 +538,7 @@ impl_BookListener_response_get_supported_fields (PortableServer_Servant servant, const GNOME_Evolution_Addressbook_stringlist *fields, CORBA_Environment *ev) { - EBookListener *listener = E_BOOK_LISTENER (bonobo_object_from_servant (servant)); + EBookListener *listener = E_BOOK_LISTENER (bonobo_object (servant)); e_book_listener_queue_get_supported_fields_response ( listener, status, fields); @@ -553,7 +549,7 @@ impl_BookListener_report_connection_status (PortableServer_Servant servant, const CORBA_boolean connected, CORBA_Environment *ev) { - EBookListener *listener = E_BOOK_LISTENER (bonobo_object_from_servant (servant)); + EBookListener *listener = E_BOOK_LISTENER (bonobo_object (servant)); e_book_listener_queue_link_status ( listener, connected); @@ -564,7 +560,7 @@ impl_BookListener_report_writable (PortableServer_Servant servant, const CORBA_boolean writable, CORBA_Environment *ev) { - EBookListener *listener = E_BOOK_LISTENER (bonobo_object_from_servant (servant)); + EBookListener *listener = E_BOOK_LISTENER (bonobo_object (servant)); e_book_listener_queue_writable_status (listener, writable); } @@ -650,70 +646,10 @@ e_book_listener_convert_status (const GNOME_Evolution_Addressbook_BookListener_C } } -void -e_book_listener_construct (EBookListener *listener, - GNOME_Evolution_Addressbook_BookListener corba_objref) -{ - EBookListenerPrivate *priv; - - g_return_if_fail (listener != NULL); - g_return_if_fail (corba_objref != CORBA_OBJECT_NIL); - - priv = listener->priv; - - g_return_if_fail (priv->corba_objref == CORBA_OBJECT_NIL); - - priv->corba_objref = corba_objref; -} - -static EBookListenerServant * -create_servant (EBookListener *listener) -{ - EBookListenerServant *servant; - POA_GNOME_Evolution_Addressbook_BookListener *corba_servant; - CORBA_Environment ev; - - CORBA_exception_init (&ev); - - servant = g_new0 (EBookListenerServant, 1); - corba_servant = (POA_GNOME_Evolution_Addressbook_BookListener *) servant; - - corba_servant->vepv = &e_book_listener_vepv; - POA_GNOME_Evolution_Addressbook_BookListener__init ((PortableServer_Servant) corba_servant, &ev); - if (ev._major != CORBA_NO_EXCEPTION) { - g_free (servant); - CORBA_exception_free (&ev); - return NULL; - } - - servant->object = listener; - - CORBA_exception_free (&ev); - - return servant; -} - -static GNOME_Evolution_Addressbook_BookListener -activate_servant (EBookListener *listener, - POA_GNOME_Evolution_Addressbook_BookListener *servant) +static void +e_book_listener_construct (EBookListener *listener) { - GNOME_Evolution_Addressbook_BookListener 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 */ } /** @@ -728,16 +664,10 @@ EBookListener * e_book_listener_new () { EBookListener *listener; - EBookListenerPrivate *priv; - GNOME_Evolution_Addressbook_BookListener corba_objref; listener = g_object_new (E_TYPE_BOOK_LISTENER, NULL); - priv = listener->priv; - - priv->servant = create_servant (listener); - corba_objref = activate_servant (listener, (POA_GNOME_Evolution_Addressbook_BookListener *) priv->servant); - e_book_listener_construct (listener, corba_objref); + e_book_listener_construct (listener); return listener; } @@ -746,7 +676,6 @@ static void e_book_listener_init (EBookListener *listener) { listener->priv = g_new0 (EBookListenerPrivate, 1); - listener->priv->corba_objref = CORBA_OBJECT_NIL; } void @@ -783,20 +712,25 @@ e_book_listener_dispose (GObject *object) } static void -corba_class_init (EBookListenerClass *klass) +e_book_listener_class_init (EBookListenerClass *klass) { - POA_GNOME_Evolution_Addressbook_BookListener__vepv *vepv; + GObjectClass *object_class = G_OBJECT_CLASS (klass); POA_GNOME_Evolution_Addressbook_BookListener__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; + parent_class = g_type_class_ref (BONOBO_TYPE_OBJECT); + e_book_listener_signals [RESPONSES_QUEUED] = + g_signal_new ("responses_queued", + G_OBJECT_CLASS_TYPE (object_class), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (EBookListenerClass, responses_queued), + NULL, NULL, + e_book_marshal_NONE__NONE, + G_TYPE_NONE, 0); - epv = &klass->epv; + object_class->dispose = e_book_listener_dispose; + epv = &klass->epv; epv->notifyOpenBookProgress = impl_BookListener_report_open_book_progress; epv->notifyBookOpened = impl_BookListener_respond_open_book; epv->notifyCardCreated = impl_BookListener_respond_create_card; @@ -810,31 +744,6 @@ corba_class_init (EBookListenerClass *klass) epv->notifyChangesRequested = impl_BookListener_respond_get_changes; epv->notifyConnectionStatus = impl_BookListener_report_connection_status; epv->notifyWritable = impl_BookListener_report_writable; - - vepv = &e_book_listener_vepv; - vepv->_base_epv = base_epv; - vepv->GNOME_Evolution_Addressbook_BookListener_epv = epv; -} - -static void -e_book_listener_class_init (EBookListenerClass *klass) -{ - GObjectClass *object_class = G_OBJECT_CLASS (klass); - - parent_class = g_type_class_ref (BONOBO_TYPE_OBJECT); - - e_book_listener_signals [RESPONSES_QUEUED] = - g_signal_new ("responses_queued", - G_OBJECT_CLASS_TYPE (object_class), - G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (EBookListenerClass, responses_queued), - NULL, NULL, - e_book_marshal_NONE__NONE, - G_TYPE_NONE, 0); - - object_class->dispose = e_book_listener_dispose; - - corba_class_init (klass); } BONOBO_TYPE_FUNC_FULL ( diff --git a/addressbook/backend/ebook/e-book-listener.h b/addressbook/backend/ebook/e-book-listener.h index c9c0bd02d5..26cd684aab 100644 --- a/addressbook/backend/ebook/e-book-listener.h +++ b/addressbook/backend/ebook/e-book-listener.h @@ -97,18 +97,8 @@ typedef struct { char *vcard; } EBookListenerResponse; - -struct _EBookListenerServant { - POA_GNOME_Evolution_Addressbook_BookListener servant_placeholder; - EBookListener *object; -}; -typedef struct _EBookListenerServant EBookListenerServant; - - EBookListener *e_book_listener_new (void); -void e_book_listener_construct (EBookListener *listener, - GNOME_Evolution_Addressbook_BookListener corba_objref); int e_book_listener_check_pending (EBookListener *listener); EBookListenerResponse *e_book_listener_pop_response (EBookListener *listener); GType e_book_listener_get_type (void); diff --git a/addressbook/backend/ebook/e-book-view-listener.c b/addressbook/backend/ebook/e-book-view-listener.c index fb1d0b3383..1ac4a7ef83 100644 --- a/addressbook/backend/ebook/e-book-view-listener.c +++ b/addressbook/backend/ebook/e-book-view-listener.c @@ -26,12 +26,8 @@ enum { static guint e_book_view_listener_signals [LAST_SIGNAL]; static BonoboObjectClass *parent_class; -POA_GNOME_Evolution_Addressbook_BookViewListener__vepv e_book_view_listener_vepv; struct _EBookViewListenerPrivate { - EBookViewListenerServant *servant; - GNOME_Evolution_Addressbook_BookViewListener corba_objref; - GList *response_queue; gint timeout_id; @@ -211,7 +207,7 @@ impl_BookViewListener_notify_card_added (PortableServer_Servant servant, const GNOME_Evolution_Addressbook_VCardList *cards, CORBA_Environment *ev) { - EBookViewListener *listener = E_BOOK_VIEW_LISTENER (bonobo_object_from_servant (servant)); + EBookViewListener *listener = E_BOOK_VIEW_LISTENER (bonobo_object (servant)); e_book_view_listener_queue_sequence_event ( listener, CardAddedEvent, cards); @@ -222,7 +218,7 @@ impl_BookViewListener_notify_card_removed (PortableServer_Servant servant, const CORBA_char* id, CORBA_Environment *ev) { - EBookViewListener *listener = E_BOOK_VIEW_LISTENER (bonobo_object_from_servant (servant)); + EBookViewListener *listener = E_BOOK_VIEW_LISTENER (bonobo_object (servant)); e_book_view_listener_queue_id_event ( listener, CardRemovedEvent, (const char *) id); @@ -233,7 +229,7 @@ impl_BookViewListener_notify_card_changed (PortableServer_Servant servant, const GNOME_Evolution_Addressbook_VCardList *cards, CORBA_Environment *ev) { - EBookViewListener *listener = E_BOOK_VIEW_LISTENER (bonobo_object_from_servant (servant)); + EBookViewListener *listener = E_BOOK_VIEW_LISTENER (bonobo_object (servant)); e_book_view_listener_queue_sequence_event ( listener, CardModifiedEvent, cards); @@ -244,7 +240,7 @@ impl_BookViewListener_notify_sequence_complete (PortableServer_Servant servant, const GNOME_Evolution_Addressbook_BookViewListener_CallStatus status, CORBA_Environment *ev) { - EBookViewListener *listener = E_BOOK_VIEW_LISTENER (bonobo_object_from_servant (servant)); + EBookViewListener *listener = E_BOOK_VIEW_LISTENER (bonobo_object (servant)); e_book_view_listener_queue_status_event (listener, SequenceCompleteEvent, e_book_view_listener_convert_status (status)); @@ -255,7 +251,7 @@ impl_BookViewListener_notify_status_message (PortableServer_Servant servant, const char *message, CORBA_Environment *ev) { - EBookViewListener *listener = E_BOOK_VIEW_LISTENER (bonobo_object_from_servant (servant)); + EBookViewListener *listener = E_BOOK_VIEW_LISTENER (bonobo_object (servant)); e_book_view_listener_queue_message_event (listener, StatusMessageEvent, message); } @@ -331,70 +327,10 @@ e_book_view_listener_convert_status (const GNOME_Evolution_Addressbook_BookViewL } } -void -e_book_view_listener_construct (EBookViewListener *listener, - GNOME_Evolution_Addressbook_BookViewListener corba_objref) -{ - EBookViewListenerPrivate *priv; - - g_return_if_fail (listener != NULL); - g_return_if_fail (corba_objref != CORBA_OBJECT_NIL); - - priv = listener->priv; - - g_return_if_fail (priv->corba_objref == CORBA_OBJECT_NIL); - - priv->corba_objref = corba_objref; -} - -static EBookViewListenerServant * -create_servant (EBookViewListener *listener) +static void +e_book_view_listener_construct (EBookViewListener *listener) { - EBookViewListenerServant *servant; - POA_GNOME_Evolution_Addressbook_BookViewListener *corba_servant; - CORBA_Environment ev; - - CORBA_exception_init (&ev); - - servant = g_new0 (EBookViewListenerServant, 1); - corba_servant = (POA_GNOME_Evolution_Addressbook_BookViewListener *) servant; - - corba_servant->vepv = &e_book_view_listener_vepv; - POA_GNOME_Evolution_Addressbook_BookViewListener__init ((PortableServer_Servant) corba_servant, &ev); - if (ev._major != CORBA_NO_EXCEPTION) { - g_free (servant); - CORBA_exception_free (&ev); - return NULL; - } - - servant->object = listener; - - CORBA_exception_free (&ev); - - return servant; -} - -static GNOME_Evolution_Addressbook_BookViewListener -activate_servant (EBookViewListener *listener, - POA_GNOME_Evolution_Addressbook_BookViewListener *servant) -{ - GNOME_Evolution_Addressbook_BookViewListener 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 needed here */ } /** @@ -409,16 +345,10 @@ EBookViewListener * e_book_view_listener_new () { EBookViewListener *listener; - EBookViewListenerPrivate *priv; - GNOME_Evolution_Addressbook_BookViewListener corba_objref; listener = g_object_new (E_TYPE_BOOK_VIEW_LISTENER, NULL); - priv = listener->priv; - priv->servant = create_servant (listener); - corba_objref = activate_servant (listener, (POA_GNOME_Evolution_Addressbook_BookViewListener *) priv->servant); - - e_book_view_listener_construct (listener, corba_objref); + e_book_view_listener_construct (listener); return listener; } @@ -427,7 +357,6 @@ static void e_book_view_listener_init (EBookViewListener *listener) { listener->priv = g_new0 (EBookViewListenerPrivate, 1); - listener->priv->corba_objref = CORBA_OBJECT_NIL; listener->priv->response_queue = NULL; listener->priv->timeout_id = 0; listener->priv->timeout_lock = FALSE; @@ -477,34 +406,10 @@ e_book_view_listener_dispose (GObject *object) } static void -corba_class_init (EBookViewListenerClass *klass) -{ - POA_GNOME_Evolution_Addressbook_BookViewListener__vepv *vepv; - POA_GNOME_Evolution_Addressbook_BookViewListener__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->notifyCardChanged = impl_BookViewListener_notify_card_changed; - epv->notifyCardRemoved = impl_BookViewListener_notify_card_removed; - epv->notifyCardAdded = impl_BookViewListener_notify_card_added; - epv->notifySequenceComplete = impl_BookViewListener_notify_sequence_complete; - epv->notifyStatusMessage = impl_BookViewListener_notify_status_message; - - vepv = &e_book_view_listener_vepv; - vepv->_base_epv = base_epv; - vepv->GNOME_Evolution_Addressbook_BookViewListener_epv = epv; -} - -static void e_book_view_listener_class_init (EBookViewListenerClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); + POA_GNOME_Evolution_Addressbook_BookViewListener__epv *epv; parent_class = g_type_class_ref (BONOBO_TYPE_OBJECT); @@ -519,7 +424,12 @@ e_book_view_listener_class_init (EBookViewListenerClass *klass) object_class->dispose = e_book_view_listener_dispose; - corba_class_init (klass); + epv = &klass->epv; + epv->notifyCardChanged = impl_BookViewListener_notify_card_changed; + epv->notifyCardRemoved = impl_BookViewListener_notify_card_removed; + epv->notifyCardAdded = impl_BookViewListener_notify_card_added; + epv->notifySequenceComplete = impl_BookViewListener_notify_sequence_complete; + epv->notifyStatusMessage = impl_BookViewListener_notify_status_message; } BONOBO_TYPE_FUNC_FULL ( diff --git a/addressbook/backend/ebook/e-book-view-listener.h b/addressbook/backend/ebook/e-book-view-listener.h index 3100a2f532..f12fdca779 100644 --- a/addressbook/backend/ebook/e-book-view-listener.h +++ b/addressbook/backend/ebook/e-book-view-listener.h @@ -71,18 +71,7 @@ typedef struct { } EBookViewListenerResponse; - -struct _EBookViewListenerServant { - POA_GNOME_Evolution_Addressbook_BookViewListener servant_placeholder; - EBookViewListener *object; -}; -typedef struct _EBookViewListenerServant EBookViewListenerServant; - - - EBookViewListener *e_book_view_listener_new (void); -void e_book_view_listener_construct (EBookViewListener *listener, - GNOME_Evolution_Addressbook_BookViewListener corba_objref); int e_book_view_listener_check_pending (EBookViewListener *listener); EBookViewListenerResponse *e_book_view_listener_pop_response (EBookViewListener *listener); GType e_book_view_listener_get_type (void); diff --git a/addressbook/backend/ebook/e-card.c b/addressbook/backend/ebook/e-card.c index 0419a6b885..f98269dff5 100644 --- a/addressbook/backend/ebook/e-card.c +++ b/addressbook/backend/ebook/e-card.c @@ -280,7 +280,7 @@ e_card_get_use_score(ECard *card) e_card_get_today (&today); g_date_set_dmy (&last_use, card->last_use->day, card->last_use->month, card->last_use->year); - days_since_last_use = g_date_julian (&today) - g_date_julian (&last_use); + days_since_last_use = g_date_get_julian (&today) - g_date_get_julian (&last_use); /* Apply a seven-day "grace period" to the use score decay. */ days_since_last_use -= 7; @@ -304,9 +304,9 @@ e_card_touch(ECard *card) if (card->last_use == NULL) card->last_use = g_new (ECardDate, 1); - card->last_use->day = g_date_day (&today); - card->last_use->month = g_date_month (&today); - card->last_use->year = g_date_year (&today); + card->last_use->day = g_date_get_day (&today); + card->last_use->month = g_date_get_month (&today); + card->last_use->year = g_date_get_year (&today); card->raw_use_score = use_score + 1.0; } 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 * |