diff options
author | Chris Toshok <toshok@ximian.com> | 2002-11-05 19:09:59 +0800 |
---|---|---|
committer | Chris Toshok <toshok@src.gnome.org> | 2002-11-05 19:09:59 +0800 |
commit | 8e9511af0e47355211e189d5cba5dcd9ae97584c (patch) | |
tree | e85c07a8fa9537b996ee82b48ec3652247a82278 /addressbook/backend/pas/pas-book-view.c | |
parent | 02e66b1085341d95377d3f2173a1900102f20b9b (diff) | |
download | gsoc2013-evolution-8e9511af0e47355211e189d5cba5dcd9ae97584c.tar gsoc2013-evolution-8e9511af0e47355211e189d5cba5dcd9ae97584c.tar.gz gsoc2013-evolution-8e9511af0e47355211e189d5cba5dcd9ae97584c.tar.bz2 gsoc2013-evolution-8e9511af0e47355211e189d5cba5dcd9ae97584c.tar.lz gsoc2013-evolution-8e9511af0e47355211e189d5cba5dcd9ae97584c.tar.xz gsoc2013-evolution-8e9511af0e47355211e189d5cba5dcd9ae97584c.tar.zst gsoc2013-evolution-8e9511af0e47355211e189d5cba5dcd9ae97584c.zip |
port to gnome 2.
2002-11-05 Chris Toshok <toshok@ximian.com>
* backend/pas/pas-backend-card-sexp.[ch]: port to gnome 2.
* backend/pas/pas-backend-file.[ch]: same.
* backend/pas/pas-backend-file.[ch]: same.
* backend/pas/pas-backend-ldap.[ch]: same.
* backend/pas/pas-backend-summary.[ch]: same.
* backend/pas/pas-backend.[ch]: same.
* backend/pas/pas-book-factory.[ch]: same.
* backend/pas/pas-book-view.[ch]: same.
* backend/pas/pas-book.[ch]: same.
* backend/pas/pas-card-cursor.[ch]: same.
* backend/pas/pas-marshal.list: list of marshallers.
* backend/pas/Makefile.am (libpas_a_SOURCES): add pas-marshal.c
also add the marshal building foo.
* backend/pas/.cvsignore: ignore pas-marshal.[ch]
svn path=/trunk/; revision=18544
Diffstat (limited to 'addressbook/backend/pas/pas-book-view.c')
-rw-r--r-- | addressbook/backend/pas/pas-book-view.c | 170 |
1 files changed, 94 insertions, 76 deletions
diff --git a/addressbook/backend/pas/pas-book-view.c b/addressbook/backend/pas/pas-book-view.c index 27d0f3ae06..19458d29a3 100644 --- a/addressbook/backend/pas/pas-book-view.c +++ b/addressbook/backend/pas/pas-book-view.c @@ -7,12 +7,16 @@ #include <config.h> #include <glib.h> +#include <bonobo/bonobo-main.h> #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; }; @@ -161,53 +165,86 @@ pas_book_view_notify_status_message (PASBookView *book_view, CORBA_exception_free (&ev); } -static gboolean +void pas_book_view_construct (PASBookView *book_view, + GNOME_Evolution_Addressbook_BookView corba_objref, GNOME_Evolution_Addressbook_BookViewListener listener) { - POA_GNOME_Evolution_Addressbook_BookView *servant; - CORBA_Environment ev; - CORBA_Object obj; + PASBookViewPrivate *priv; + CORBA_Environment ev; - g_assert (book_view != NULL); - g_assert (PAS_IS_BOOK_VIEW (book_view)); - g_assert (listener != CORBA_OBJECT_NIL); + g_return_if_fail (book_view != NULL); + g_return_if_fail (corba_objref != CORBA_OBJECT_NIL); + g_return_if_fail (listener != CORBA_OBJECT_NIL); - servant = (POA_GNOME_Evolution_Addressbook_BookView *) g_new0 (BonoboObjectServant, 1); - servant->vepv = &pas_book_view_vepv; + priv = book_view->priv; + g_return_if_fail (priv->corba_objref == CORBA_OBJECT_NIL); + + priv->corba_objref = corba_objref; + CORBA_exception_init (&ev); - POA_GNOME_Evolution_Addressbook_BookView__init ((PortableServer_Servant) servant, &ev); + bonobo_object_dup_ref (listener, &ev); if (ev._major != CORBA_NO_EXCEPTION) { - g_free (servant); + g_warning("Unable to duplicate & ref listener object in pas-book-view.c\n"); CORBA_exception_free (&ev); - - return FALSE; + return; } - bonobo_object_dup_ref (listener, &ev); + CORBA_exception_free (&ev); + + 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_warning("Unable to duplicate & ref listener object in pas-book-view.c\n"); + g_free (servant); CORBA_exception_free (&ev); - - return FALSE; + return NULL; } + servant->object = factory; + CORBA_exception_free (&ev); - obj = bonobo_object_activate_servant (BONOBO_OBJECT (book_view), servant); - if (obj == CORBA_OBJECT_NIL) { - g_free (servant); + return servant; +} - return FALSE; - } +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); - bonobo_object_construct (BONOBO_OBJECT (book_view), obj); + if (ev._major == CORBA_NO_EXCEPTION && ! CORBA_Object_is_nil (corba_object, &ev)) { + CORBA_exception_free (&ev); + return corba_object; + } - book_view->priv->listener = listener; + CORBA_exception_free (&ev); - return TRUE; + return CORBA_OBJECT_NIL; } /** @@ -217,22 +254,22 @@ PASBookView * pas_book_view_new (GNOME_Evolution_Addressbook_BookViewListener listener) { PASBookView *book_view; + PASBookViewPrivate *priv; + GNOME_Evolution_Addressbook_BookView corba_objref; - g_return_val_if_fail (listener != CORBA_OBJECT_NIL, NULL); - - book_view = gtk_type_new (pas_book_view_get_type ()); + book_view = g_object_new (PAS_TYPE_BOOK_VIEW, NULL); + priv = book_view->priv; - if (! pas_book_view_construct (book_view, listener)) { - gtk_object_unref (GTK_OBJECT (book_view)); - - return NULL; - } + 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); return book_view; } static void -pas_book_view_destroy (GtkObject *object) +pas_book_view_dispose (GObject *object) { PASBookView *book_view = PAS_BOOK_VIEW (object); CORBA_Environment ev; @@ -248,37 +285,39 @@ pas_book_view_destroy (GtkObject *object) g_free (book_view->priv); - GTK_OBJECT_CLASS (pas_book_view_parent_class)->destroy (object); + G_OBJECT_CLASS (pas_book_view_parent_class)->dispose (object); } -static POA_GNOME_Evolution_Addressbook_BookView__epv * -pas_book_view_get_epv (void) +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; - epv = g_new0 (POA_GNOME_Evolution_Addressbook_BookView__epv, 1); + base_epv = g_new0 (PortableServer_ServantBase__epv, 1); + base_epv->_private = NULL; + base_epv->finalize = NULL; + base_epv->default_POA = NULL; - return epv; - -} -static void -pas_book_view_corba_class_init (void) -{ - pas_book_view_vepv.Bonobo_Unknown_epv = bonobo_object_get_epv (); - pas_book_view_vepv.GNOME_Evolution_Addressbook_BookView_epv = pas_book_view_get_epv (); + 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) { - GtkObjectClass *object_class = (GtkObjectClass *) klass; + GObjectClass *object_class = G_OBJECT_CLASS (klass); - pas_book_view_parent_class = gtk_type_class (bonobo_object_get_type ()); + pas_book_view_parent_class = g_object_new (BONOBO_TYPE_OBJECT, NULL); - object_class->destroy = pas_book_view_destroy; + object_class->dispose = pas_book_view_dispose; - pas_book_view_corba_class_init (); + corba_class_init (klass); } static void @@ -288,29 +327,8 @@ pas_book_view_init (PASBookView *book_view) book_view->priv->listener = CORBA_OBJECT_NIL; } -/** - * pas_book_view_get_type: - */ -GtkType -pas_book_view_get_type (void) -{ - static GtkType type = 0; - - if (! type) { - GtkTypeInfo info = { - "PASBookView", - sizeof (PASBookView), - sizeof (PASBookViewClass), - (GtkClassInitFunc) pas_book_view_class_init, - (GtkObjectInitFunc) pas_book_view_init, - NULL, /* reserved 1 */ - NULL, /* reserved 2 */ - (GtkClassInitFunc) NULL - }; - - type = gtk_type_unique (bonobo_object_get_type (), &info); - } - - return type; -} - +BONOBO_TYPE_FUNC_FULL ( + PASBookView, + GNOME_Evolution_Addressbook_BookView, + BONOBO_TYPE_OBJECT, + pas_book_view); |