aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2013-07-20 03:37:27 +0800
committerMatthew Barnes <mbarnes@redhat.com>2013-07-20 21:07:43 +0800
commit0ad9e247441b2c21f46fc7d2fdc2b66cea6740fc (patch)
tree0710a11dc0132fa57c7670f8e30b65f9ce4bbc1f
parent3b7efa149ac541e24e6e4ae54bdda4b0ecd6936d (diff)
downloadgsoc2013-evolution-0ad9e247441b2c21f46fc7d2fdc2b66cea6740fc.tar.gz
gsoc2013-evolution-0ad9e247441b2c21f46fc7d2fdc2b66cea6740fc.tar.zst
gsoc2013-evolution-0ad9e247441b2c21f46fc7d2fdc2b66cea6740fc.zip
EMemoShellView: Disconnect all signal handlers in dispose().
-rw-r--r--modules/calendar/e-memo-shell-view-private.c201
-rw-r--r--modules/calendar/e-memo-shell-view-private.h21
2 files changed, 178 insertions, 44 deletions
diff --git a/modules/calendar/e-memo-shell-view-private.c b/modules/calendar/e-memo-shell-view-private.c
index c049f44a52..df5182731d 100644
--- a/modules/calendar/e-memo-shell-view-private.c
+++ b/modules/calendar/e-memo-shell-view-private.c
@@ -153,17 +153,12 @@ void
e_memo_shell_view_private_constructed (EMemoShellView *memo_shell_view)
{
EMemoShellViewPrivate *priv = memo_shell_view->priv;
- EMemoShellContent *memo_shell_content;
- EMemoShellSidebar *memo_shell_sidebar;
EShellBackend *shell_backend;
EShellContent *shell_content;
EShellSidebar *shell_sidebar;
EShellWindow *shell_window;
EShellView *shell_view;
EShell *shell;
- EMemoTable *memo_table;
- ECalModel *model;
- ESourceSelector *selector;
gulong handler_id;
shell_view = E_SHELL_VIEW (memo_shell_view);
@@ -181,16 +176,22 @@ e_memo_shell_view_private_constructed (EMemoShellView *memo_shell_view)
priv->memo_shell_content = g_object_ref (shell_content);
priv->memo_shell_sidebar = g_object_ref (shell_sidebar);
- memo_shell_content = E_MEMO_SHELL_CONTENT (shell_content);
- memo_table = e_memo_shell_content_get_memo_table (memo_shell_content);
- model = e_memo_table_get_model (memo_table);
+ handler_id = g_signal_connect_swapped (
+ priv->memo_shell_sidebar, "client-added",
+ G_CALLBACK (memo_shell_view_selector_client_added_cb),
+ memo_shell_view);
+ priv->client_added_handler_id = handler_id;
- memo_shell_sidebar = E_MEMO_SHELL_SIDEBAR (shell_sidebar);
- selector = e_memo_shell_sidebar_get_selector (memo_shell_sidebar);
+ handler_id = g_signal_connect_swapped (
+ priv->memo_shell_sidebar, "client-removed",
+ G_CALLBACK (memo_shell_view_selector_client_removed_cb),
+ memo_shell_view);
+ priv->client_removed_handler_id = handler_id;
/* Keep our own reference to this so we can
- * disconnect our signal handler in dispose(). */
- priv->client_cache = g_object_ref (e_shell_get_client_cache (shell));
+ * disconnect our signal handlers in dispose(). */
+ priv->client_cache = e_shell_get_client_cache (shell);
+ g_object_ref (priv->client_cache);
handler_id = g_signal_connect (
priv->client_cache, "backend-error",
@@ -198,70 +199,88 @@ e_memo_shell_view_private_constructed (EMemoShellView *memo_shell_view)
memo_shell_view);
priv->backend_error_handler_id = handler_id;
- g_signal_connect_swapped (
- model, "row-appended",
- G_CALLBACK (memo_shell_view_model_row_appended_cb),
- memo_shell_view);
+ /* Keep our own reference to this so we can
+ * disconnect our signal handlers in dispose(). */
+ priv->memo_table = e_memo_shell_content_get_memo_table (
+ E_MEMO_SHELL_CONTENT (shell_content));
+ g_object_ref (priv->memo_table);
- g_signal_connect_swapped (
- memo_table, "open-component",
+ handler_id = g_signal_connect_swapped (
+ priv->memo_table, "open-component",
G_CALLBACK (e_memo_shell_view_open_memo),
memo_shell_view);
+ priv->open_component_handler_id = handler_id;
- g_signal_connect_swapped (
- memo_table, "popup-event",
+ handler_id = g_signal_connect_swapped (
+ priv->memo_table, "popup-event",
G_CALLBACK (memo_shell_view_table_popup_event_cb),
memo_shell_view);
+ priv->popup_event_handler_id = handler_id;
- g_signal_connect_swapped (
- memo_table, "selection-change",
+ handler_id = g_signal_connect_swapped (
+ priv->memo_table, "selection-change",
G_CALLBACK (e_memo_shell_view_update_sidebar),
memo_shell_view);
+ priv->selection_change_1_handler_id = handler_id;
- g_signal_connect_swapped (
- memo_table, "selection-change",
+ handler_id = g_signal_connect_swapped (
+ priv->memo_table, "selection-change",
G_CALLBACK (e_shell_view_update_actions),
memo_shell_view);
+ priv->selection_change_2_handler_id = handler_id;
- g_signal_connect_swapped (
- memo_table, "status-message",
+ handler_id = g_signal_connect_swapped (
+ priv->memo_table, "status-message",
G_CALLBACK (e_memo_shell_view_set_status_message),
memo_shell_view);
+ priv->status_message_handler_id = handler_id;
+
+ /* Keep our own reference to this so we can
+ * disconnect our signal handlers in dispose(). */
+ priv->model = e_memo_table_get_model (priv->memo_table);
+ g_object_ref (priv->model);
- g_signal_connect_swapped (
- model, "model-changed",
+ handler_id = g_signal_connect_swapped (
+ priv->model, "model-changed",
G_CALLBACK (e_memo_shell_view_update_sidebar),
memo_shell_view);
+ priv->model_changed_handler_id = handler_id;
- g_signal_connect_swapped (
- model, "model-rows-deleted",
+ handler_id = g_signal_connect_swapped (
+ priv->model, "model-rows-deleted",
G_CALLBACK (e_memo_shell_view_update_sidebar),
memo_shell_view);
+ priv->model_rows_deleted_handler_id = handler_id;
- g_signal_connect_swapped (
- model, "model-rows-inserted",
+ handler_id = g_signal_connect_swapped (
+ priv->model, "model-rows-inserted",
G_CALLBACK (e_memo_shell_view_update_sidebar),
memo_shell_view);
+ priv->model_rows_inserted_handler_id = handler_id;
- g_signal_connect_swapped (
- memo_shell_sidebar, "client-added",
- G_CALLBACK (memo_shell_view_selector_client_added_cb),
+ handler_id = g_signal_connect_swapped (
+ priv->model, "row-appended",
+ G_CALLBACK (memo_shell_view_model_row_appended_cb),
memo_shell_view);
+ priv->row_appended_handler_id = handler_id;
- g_signal_connect_swapped (
- memo_shell_sidebar, "client-removed",
- G_CALLBACK (memo_shell_view_selector_client_removed_cb),
- memo_shell_view);
+ /* Keep our own reference to this so we can
+ * disconnect our signal handlers in dispose(). */
+ priv->selector = e_memo_shell_sidebar_get_selector (
+ E_MEMO_SHELL_SIDEBAR (shell_sidebar));
+ g_object_ref (priv->selector);
- g_signal_connect_swapped (
- selector, "popup-event",
+ handler_id = g_signal_connect_swapped (
+ priv->selector, "popup-event",
G_CALLBACK (memo_shell_view_selector_popup_event_cb),
memo_shell_view);
+ priv->selector_popup_event_handler_id = handler_id;
- g_signal_connect_swapped (
- selector, "primary-selection-changed",
+ handler_id = g_signal_connect_swapped (
+ priv->selector, "primary-selection-changed",
G_CALLBACK (e_shell_view_update_actions),
memo_shell_view);
+ priv->primary_selection_changed_handler_id = handler_id;
e_categories_add_change_hook (
(GHookFunc) e_memo_shell_view_update_search_filter,
@@ -270,7 +289,7 @@ e_memo_shell_view_private_constructed (EMemoShellView *memo_shell_view)
/* Keep the ECalModel in sync with the sidebar. */
g_object_bind_property (
shell_sidebar, "default-client",
- model, "default-client",
+ priv->model, "default-client",
G_BINDING_SYNC_CREATE);
e_memo_shell_view_actions_init (memo_shell_view);
@@ -283,6 +302,20 @@ e_memo_shell_view_private_dispose (EMemoShellView *memo_shell_view)
{
EMemoShellViewPrivate *priv = memo_shell_view->priv;
+ if (priv->client_added_handler_id > 0) {
+ g_signal_handler_disconnect (
+ priv->memo_shell_sidebar,
+ priv->client_added_handler_id);
+ priv->client_added_handler_id = 0;
+ }
+
+ if (priv->client_removed_handler_id > 0) {
+ g_signal_handler_disconnect (
+ priv->memo_shell_sidebar,
+ priv->client_removed_handler_id);
+ priv->client_removed_handler_id = 0;
+ }
+
if (priv->backend_error_handler_id > 0) {
g_signal_handler_disconnect (
priv->client_cache,
@@ -290,11 +323,91 @@ e_memo_shell_view_private_dispose (EMemoShellView *memo_shell_view)
priv->backend_error_handler_id = 0;
}
+ if (priv->open_component_handler_id > 0) {
+ g_signal_handler_disconnect (
+ priv->memo_table,
+ priv->open_component_handler_id);
+ priv->open_component_handler_id = 0;
+ }
+
+ if (priv->popup_event_handler_id > 0) {
+ g_signal_handler_disconnect (
+ priv->memo_table,
+ priv->popup_event_handler_id);
+ priv->popup_event_handler_id = 0;
+ }
+
+ if (priv->selection_change_1_handler_id > 0) {
+ g_signal_handler_disconnect (
+ priv->memo_table,
+ priv->selection_change_1_handler_id);
+ priv->selection_change_1_handler_id = 0;
+ }
+
+ if (priv->selection_change_2_handler_id > 0) {
+ g_signal_handler_disconnect (
+ priv->memo_table,
+ priv->selection_change_2_handler_id);
+ priv->selection_change_2_handler_id = 0;
+ }
+
+ if (priv->status_message_handler_id > 0) {
+ g_signal_handler_disconnect (
+ priv->memo_table,
+ priv->status_message_handler_id);
+ priv->status_message_handler_id = 0;
+ }
+
+ if (priv->model_changed_handler_id > 0) {
+ g_signal_handler_disconnect (
+ priv->model,
+ priv->model_changed_handler_id);
+ priv->model_changed_handler_id = 0;
+ }
+
+ if (priv->model_rows_deleted_handler_id > 0) {
+ g_signal_handler_disconnect (
+ priv->model,
+ priv->model_rows_deleted_handler_id);
+ priv->model_rows_deleted_handler_id = 0;
+ }
+
+ if (priv->model_rows_inserted_handler_id > 0) {
+ g_signal_handler_disconnect (
+ priv->model,
+ priv->model_rows_inserted_handler_id);
+ priv->model_rows_inserted_handler_id = 0;
+ }
+
+ if (priv->row_appended_handler_id > 0) {
+ g_signal_handler_disconnect (
+ priv->model,
+ priv->row_appended_handler_id);
+ priv->row_appended_handler_id = 0;
+ }
+
+ if (priv->selector_popup_event_handler_id > 0) {
+ g_signal_handler_disconnect (
+ priv->selector,
+ priv->selector_popup_event_handler_id);
+ priv->selector_popup_event_handler_id = 0;
+ }
+
+ if (priv->primary_selection_changed_handler_id > 0) {
+ g_signal_handler_disconnect (
+ priv->selector,
+ priv->primary_selection_changed_handler_id);
+ priv->primary_selection_changed_handler_id = 0;
+ }
+
g_clear_object (&priv->memo_shell_backend);
g_clear_object (&priv->memo_shell_content);
g_clear_object (&priv->memo_shell_sidebar);
g_clear_object (&priv->client_cache);
+ g_clear_object (&priv->memo_table);
+ g_clear_object (&priv->model);
+ g_clear_object (&priv->selector);
if (memo_shell_view->priv->activity != NULL) {
/* XXX Activity is not cancellable. */
diff --git a/modules/calendar/e-memo-shell-view-private.h b/modules/calendar/e-memo-shell-view-private.h
index 29f5a6333a..aa04e60a11 100644
--- a/modules/calendar/e-memo-shell-view-private.h
+++ b/modules/calendar/e-memo-shell-view-private.h
@@ -78,9 +78,30 @@ struct _EMemoShellViewPrivate {
EMemoShellContent *memo_shell_content;
EMemoShellSidebar *memo_shell_sidebar;
+ /* sidebar signal handlers */
+ gulong client_added_handler_id;
+ gulong client_removed_handler_id;
+
EClientCache *client_cache;
gulong backend_error_handler_id;
+ EMemoTable *memo_table;
+ gulong open_component_handler_id;
+ gulong popup_event_handler_id;
+ gulong selection_change_1_handler_id;
+ gulong selection_change_2_handler_id;
+ gulong status_message_handler_id;
+
+ ECalModel *model;
+ gulong model_changed_handler_id;
+ gulong model_rows_deleted_handler_id;
+ gulong model_rows_inserted_handler_id;
+ gulong row_appended_handler_id;
+
+ ESourceSelector *selector;
+ gulong selector_popup_event_handler_id;
+ gulong primary_selection_changed_handler_id;
+
EActivity *activity;
};