[evolution] fix lifecycle nasties bgo#625852



commit b5299135f67ca5cf5f2bf12cad51049b90287776
Author: Michael Meeks <michael meeks novell com>
Date:   Mon Aug 2 17:45:48 2010 +0100

    fix lifecycle nasties bgo#625852

 modules/addressbook/e-book-shell-view-private.c |   56 +++++++++++++----------
 modules/addressbook/e-book-shell-view.c         |    7 ++-
 2 files changed, 36 insertions(+), 27 deletions(-)
---
diff --git a/modules/addressbook/e-book-shell-view-private.c b/modules/addressbook/e-book-shell-view-private.c
index 746a11c..a9b64a3 100644
--- a/modules/addressbook/e-book-shell-view-private.c
+++ b/modules/addressbook/e-book-shell-view-private.c
@@ -139,6 +139,9 @@ contact_changed (EBookShellView *book_shell_view,
 	EBookShellContent *book_shell_content;
 	EContact *contact;
 
+	g_return_if_fail (E_IS_SHELL_VIEW (book_shell_view));
+	g_return_if_fail (book_shell_view->priv != NULL);
+
 	book_shell_content = book_shell_view->priv->book_shell_content;
 
 	contact = e_addressbook_model_contact_at (model, index);
@@ -158,6 +161,9 @@ contacts_removed (EBookShellView *book_shell_view,
 	EBookShellContent *book_shell_content;
 	EContact *preview_contact;
 
+	g_return_if_fail (E_IS_SHELL_VIEW (book_shell_view));
+	g_return_if_fail (book_shell_view->priv != NULL);
+
 	book_shell_content = book_shell_view->priv->book_shell_content;
 
 	preview_contact =
@@ -259,22 +265,22 @@ book_shell_view_activate_selected_source (EBookShellView *book_shell_view,
 			hash_table, g_strdup (uid),
 			g_object_ref (widget));
 
-		g_signal_connect_swapped (
-			widget, "open-contact",
-			G_CALLBACK (open_contact), book_shell_view);
+		g_signal_connect_object (
+			widget, "open-contact", G_CALLBACK (open_contact),
+			book_shell_view, G_CONNECT_SWAPPED);
 
-		g_signal_connect_swapped (
-			widget, "popup-event",
-			G_CALLBACK (popup_event), book_shell_view);
+		g_signal_connect_object (
+			widget, "popup-event", G_CALLBACK (popup_event),
+			book_shell_view, G_CONNECT_SWAPPED);
 
-		g_signal_connect_swapped (
+		g_signal_connect_object (
 			widget, "command-state-change",
 			G_CALLBACK (e_shell_view_update_actions),
-			book_shell_view);
+			book_shell_view, G_CONNECT_SWAPPED);
 
-		g_signal_connect_swapped (
-			widget, "selection-change",
-			G_CALLBACK (selection_change), book_shell_view);
+		g_signal_connect_object (
+			widget, "selection-change", G_CALLBACK (selection_change),
+			book_shell_view, G_CONNECT_SWAPPED);
 
 		book = e_book_new (source, NULL);
 		view = E_ADDRESSBOOK_VIEW (widget);
@@ -284,13 +290,13 @@ book_shell_view_activate_selected_source (EBookShellView *book_shell_view,
 
 		model = e_addressbook_view_get_model (view);
 
-		g_signal_connect_swapped (
-			model, "contact-changed",
-			G_CALLBACK (contact_changed), book_shell_view);
+		g_signal_connect_object (
+			model, "contact-changed", G_CALLBACK (contact_changed),
+			book_shell_view, G_CONNECT_SWAPPED);
 
-		g_signal_connect_swapped (
-			model, "contacts-removed",
-			G_CALLBACK (contacts_removed), book_shell_view);
+		g_signal_connect_object (
+			model, "contacts-removed", G_CALLBACK (contacts_removed),
+			book_shell_view, G_CONNECT_SWAPPED);
 	}
 
 	e_book_shell_content_set_current_view (
@@ -478,25 +484,25 @@ 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_swapped (
+	g_signal_connect_object (
 		selector, "button-press-event",
 		G_CALLBACK (book_shell_view_selector_button_press_event_cb),
-		book_shell_view);
+		book_shell_view, G_CONNECT_SWAPPED);
 
-	g_signal_connect_swapped (
+	g_signal_connect_object (
 		selector, "key-press-event",
 		G_CALLBACK (book_shell_view_selector_key_press_event_cb),
-		book_shell_view);
+		book_shell_view, G_CONNECT_SWAPPED);
 
-	g_signal_connect_swapped (
+	g_signal_connect_object (
 		selector, "popup-menu",
 		G_CALLBACK (book_shell_view_selector_popup_menu_cb),
-		book_shell_view);
+		book_shell_view, G_CONNECT_SWAPPED);
 
-	g_signal_connect_swapped (
+	g_signal_connect_object (
 		selector, "primary-selection-changed",
 		G_CALLBACK (book_shell_view_activate_selected_source),
-		book_shell_view);
+		book_shell_view, G_CONNECT_SWAPPED);
 
 	e_categories_add_change_hook (
 		(GHookFunc) e_book_shell_view_update_search_filter,
diff --git a/modules/addressbook/e-book-shell-view.c b/modules/addressbook/e-book-shell-view.c
index e7b1c7b..2ac5d98 100644
--- a/modules/addressbook/e-book-shell-view.c
+++ b/modules/addressbook/e-book-shell-view.c
@@ -33,6 +33,9 @@ book_shell_view_source_list_changed_cb (EBookShellView *book_shell_view,
 	EShellView *shell_view;
 	GList *keys, *iter;
 
+	g_return_if_fail (E_IS_SHELL_VIEW (book_shell_view));
+	g_return_if_fail (book_shell_view->priv != NULL);
+
 	shell_view = E_SHELL_VIEW (book_shell_view);
 	book_shell_content = book_shell_view->priv->book_shell_content;
 
@@ -114,10 +117,10 @@ book_shell_view_constructed (GObject *object)
 	book_shell_backend = book_shell_view->priv->book_shell_backend;
 	source_list = e_book_shell_backend_get_source_list (book_shell_backend);
 
-	g_signal_connect_swapped (
+	g_signal_connect_object (
 		source_list, "changed",
 		G_CALLBACK (book_shell_view_source_list_changed_cb),
-		book_shell_view);
+		book_shell_view, G_CONNECT_SWAPPED);
 }
 
 static void



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]