From b55c39cdecd01471c808e7c0e88e8560afa54eab Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Fri, 15 Feb 2013 19:55:53 -0500 Subject: EBookShellView: Keep an ID for "source-removed" signal handler. --- modules/addressbook/e-book-shell-view-private.c | 19 +++++++++++-------- modules/addressbook/e-book-shell-view-private.h | 2 ++ 2 files changed, 13 insertions(+), 8 deletions(-) (limited to 'modules') diff --git a/modules/addressbook/e-book-shell-view-private.c b/modules/addressbook/e-book-shell-view-private.c index efe4322cd0..82b339596f 100644 --- a/modules/addressbook/e-book-shell-view-private.c +++ b/modules/addressbook/e-book-shell-view-private.c @@ -530,6 +530,7 @@ e_book_shell_view_private_constructed (EBookShellView *book_shell_view) EShellSidebar *shell_sidebar; EShellBackend *shell_backend; ESourceSelector *selector; + gulong handler_id; shell_view = E_SHELL_VIEW (book_shell_view); shell_backend = e_shell_view_get_shell_backend (shell_view); @@ -553,10 +554,11 @@ e_book_shell_view_private_constructed (EBookShellView *book_shell_view) selector = e_book_shell_sidebar_get_selector ( E_BOOK_SHELL_SIDEBAR (shell_sidebar)); - g_signal_connect ( + handler_id = g_signal_connect ( priv->registry, "source-removed", G_CALLBACK (book_shell_view_source_removed_cb), book_shell_view); + priv->source_removed_handler_id = handler_id; g_signal_connect_object ( selector, "button-press-event", @@ -587,17 +589,18 @@ e_book_shell_view_private_dispose (EBookShellView *book_shell_view) { EBookShellViewPrivate *priv = book_shell_view->priv; + if (priv->source_removed_handler_id > 0) { + g_signal_handler_disconnect ( + priv->registry, + priv->source_removed_handler_id); + priv->source_removed_handler_id = 0; + } + g_clear_object (&priv->book_shell_backend); g_clear_object (&priv->book_shell_content); g_clear_object (&priv->book_shell_sidebar); - if (priv->registry != NULL) { - g_signal_handlers_disconnect_matched ( - priv->registry, G_SIGNAL_MATCH_DATA, - 0, 0, NULL, NULL, book_shell_view); - g_object_unref (priv->registry); - priv->registry = NULL; - } + g_clear_object (&priv->registry); g_hash_table_remove_all (priv->uid_to_view); } diff --git a/modules/addressbook/e-book-shell-view-private.h b/modules/addressbook/e-book-shell-view-private.h index 1fe2b9b7a4..108677b790 100644 --- a/modules/addressbook/e-book-shell-view-private.h +++ b/modules/addressbook/e-book-shell-view-private.h @@ -85,6 +85,8 @@ struct _EBookShellViewPrivate { EBookShellSidebar *book_shell_sidebar; ESourceRegistry *registry; + gulong source_removed_handler_id; + GHashTable *uid_to_view; gint preview_index; -- cgit