aboutsummaryrefslogtreecommitdiffstats
path: root/addressbook
diff options
context:
space:
mode:
authorChris Toshok <toshok@ximian.com>2002-11-05 19:09:59 +0800
committerChris Toshok <toshok@src.gnome.org>2002-11-05 19:09:59 +0800
commit8e9511af0e47355211e189d5cba5dcd9ae97584c (patch)
treee85c07a8fa9537b996ee82b48ec3652247a82278 /addressbook
parent02e66b1085341d95377d3f2173a1900102f20b9b (diff)
downloadgsoc2013-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')
-rw-r--r--addressbook/ChangeLog29
-rw-r--r--addressbook/backend/pas/.cvsignore2
-rw-r--r--addressbook/backend/pas/Makefile.am25
-rw-r--r--addressbook/backend/pas/pas-backend-card-sexp.c71
-rw-r--r--addressbook/backend/pas/pas-backend-card-sexp.h22
-rw-r--r--addressbook/backend/pas/pas-backend-file.c116
-rw-r--r--addressbook/backend/pas/pas-backend-file.h16
-rw-r--r--addressbook/backend/pas/pas-backend-ldap.c177
-rw-r--r--addressbook/backend/pas/pas-backend-ldap.h16
-rw-r--r--addressbook/backend/pas/pas-backend-summary.c55
-rw-r--r--addressbook/backend/pas/pas-backend-summary.h22
-rw-r--r--addressbook/backend/pas/pas-backend.c73
-rw-r--r--addressbook/backend/pas/pas-backend.h23
-rw-r--r--addressbook/backend/pas/pas-book-factory.c239
-rw-r--r--addressbook/backend/pas/pas-book-factory.h38
-rw-r--r--addressbook/backend/pas/pas-book-view.c170
-rw-r--r--addressbook/backend/pas/pas-book-view.h34
-rw-r--r--addressbook/backend/pas/pas-book.c209
-rw-r--r--addressbook/backend/pas/pas-book.h37
-rw-r--r--addressbook/backend/pas/pas-card-cursor.c192
-rw-r--r--addressbook/backend/pas/pas-card-cursor.h34
-rw-r--r--addressbook/backend/pas/pas-marshal.list1
22 files changed, 886 insertions, 715 deletions
diff --git a/addressbook/ChangeLog b/addressbook/ChangeLog
index c7f5fa4a7c..1a4e2d7756 100644
--- a/addressbook/ChangeLog
+++ b/addressbook/ChangeLog
@@ -1,5 +1,34 @@
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]
+
+2002-11-05 Chris Toshok <toshok@ximian.com>
+
* backend/ebook/test-client-list.c (main): don't call
bonobo_activation_init directly.
diff --git a/addressbook/backend/pas/.cvsignore b/addressbook/backend/pas/.cvsignore
index 071cef99ae..6eb58802ec 100644
--- a/addressbook/backend/pas/.cvsignore
+++ b/addressbook/backend/pas/.cvsignore
@@ -9,3 +9,5 @@ addressbook-common.c
addressbook.h
*.lo
*.la
+pas-marshal.c
+pas-marshal.h \ No newline at end of file
diff --git a/addressbook/backend/pas/Makefile.am b/addressbook/backend/pas/Makefile.am
index eaaeebb25a..deac7eee14 100644
--- a/addressbook/backend/pas/Makefile.am
+++ b/addressbook/backend/pas/Makefile.am
@@ -10,10 +10,8 @@ CORBA_SOURCE = $(CORBA_SOURCE_H) $(CORBA_SOURCE_C)
idls = \
$(srcdir)/../idl/addressbook.idl
-idl_flags = `$(GNOME_CONFIG) --cflags idl` -I $(datadir)/idl
-
$(CORBA_SOURCE): $(idls)
- $(ORBIT_IDL) -I $(srcdir) $(srcdir)/../idl/addressbook.idl $(idl_flags)
+ $(ORBIT_IDL) $(IDL_INCLUDES) -I $(srcdir) $(srcdir)/../idl/addressbook.idl
INCLUDES = \
$(DB3_CFLAGS) \
@@ -65,7 +63,8 @@ libpas_a_SOURCES = \
pas-backend-file.c \
pas-backend.c \
pas-backend-summary.c \
- pas-card-cursor.c
+ pas-card-cursor.c \
+ pas-marshal.c
libpasfile_a_SOURCES = \
pas-backend-file.c \
@@ -76,10 +75,24 @@ libpasldap_a_SOURCES = \
$(LDAP_BACKEND_FILES)
endif
-BUILT_SOURCES = $(CORBA_SOURCE)
+# GLib marshalling cruft
+
+pas-marshal.h: pas-marshal.list
+ ( @GLIB_GENMARSHAL@ --prefix=pas_marshal pas-marshal.list --header > pas-marshal.tmp \
+ && mv pas-marshal.tmp pas-marshal.h ) \
+ || ( rm -f pas-marshal.tmp && exit 1 )
+
+pas-marshal.c: pas-marshal.h
+ ( @GLIB_GENMARSHAL@ --prefix=pas_marshal pas-marshal.list --body > pas-marshal.tmp \
+ && mv pas-marshal.tmp pas-marshal.c ) \
+ || ( rm -f pas-marshal.tmp && exit 1 )
+
+MARSHAL_GENERATED = pas-marshal.c pas-marshal.h
+
+BUILT_SOURCES = $(CORBA_SOURCE) $(MARSHAL_GENERATED)
CLEANFILES = $(BUILT_SOURCES)
dist-hook:
cd $(distdir); rm -f $(BUILT_SOURCES)
-EXTRA_DIST = $(LDAP_BACKEND_FILES) $(LDAP_SCHEMA)
+EXTRA_DIST = $(LDAP_BACKEND_FILES) $(LDAP_SCHEMA) pas-marshal.list
diff --git a/addressbook/backend/pas/pas-backend-card-sexp.c b/addressbook/backend/pas/pas-backend-card-sexp.c
index f747189bba..f33c391534 100644
--- a/addressbook/backend/pas/pas-backend-card-sexp.c
+++ b/addressbook/backend/pas/pas-backend-card-sexp.c
@@ -25,7 +25,7 @@
#include <ebook/e-card-simple.h>
#include <gal/widgets/e-unicode.h>
-static GtkObjectClass *parent_class;
+static GObjectClass *parent_class;
typedef struct _SearchContext SearchContext;
@@ -104,12 +104,12 @@ compare_category (ECardSimple *card, const char *str,
ECard *ecard;
gboolean ret_val = FALSE;
- gtk_object_get (GTK_OBJECT (card),
- "card", &ecard,
- NULL);
- gtk_object_get (GTK_OBJECT (ecard),
- "category_list", &categories,
- NULL);
+ g_object_get (card,
+ "card", &ecard,
+ NULL);
+ g_object_get (ecard,
+ "category_list", &categories,
+ NULL);
for (iterator = e_list_get_iterator(categories); e_iterator_is_valid (iterator); e_iterator_next (iterator)) {
const char *category = e_iterator_get (iterator);
@@ -120,7 +120,7 @@ compare_category (ECardSimple *card, const char *str,
}
}
- gtk_object_unref (GTK_OBJECT (iterator));
+ g_object_unref (iterator);
e_card_free_empty_lists (ecard);
return ret_val;
}
@@ -134,12 +134,12 @@ compare_arbitrary (ECardSimple *card, const char *str,
ECard *ecard;
gboolean ret_val = FALSE;
- gtk_object_get (GTK_OBJECT (card),
- "card", &ecard,
- NULL);
- gtk_object_get (GTK_OBJECT (ecard),
- "arbitrary", &list,
- NULL);
+ g_object_get (card,
+ "card", &ecard,
+ NULL);
+ g_object_get (ecard,
+ "arbitrary", &list,
+ NULL);
for (iterator = e_list_get_iterator(list); e_iterator_is_valid (iterator); e_iterator_next (iterator)) {
const ECardArbitrary *arbitrary = e_iterator_get (iterator);
@@ -150,7 +150,7 @@ compare_arbitrary (ECardSimple *card, const char *str,
}
}
- gtk_object_unref (GTK_OBJECT (iterator));
+ g_object_unref (iterator);
e_card_free_empty_lists (ecard);
return ret_val;
}
@@ -353,7 +353,7 @@ pas_backend_card_sexp_match_vcard (PASBackendCardSExp *sexp, const char *vcard)
card = e_card_new ((char*)vcard);
sexp->priv->search_context->card = e_card_simple_new (card);
- gtk_object_unref(GTK_OBJECT(card));
+ g_object_unref(card);
/* if it's not a valid vcard why is it in our db? :) */
if (!sexp->priv->search_context->card)
@@ -363,7 +363,7 @@ pas_backend_card_sexp_match_vcard (PASBackendCardSExp *sexp, const char *vcard)
retval = (r && r->type == ESEXP_RES_BOOL && r->value.bool);
- gtk_object_unref(GTK_OBJECT(sexp->priv->search_context->card));
+ g_object_unref(sexp->priv->search_context->card);
e_sexp_result_free(sexp->priv->search_sexp, r);
@@ -378,7 +378,7 @@ pas_backend_card_sexp_match_vcard (PASBackendCardSExp *sexp, const char *vcard)
PASBackendCardSExp *
pas_backend_card_sexp_new (const char *text)
{
- PASBackendCardSExp *sexp = gtk_type_new (pas_backend_card_sexp_get_type ());
+ PASBackendCardSExp *sexp = g_object_new (PAS_TYPE_BACKEND_CARD_SEXP, NULL);
int esexp_error;
int i;
@@ -398,7 +398,7 @@ pas_backend_card_sexp_new (const char *text)
esexp_error = e_sexp_parse(sexp->priv->search_sexp);
if (esexp_error == -1) {
- gtk_object_unref (GTK_OBJECT (sexp));
+ g_object_unref (sexp);
sexp = NULL;
}
@@ -406,7 +406,7 @@ pas_backend_card_sexp_new (const char *text)
}
static void
-pas_backend_card_sexp_destroy (GtkObject *object)
+pas_backend_card_sexp_dispose (GObject *object)
{
PASBackendCardSExp *sexp = PAS_BACKEND_CARD_SEXP (object);
e_sexp_unref(sexp->priv->search_sexp);
@@ -414,19 +414,19 @@ pas_backend_card_sexp_destroy (GtkObject *object)
g_free (sexp->priv->search_context);
g_free (sexp->priv);
- GTK_OBJECT_CLASS (parent_class)->destroy (object);
+ G_OBJECT_CLASS (parent_class)->dispose (object);
}
static void
pas_backend_card_sexp_class_init (PASBackendCardSExpClass *klass)
{
- GtkObjectClass *object_class = (GtkObjectClass *) klass;
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
- parent_class = gtk_type_class (gtk_object_get_type ());
+ parent_class = g_type_class_ref (G_TYPE_OBJECT);
/* Set the virtual methods. */
- object_class->destroy = pas_backend_card_sexp_destroy;
+ object_class->dispose = pas_backend_card_sexp_dispose;
}
static void
@@ -443,24 +443,25 @@ pas_backend_card_sexp_init (PASBackendCardSExp *sexp)
/**
* pas_backend_card_sexp_get_type:
*/
-GtkType
+GType
pas_backend_card_sexp_get_type (void)
{
- static GtkType type = 0;
+ static GType type = 0;
if (! type) {
- GtkTypeInfo info = {
- "PASBackendCardSExp",
- sizeof (PASBackendCardSExp),
+ GTypeInfo info = {
sizeof (PASBackendCardSExpClass),
- (GtkClassInitFunc) pas_backend_card_sexp_class_init,
- (GtkObjectInitFunc) pas_backend_card_sexp_init,
- NULL, /* reserved 1 */
- NULL, /* reserved 2 */
- (GtkClassInitFunc) NULL
+ NULL, /* base_class_init */
+ NULL, /* base_class_finalize */
+ (GClassInitFunc) pas_backend_card_sexp_class_init,
+ NULL, /* class_finalize */
+ NULL, /* class_data */
+ sizeof (PASBackendCardSExp),
+ 0, /* n_preallocs */
+ (GInstanceInitFunc) pas_backend_card_sexp_init
};
- type = gtk_type_unique (gtk_object_get_type (), &info);
+ type = g_type_register_static (G_TYPE_OBJECT, "PASBackendCardSExp", &info, 0);
}
return type;
diff --git a/addressbook/backend/pas/pas-backend-card-sexp.h b/addressbook/backend/pas/pas-backend-card-sexp.h
index ee51a75dab..e3b4b49c20 100644
--- a/addressbook/backend/pas/pas-backend-card-sexp.h
+++ b/addressbook/backend/pas/pas-backend-card-sexp.h
@@ -24,28 +24,30 @@
#ifndef __PAS_BACKEND_CARD_SEXP_H__
#define __PAS_BACKEND_CARD_SEXP_H__
-#include <gtk/gtk.h>
+#include <glib.h>
+#include <glib-object.h>
+
+#define PAS_TYPE_BACKEND_CARD_SEXP (pas_backend_card_sexp_get_type ())
+#define PAS_BACKEND_CARD_SEXP(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), PAS_TYPE_BACKEND_CARD_SEXP, PASBackendCardSExp))
+#define PAS_BACKEND_CARD_SEXP_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), PAS_BACKEND_TYPE, PASBackendCardSExpClass))
+#define PAS_IS_BACKEND_CARD_SEXP(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), PAS_TYPE_BACKEND_CARD_SEXP))
+#define PAS_IS_BACKEND_CARD_SEXP_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), PAS_TYPE_BACKEND_CARD_SEXP))
+#define PAS_BACKEND_CARD_SEXP_GET_CLASS(k) (G_TYPE_INSTANCE_GET_CLASS ((obj), PAS_TYPE_BACKEND_CARD_SEXP, PASBackendCardSExpClass))
typedef struct _PASBackendCardSExpPrivate PASBackendCardSExpPrivate;
typedef struct {
- GtkObject parent_object;
+ GObject parent_object;
PASBackendCardSExpPrivate *priv;
} PASBackendCardSExp;
typedef struct {
- GtkObjectClass parent_class;
+ GObjectClass parent_class;
} PASBackendCardSExpClass;
PASBackendCardSExp *pas_backend_card_sexp_new (const char *text);
-GtkType pas_backend_card_sexp_get_type (void);
+GType pas_backend_card_sexp_get_type (void);
gboolean pas_backend_card_sexp_match_vcard (PASBackendCardSExp *sexp, const char *vcard);
-#define PAS_BACKEND_CARD_SEXP_TYPE (pas_backend_card_sexp_get_type ())
-#define PAS_BACKEND_CARD_SEXP(o) (GTK_CHECK_CAST ((o), PAS_BACKEND_CARD_SEXP_TYPE, PASBackendCardSExp))
-#define PAS_BACKEND_CARD_SEXP_CLASS(k) (GTK_CHECK_CLASS_CAST((k), PAS_BACKEND_TYPE, PASBackendCardSExpClass))
-#define PAS_IS_BACKEND_CARD_SEXP(o) (GTK_CHECK_TYPE ((o), PAS_BACKEND_CARD_SEXP_TYPE))
-#define PAS_IS_BACKEND_CARD_SEXP_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), PAS_BACKEND_CARD_SEXP_TYPE))
-
#endif /* __PAS_BACKEND_CARD_SEXP_H__ */
diff --git a/addressbook/backend/pas/pas-backend-file.c b/addressbook/backend/pas/pas-backend-file.c
index 492637f99e..0c09f5e325 100644
--- a/addressbook/backend/pas/pas-backend-file.c
+++ b/addressbook/backend/pas/pas-backend-file.c
@@ -10,15 +10,13 @@
#include "pas-backend-file.h"
#include <stdio.h>
+#include <string.h>
#include <unistd.h>
#include <fcntl.h>
#include <time.h>
#include <db.h>
#include <sys/stat.h>
-#include <libgnome/gnome-defs.h>
-#include <libgnome/gnome-i18n.h>
-
#include <e-util/e-db3-utils.h>
#if DB_VERSION_MAJOR != 3 || \
@@ -27,15 +25,14 @@
#error Including wrong DB3. Need libdb 3.1.17.
#endif
-#include <gtk/gtksignal.h>
-#include <libgnome/gnome-defs.h>
-#include <libgnome/gnome-util.h>
#include <gal/util/e-util.h>
#include <gal/widgets/e-unicode.h>
#include <ebook/e-card-simple.h>
#include <e-util/e-dbhash.h>
#include <e-util/e-db3-utils.h>
+#include <libgnome/gnome-i18n.h>
+
#include "pas-book.h"
#include "pas-card-cursor.h"
#include "pas-backend-card-sexp.h"
@@ -214,7 +211,7 @@ pas_backend_file_book_view_copy(const PASBackendFileBookView *book_view, void *c
new_book_view->search = g_strdup(book_view->search);
new_book_view->card_sexp = book_view->card_sexp;
if (new_book_view->card_sexp)
- gtk_object_ref(GTK_OBJECT(new_book_view->card_sexp));
+ g_object_ref(new_book_view->card_sexp);
new_book_view->change_id = g_strdup(book_view->change_id);
if (book_view->change_context) {
@@ -236,7 +233,7 @@ pas_backend_file_book_view_free(PASBackendFileBookView *book_view, void *closure
{
g_free(book_view->search);
if (book_view->card_sexp)
- gtk_object_unref (GTK_OBJECT(book_view->card_sexp));
+ g_object_unref (book_view->card_sexp);
g_free(book_view->change_id);
if (book_view->change_context) {
@@ -274,7 +271,7 @@ get_nth(PASCardCursor *cursor, long n, gpointer data)
}
static void
-cursor_destroy(GtkObject *object, gpointer data)
+cursor_destroy(GObject *object, gpointer data)
{
CORBA_Environment ev;
GNOME_Evolution_Addressbook_Book corba_book;
@@ -300,7 +297,7 @@ cursor_destroy(GtkObject *object, gpointer data)
}
static void
-view_destroy(GtkObject *object, gpointer data)
+view_destroy(GObject *object, gpointer data)
{
PASBook *book = (PASBook *)data;
PASBackendFile *bf;
@@ -318,7 +315,7 @@ view_destroy(GtkObject *object, gpointer data)
}
if (!success)
g_warning ("Failed to remove from book_views list");
- gtk_object_unref(GTK_OBJECT(iterator));
+ g_object_unref(iterator);
bonobo_object_unref(BONOBO_OBJECT(book));
}
@@ -366,7 +363,7 @@ pas_backend_file_search (PASBackendFile *bf,
pas_book_view_notify_status_message (view->book_view, _("Loading..."));
if (view->card_sexp) {
- gtk_object_unref (GTK_OBJECT(view->card_sexp));
+ g_object_unref (view->card_sexp);
view->card_sexp = NULL;
}
@@ -524,9 +521,9 @@ pas_backend_file_changes (PASBackendFile *bf,
* card changing
*/
card = e_card_new (vcard_dbt.data);
- gtk_object_set (GTK_OBJECT (card), "last_use", NULL, "use_score", 0.0, NULL);
+ g_object_set (card, "last_use", NULL, "use_score", 0.0, NULL);
vcard_string = e_card_get_vcard_assume_utf8 (card);
- gtk_object_unref (GTK_OBJECT (card));
+ g_object_unref (card);
/* check what type of change has occurred, if any */
switch (e_dbhash_compare (ehash, id, vcard_string)) {
@@ -636,7 +633,7 @@ do_create(PASBackend *backend,
ret_val = NULL;
}
- gtk_object_unref(GTK_OBJECT(card));
+ g_object_unref(card);
card = NULL;
if (vcard_ptr && ret_val)
@@ -668,7 +665,7 @@ pas_backend_file_process_create_card (PASBackend *backend,
bonobo_object_unref (BONOBO_OBJECT (view->book_view));
}
}
- gtk_object_unref(GTK_OBJECT(iterator));
+ g_object_unref(iterator);
pas_book_respond_create (
book,
@@ -738,7 +735,7 @@ pas_backend_file_process_remove_card (PASBackend *backend,
bonobo_object_unref (BONOBO_OBJECT (view->book_view));
}
}
- gtk_object_unref(GTK_OBJECT(iterator));
+ g_object_unref(iterator);
pas_book_respond_remove (
book,
@@ -822,7 +819,7 @@ pas_backend_file_process_modify_card (PASBackend *backend,
CORBA_exception_free (&ev);
}
- gtk_object_unref(GTK_OBJECT(iterator));
+ g_object_unref(iterator);
pas_book_respond_modify (
book,
@@ -839,7 +836,7 @@ pas_backend_file_process_modify_card (PASBackend *backend,
g_free(old_vcard_string);
- gtk_object_unref(GTK_OBJECT(card));
+ g_object_unref(card);
}
static void
@@ -973,8 +970,8 @@ pas_backend_file_process_get_cursor (PASBackend *backend,
get_nth,
cursor_data);
- gtk_signal_connect(GTK_OBJECT(cursor), "destroy",
- GTK_SIGNAL_FUNC(cursor_destroy), cursor_data);
+ g_signal_connect(cursor, "destroy",
+ G_CALLBACK(cursor_destroy), cursor_data);
pas_book_respond_get_cursor (
book,
@@ -1000,8 +997,8 @@ pas_backend_file_process_get_book_view (PASBackend *backend,
book_view = pas_book_view_new (req->listener);
- gtk_signal_connect(GTK_OBJECT(book_view), "destroy",
- GTK_SIGNAL_FUNC(view_destroy), book);
+ g_signal_connect(book_view, "destroy",
+ G_CALLBACK(view_destroy), book);
view.book_view = book_view;
view.search = g_strdup (req->search);
@@ -1020,7 +1017,7 @@ pas_backend_file_process_get_book_view (PASBackend *backend,
iterator = e_list_get_iterator(bf->priv->book_views);
e_iterator_last(iterator);
pas_backend_file_search (bf, book, e_iterator_get(iterator), FALSE);
- gtk_object_unref(GTK_OBJECT(iterator));
+ g_object_unref(iterator);
}
static void
@@ -1039,8 +1036,8 @@ pas_backend_file_process_get_completion_view (PASBackend *backend,
book_view = pas_book_view_new (req->listener);
- gtk_signal_connect(GTK_OBJECT(book_view), "destroy",
- GTK_SIGNAL_FUNC(view_destroy), book);
+ g_signal_connect(book_view, "destroy",
+ G_CALLBACK(view_destroy), book);
view.book_view = book_view;
view.search = g_strdup (req->search);
@@ -1059,7 +1056,7 @@ pas_backend_file_process_get_completion_view (PASBackend *backend,
iterator = e_list_get_iterator(bf->priv->book_views);
e_iterator_last(iterator);
pas_backend_file_search (bf, book, e_iterator_get(iterator), TRUE);
- gtk_object_unref(GTK_OBJECT(iterator));
+ g_object_unref(iterator);
}
static void
@@ -1079,8 +1076,8 @@ pas_backend_file_process_get_changes (PASBackend *backend,
book_view = pas_book_view_new (req->listener);
- gtk_signal_connect(GTK_OBJECT(book_view), "destroy",
- GTK_SIGNAL_FUNC(view_destroy), book);
+ g_signal_connect(book_view, "destroy",
+ G_CALLBACK(view_destroy), book);
pas_book_respond_get_changes (book,
(book_view != NULL
@@ -1105,7 +1102,7 @@ pas_backend_file_process_get_changes (PASBackend *backend,
iterator = e_list_get_iterator(bf->priv->book_views);
e_iterator_last(iterator);
pas_backend_file_changes (bf, book, e_iterator_get(iterator));
- gtk_object_unref(GTK_OBJECT(iterator));
+ g_object_unref(iterator);
}
static void
@@ -1154,8 +1151,8 @@ pas_backend_file_process_get_supported_fields (PASBackend *backend,
for (i = 0; i < E_CARD_SIMPLE_FIELD_LAST; i ++)
e_list_append (fields, e_card_simple_get_ecard_field (simple, i));
- gtk_object_unref (GTK_OBJECT (card));
- gtk_object_unref (GTK_OBJECT (simple));
+ g_object_unref (card);
+ g_object_unref (simple);
pas_book_respond_get_supported_fields (book,
GNOME_Evolution_Addressbook_BookListener_Success,
@@ -1307,7 +1304,7 @@ pas_backend_file_upgrade_db (PASBackendFile *bf, char *old_version)
card_failed++;
}
- gtk_object_unref (GTK_OBJECT(card));
+ g_object_unref (card);
}
db_error = dbc->c_get(dbc, &id_dbt, &vcard_dbt, DB_NEXT);
@@ -1432,9 +1429,9 @@ pas_backend_file_load_uri (PASBackend *backend,
char *dir;
dir = g_dirname(filename);
- create_initial_file = g_concat_dir_and_file(dir, "create-initial");
+ create_initial_file = g_build_filename (dir, "create-initial", NULL);
- if (g_file_exists(create_initial_file)) {
+ if (g_file_test(create_initial_file, G_FILE_TEST_EXISTS)) {
char *id;
id = do_create(backend, INITIAL_VCARD, NULL);
g_free (id);
@@ -1525,11 +1522,11 @@ pas_backend_file_add_client (PASBackend *backend,
return FALSE;
}
- gtk_signal_connect (GTK_OBJECT (book), "destroy",
- pas_backend_file_book_destroy_cb, backend);
+ g_signal_connect (book, "destroy",
+ G_CALLBACK (pas_backend_file_book_destroy_cb), backend);
- gtk_signal_connect (GTK_OBJECT (book), "requests_queued",
- pas_backend_file_process_client_requests, NULL);
+ g_signal_connect (book, "requests_queued",
+ G_CALLBACK (pas_backend_file_process_client_requests), NULL);
bf->priv->clients = g_list_prepend (
bf->priv->clients, book);
@@ -1613,10 +1610,10 @@ pas_backend_file_new (void)
{
PASBackendFile *backend;
- backend = gtk_type_new (pas_backend_file_get_type ());
+ backend = g_object_new (PAS_TYPE_BACKEND_FILE, NULL);
if (! pas_backend_file_construct (backend)) {
- gtk_object_unref (GTK_OBJECT (backend));
+ g_object_unref (backend);
return NULL;
}
@@ -1625,29 +1622,29 @@ pas_backend_file_new (void)
}
static void
-pas_backend_file_destroy (GtkObject *object)
+pas_backend_file_dispose (GObject *object)
{
PASBackendFile *bf;
bf = PAS_BACKEND_FILE (object);
- gtk_object_unref(GTK_OBJECT(bf->priv->book_views));
- gtk_object_unref(GTK_OBJECT(bf->priv->summary));
+ g_object_unref(bf->priv->book_views);
+ g_object_unref(bf->priv->summary);
g_free (bf->priv->uri);
g_free (bf->priv->filename);
g_free (bf->priv);
- GTK_OBJECT_CLASS (pas_backend_file_parent_class)->destroy (object);
+ G_OBJECT_CLASS (pas_backend_file_parent_class)->dispose (object);
}
static void
pas_backend_file_class_init (PASBackendFileClass *klass)
{
- GtkObjectClass *object_class = (GtkObjectClass *) klass;
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
PASBackendClass *parent_class;
- pas_backend_file_parent_class = gtk_type_class (pas_backend_get_type ());
+ pas_backend_file_parent_class = g_type_class_ref (PAS_TYPE_BACKEND);
parent_class = PAS_BACKEND_CLASS (klass);
@@ -1658,7 +1655,7 @@ pas_backend_file_class_init (PASBackendFileClass *klass)
parent_class->remove_client = pas_backend_file_remove_client;
parent_class->get_static_capabilities = pas_backend_file_get_static_capabilities;
- object_class->destroy = pas_backend_file_destroy;
+ object_class->dispose = pas_backend_file_dispose;
}
static void
@@ -1679,24 +1676,25 @@ pas_backend_file_init (PASBackendFile *backend)
/**
* pas_backend_file_get_type:
*/
-GtkType
+GType
pas_backend_file_get_type (void)
{
- static GtkType type = 0;
+ static GType type = 0;
if (! type) {
- GtkTypeInfo info = {
- "PASBackendFile",
- sizeof (PASBackendFile),
+ GTypeInfo info = {
sizeof (PASBackendFileClass),
- (GtkClassInitFunc) pas_backend_file_class_init,
- (GtkObjectInitFunc) pas_backend_file_init,
- NULL, /* reserved 1 */
- NULL, /* reserved 2 */
- (GtkClassInitFunc) NULL
+ NULL, /* base_class_init */
+ NULL, /* base_class_finalize */
+ (GClassInitFunc) pas_backend_file_class_init,
+ NULL, /* class_finalize */
+ NULL, /* class_data */
+ sizeof (PASBackendFile),
+ 0, /* n_preallocs */
+ (GInstanceInitFunc) pas_backend_file_init
};
- type = gtk_type_unique (pas_backend_get_type (), &info);
+ type = g_type_register_static (PAS_TYPE_BACKEND, "PASBackendFile", &info, 0);
}
return type;
diff --git a/addressbook/backend/pas/pas-backend-file.h b/addressbook/backend/pas/pas-backend-file.h
index 6c29c8b7a2..fd98d2cdd5 100644
--- a/addressbook/backend/pas/pas-backend-file.h
+++ b/addressbook/backend/pas/pas-backend-file.h
@@ -5,9 +5,15 @@
#ifndef __PAS_BACKEND_FILE_H__
#define __PAS_BACKEND_FILE_H__
-#include <libgnome/gnome-defs.h>
#include "pas-backend.h"
+#define PAS_TYPE_BACKEND_FILE (pas_backend_file_get_type ())
+#define PAS_BACKEND_FILE(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), PAS_TYPE_BACKEND_FILE, PASBackendFile))
+#define PAS_BACKEND_FILE_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), PAS_BACKEND_TYPE, PASBackendFileClass))
+#define PAS_IS_BACKEND_FILE(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), PAS_TYPE_BACKEND_FILE))
+#define PAS_IS_BACKEND_FILE_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), PAS_TYPE_BACKEND_FILE))
+#define PAS_BACKEND_FILE_GET_CLASS(k) (G_TYPE_INSTANCE_GET_CLASS ((obj), PAS_TYPE_BACKEND_FILE, PASBackendFileClass))
+
typedef struct _PASBackendFilePrivate PASBackendFilePrivate;
typedef struct {
@@ -20,13 +26,7 @@ typedef struct {
} PASBackendFileClass;
PASBackend *pas_backend_file_new (void);
-GtkType pas_backend_file_get_type (void);
-
-#define PAS_BACKEND_FILE_TYPE (pas_backend_file_get_type ())
-#define PAS_BACKEND_FILE(o) (GTK_CHECK_CAST ((o), PAS_BACKEND_FILE_TYPE, PASBackendFile))
-#define PAS_BACKEND_FILE_CLASS(k) (GTK_CHECK_CLASS_CAST((k), PAS_BACKEND_TYPE, PASBackendFileClass))
-#define PAS_IS_BACKEND_FILE(o) (GTK_CHECK_TYPE ((o), PAS_BACKEND_FILE_TYPE))
-#define PAS_IS_BACKEND_FILE_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), PAS_BACKEND_FILE_TYPE))
+GType pas_backend_file_get_type (void);
#endif /* ! __PAS_BACKEND_FILE_H__ */
diff --git a/addressbook/backend/pas/pas-backend-ldap.c b/addressbook/backend/pas/pas-backend-ldap.c
index 00dc5df4a2..f7442cdf2d 100644
--- a/addressbook/backend/pas/pas-backend-ldap.c
+++ b/addressbook/backend/pas/pas-backend-ldap.c
@@ -10,10 +10,7 @@
#include "config.h"
#include <fcntl.h>
-#include <gtk/gtksignal.h>
-
-#include <libgnome/gnome-defs.h>
-#include <libgnome/gnome-i18n.h>
+#include <string.h>
#ifdef DEBUG
#define LDAP_DEBUG
@@ -38,6 +35,7 @@
#include <e-util/e-sexp.h>
#include <ebook/e-card-simple.h>
+#include <libgnome/gnome-i18n.h>
#include "pas-backend-ldap.h"
#include "pas-backend-card-sexp.h"
@@ -293,7 +291,7 @@ remove_view (int msgid, LDAPOp *op, PASBookView *view)
}
static void
-view_destroy(GtkObject *object, gpointer data)
+view_destroy(GObject *object, gpointer data)
{
PASBook *book = (PASBook *)data;
PASBackendLDAP *bl;
@@ -321,7 +319,7 @@ view_destroy(GtkObject *object, gpointer data)
/* free up the view structure */
g_free (view->search);
- gtk_object_unref (GTK_OBJECT (view->card_sexp));
+ g_object_unref (view->card_sexp);
g_free (view);
/* and remove it from our list */
@@ -346,7 +344,7 @@ view_destroy(GtkObject *object, gpointer data)
e_iterator_next (iter);
}
- gtk_object_unref (GTK_OBJECT (iter));
+ g_object_unref (iter);
}
@@ -371,7 +369,7 @@ find_book_view (PASBackendLDAP *bl)
rv = v->book_view;
}
- gtk_object_unref (GTK_OBJECT (iter));
+ g_object_unref (iter);
return rv;
}
@@ -1106,7 +1104,7 @@ create_card_handler (LDAPOp *op, LDAPMessage *res)
e_iterator_next (iter);
}
- gtk_object_unref (GTK_OBJECT (iter));
+ g_object_unref (iter);
}
else {
ldap_perror (ldap, "create_card");
@@ -1130,7 +1128,7 @@ create_card_dtor (LDAPOp *op)
LDAPCreateOp *create_op = (LDAPCreateOp*)op;
g_free (create_op->dn);
- gtk_object_unref (GTK_OBJECT (create_op->new_card));
+ g_object_unref (create_op->new_card);
g_free (create_op);
}
@@ -1174,7 +1172,7 @@ pas_backend_ldap_process_create_card (PASBackend *backend,
create_op->dn);
g_free (create_op->dn);
- gtk_object_unref (GTK_OBJECT(create_op->new_card));
+ g_object_unref (create_op->new_card);
g_free (create_op);
return;
}
@@ -1295,7 +1293,7 @@ remove_card_handler (LDAPOp *op, LDAPMessage *res)
e_iterator_next (iter);
}
- gtk_object_unref (GTK_OBJECT (iter));
+ g_object_unref (iter);
}
else {
ldap_perror (bl->priv->ldap, "remove_card");
@@ -1423,7 +1421,7 @@ modify_card_modify_handler (LDAPOp *op, LDAPMessage *res)
e_iterator_next (iter);
}
- gtk_object_unref (GTK_OBJECT (iter));
+ g_object_unref (iter);
}
else {
ldap_perror (ldap, "ldap_modify_s");
@@ -1539,10 +1537,10 @@ modify_card_dtor (LDAPOp *op)
g_list_free (modify_op->existing_objectclasses);
g_free (modify_op->current_vcard);
if (modify_op->current_card)
- gtk_object_unref (GTK_OBJECT (modify_op->current_card));
+ g_object_unref (modify_op->current_card);
g_free (modify_op->vcard);
if (modify_op->card)
- gtk_object_unref (GTK_OBJECT (modify_op->card));
+ g_object_unref (modify_op->card);
g_free (modify_op);
}
@@ -1564,7 +1562,7 @@ pas_backend_ldap_process_modify_card (PASBackend *backend,
modify_op->vcard = g_strdup (req->modify.vcard);
new_ecard = e_card_new (modify_op->vcard);
modify_op->card = e_card_simple_new (new_ecard);
- gtk_object_unref (GTK_OBJECT (new_ecard));
+ g_object_unref (new_ecard);
modify_op->id = e_card_simple_get_id(modify_op->card);
ldap = bl->priv->ldap;
@@ -1631,7 +1629,7 @@ get_vcard_handler (LDAPOp *op, LDAPMessage *res)
GNOME_Evolution_Addressbook_BookListener_Success,
vcard);
g_free (vcard);
- gtk_object_unref (GTK_OBJECT (simple));
+ g_object_unref (simple);
ldap_op_finished (op);
}
else if (msg_type == LDAP_RES_SEARCH_RESULT) {
@@ -1720,7 +1718,7 @@ get_nth(PASCardCursor *cursor, long n, gpointer data)
}
static void
-cursor_destroy(GtkObject *object, gpointer data)
+cursor_destroy(GObject *object, gpointer data)
{
PASBackendLDAPCursorPrivate *cursor_data = (PASBackendLDAPCursorPrivate *) data;
@@ -1771,7 +1769,7 @@ get_cursor_handler (LDAPOp *op, LDAPMessage *res)
cursor_op->cursor_data->num_elements ++;
cursor_op->cursor_data->elements = g_list_prepend (cursor_op->cursor_data->elements,
vcard);
- gtk_object_unref (GTK_OBJECT (simple));
+ g_object_unref (simple);
}
}
}
@@ -1786,8 +1784,8 @@ get_cursor_handler (LDAPOp *op, LDAPMessage *res)
get_nth,
cursor_op->cursor_data);
- gtk_signal_connect(GTK_OBJECT(cursor), "destroy",
- GTK_SIGNAL_FUNC(cursor_destroy), cursor_op->cursor_data);
+ g_signal_connect(cursor, "destroy",
+ G_CALLBACK(cursor_destroy), cursor_op->cursor_data);
cursor_op->responded = TRUE;
}
@@ -2089,9 +2087,9 @@ anniversary_populate (ECardSimple *card, char **values)
{
if (values[0]) {
ECardDate dt = e_card_date_from_string (values[0]);
- gtk_object_set (GTK_OBJECT (card->card),
- "anniversary", &dt,
- NULL);
+ g_object_set (card->card,
+ "anniversary", &dt,
+ NULL);
}
}
@@ -2101,9 +2099,9 @@ anniversary_ber (ECardSimple *card)
ECardDate *dt;
struct berval** result = NULL;
- gtk_object_get (GTK_OBJECT (card->card),
- "anniversary", &dt,
- NULL);
+ g_object_get (card->card,
+ "anniversary", &dt,
+ NULL);
if (dt) {
char *anniversary;
@@ -2128,15 +2126,15 @@ anniversary_compare (ECardSimple *ecard1, ECardSimple *ecard2)
char *date1 = NULL, *date2 = NULL;
gboolean equal;
- gtk_object_get (GTK_OBJECT (ecard1->card),
- "anniversary", &dt,
- NULL);
+ g_object_get (ecard1->card,
+ "anniversary", &dt,
+ NULL);
if (dt)
date1 = e_card_date_to_string (dt);
- gtk_object_get (GTK_OBJECT (ecard2->card),
- "anniversary", &dt,
- NULL);
+ g_object_get (ecard2->card,
+ "anniversary", &dt,
+ NULL);
if (dt)
date2 = e_card_date_to_string (dt);
@@ -2156,9 +2154,9 @@ birthday_populate (ECardSimple *card, char **values)
{
if (values[0]) {
ECardDate dt = e_card_date_from_string (values[0]);
- gtk_object_set (GTK_OBJECT (card->card),
- "birth_date", &dt,
- NULL);
+ g_object_set (card->card,
+ "birth_date", &dt,
+ NULL);
}
}
@@ -2168,9 +2166,9 @@ birthday_ber (ECardSimple *card)
ECardDate *dt;
struct berval** result = NULL;
- gtk_object_get (GTK_OBJECT (card->card),
- "birth_date", &dt,
- NULL);
+ g_object_get (card->card,
+ "birth_date", &dt,
+ NULL);
if (dt) {
char *birthday;
@@ -2195,15 +2193,15 @@ birthday_compare (ECardSimple *ecard1, ECardSimple *ecard2)
char *date1 = NULL, *date2 = NULL;
gboolean equal;
- gtk_object_get (GTK_OBJECT (ecard1->card),
- "birth_date", &dt,
- NULL);
+ g_object_get (ecard1->card,
+ "birth_date", &dt,
+ NULL);
if (dt)
date1 = e_card_date_to_string (dt);
- gtk_object_get (GTK_OBJECT (ecard2->card),
- "birth_date", &dt,
- NULL);
+ g_object_get (ecard2->card,
+ "birth_date", &dt,
+ NULL);
if (dt)
date2 = e_card_date_to_string (dt);
@@ -2225,9 +2223,9 @@ category_populate (ECardSimple *card, char **values)
ECard *ecard;
EList *categories;
- gtk_object_get (GTK_OBJECT (card),
- "card", &ecard,
- NULL);
+ g_object_get (card,
+ "card", &ecard,
+ NULL);
categories = e_list_new((EListCopyFunc) g_strdup,
(EListFreeFunc) g_free,
@@ -2236,11 +2234,11 @@ category_populate (ECardSimple *card, char **values)
for (i = 0; values[i]; i++)
e_list_append (categories, values[i]);
- gtk_object_set (GTK_OBJECT (ecard),
- "category_list", categories,
- NULL);
+ g_object_set (ecard,
+ "category_list", categories,
+ NULL);
- gtk_object_unref (GTK_OBJECT (categories));
+ g_object_unref (categories);
e_card_simple_sync_card (card);
}
@@ -2254,13 +2252,13 @@ category_ber (ECardSimple *card)
ECard *ecard;
int i;
- gtk_object_get (GTK_OBJECT (card),
- "card", &ecard,
- NULL);
+ g_object_get (card,
+ "card", &ecard,
+ NULL);
- gtk_object_get (GTK_OBJECT (ecard),
- "category_list", &categories,
- NULL);
+ g_object_get (ecard,
+ "category_list", &categories,
+ NULL);
if (e_list_length (categories) != 0) {
result = g_new0 (struct berval*, e_list_length (categories) + 1);
@@ -2274,7 +2272,7 @@ category_ber (ECardSimple *card)
result[i]->bv_len = strlen (category);
}
- gtk_object_unref (GTK_OBJECT (iterator));
+ g_object_unref (iterator);
}
return result;
@@ -2740,7 +2738,7 @@ build_card_from_entry (LDAP *ldap, LDAPMessage *e, GList **existing_objectclasse
}
else if (info->prop_type & PROP_TYPE_COMPLEX) {
/* if it's a list call the ecard-populate function,
- which calls gtk_object_set to set the property */
+ which calls g_object_set to set the property */
info->populate_ecard_func(card,
values);
}
@@ -2758,7 +2756,7 @@ build_card_from_entry (LDAP *ldap, LDAPMessage *e, GList **existing_objectclasse
e_card_simple_sync_card (card);
- gtk_object_unref (GTK_OBJECT (ecard));
+ g_object_unref (ecard);
return card;
}
@@ -2824,7 +2822,7 @@ poll_ldap (PASBackendLDAP *bl)
}
e_iterator_next (iter);
}
- gtk_object_unref (GTK_OBJECT (iter));
+ g_object_unref (iter);
return TRUE;
}
@@ -2900,7 +2898,7 @@ ldap_search_handler (LDAPOp *op, LDAPMessage *res)
e_card_simple_get_vcard_assume_utf8 (card));
search_op->num_pending_adds ++;
- gtk_object_unref (GTK_OBJECT(card));
+ g_object_unref (card);
e = ldap_next_entry(ldap, e);
}
@@ -3039,8 +3037,8 @@ pas_backend_ldap_process_get_book_view (PASBackend *backend,
book_view = pas_book_view_new (req->get_book_view.listener);
bonobo_object_ref(BONOBO_OBJECT(book));
- gtk_signal_connect(GTK_OBJECT(book_view), "destroy",
- GTK_SIGNAL_FUNC(view_destroy), book);
+ g_signal_connect(book_view, "destroy",
+ G_CALLBACK (view_destroy), book);
view = g_new0(PASBackendLDAPBookView, 1);
view->book_view = book_view;
@@ -3336,11 +3334,11 @@ pas_backend_ldap_add_client (PASBackend *backend,
return FALSE;
}
- gtk_signal_connect (GTK_OBJECT (book), "destroy",
- pas_backend_ldap_book_destroy_cb, backend);
+ g_signal_connect (book, "destroy",
+ G_CALLBACK (pas_backend_ldap_book_destroy_cb), backend);
- gtk_signal_connect (GTK_OBJECT (book), "requests_queued",
- pas_backend_ldap_process_client_requests, NULL);
+ g_signal_connect (book, "requests_queued",
+ G_CALLBACK (pas_backend_ldap_process_client_requests), NULL);
bl->priv->clients = g_list_prepend (
bl->priv->clients, book);
@@ -3409,10 +3407,10 @@ pas_backend_ldap_new (void)
{
PASBackendLDAP *backend;
- backend = gtk_type_new (pas_backend_ldap_get_type ());
+ backend = g_object_new (PAS_TYPE_BACKEND_LDAP, NULL);
if (! pas_backend_ldap_construct (backend)) {
- gtk_object_unref (GTK_OBJECT (backend));
+ g_object_unref (backend);
return NULL;
}
@@ -3431,7 +3429,7 @@ call_dtor (int msgid, LDAPOp *op, gpointer data)
}
static void
-pas_backend_ldap_destroy (GtkObject *object)
+pas_backend_ldap_dispose (GObject *object)
{
PASBackendLDAP *bl;
@@ -3445,26 +3443,26 @@ pas_backend_ldap_destroy (GtkObject *object)
g_source_remove (bl->priv->poll_timeout);
}
- gtk_object_unref (GTK_OBJECT (bl->priv->book_views));
+ g_object_unref (bl->priv->book_views);
if (bl->priv->supported_fields)
- gtk_object_unref (GTK_OBJECT (bl->priv->supported_fields));
+ g_object_unref (bl->priv->supported_fields);
g_free (bl->priv->uri);
- GTK_OBJECT_CLASS (pas_backend_ldap_parent_class)->destroy (object);
+ G_OBJECT_CLASS (pas_backend_ldap_parent_class)->dispose (object);
}
static void
pas_backend_ldap_class_init (PASBackendLDAPClass *klass)
{
- GtkObjectClass *object_class = (GtkObjectClass *) klass;
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
PASBackendClass *parent_class;
/* get client side information (extensions present in the library) */
get_ldap_library_info ();
- pas_backend_ldap_parent_class = gtk_type_class (pas_backend_get_type ());
+ pas_backend_ldap_parent_class = g_type_class_ref (PAS_TYPE_BACKEND);
parent_class = PAS_BACKEND_CLASS (klass);
@@ -3475,7 +3473,7 @@ pas_backend_ldap_class_init (PASBackendLDAPClass *klass)
parent_class->remove_client = pas_backend_ldap_remove_client;
parent_class->get_static_capabilities = pas_backend_ldap_get_static_capabilities;
- object_class->destroy = pas_backend_ldap_destroy;
+ object_class->dispose = pas_backend_ldap_dispose;
}
static void
@@ -3497,24 +3495,25 @@ pas_backend_ldap_init (PASBackendLDAP *backend)
/**
* pas_backend_ldap_get_type:
*/
-GtkType
+GType
pas_backend_ldap_get_type (void)
{
- static GtkType type = 0;
+ static GType type = 0;
if (! type) {
- GtkTypeInfo info = {
- "PASBackendLDAP",
- sizeof (PASBackendLDAP),
+ GTypeInfo info = {
sizeof (PASBackendLDAPClass),
- (GtkClassInitFunc) pas_backend_ldap_class_init,
- (GtkObjectInitFunc) pas_backend_ldap_init,
- NULL, /* reserved 1 */
- NULL, /* reserved 2 */
- (GtkClassInitFunc) NULL
+ NULL, /* base_class_init */
+ NULL, /* base_class_finalize */
+ (GClassInitFunc) pas_backend_ldap_class_init,
+ NULL, /* class_finalize */
+ NULL, /* class_data */
+ sizeof (PASBackendLDAP),
+ 0, /* n_preallocs */
+ (GInstanceInitFunc) pas_backend_ldap_init
};
- type = gtk_type_unique (pas_backend_get_type (), &info);
+ type = g_type_register_static (PAS_TYPE_BACKEND, "PASBackendLDAP", &info, 0);
}
return type;
diff --git a/addressbook/backend/pas/pas-backend-ldap.h b/addressbook/backend/pas/pas-backend-ldap.h
index 9f32c58bbf..ca04ee6a21 100644
--- a/addressbook/backend/pas/pas-backend-ldap.h
+++ b/addressbook/backend/pas/pas-backend-ldap.h
@@ -5,9 +5,15 @@
#ifndef __PAS_BACKEND_LDAP_H__
#define __PAS_BACKEND_LDAP_H__
-#include <libgnome/gnome-defs.h>
#include "pas-backend.h"
+#define PAS_TYPE_BACKEND_LDAP (pas_backend_ldap_get_type ())
+#define PAS_BACKEND_LDAP(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), PAS_TYPE_BACKEND_LDAP, PASBackendLDAP))
+#define PAS_BACKEND_LDAP_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), PAS_BACKEND_TYPE, PASBackendLDAPClass))
+#define PAS_IS_BACKEND_LDAP(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), PAS_TYPE_BACKEND_LDAP))
+#define PAS_IS_BACKEND_LDAP_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), PAS_TYPE_BACKEND_LDAP))
+#define PAS_BACKEND_LDAP_GET_CLASS(k) (G_TYPE_INSTANCE_GET_CLASS ((obj), PAS_TYPE_BACKEND_LDAP, PASBackendLDAPClass))
+
typedef struct _PASBackendLDAPPrivate PASBackendLDAPPrivate;
typedef struct {
@@ -20,13 +26,7 @@ typedef struct {
} PASBackendLDAPClass;
PASBackend *pas_backend_ldap_new (void);
-GtkType pas_backend_ldap_get_type (void);
-
-#define PAS_BACKEND_LDAP_TYPE (pas_backend_ldap_get_type ())
-#define PAS_BACKEND_LDAP(o) (GTK_CHECK_CAST ((o), PAS_BACKEND_LDAP_TYPE, PASBackendLDAP))
-#define PAS_BACKEND_LDAP_CLASS(k) (GTK_CHECK_CLASS_CAST((k), PAS_BACKEND_TYPE, PASBackendLDAPClass))
-#define PAS_IS_BACKEND_LDAP(o) (GTK_CHECK_TYPE ((o), PAS_BACKEND_LDAP_TYPE))
-#define PAS_IS_BACKEND_LDAP_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), PAS_BACKEND_LDAP_TYPE))
+GType pas_backend_ldap_get_type (void);
#endif /* ! __PAS_BACKEND_LDAP_H__ */
diff --git a/addressbook/backend/pas/pas-backend-summary.c b/addressbook/backend/pas/pas-backend-summary.c
index fb91718b9b..9161ef7ffb 100644
--- a/addressbook/backend/pas/pas-backend-summary.c
+++ b/addressbook/backend/pas/pas-backend-summary.c
@@ -37,7 +37,7 @@
#include "pas-backend-summary.h"
#include "e-util/e-sexp.h"
-static GtkObjectClass *parent_class;
+static GObjectClass *parent_class;
struct _PASBackendSummaryPrivate {
char *summary_path;
@@ -136,7 +136,7 @@ clear_items (PASBackendSummary *summary)
PASBackendSummary*
pas_backend_summary_new (const char *summary_path, int flush_timeout_millis)
{
- PASBackendSummary *summary = gtk_type_new (PAS_BACKEND_SUMMARY_TYPE);
+ PASBackendSummary *summary = g_object_new (PAS_TYPE_BACKEND_SUMMARY, NULL);
summary->priv->summary_path = g_strdup (summary_path);
summary->priv->flush_timeout_millis = flush_timeout_millis;
@@ -146,7 +146,7 @@ pas_backend_summary_new (const char *summary_path, int flush_timeout_millis)
}
static void
-pas_backend_summary_destroy (GtkObject *object)
+pas_backend_summary_dispose (GObject *object)
{
PASBackendSummary *summary = PAS_BACKEND_SUMMARY (object);
@@ -154,7 +154,7 @@ pas_backend_summary_destroy (GtkObject *object)
g_warning ("Destroying dirty summary");
if (summary->priv->flush_timeout) {
- gtk_timeout_remove (summary->priv->flush_timeout);
+ g_source_remove (summary->priv->flush_timeout);
summary->priv->flush_timeout = 0;
}
@@ -169,19 +169,19 @@ pas_backend_summary_destroy (GtkObject *object)
g_free (summary->priv);
- GTK_OBJECT_CLASS (parent_class)->destroy (object);
+ G_OBJECT_CLASS (parent_class)->dispose (object);
}
static void
pas_backend_summary_class_init (PASBackendSummaryClass *klass)
{
- GtkObjectClass *object_class = (GtkObjectClass *) klass;
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
- parent_class = gtk_type_class (gtk_object_get_type ());
+ parent_class = g_type_class_ref (G_TYPE_OBJECT);
/* Set the virtual methods. */
- object_class->destroy = pas_backend_summary_destroy;
+ object_class->dispose = pas_backend_summary_dispose;
}
static void
@@ -209,24 +209,25 @@ pas_backend_summary_init (PASBackendSummary *summary)
/**
* pas_backend_summary_get_type:
*/
-GtkType
+GType
pas_backend_summary_get_type (void)
{
- static GtkType type = 0;
+ static GType type = 0;
if (! type) {
- GtkTypeInfo info = {
- "PASBackendSummary",
- sizeof (PASBackendSummary),
+ GTypeInfo info = {
sizeof (PASBackendSummaryClass),
- (GtkClassInitFunc) pas_backend_summary_class_init,
- (GtkObjectInitFunc) pas_backend_summary_init,
- NULL, /* reserved 1 */
- NULL, /* reserved 2 */
- (GtkClassInitFunc) NULL
+ NULL, /* base_class_init */
+ NULL, /* base_class_finalize */
+ (GClassInitFunc) pas_backend_summary_class_init,
+ NULL, /* class_finalize */
+ NULL, /* class_data */
+ sizeof (PASBackendSummary),
+ 0, /* n_preallocs */
+ (GInstanceInitFunc) pas_backend_summary_init
};
- type = gtk_type_unique (gtk_object_get_type (), &info);
+ type = g_type_register_static (G_TYPE_OBJECT, "PASBackendSummary", &info, 0);
}
return type;
@@ -654,7 +655,7 @@ pas_backend_summary_save (PASBackendSummary *summary)
/* if we have a queued flush, clear it (since we just flushed) */
if (summary->priv->flush_timeout) {
- gtk_timeout_remove (summary->priv->flush_timeout);
+ g_source_remove (summary->priv->flush_timeout);
summary->priv->flush_timeout = 0;
}
@@ -712,8 +713,8 @@ pas_backend_summary_add_card (PASBackendSummary *summary, const char *vcard)
g_ptr_array_add (summary->priv->items, new_item);
g_hash_table_insert (summary->priv->id_to_item, new_item->id, new_item);
- gtk_object_unref (GTK_OBJECT (simple));
- gtk_object_unref (GTK_OBJECT (card));
+ g_object_unref (simple);
+ g_object_unref (card);
#ifdef SUMMARY_STATS
summary->priv->size += sizeof (PASBackendSummaryItem);
@@ -746,7 +747,7 @@ pas_backend_summary_remove_card (PASBackendSummary *summary, const char *id)
g_warning ("pas_backend_summary_remove_card: unable to locate id `%s'", id);
}
-static int
+static gboolean
summary_flush_func (gpointer data)
{
PASBackendSummary *summary = PAS_BACKEND_SUMMARY (data);
@@ -778,8 +779,8 @@ pas_backend_summary_touch (PASBackendSummary *summary)
summary->priv->dirty = TRUE;
if (!summary->priv->flush_timeout
&& summary->priv->flush_timeout_millis)
- summary->priv->flush_timeout = gtk_timeout_add (summary->priv->flush_timeout_millis,
- summary_flush_func, summary);
+ summary->priv->flush_timeout = g_timeout_add (summary->priv->flush_timeout_millis,
+ summary_flush_func, summary);
}
gboolean
@@ -1074,8 +1075,8 @@ pas_backend_summary_get_summary_vcard(PASBackendSummary *summary, const char *id
vcard = e_card_simple_get_vcard (simple);
- gtk_object_unref (GTK_OBJECT (simple));
- gtk_object_unref (GTK_OBJECT (card));
+ g_object_unref (simple);
+ g_object_unref (card);
return vcard;
}
diff --git a/addressbook/backend/pas/pas-backend-summary.h b/addressbook/backend/pas/pas-backend-summary.h
index 96f069652e..54083855d5 100644
--- a/addressbook/backend/pas/pas-backend-summary.h
+++ b/addressbook/backend/pas/pas-backend-summary.h
@@ -24,22 +24,30 @@
#ifndef __PAS_BACKEND_SUMMARY_H__
#define __PAS_BACKEND_SUMMARY_H__
-#include <gtk/gtk.h>
+#include <glib.h>
+#include <glib-object.h>
+
+#define PAS_TYPE_BACKEND_SUMMARY (pas_backend_summary_get_type ())
+#define PAS_BACKEND_SUMMARY(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), PAS_TYPE_BACKEND_SUMMARY, PASBackendSummary))
+#define PAS_BACKEND_SUMMARY_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), PAS_BACKEND_TYPE, PASBackendSummaryClass))
+#define PAS_IS_BACKEND_SUMMARY(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), PAS_TYPE_BACKEND_SUMMARY))
+#define PAS_IS_BACKEND_SUMMARY_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), PAS_TYPE_BACKEND_SUMMARY))
+#define PAS_BACKEND_SUMMARY_GET_CLASS(k) (G_TYPE_INSTANCE_GET_CLASS ((obj), PAS_TYPE_BACKEND_SUMMARY, PASBackendSummaryClass))
typedef struct _PASBackendSummaryPrivate PASBackendSummaryPrivate;
typedef struct {
- GtkObject parent_object;
+ GObject parent_object;
PASBackendSummaryPrivate *priv;
} PASBackendSummary;
typedef struct {
- GtkObjectClass parent_class;
+ GObjectClass parent_class;
} PASBackendSummaryClass;
PASBackendSummary* pas_backend_summary_new (const char *summary_path,
int flush_timeout_millis);
-GtkType pas_backend_summary_get_type (void);
+GType pas_backend_summary_get_type (void);
/* returns FALSE if the load fails for any reason (including that the
summary is out of date), TRUE if it succeeds */
@@ -59,10 +67,4 @@ gboolean pas_backend_summary_is_summary_query (PASBackendSummary *sum
GPtrArray* pas_backend_summary_search (PASBackendSummary *summary, const char *query);
char* pas_backend_summary_get_summary_vcard (PASBackendSummary *summary, const char *id);
-#define PAS_BACKEND_SUMMARY_TYPE (pas_backend_summary_get_type ())
-#define PAS_BACKEND_SUMMARY(o) (GTK_CHECK_CAST ((o), PAS_BACKEND_SUMMARY_TYPE, PASBackendSummary))
-#define PAS_BACKEND_SUMMARY_CLASS(k) (GTK_CHECK_CLASS_CAST((k), PAS_BACKEND_TYPE, PASBackendSummaryClass))
-#define PAS_IS_BACKEND_SUMMARY(o) (GTK_CHECK_TYPE ((o), PAS_BACKEND_SUMMARY_TYPE))
-#define PAS_IS_BACKEND_SUMMARY_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), PAS_BACKEND_SUMMARY_TYPE))
-
#endif /* __PAS_BACKEND_SUMMARY_H__ */
diff --git a/addressbook/backend/pas/pas-backend.c b/addressbook/backend/pas/pas-backend.c
index a17e014002..6d64ba938b 100644
--- a/addressbook/backend/pas/pas-backend.c
+++ b/addressbook/backend/pas/pas-backend.c
@@ -7,11 +7,8 @@
*/
#include <config.h>
-#include <gtk/gtkobject.h>
-#include <gtk/gtksignal.h>
#include "pas-backend.h"
-
-#define CLASS(o) PAS_BACKEND_CLASS (GTK_OBJECT (o)->klass)
+#include "pas-marshal.h"
/* Signal IDs */
enum {
@@ -36,9 +33,9 @@ pas_backend_load_uri (PASBackend *backend,
g_return_val_if_fail (PAS_IS_BACKEND (backend), FALSE);
g_return_val_if_fail (uri != NULL, FALSE);
- g_assert (CLASS (backend)->load_uri != NULL);
+ g_assert (PAS_BACKEND_GET_CLASS (backend)->load_uri != NULL);
- return (* CLASS (backend)->load_uri) (backend, uri);
+ return (* PAS_BACKEND_GET_CLASS (backend)->load_uri) (backend, uri);
}
/**
@@ -55,9 +52,9 @@ pas_backend_get_uri (PASBackend *backend)
g_return_val_if_fail (backend != NULL, NULL);
g_return_val_if_fail (PAS_IS_BACKEND (backend), NULL);
- g_assert (CLASS (backend)->get_uri != NULL);
+ g_assert (PAS_BACKEND_GET_CLASS (backend)->get_uri != NULL);
- return (* CLASS (backend)->get_uri) (backend);
+ return (* PAS_BACKEND_GET_CLASS (backend)->get_uri) (backend);
}
/**
@@ -77,9 +74,9 @@ pas_backend_add_client (PASBackend *backend,
g_return_val_if_fail (PAS_IS_BACKEND (backend), FALSE);
g_return_val_if_fail (listener != CORBA_OBJECT_NIL, FALSE);
- g_assert (CLASS (backend)->add_client != NULL);
+ g_assert (PAS_BACKEND_GET_CLASS (backend)->add_client != NULL);
- return CLASS (backend)->add_client (backend, listener);
+ return PAS_BACKEND_GET_CLASS (backend)->add_client (backend, listener);
}
void
@@ -91,9 +88,9 @@ pas_backend_remove_client (PASBackend *backend,
g_return_if_fail (book != NULL);
g_return_if_fail (PAS_IS_BOOK (book));
- g_assert (CLASS (backend)->remove_client != NULL);
+ g_assert (PAS_BACKEND_GET_CLASS (backend)->remove_client != NULL);
- CLASS (backend)->remove_client (backend, book);
+ PAS_BACKEND_GET_CLASS (backend)->remove_client (backend, book);
}
char *
@@ -102,9 +99,9 @@ pas_backend_get_static_capabilities (PASBackend *backend)
g_return_val_if_fail (backend != NULL, NULL);
g_return_val_if_fail (PAS_IS_BACKEND (backend), NULL);
- g_assert (CLASS (backend)->get_static_capabilities != NULL);
+ g_assert (PAS_BACKEND_GET_CLASS (backend)->get_static_capabilities != NULL);
- return CLASS (backend)->get_static_capabilities (backend);
+ return PAS_BACKEND_GET_CLASS (backend)->get_static_capabilities (backend);
}
/**
@@ -121,7 +118,7 @@ pas_backend_last_client_gone (PASBackend *backend)
g_return_if_fail (backend != NULL);
g_return_if_fail (PAS_IS_BACKEND (backend));
- gtk_signal_emit (GTK_OBJECT (backend), pas_backend_signals[LAST_CLIENT_GONE]);
+ g_signal_emit (backend, pas_backend_signals[LAST_CLIENT_GONE], 0);
}
static void
@@ -132,46 +129,46 @@ pas_backend_init (PASBackend *backend)
static void
pas_backend_class_init (PASBackendClass *klass)
{
- GtkObjectClass *object_class;
-
- object_class = (GtkObjectClass *) klass;
-
- pas_backend_signals[LAST_CLIENT_GONE] =
- gtk_signal_new ("last_client_gone",
- GTK_RUN_FIRST,
- object_class->type,
- GTK_SIGNAL_OFFSET (PASBackendClass, last_client_gone),
- gtk_marshal_NONE__NONE,
- GTK_TYPE_NONE, 0);
+ GObjectClass *object_class;
- gtk_object_class_add_signals (object_class, pas_backend_signals, LAST_SIGNAL);
+ object_class = (GObjectClass *) klass;
klass->add_client = NULL;
klass->remove_client = NULL;
klass->get_static_capabilities = NULL;
+
+ pas_backend_signals[LAST_CLIENT_GONE] =
+ g_signal_new ("last_client_gone",
+ G_OBJECT_CLASS_TYPE (object_class),
+ G_SIGNAL_RUN_FIRST,
+ G_STRUCT_OFFSET (PASBackendClass, last_client_gone),
+ NULL, NULL,
+ pas_marshal_NONE__NONE,
+ G_TYPE_NONE, 0);
}
/**
* pas_backend_get_type:
*/
-GtkType
+GType
pas_backend_get_type (void)
{
- static GtkType type = 0;
+ static GType type = 0;
if (! type) {
- GtkTypeInfo info = {
- "PASBackend",
- sizeof (PASBackend),
+ GTypeInfo info = {
sizeof (PASBackendClass),
- (GtkClassInitFunc) pas_backend_class_init,
- (GtkObjectInitFunc) pas_backend_init,
- NULL, /* reserved 1 */
- NULL, /* reserved 2 */
- (GtkClassInitFunc) NULL
+ NULL, /* base_class_init */
+ NULL, /* base_class_finalize */
+ (GClassInitFunc) pas_backend_class_init,
+ NULL, /* class_finalize */
+ NULL, /* class_data */
+ sizeof (PASBackend),
+ 0, /* n_preallocs */
+ (GInstanceInitFunc) pas_backend_init
};
- type = gtk_type_unique (gtk_object_get_type (), &info);
+ type = g_type_register_static (G_TYPE_OBJECT, "PASBackend", &info, 0);
}
return type;
diff --git a/addressbook/backend/pas/pas-backend.h b/addressbook/backend/pas/pas-backend.h
index cdf8f37c30..d1d5705b0f 100644
--- a/addressbook/backend/pas/pas-backend.h
+++ b/addressbook/backend/pas/pas-backend.h
@@ -22,22 +22,29 @@
#ifndef __PAS_BACKEND_H__
#define __PAS_BACKEND_H__
-#include <libgnome/gnome-defs.h>
-#include <gtk/gtkobject.h>
+#include <glib.h>
+#include <glib-object.h>
#include <pas/addressbook.h>
+#define PAS_TYPE_BACKEND (pas_backend_get_type ())
+#define PAS_BACKEND(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), PAS_TYPE_BACKEND, PASBackend))
+#define PAS_BACKEND_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), PAS_TYPE_BACKEND, PASBackendClass))
+#define PAS_IS_BACKEND(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), PAS_TYPE_BACKEND))
+#define PAS_IS_BACKEND_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), PAS_TYPE_BACKEND))
+#define PAS_BACKEND_GET_CLASS(k) (G_TYPE_INSTANCE_GET_CLASS ((k), PAS_TYPE_BACKEND, PASBackendClass))
+
typedef struct _PASBackend PASBackend;
typedef struct _PASBackendPrivate PASBackendPrivate;
#include <pas/pas-book.h>
struct _PASBackend {
- GtkObject parent_object;
+ GObject parent_object;
PASBackendPrivate *priv;
};
typedef struct {
- GtkObjectClass parent_class;
+ GObjectClass parent_class;
/* Virtual methods */
GNOME_Evolution_Addressbook_BookListener_CallStatus (*load_uri) (PASBackend *backend, const char *uri);
@@ -67,13 +74,7 @@ char *pas_backend_get_static_capabilities (PASBackend *backen
void pas_backend_last_client_gone (PASBackend *backend);
-GtkType pas_backend_get_type (void);
-
-#define PAS_BACKEND_TYPE (pas_backend_get_type ())
-#define PAS_BACKEND(o) (GTK_CHECK_CAST ((o), PAS_BACKEND_TYPE, PASBackend))
-#define PAS_BACKEND_CLASS(k) (GTK_CHECK_CLASS_CAST((k), PAS_BACKEND_TYPE, PASBackendClass))
-#define PAS_IS_BACKEND(o) (GTK_CHECK_TYPE ((o), PAS_BACKEND_TYPE))
-#define PAS_IS_BACKEND_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), PAS_BACKEND_TYPE))
+GType pas_backend_get_type (void);
#endif /* ! __PAS_BACKEND_H__ */
diff --git a/addressbook/backend/pas/pas-book-factory.c b/addressbook/backend/pas/pas-book-factory.c
index 9c713f5ce8..3bca69cf59 100644
--- a/addressbook/backend/pas/pas-book-factory.c
+++ b/addressbook/backend/pas/pas-book-factory.c
@@ -8,12 +8,13 @@
*/
#include <config.h>
-#include <ctype.h>
+#include <string.h>
-#include <gtk/gtksignal.h>
-#include <liboaf/liboaf.h>
#include "addressbook.h"
#include "pas-book-factory.h"
+#include "pas-marshal.h"
+#include <bonobo-activation/bonobo-activation.h>
+#include <bonobo/bonobo-main.h>
#define DEFAULT_PAS_BOOK_FACTORY_OAF_ID "OAFIID:GNOME_Evolution_Wombat_ServerFactory"
@@ -26,6 +27,9 @@ typedef struct {
} PASBookFactoryQueuedRequest;
struct _PASBookFactoryPrivate {
+ PASBookFactoryServant *servant;
+ GNOME_Evolution_Addressbook_BookFactory corba_objref;
+
gint idle_id;
GHashTable *backends;
GHashTable *active_server_map;
@@ -163,12 +167,12 @@ backend_last_client_gone_cb (PASBackend *backend, gpointer data)
g_hash_table_remove (factory->priv->active_server_map, orig_uri);
g_free (orig_uri);
- gtk_object_unref (GTK_OBJECT (backend));
+ g_object_unref (backend);
/* Notify upstream if there are no more backends */
if (g_hash_table_size (factory->priv->active_server_map) == 0)
- gtk_signal_emit (GTK_OBJECT (factory), factory_signals[LAST_BOOK_GONE]);
+ g_signal_emit (G_OBJECT (factory), factory_signals[LAST_BOOK_GONE], 0);
}
static PASBackendFactoryFn
@@ -253,9 +257,9 @@ pas_book_factory_launch_backend (PASBookFactory *factory,
g_strdup (uri),
backend);
- gtk_signal_connect (GTK_OBJECT (backend), "last_client_gone",
- backend_last_client_gone_cb,
- factory);
+ g_signal_connect (backend, "last_client_gone",
+ G_CALLBACK (backend_last_client_gone_cb),
+ factory);
return backend;
}
@@ -384,6 +388,14 @@ 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,
@@ -391,8 +403,7 @@ impl_GNOME_Evolution_Addressbook_BookFactory_openBook (PortableServer_Servant
const GNOME_Evolution_Addressbook_BookListener listener,
CORBA_Environment *ev)
{
- PASBookFactory *factory =
- PAS_BOOK_FACTORY (bonobo_object_from_servant (servant));
+ PASBookFactory *factory = factory_from_servant (servant);
PASBackendFactoryFn backend_factory;
backend_factory = pas_book_factory_lookup_backend_factory (factory, uri);
@@ -410,41 +421,71 @@ impl_GNOME_Evolution_Addressbook_BookFactory_openBook (PortableServer_Servant
pas_book_factory_queue_request (factory, uri, listener);
}
-static gboolean
-pas_book_factory_construct (PASBookFactory *factory)
+void
+pas_book_factory_construct (PASBookFactory *factory,
+ GNOME_Evolution_Addressbook_BookListener corba_objref)
{
- POA_GNOME_Evolution_Addressbook_BookFactory *servant;
- CORBA_Environment ev;
- CORBA_Object obj;
+ PASBookFactoryPrivate *priv;
- g_assert (factory != NULL);
- g_assert (PAS_IS_BOOK_FACTORY (factory));
+ 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;
+}
- servant = (POA_GNOME_Evolution_Addressbook_BookFactory *) g_new0 (BonoboObjectServant, 1);
- servant->vepv = &pas_book_factory_vepv;
+
+static PASBookFactoryServant *
+create_servant (PASBookFactory *factory)
+{
+ PASBookFactoryServant *servant;
+ POA_GNOME_Evolution_Addressbook_BookFactory *corba_servant;
+ CORBA_Environment ev;
CORBA_exception_init (&ev);
- POA_GNOME_Evolution_Addressbook_BookFactory__init ((PortableServer_Servant) servant, &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 FALSE;
+ return NULL;
}
+ servant->object = factory;
+
CORBA_exception_free (&ev);
- obj = bonobo_object_activate_servant (BONOBO_OBJECT (factory), servant);
- if (obj == CORBA_OBJECT_NIL) {
- g_free (servant);
+ return servant;
+}
- return FALSE;
+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;
}
- bonobo_object_construct (BONOBO_OBJECT (factory), obj);
+ CORBA_exception_free (&ev);
- return TRUE;
+ return CORBA_OBJECT_NIL;
}
/**
@@ -454,15 +495,16 @@ PASBookFactory *
pas_book_factory_new (void)
{
PASBookFactory *factory;
+ PASBookFactoryPrivate *priv;
+ GNOME_Evolution_Addressbook_BookFactory corba_objref;
- factory = gtk_type_new (pas_book_factory_get_type ());
-
- if (! pas_book_factory_construct (factory)) {
- g_warning ("pas_book_factory_new: Could not construct PASBookFactory!\n");
- gtk_object_unref (GTK_OBJECT (factory));
+ factory = g_object_new (PAS_TYPE_BOOK_FACTORY, NULL);
+ priv = factory->priv;
- return NULL;
- }
+ priv->servant = create_servant (factory);
+ corba_objref = activate_servant (factory, (POA_GNOME_Evolution_Addressbook_BookFactory*)priv->servant);
+
+ pas_book_factory_construct (factory, corba_objref);
return factory;
}
@@ -475,7 +517,7 @@ pas_book_factory_activate (PASBookFactory *factory, const char *iid)
{
PASBookFactoryPrivate *priv;
CORBA_Object obj;
- OAF_RegistrationResult result;
+ Bonobo_RegistrationResult result;
char *tmp_iid;
g_return_val_if_fail (factory != NULL, FALSE);
@@ -491,22 +533,20 @@ pas_book_factory_activate (PASBookFactory *factory, const char *iid)
else
tmp_iid = g_strdup (DEFAULT_PAS_BOOK_FACTORY_OAF_ID);
- obj = bonobo_object_corba_objref (BONOBO_OBJECT (factory));
-
- result = oaf_active_server_register (tmp_iid, obj);
+ result = bonobo_activation_active_server_register (tmp_iid, priv->corba_objref);
switch (result) {
- case OAF_REG_SUCCESS:
+ case Bonobo_ACTIVATION_REG_SUCCESS:
priv->registered = TRUE;
priv->iid = tmp_iid;
return TRUE;
- case OAF_REG_NOT_LISTED:
+ case Bonobo_ACTIVATION_REG_NOT_LISTED:
g_message ("Error registering the PAS factory: not listed");
break;
- case OAF_REG_ALREADY_ACTIVE:
+ case Bonobo_ACTIVATION_REG_ALREADY_ACTIVE:
g_message ("Error registering the PAS factory: already active");
break;
- case OAF_REG_ERROR:
+ case Bonobo_ACTIVATION_REG_ERROR:
default:
g_message ("Error registering the PAS factory: generic error");
break;
@@ -537,7 +577,7 @@ free_active_server_map_entry (gpointer key, gpointer value, gpointer data)
g_free (uri);
backend = PAS_BACKEND (value);
- gtk_object_unref (GTK_OBJECT (backend));
+ g_object_unref (backend);
}
static void
@@ -550,12 +590,14 @@ remove_backends_entry (gpointer key, gpointer value, gpointer data)
}
static void
-pas_book_factory_destroy (GtkObject *object)
+pas_book_factory_dispose (GObject *object)
{
PASBookFactory *factory = PAS_BOOK_FACTORY (object);
+ PASBookFactoryPrivate *priv = factory->priv;
+
GList *l;
- for (l = factory->priv->queued_requests; l != NULL; l = l->next) {
+ for (l = priv->queued_requests; l != NULL; l = l->next) {
PASBookFactoryQueuedRequest *request = l->data;
CORBA_Environment ev;
@@ -567,99 +609,98 @@ pas_book_factory_destroy (GtkObject *object)
g_free (request);
}
- g_list_free (factory->priv->queued_requests);
- factory->priv->queued_requests = NULL;
+ g_list_free (priv->queued_requests);
+ priv->queued_requests = NULL;
- g_hash_table_foreach (factory->priv->active_server_map,
+ g_hash_table_foreach (priv->active_server_map,
free_active_server_map_entry,
NULL);
- g_hash_table_destroy (factory->priv->active_server_map);
- factory->priv->active_server_map = NULL;
+ g_hash_table_destroy (priv->active_server_map);
+ priv->active_server_map = NULL;
- g_hash_table_foreach (factory->priv->backends,
+ g_hash_table_foreach (priv->backends,
remove_backends_entry,
NULL);
- g_hash_table_destroy (factory->priv->backends);
- factory->priv->backends = NULL;
+ g_hash_table_destroy (priv->backends);
+ priv->backends = NULL;
- if (factory->priv->registered) {
- CORBA_Object obj;
-
- obj = bonobo_object_corba_objref (BONOBO_OBJECT (factory));
- oaf_active_server_unregister (factory->priv->iid, obj);
- factory->priv->registered = FALSE;
+ if (priv->registered) {
+ bonobo_activation_active_server_unregister (priv->iid, priv->corba_objref);
+ priv->registered = FALSE;
}
- g_free (factory->priv->iid);
+ g_free (priv->iid);
- g_free (factory->priv);
+ g_free (priv);
- GTK_OBJECT_CLASS (pas_book_factory_parent_class)->destroy (object);
+ G_OBJECT_CLASS (pas_book_factory_parent_class)->dispose (object);
}
-static POA_GNOME_Evolution_Addressbook_BookFactory__epv *
-pas_book_factory_get_epv (void)
+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;
- return epv;
-
-}
-
-static void
-pas_book_factory_corba_class_init (void)
-{
- pas_book_factory_vepv.Bonobo_Unknown_epv = bonobo_object_get_epv ();
- pas_book_factory_vepv.GNOME_Evolution_Addressbook_BookFactory_epv = pas_book_factory_get_epv ();
+ 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)
{
- GtkObjectClass *object_class = (GtkObjectClass *) klass;
-
- pas_book_factory_parent_class = gtk_type_class (bonobo_object_get_type ());
-
- factory_signals[LAST_BOOK_GONE] =
- gtk_signal_new ("last_book_gone",
- GTK_RUN_FIRST,
- object_class->type,
- GTK_SIGNAL_OFFSET (PASBookFactoryClass, last_book_gone),
- gtk_marshal_NONE__NONE,
- GTK_TYPE_NONE, 0);
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
- gtk_object_class_add_signals (object_class, factory_signals, LAST_SIGNAL);
+ pas_book_factory_parent_class = g_type_class_ref (G_TYPE_OBJECT);
- object_class->destroy = pas_book_factory_destroy;
+ object_class->dispose = pas_book_factory_dispose;
- pas_book_factory_corba_class_init ();
+ factory_signals[LAST_BOOK_GONE] =
+ g_signal_new ("last_book_gone",
+ G_OBJECT_CLASS_TYPE (object_class),
+ G_SIGNAL_RUN_FIRST,
+ G_STRUCT_OFFSET (PASBookFactoryClass, last_book_gone),
+ NULL, NULL,
+ pas_marshal_NONE__NONE,
+ G_TYPE_NONE, 0);
+
+ corba_class_init ();
}
/**
* pas_book_factory_get_type:
*/
-GtkType
+GType
pas_book_factory_get_type (void)
{
- static GtkType type = 0;
+ static GType type = 0;
if (! type) {
- GtkTypeInfo info = {
- "PASBookFactory",
- sizeof (PASBookFactory),
+ GTypeInfo info = {
sizeof (PASBookFactoryClass),
- (GtkClassInitFunc) pas_book_factory_class_init,
- (GtkObjectInitFunc) pas_book_factory_init,
- NULL, /* reserved 1 */
- NULL, /* reserved 2 */
- (GtkClassInitFunc) NULL
+ 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 = gtk_type_unique (bonobo_object_get_type (), &info);
+ type = g_type_register_static (G_TYPE_OBJECT, "PASBookFactory", &info, 0);
}
return type;
diff --git a/addressbook/backend/pas/pas-book-factory.h b/addressbook/backend/pas/pas-book-factory.h
index 1936701296..fd8683907c 100644
--- a/addressbook/backend/pas/pas-book-factory.h
+++ b/addressbook/backend/pas/pas-book-factory.h
@@ -2,32 +2,48 @@
* Copyright 2000, Ximian, Inc.
*/
-#include <bonobo/bonobo-object.h>
-#include <libgnome/gnome-defs.h>
-
#include <pas/pas-backend.h>
+#include <bonobo/bonobo-object.h>
#ifndef __PAS_BOOK_FACTORY_H__
#define __PAS_BOOK_FACTORY_H__
-BEGIN_GNOME_DECLS
+G_BEGIN_DECLS
+
+#define PAS_TYPE_BOOK_FACTORY (pas_book_factory_get_type ())
+#define PAS_BOOK_FACTORY(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), PAS_TYPE_BOOK_FACTORY, PASBookFactory))
+#define PAS_BOOK_FACTORY_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), PAS_TYPE_BOOK_FACTORY, PASBookFactoryClass))
+#define PAS_IS_BOOK_FACTORY(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), PAS_TYPE_BOOK_FACTORY))
+#define PAS_IS_BOOK_FACTORY_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), PAS_TYPE_BOOK_FACTORY))
+#define PAS_BOOK_FACTORY_GET_CLASS(k) (G_TYPE_INSTANCE_GET_CLASS ((obj), PAS_TYPE_BOOK_FACTORY, PASBookFactoryClass))
typedef struct _PASBookFactoryPrivate PASBookFactoryPrivate;
typedef struct {
- BonoboObject parent_object;
+ GObject parent_object;
PASBookFactoryPrivate *priv;
} PASBookFactory;
typedef struct {
- BonoboObjectClass parent_class;
+ GObjectClass parent_class;
/* 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,
@@ -39,14 +55,8 @@ void pas_book_factory_dump_active_backends (PASBookFactory *factory);
gboolean pas_book_factory_activate (PASBookFactory *factory, const char *iid);
-GtkType pas_book_factory_get_type (void);
-
-#define PAS_BOOK_FACTORY_TYPE (pas_book_factory_get_type ())
-#define PAS_BOOK_FACTORY(o) (GTK_CHECK_CAST ((o), PAS_BOOK_FACTORY_TYPE, PASBookFactory))
-#define PAS_BOOK_FACTORY_CLASS(k) (GTK_CHECK_CLASS_CAST((k), PAS_BOOK_FACTORY_TYPE, PASBookFactoryClass))
-#define PAS_IS_BOOK_FACTORY(o) (GTK_CHECK_TYPE ((o), PAS_BOOK_FACTORY_TYPE))
-#define PAS_IS_BOOK_FACTORY_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), PAS_BOOK_FACTORY_TYPE))
+GType pas_book_factory_get_type (void);
-END_GNOME_DECLS
+G_END_DECLS
#endif /* ! __PAS_BOOK_FACTORY_H__ */
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);
diff --git a/addressbook/backend/pas/pas-book-view.h b/addressbook/backend/pas/pas-book-view.h
index 712f3c3b96..7948baf1ea 100644
--- a/addressbook/backend/pas/pas-book-view.h
+++ b/addressbook/backend/pas/pas-book-view.h
@@ -13,8 +13,16 @@
#define __PAS_BOOK_VIEW_H__
#include <bonobo/bonobo-object.h>
-#include <libgnome/gnome-defs.h>
#include <pas/addressbook.h>
+#include <glib.h>
+#include <glib-object.h>
+
+#define PAS_TYPE_BOOK_VIEW (pas_book_view_get_type ())
+#define PAS_BOOK_VIEW(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), PAS_TYPE_BOOK_VIEW, PASBookView))
+#define PAS_BOOK_VIEW_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), PAS_TYPE_BOOK_VIEW, PASBookViewClass))
+#define PAS_IS_BOOK_VIEW(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), PAS_TYPE_BOOK_VIEW))
+#define PAS_IS_BOOK_VIEW_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), PAS_TYPE_BOOK_VIEW))
+#define PAS_BOOK_VIEW_GET_CLASS(k) (G_TYPE_INSTANCE_GET_CLASS ((obj), PAS_TYPE_BOOK_VIEW, PASBookView))
typedef struct _PASBookView PASBookView;
typedef struct _PASBookViewClass PASBookViewClass;
@@ -27,8 +35,24 @@ struct _PASBookView {
struct _PASBookViewClass {
BonoboObjectClass parent_class;
+
+ POA_GNOME_Evolution_Addressbook_BookView__epv epv;
+};
+
+
+
+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);
@@ -45,12 +69,6 @@ void pas_book_view_notify_complete (PASBookView *b
void pas_book_view_notify_status_message (PASBookView *book_view,
const char *message);
-GtkType pas_book_view_get_type (void);
-
-#define PAS_BOOK_VIEW_TYPE (pas_book_view_get_type ())
-#define PAS_BOOK_VIEW(o) (GTK_CHECK_CAST ((o), PAS_BOOK_VIEW_TYPE, PASBookView))
-#define PAS_BOOK_VIEW_CLASS(k) (GTK_CHECK_CLASS_CAST((k), PAS_BOOK_VIEW_FACTORY_TYPE, PASBookViewClass))
-#define PAS_IS_BOOK_VIEW(o) (GTK_CHECK_TYPE ((o), PAS_BOOK_VIEW_TYPE))
-#define PAS_IS_BOOK_VIEW_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), PAS_BOOK_VIEW_TYPE))
+GType pas_book_view_get_type (void);
#endif /* ! __PAS_BOOK_VIEW_H__ */
diff --git a/addressbook/backend/pas/pas-book.c b/addressbook/backend/pas/pas-book.c
index 7a3ab55f92..2d8f41cf98 100644
--- a/addressbook/backend/pas/pas-book.c
+++ b/addressbook/backend/pas/pas-book.c
@@ -6,9 +6,10 @@
*/
#include <config.h>
-#include <gtk/gtksignal.h>
+#include <bonobo/bonobo-main.h>
#include "e-util/e-list.h"
-#include "pas-book.h"
+#include "pas-backend.h"
+#include "pas-marshal.h"
static BonoboObjectClass *pas_book_parent_class;
POA_GNOME_Evolution_Addressbook_Book__vepv pas_book_vepv;
@@ -21,6 +22,9 @@ 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;
@@ -39,8 +43,7 @@ pas_book_check_queue (PASBook *book)
book->priv->timeout_lock = TRUE;
if (book->priv->request_queue != NULL) {
- gtk_signal_emit (GTK_OBJECT (book),
- pas_book_signals [REQUESTS_QUEUED]);
+ g_signal_emit (book, pas_book_signals [REQUESTS_QUEUED], 0);
}
if (book->priv->request_queue == NULL) {
@@ -239,7 +242,7 @@ pas_book_queue_check_connection (PASBook *book)
static void
impl_GNOME_Evolution_Addressbook_Book_getVCard (PortableServer_Servant servant,
- const GNOME_Evolution_Addressbook_CardId id,
+ const CORBA_char *id,
CORBA_Environment *ev)
{
PASBook *book = PAS_BOOK (bonobo_object_from_servant (servant));
@@ -261,8 +264,8 @@ impl_GNOME_Evolution_Addressbook_Book_authenticateUser (PortableServer_Servant s
static void
impl_GNOME_Evolution_Addressbook_Book_addCard (PortableServer_Servant servant,
- const GNOME_Evolution_Addressbook_VCard vcard,
- CORBA_Environment *ev)
+ const CORBA_char *vcard,
+ CORBA_Environment *ev)
{
PASBook *book = PAS_BOOK (bonobo_object_from_servant (servant));
@@ -271,8 +274,8 @@ impl_GNOME_Evolution_Addressbook_Book_addCard (PortableServer_Servant servant,
static void
impl_GNOME_Evolution_Addressbook_Book_removeCard (PortableServer_Servant servant,
- const GNOME_Evolution_Addressbook_CardId id,
- CORBA_Environment *ev)
+ const CORBA_char *id,
+ CORBA_Environment *ev)
{
PASBook *book = PAS_BOOK (bonobo_object_from_servant (servant));
@@ -281,8 +284,8 @@ impl_GNOME_Evolution_Addressbook_Book_removeCard (PortableServer_Servant servant
static void
impl_GNOME_Evolution_Addressbook_Book_modifyCard (PortableServer_Servant servant,
- const GNOME_Evolution_Addressbook_VCard vcard,
- CORBA_Environment *ev)
+ const CORBA_char *vcard,
+ CORBA_Environment *ev)
{
PASBook *book = PAS_BOOK (bonobo_object_from_servant (servant));
@@ -572,7 +575,7 @@ pas_book_respond_get_supported_fields (PASBook *book,
stringlist._buffer[i] = CORBA_string_dup (e_iterator_get(iter));
}
- gtk_object_unref (GTK_OBJECT (fields));
+ g_object_unref (fields);
GNOME_Evolution_Addressbook_BookListener_notifySupportedFields (
book->priv->listener, status,
@@ -755,55 +758,87 @@ pas_book_report_writable (PASBook *book,
CORBA_exception_free (&ev);
}
-static gboolean
+void
pas_book_construct (PASBook *book,
+ GNOME_Evolution_Addressbook_Book corba_objref,
PASBackend *backend,
GNOME_Evolution_Addressbook_BookListener listener)
{
- POA_GNOME_Evolution_Addressbook_Book *servant;
- CORBA_Environment ev;
- CORBA_Object obj;
+ PASBookPrivate *priv;
+ CORBA_Environment ev;
+
+ g_return_if_fail (book != NULL);
+ g_return_if_fail (corba_objref != CORBA_OBJECT_NIL);
- g_assert (book != NULL);
- g_assert (PAS_IS_BOOK (book));
- g_assert (listener != CORBA_OBJECT_NIL);
+ priv = book->priv;
- servant = (POA_GNOME_Evolution_Addressbook_Book *) g_new0 (BonoboObjectServant, 1);
- servant->vepv = &pas_book_vepv;
+ g_return_if_fail (priv->corba_objref == CORBA_OBJECT_NIL);
+
+ priv->corba_objref = corba_objref;
+ priv->backend = backend;
CORBA_exception_init (&ev);
+ book->priv->listener = CORBA_Object_duplicate (listener, &ev);
- POA_GNOME_Evolution_Addressbook_Book__init ((PortableServer_Servant) servant, &ev);
if (ev._major != CORBA_NO_EXCEPTION) {
- g_free (servant);
+ g_message ("pas_book_construct(): could not duplicate the listener");
CORBA_exception_free (&ev);
-
- return FALSE;
+ return;
}
CORBA_exception_free (&ev);
- obj = bonobo_object_activate_servant (BONOBO_OBJECT (book), servant);
- if (obj == CORBA_OBJECT_NIL) {
- g_free (servant);
+ priv->listener = listener;
+}
- return FALSE;
+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;
}
- bonobo_object_construct (BONOBO_OBJECT (book), obj);
+ 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);
- book->priv->listener = CORBA_Object_duplicate (listener, &ev);
- if (ev._major != CORBA_NO_EXCEPTION)
- g_message ("pas_book_construct(): could not duplicate the listener");
+ CORBA_free (PortableServer_POA_activate_object (bonobo_poa (), servant, &ev));
- CORBA_exception_free (&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;
+ }
- book->priv->listener = listener;
- book->priv->backend = backend;
+ CORBA_exception_free (&ev);
- return TRUE;
+ return CORBA_OBJECT_NIL;
}
/**
@@ -814,16 +849,16 @@ pas_book_new (PASBackend *backend,
GNOME_Evolution_Addressbook_BookListener listener)
{
PASBook *book;
+ PASBookPrivate *priv;
+ GNOME_Evolution_Addressbook_Book corba_objref;
- g_return_val_if_fail (listener != CORBA_OBJECT_NIL, NULL);
-
- book = gtk_type_new (pas_book_get_type ());
+ book = g_object_new (PAS_TYPE_BOOK, NULL);
+ priv = book->priv;
- if (! pas_book_construct (book, backend, listener)) {
- gtk_object_unref (GTK_OBJECT (book));
-
- return NULL;
- }
+ 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);
return book;
}
@@ -896,7 +931,7 @@ pas_book_free_request (PASRequest *req)
}
static void
-pas_book_destroy (GtkObject *object)
+pas_book_dispose (GObject *object)
{
PASBook *book = PAS_BOOK (object);
GList *l;
@@ -927,15 +962,23 @@ pas_book_destroy (GtkObject *object)
g_free (book->priv);
book->priv = NULL;
- GTK_OBJECT_CLASS (pas_book_parent_class)->destroy (object);
+ G_OBJECT_CLASS (pas_book_parent_class)->dispose (object);
}
-static POA_GNOME_Evolution_Addressbook_Book__epv *
-pas_book_get_epv (void)
+static void
+corba_class_init (PASBookClass *klass)
{
+ POA_GNOME_Evolution_Addressbook_Book__vepv *vepv;
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;
- epv = g_new0 (POA_GNOME_Evolution_Addressbook_Book__epv, 1);
+
+ epv = &klass->epv;
epv->getVCard = impl_GNOME_Evolution_Addressbook_Book_getVCard;
epv->authenticateUser = impl_GNOME_Evolution_Addressbook_Book_authenticateUser;
@@ -950,37 +993,30 @@ pas_book_get_epv (void)
epv->getCompletionView = impl_GNOME_Evolution_Addressbook_Book_getCompletionView;
epv->getChanges = impl_GNOME_Evolution_Addressbook_Book_getChanges;
- return epv;
-
-}
-
-static void
-pas_book_corba_class_init (void)
-{
- pas_book_vepv.Bonobo_Unknown_epv = bonobo_object_get_epv ();
- pas_book_vepv.GNOME_Evolution_Addressbook_Book_epv = pas_book_get_epv ();
+ vepv = &pas_book_vepv;
+ vepv->_base_epv = base_epv;
+ vepv->GNOME_Evolution_Addressbook_Book_epv = epv;
}
static void
pas_book_class_init (PASBookClass *klass)
{
- GtkObjectClass *object_class = (GtkObjectClass *) klass;
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
- pas_book_parent_class = gtk_type_class (bonobo_object_get_type ());
+ pas_book_parent_class = g_type_class_peek_parent (klass);
pas_book_signals [REQUESTS_QUEUED] =
- gtk_signal_new ("requests_queued",
- GTK_RUN_LAST,
- object_class->type,
- GTK_SIGNAL_OFFSET (PASBookClass, requests_queued),
- gtk_marshal_NONE__NONE,
- GTK_TYPE_NONE, 0);
+ 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);
- gtk_object_class_add_signals (object_class, pas_book_signals, LAST_SIGNAL);
+ object_class->dispose = pas_book_dispose;
- object_class->destroy = pas_book_destroy;
-
- pas_book_corba_class_init ();
+ corba_class_init (klass);
}
static void
@@ -993,29 +1029,8 @@ pas_book_init (PASBook *book)
book->priv->timeout_lock = FALSE;
}
-/**
- * pas_book_get_type:
- */
-GtkType
-pas_book_get_type (void)
-{
- static GtkType type = 0;
-
- if (! type) {
- GtkTypeInfo info = {
- "PASBook",
- sizeof (PASBook),
- sizeof (PASBookClass),
- (GtkClassInitFunc) pas_book_class_init,
- (GtkObjectInitFunc) pas_book_init,
- NULL, /* reserved 1 */
- NULL, /* reserved 2 */
- (GtkClassInitFunc) NULL
- };
-
- type = gtk_type_unique (bonobo_object_get_type (), &info);
- }
-
- return type;
-}
-
+BONOBO_TYPE_FUNC_FULL (
+ PASBook,
+ GNOME_Evolution_Addressbook_Book,
+ BONOBO_TYPE_OBJECT,
+ pas_book);
diff --git a/addressbook/backend/pas/pas-book.h b/addressbook/backend/pas/pas-book.h
index 4dcd1e205d..6f053c85ed 100644
--- a/addressbook/backend/pas/pas-book.h
+++ b/addressbook/backend/pas/pas-book.h
@@ -13,17 +13,23 @@
#define __PAS_BOOK_H__
#include <bonobo/bonobo-object.h>
-#include <libgnome/gnome-defs.h>
#include <pas/addressbook.h>
#include <pas/pas-book-view.h>
#include "e-util/e-list.h"
-typedef struct _PASBook PASBook;
-typedef struct _PASBookPrivate PASBookPrivate;
-
#include <pas/pas-backend.h>
#include <pas/pas-card-cursor.h>
+#define PAS_TYPE_BOOK (pas_book_get_type ())
+#define PAS_BOOK(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), PAS_TYPE_BOOK, PASBook))
+#define PAS_BOOK_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), PAS_BOOK_FACTORY_TYPE, PASBookClass))
+#define PAS_IS_BOOK(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), PAS_TYPE_BOOK))
+#define PAS_IS_BOOK_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), PAS_TYPE_BOOK))
+#define PAS_BOOK_GET_CLASS(k) (G_TYPE_INSTANCE_GET_CLASS ((obj), PAS_TYPE_BOOK, PASBookClass))
+
+typedef struct _PASBook PASBook;
+typedef struct _PASBookPrivate PASBookPrivate;
+
typedef enum {
CreateCard,
RemoveCard,
@@ -121,15 +127,30 @@ struct _PASBook {
typedef struct {
BonoboObjectClass parent_class;
+ POA_GNOME_Evolution_Addressbook_Book__epv epv;
+
/* Signals */
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);
@@ -171,12 +192,6 @@ void pas_book_report_connection (PASBook
void pas_book_report_writable (PASBook *book,
gboolean writable);
-GtkType pas_book_get_type (void);
-
-#define PAS_BOOK_TYPE (pas_book_get_type ())
-#define PAS_BOOK(o) (GTK_CHECK_CAST ((o), PAS_BOOK_TYPE, PASBook))
-#define PAS_BOOK_CLASS(k) (GTK_CHECK_CLASS_CAST((k), PAS_BOOK_FACTORY_TYPE, PASBookClass))
-#define PAS_IS_BOOK(o) (GTK_CHECK_TYPE ((o), PAS_BOOK_TYPE))
-#define PAS_IS_BOOK_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), PAS_BOOK_TYPE))
+GType pas_book_get_type (void);
#endif /* ! __PAS_BOOK_H__ */
diff --git a/addressbook/backend/pas/pas-card-cursor.c b/addressbook/backend/pas/pas-card-cursor.c
index 572f63f46e..68230eca52 100644
--- a/addressbook/backend/pas/pas-card-cursor.c
+++ b/addressbook/backend/pas/pas-card-cursor.c
@@ -7,10 +7,13 @@
*/
#include <config.h>
+#include <bonobo/bonobo-main.h>
#include "addressbook.h"
#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;
@@ -24,20 +27,20 @@ static BonoboObjectClass *parent_class;
/*
* The VEPV for the CardCursor object
*/
-static POA_GNOME_Evolution_Addressbook_CardCursor__vepv cursor_vepv;
+static POA_GNOME_Evolution_Addressbook_CardCursor__vepv pas_card_cursor_vepv;
/*
- * Implemented GtkObject::destroy
+ * Implemented GObject::dispose
*/
static void
-pas_card_cursor_destroy (GtkObject *object)
+pas_card_cursor_dispose (GObject *object)
{
PASCardCursor *cursor = PAS_CARD_CURSOR (object);
if ( cursor->priv )
g_free ( cursor->priv );
- GTK_OBJECT_CLASS (parent_class)->destroy (object);
+ G_OBJECT_CLASS (parent_class)->dispose (object);
}
/*
@@ -72,134 +75,128 @@ impl_pas_card_cursor_get_nth (PortableServer_Servant servant,
return CORBA_string_dup ("");
}
-/*
- * If you want users to derive classes from your implementation
- * you need to support this method.
- */
-POA_GNOME_Evolution_Addressbook_CardCursor__epv *
-pas_card_cursor_get_epv (void)
+
+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 = g_new0 (POA_GNOME_Evolution_Addressbook_CardCursor__epv, 1);
+ epv = &klass->epv;
- /*
- * This is the method invoked by CORBA
- */
epv->count = impl_pas_card_cursor_get_length;
epv->getNth = impl_pas_card_cursor_get_nth;
- return epv;
-}
-
-static void
-init_pas_card_cursor_corba_class (void)
-{
- cursor_vepv.Bonobo_Unknown_epv = bonobo_object_get_epv ();
- cursor_vepv.GNOME_Evolution_Addressbook_CardCursor_epv = pas_card_cursor_get_epv ();
+ 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)
{
- GtkObjectClass *object_class = (GtkObjectClass *) klass;
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
- parent_class = gtk_type_class (bonobo_object_get_type ());
+ parent_class = g_type_class_ref (BONOBO_TYPE_OBJECT);
- object_class->destroy = pas_card_cursor_destroy;
+ object_class->dispose = pas_card_cursor_dispose;
- init_pas_card_cursor_corba_class ();
+ corba_class_init (klass);
}
static void
pas_card_cursor_init (PASCardCursor *cursor)
{
cursor->priv = g_new(PASCardCursorPrivate, 1);
+ cursor->priv->corba_cursor = CORBA_OBJECT_NIL;
cursor->priv->get_length = NULL;
cursor->priv->get_nth = NULL;
cursor->priv->data = NULL;
}
-GtkType
-pas_card_cursor_get_type (void)
-{
- static GtkType type = 0;
-
- if (!type){
- GtkTypeInfo info = {
- "PASCardCursor",
- sizeof (PASCardCursor),
- sizeof (PASCardCursorClass),
- (GtkClassInitFunc) pas_card_cursor_class_init,
- (GtkObjectInitFunc) pas_card_cursor_init,
- NULL, /* reserved 1 */
- NULL, /* reserved 2 */
- (GtkClassInitFunc) NULL
- };
-
- type = gtk_type_unique (bonobo_object_get_type (), &info);
- }
+BONOBO_TYPE_FUNC_FULL (
+ PASCardCursor,
+ GNOME_Evolution_Addressbook_CardCursor,
+ BONOBO_TYPE_OBJECT,
+ pas_card_cursor);
- return type;
-}
-
-PASCardCursor *
+void
pas_card_cursor_construct (PASCardCursor *cursor,
GNOME_Evolution_Addressbook_CardCursor corba_cursor,
PASCardCursorLengthFunc get_length,
PASCardCursorNthFunc get_nth,
gpointer data)
{
- g_return_val_if_fail (cursor != NULL, NULL);
- g_return_val_if_fail (PAS_IS_CARD_CURSOR (cursor), NULL);
- g_return_val_if_fail (corba_cursor != CORBA_OBJECT_NIL, NULL);
-
- /*
- * Call parent constructor
- */
- if (!bonobo_object_construct (BONOBO_OBJECT (cursor), (CORBA_Object) corba_cursor))
+ PASCardCursorPrivate *priv;
+
+ 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;
+ }
- /*
- * Initialize cursor
- */
- cursor->priv->get_length = get_length;
- cursor->priv->get_nth = get_nth;
- cursor->priv->data = data;
-
- /*
- * Success: return the GtkType we were given
- */
- return cursor;
+ servant->object = cursor;
+
+ CORBA_exception_free (&ev);
+
+ return servant;
}
-/*
- * This routine creates the ORBit CORBA server and initializes the
- * CORBA side of things
- */
static GNOME_Evolution_Addressbook_CardCursor
-create_cursor (BonoboObject *cursor)
+activate_servant (PASCardCursor *cursor,
+ POA_GNOME_Evolution_Addressbook_CardCursor *servant)
{
- POA_GNOME_Evolution_Addressbook_CardCursor *servant;
+ GNOME_Evolution_Addressbook_CardCursor corba_object;
CORBA_Environment ev;
- servant = (POA_GNOME_Evolution_Addressbook_CardCursor *) g_new0 (BonoboObjectServant, 1);
- servant->vepv = &cursor_vepv;
-
CORBA_exception_init (&ev);
- POA_GNOME_Evolution_Addressbook_CardCursor__init ((PortableServer_Servant) servant, &ev);
- if (ev._major != CORBA_NO_EXCEPTION){
- g_free (servant);
+
+ 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_NIL;
+ return corba_object;
}
CORBA_exception_free (&ev);
- /*
- * Activates the CORBA object.
- */
- return (GNOME_Evolution_Addressbook_CardCursor) bonobo_object_activate_servant (cursor, servant);
+ return CORBA_OBJECT_NIL;
}
PASCardCursor *
@@ -208,19 +205,20 @@ pas_card_cursor_new (PASCardCursorLengthFunc get_length,
gpointer data)
{
PASCardCursor *cursor;
+ PASCardCursorPrivate *priv;
GNOME_Evolution_Addressbook_CardCursor corba_cursor;
- cursor = gtk_type_new (pas_card_cursor_get_type ());
- corba_cursor = create_cursor (BONOBO_OBJECT (cursor));
+ cursor = g_object_new (PAS_TYPE_CARD_CURSOR, NULL);
+ priv = cursor->priv;
- if (corba_cursor == CORBA_OBJECT_NIL){
- gtk_object_unref (GTK_OBJECT (cursor));
- return NULL;
- }
-
- return pas_card_cursor_construct (cursor,
- corba_cursor,
- get_length,
- get_nth,
- data);
+ 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;
}
diff --git a/addressbook/backend/pas/pas-card-cursor.h b/addressbook/backend/pas/pas-card-cursor.h
index 70ecb5e718..880632decd 100644
--- a/addressbook/backend/pas/pas-card-cursor.h
+++ b/addressbook/backend/pas/pas-card-cursor.h
@@ -10,11 +10,17 @@
#ifndef __PAS_CARD_CURSOR_H__
#define __PAS_CARD_CURSOR_H__
-#include <libgnome/gnome-defs.h>
#include <bonobo/bonobo-object.h>
#include <pas/addressbook.h>
-BEGIN_GNOME_DECLS
+G_BEGIN_DECLS
+
+#define PAS_TYPE_CARD_CURSOR (pas_card_cursor_get_type ())
+#define PAS_CARD_CURSOR(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), PAS_TYPE_CARD_CURSOR, PASCardCursor))
+#define PAS_CARD_CURSOR_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), PAS_TYPE_CARD_CURSOR, PASCardCursorClass))
+#define PAS_IS_CARD_CURSOR(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), PAS_TYPE_CARD_CURSOR))
+#define PAS_IS_CARD_CURSOR_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), PAS_TYPE_CARD_CURSOR))
+#define PAS_CARD_CURSOR_GET_CLASS(k) (G_TYPE_INSTANCE_GET_CLASS ((obj), PAS_TYPE_CARD_CURSOR, PASCardCursorClass))
typedef struct _PASCardCursor PASCardCursor;
typedef struct _PASCardCursorPrivate PASCardCursorPrivate;
@@ -30,29 +36,33 @@ struct _PASCardCursor {
struct _PASCardCursorClass {
BonoboObjectClass parent;
+
+ POA_GNOME_Evolution_Addressbook_CardCursor__epv epv;
+};
+
+
+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);
-PASCardCursor *pas_card_cursor_construct (PASCardCursor *cursor,
+void pas_card_cursor_construct (PASCardCursor *cursor,
GNOME_Evolution_Addressbook_CardCursor corba_cursor,
PASCardCursorLengthFunc get_length,
PASCardCursorNthFunc get_nth,
gpointer data);
-GtkType pas_card_cursor_get_type (void);
+GType pas_card_cursor_get_type (void);
POA_GNOME_Evolution_Addressbook_CardCursor__epv *
pas_card_cursor_get_epv (void);
-/* Fetching cards. */
-#define PAS_CARD_CURSOR_TYPE (pas_card_cursor_get_type ())
-#define PAS_CARD_CURSOR(o) (GTK_CHECK_CAST ((o), PAS_CARD_CURSOR_TYPE, PASCardCursor))
-#define PAS_CARD_CURSOR_CLASS(k) (GTK_CHECK_CLASS_CAST((k), PAS_CARD_CURSOR_TYPE, PASCardCursorClass))
-#define PAS_IS_CARD_CURSOR(o) (GTK_CHECK_TYPE ((o), PAS_CARD_CURSOR_TYPE))
-#define PAS_IS_CARD_CURSOR_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), PAS_CARD_CURSOR_TYPE))
-
-END_GNOME_DECLS
+G_END_DECLS
#endif /* ! __PAS_CARD_CURSOR_H__ */
diff --git a/addressbook/backend/pas/pas-marshal.list b/addressbook/backend/pas/pas-marshal.list
new file mode 100644
index 0000000000..fa33740eaa
--- /dev/null
+++ b/addressbook/backend/pas/pas-marshal.list
@@ -0,0 +1 @@
+NONE:NONE