aboutsummaryrefslogtreecommitdiffstats
path: root/addressbook/backend
diff options
context:
space:
mode:
Diffstat (limited to 'addressbook/backend')
-rw-r--r--addressbook/backend/ebook/e-book-view-listener.c44
-rw-r--r--addressbook/backend/ebook/e-book-view-listener.h1
-rw-r--r--addressbook/backend/ebook/e-book-view.c1
-rw-r--r--addressbook/backend/pas/pas-backend-file.c63
-rw-r--r--addressbook/backend/pas/pas-backend-ldap.c36
-rw-r--r--addressbook/backend/pas/pas-book-view.c23
-rw-r--r--addressbook/backend/pas/pas-book.c4
7 files changed, 84 insertions, 88 deletions
diff --git a/addressbook/backend/ebook/e-book-view-listener.c b/addressbook/backend/ebook/e-book-view-listener.c
index 8433d1cc29..5f25e7f22a 100644
--- a/addressbook/backend/ebook/e-book-view-listener.c
+++ b/addressbook/backend/ebook/e-book-view-listener.c
@@ -28,6 +28,8 @@ POA_GNOME_Evolution_Addressbook_BookViewListener__vepv e_book_view_listener_vep
struct _EBookViewListenerPrivate {
GList *response_queue;
gint idle_id;
+
+ guint stopped : 1;
};
static gboolean
@@ -36,6 +38,11 @@ e_book_view_listener_check_queue (EBookViewListener *listener)
static gint thrash = 0;
gint queue_len;
+ if (listener->priv->stopped) {
+ listener->priv->idle_id = 0;
+ return TRUE;
+ }
+
queue_len = g_list_length (listener->priv->response_queue);
bonobo_object_ref (BONOBO_OBJECT (listener));
@@ -89,6 +96,9 @@ e_book_view_listener_queue_empty_event (EBookViewListener *listener,
{
EBookViewListenerResponse *resp;
+ if (listener->priv->stopped)
+ return;
+
resp = g_new0 (EBookViewListenerResponse, 1);
resp->op = op;
@@ -107,6 +117,9 @@ e_book_view_listener_queue_id_event (EBookViewListener *listener,
{
EBookViewListenerResponse *resp;
+ if (listener->priv->stopped)
+ return;
+
resp = g_new0 (EBookViewListenerResponse, 1);
resp->op = op;
@@ -126,6 +139,9 @@ e_book_view_listener_queue_sequence_event (EBookViewListener *listener,
EBookViewListenerResponse *resp;
int i;
+ if (listener->priv->stopped)
+ return;
+
resp = g_new0 (EBookViewListenerResponse, 1);
resp->op = op;
@@ -148,6 +164,9 @@ e_book_view_listener_queue_message_event (EBookViewListener *listener,
{
EBookViewListenerResponse *resp;
+ if (listener->priv->stopped)
+ return;
+
resp = g_new0 (EBookViewListenerResponse, 1);
resp->op = op;
@@ -328,16 +347,21 @@ e_book_view_listener_init (EBookViewListener *listener)
listener->priv = g_new0 (EBookViewListenerPrivate, 1);
listener->priv->response_queue = NULL;
listener->priv->idle_id = 0;
+ listener->priv->stopped = FALSE;
}
-static void
-e_book_view_listener_destroy (GtkObject *object)
+void
+e_book_view_listener_stop (EBookViewListener *listener)
{
- EBookViewListener *listener = E_BOOK_VIEW_LISTENER (object);
- GList *l;
+ GList *l;
- if (listener->priv->idle_id)
+ if (listener->priv->stopped)
+ return;
+
+ if (listener->priv->idle_id) {
g_source_remove(listener->priv->idle_id);
+ listener->priv->idle_id = 0;
+ }
for (l = listener->priv->response_queue; l != NULL; l = l->next) {
EBookViewListenerResponse *resp = l->data;
@@ -352,7 +376,17 @@ e_book_view_listener_destroy (GtkObject *object)
g_free (resp);
}
g_list_free (listener->priv->response_queue);
+ listener->priv->response_queue = NULL;
+
+ listener->priv->stopped = TRUE;
+}
+
+static void
+e_book_view_listener_destroy (GtkObject *object)
+{
+ EBookViewListener *listener = E_BOOK_VIEW_LISTENER (object);
+ e_book_view_listener_stop (listener);
g_free (listener->priv);
GTK_OBJECT_CLASS (e_book_view_listener_parent_class)->destroy (object);
diff --git a/addressbook/backend/ebook/e-book-view-listener.h b/addressbook/backend/ebook/e-book-view-listener.h
index addf91e702..5d85d86c3a 100644
--- a/addressbook/backend/ebook/e-book-view-listener.h
+++ b/addressbook/backend/ebook/e-book-view-listener.h
@@ -63,6 +63,7 @@ EBookViewListener *e_book_view_listener_new (void);
int e_book_view_listener_check_pending (EBookViewListener *listener);
EBookViewListenerResponse *e_book_view_listener_pop_response (EBookViewListener *listener);
GtkType e_book_view_listener_get_type (void);
+void e_book_view_listener_stop (EBookViewListener *listener);
POA_GNOME_Evolution_Addressbook_BookViewListener__epv *e_book_view_listener_get_epv (void);
diff --git a/addressbook/backend/ebook/e-book-view.c b/addressbook/backend/ebook/e-book-view.c
index 3528bde63f..f20531a50a 100644
--- a/addressbook/backend/ebook/e-book-view.c
+++ b/addressbook/backend/ebook/e-book-view.c
@@ -208,6 +208,7 @@ e_book_view_destroy (GtkObject *object)
if (book_view->priv->responses_queued_id)
gtk_signal_disconnect(GTK_OBJECT(book_view->priv->listener),
book_view->priv->responses_queued_id);
+ e_book_view_listener_stop (book_view->priv->listener);
bonobo_object_unref (BONOBO_OBJECT(book_view->priv->listener));
}
diff --git a/addressbook/backend/pas/pas-backend-file.c b/addressbook/backend/pas/pas-backend-file.c
index 9e0a24fd50..ec7bdfcd7f 100644
--- a/addressbook/backend/pas/pas-backend-file.c
+++ b/addressbook/backend/pas/pas-backend-file.c
@@ -187,8 +187,6 @@ cursor_destroy(GtkObject *object, gpointer data)
static void
view_destroy(GtkObject *object, gpointer data)
{
- CORBA_Environment ev;
- GNOME_Evolution_Addressbook_Book corba_book;
PASBook *book = (PASBook *)data;
PASBackendFile *bf;
EIterator *iterator;
@@ -207,18 +205,7 @@ view_destroy(GtkObject *object, gpointer data)
g_warning ("Failed to remove from book_views list");
gtk_object_unref(GTK_OBJECT(iterator));
- corba_book = bonobo_object_corba_objref(BONOBO_OBJECT(book));
-
- CORBA_exception_init(&ev);
-
- GNOME_Evolution_Addressbook_Book_unref(corba_book, &ev);
-
- if (ev._major != CORBA_NO_EXCEPTION) {
- g_warning("view_destroy: Exception unreffing "
- "corba book.\n");
- }
-
- CORBA_exception_free(&ev);
+ bonobo_object_unref(BONOBO_OBJECT(book));
}
static void
@@ -991,25 +978,13 @@ pas_backend_file_process_get_book_view (PASBackend *backend,
PASBackendFile *bf = PAS_BACKEND_FILE (backend);
CORBA_Environment ev;
PASBookView *book_view;
- GNOME_Evolution_Addressbook_Book corba_book;
PASBackendFileBookView view;
PASBackendFileSearchContext ctx;
EIterator *iterator;
g_return_if_fail (req->listener != NULL);
- corba_book = bonobo_object_corba_objref(BONOBO_OBJECT(book));
-
- CORBA_exception_init(&ev);
-
- GNOME_Evolution_Addressbook_Book_ref(corba_book, &ev);
-
- if (ev._major != CORBA_NO_EXCEPTION) {
- g_warning("pas_backend_file_process_get_book_view: Exception reffing "
- "corba book.\n");
- }
-
- CORBA_exception_free(&ev);
+ bonobo_object_ref(BONOBO_OBJECT(book));
book_view = pas_book_view_new (req->listener);
@@ -1033,11 +1008,20 @@ 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));
gtk_object_unref(GTK_OBJECT(iterator));
g_free(req->search);
+ CORBA_exception_init(&ev);
+
+ bonobo_object_release_unref (req->listener, &ev);
+
+ if (ev._major != CORBA_NO_EXCEPTION) {
+ g_warning("pas_backend_file_process_get_book_view: Exception unreffing "
+ "listener.\n");
+ }
+
+ CORBA_exception_free(&ev);
}
static void
@@ -1048,25 +1032,13 @@ pas_backend_file_process_get_changes (PASBackend *backend,
PASBackendFile *bf = PAS_BACKEND_FILE (backend);
CORBA_Environment ev;
PASBookView *book_view;
- GNOME_Evolution_Addressbook_Book corba_book;
PASBackendFileBookView view;
PASBackendFileChangeContext ctx;
EIterator *iterator;
g_return_if_fail (req->listener != NULL);
- corba_book = bonobo_object_corba_objref(BONOBO_OBJECT(book));
-
- CORBA_exception_init(&ev);
-
- GNOME_Evolution_Addressbook_Book_ref(corba_book, &ev);
-
- if (ev._major != CORBA_NO_EXCEPTION) {
- g_warning("pas_backend_file_process_get_book_view: Exception reffing "
- "corba book.\n");
- }
-
- CORBA_exception_free(&ev);
+ bonobo_object_ref(BONOBO_OBJECT(book));
book_view = pas_book_view_new (req->listener);
@@ -1100,6 +1072,15 @@ pas_backend_file_process_get_changes (PASBackend *backend,
gtk_object_unref(GTK_OBJECT(iterator));
g_free(req->search);
+ CORBA_exception_init(&ev);
+ bonobo_object_release_unref (req->listener, &ev);
+
+ if (ev._major != CORBA_NO_EXCEPTION) {
+ g_warning("pas_backend_file_process_get_changed: Exception unreffing "
+ "listener.\n");
+ }
+
+ CORBA_exception_free(&ev);
}
static void
diff --git a/addressbook/backend/pas/pas-backend-ldap.c b/addressbook/backend/pas/pas-backend-ldap.c
index cc5a36f7db..c8cd900f87 100644
--- a/addressbook/backend/pas/pas-backend-ldap.c
+++ b/addressbook/backend/pas/pas-backend-ldap.c
@@ -1975,36 +1975,17 @@ pas_backend_ldap_process_get_book_view (PASBackend *backend,
{
PASBackendLDAP *bl = PAS_BACKEND_LDAP (backend);
CORBA_Environment ev;
- GNOME_Evolution_Addressbook_Book corba_book;
PASBookView *book_view;
PASBackendLDAPBookView *view;
g_return_if_fail (req->listener != NULL);
- corba_book = bonobo_object_corba_objref(BONOBO_OBJECT(book));
-
- CORBA_exception_init(&ev);
-
- GNOME_Evolution_Addressbook_Book_ref(corba_book, &ev);
-
- if (ev._major != CORBA_NO_EXCEPTION) {
- g_warning("pas_backend_file_process_get_book_view: Exception reffing "
- "corba book.\n");
- }
-
- CORBA_exception_free(&ev);
-
book_view = pas_book_view_new (req->listener);
+ bonobo_object_ref(BONOBO_OBJECT(book));
gtk_signal_connect(GTK_OBJECT(book_view), "destroy",
GTK_SIGNAL_FUNC(view_destroy), book);
- pas_book_respond_get_book_view (book,
- (book_view != NULL
- ? GNOME_Evolution_Addressbook_BookListener_Success
- : GNOME_Evolution_Addressbook_BookListener_CardNotFound /* XXX */),
- book_view);
-
view = g_new0(PASBackendLDAPBookView, 1);
view->book_view = book_view;
view->search = g_strdup(req->search);
@@ -2012,8 +1993,23 @@ pas_backend_ldap_process_get_book_view (PASBackend *backend,
bl->priv->book_views = g_list_prepend(bl->priv->book_views, view);
+ pas_book_respond_get_book_view (book,
+ (book_view != NULL
+ ? GNOME_Evolution_Addressbook_BookListener_Success
+ : GNOME_Evolution_Addressbook_BookListener_CardNotFound /* XXX */),
+ book_view);
+
pas_backend_ldap_search (bl, book, view);
+ g_free (req->search);
+ CORBA_exception_init(&ev);
+ bonobo_object_release_unref(req->listener, &ev);
+ if (ev._major != CORBA_NO_EXCEPTION) {
+ g_warning("pas_backend_file_process_get_book_view: Exception reffing "
+ "corba book.\n");
+ }
+ CORBA_exception_free(&ev);
+
}
static void
diff --git a/addressbook/backend/pas/pas-book-view.c b/addressbook/backend/pas/pas-book-view.c
index db56ae1cff..58f2e79cda 100644
--- a/addressbook/backend/pas/pas-book-view.c
+++ b/addressbook/backend/pas/pas-book-view.c
@@ -185,17 +185,9 @@ pas_book_view_construct (PASBookView *book_view,
return FALSE;
}
- CORBA_Object_duplicate (listener, &ev);
+ bonobo_object_dup_ref (listener, &ev);
if (ev._major != CORBA_NO_EXCEPTION) {
- g_warning("Unable to duplicate listener object in pas-book-view.c\n");
- CORBA_exception_free (&ev);
-
- return FALSE;
- }
-
- GNOME_Evolution_Addressbook_BookViewListener_ref (listener, &ev);
- if (ev._major != CORBA_NO_EXCEPTION) {
- g_warning("Unable to ref listener object in pas-book-view.c\n");
+ g_warning("Unable to duplicate & ref listener object in pas-book-view.c\n");
CORBA_exception_free (&ev);
return FALSE;
@@ -245,21 +237,12 @@ pas_book_view_destroy (GtkObject *object)
CORBA_Environment ev;
CORBA_exception_init (&ev);
-
- GNOME_Evolution_Addressbook_BookViewListener_unref (book_view->priv->listener, &ev);
+ bonobo_object_release_unref (book_view->priv->listener, &ev);
if (ev._major != CORBA_NO_EXCEPTION) {
CORBA_exception_free (&ev);
return;
}
-
- CORBA_Object_release (book_view->priv->listener, &ev);
- if (ev._major != CORBA_NO_EXCEPTION) {
- CORBA_exception_free (&ev);
-
- return;
- }
-
CORBA_exception_free (&ev);
g_free (book_view->priv);
diff --git a/addressbook/backend/pas/pas-book.c b/addressbook/backend/pas/pas-book.c
index d115e9062f..74e95a8ab3 100644
--- a/addressbook/backend/pas/pas-book.c
+++ b/addressbook/backend/pas/pas-book.c
@@ -144,7 +144,7 @@ pas_book_queue_get_book_view (PASBook *book, const GNOME_Evolution_Addressbook_B
CORBA_exception_init (&ev);
- req->listener = CORBA_Object_duplicate(listener, &ev);
+ req->listener = bonobo_object_dup_ref(listener, &ev);
if (ev._major != CORBA_NO_EXCEPTION) {
g_warning ("pas_book_queue_get_book_view: Exception "
@@ -168,7 +168,7 @@ pas_book_queue_get_changes (PASBook *book, const GNOME_Evolution_Addressbook_Boo
CORBA_exception_init (&ev);
- req->listener = CORBA_Object_duplicate(listener, &ev);
+ req->listener = bonobo_object_dup_ref(listener, &ev);
if (ev._major != CORBA_NO_EXCEPTION) {
g_warning ("pas_book_queue_get_changes: Exception "