aboutsummaryrefslogtreecommitdiffstats
path: root/addressbook/backend/ebook
diff options
context:
space:
mode:
authorChristopher James Lahey <clahey@ximian.com>2001-04-15 04:26:40 +0800
committerChris Lahey <clahey@src.gnome.org>2001-04-15 04:26:40 +0800
commit1d4c16a76ac2886fc626b7f64ff1f6f284cc9c9f (patch)
treea7a08eda206fea83a84329ef066e83bdc2f0135a /addressbook/backend/ebook
parenta0a4b49f2d361521bc9173c15148a543a9c4b756 (diff)
downloadgsoc2013-evolution-1d4c16a76ac2886fc626b7f64ff1f6f284cc9c9f.tar
gsoc2013-evolution-1d4c16a76ac2886fc626b7f64ff1f6f284cc9c9f.tar.gz
gsoc2013-evolution-1d4c16a76ac2886fc626b7f64ff1f6f284cc9c9f.tar.bz2
gsoc2013-evolution-1d4c16a76ac2886fc626b7f64ff1f6f284cc9c9f.tar.lz
gsoc2013-evolution-1d4c16a76ac2886fc626b7f64ff1f6f284cc9c9f.tar.xz
gsoc2013-evolution-1d4c16a76ac2886fc626b7f64ff1f6f284cc9c9f.tar.zst
gsoc2013-evolution-1d4c16a76ac2886fc626b7f64ff1f6f284cc9c9f.zip
Added the function e_book_view_listener_stop to tell the book view
2001-04-14 Christopher James Lahey <clahey@ximian.com> * backend/ebook/e-book-view-listener.c, backend/ebook/e-book-view-listener.h: Added the function e_book_view_listener_stop to tell the book view listener to stop sending signals. * backend/ebook/e-book-view.c (e_book_view_destroy): Tell the EBookViewListener to stop when we're destroyed. * backend/pas/pas-backend-file.c (view_destroy, pas_backend_file_process_get_book_view, pas_backend_file_process_get_changes): Cleaned these up a bit using bonobo_object_ref and bonobo_object_unref. (pas_backend_file_process_get_book_view, pas_backend_file_process_get_changes): bonobo_object_release_unref the EBookListener here. * backend/pas/pas-backend-ldap.c (pas_backend_ldap_process_get_book_view): Cleaned this up a bit using bonobo_object_ref. Make sure to unref the listener when we're done with it. Put the new book_view in the list before telling the book_listener that it's ready. * backend/pas/pas-book-view.c (pas_book_view_construct): Cleaned this up a bit using bonobo_object_dup_ref. (pas_book_view_destroy): Cleaned this up a bit using bonobo_object_release_unref. * backend/pas/pas-book.c (pas_book_queue_get_book_view, pas_book_queue_get_changes): bonobo_object_dup_ref here instead of just duplicating. svn path=/trunk/; revision=9313
Diffstat (limited to 'addressbook/backend/ebook')
-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
3 files changed, 41 insertions, 5 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));
}