[evolution-patches] fix for message-browser



keep track of the signal handlers by id, fixes at least a warning. For
message_list_built's callback, might fix an actual bug as well.

Jeff

-- 
Jeffrey Stedfast
Evolution Hacker - Ximian, Inc.
fejj ximian com  - www.ximian.com
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/mail/ChangeLog,v
retrieving revision 1.2755
diff -u -r1.2755 ChangeLog
--- ChangeLog	23 Jun 2003 20:26:09 -0000	1.2755
+++ ChangeLog	24 Jun 2003 20:38:54 -0000
@@ -1,3 +1,16 @@
+2003-06-24  Jeffrey Stedfast  <fejj ximian com>
+
+	Might fix bug #45368 but I wouldn't bet on it.
+
+	* message-browser.c (message_browser_new): Record the signal id
+	for folder_loaded.
+	(message_browser_folder_loaded): disconnect by id rather than
+	searching for the handler. Save the id of the message_list_built
+	signal handler.
+	(message_browser_message_list_built): Disconnect the handler by
+	id.
+	(message_browser_destroy): Disconnect the signal handlers by id.
+
 2003-06-23  Dan Winship  <danw ximian com>
 
 	* message-list.c (on_selection_changed_cmd): Save the idle_id
Index: message-browser.c
===================================================================
RCS file: /cvs/gnome/evolution/mail/message-browser.c,v
retrieving revision 1.38
diff -u -r1.38 message-browser.c
--- message-browser.c	17 Jun 2003 03:15:46 -0000	1.38
+++ message-browser.c	24 Jun 2003 20:38:54 -0000
@@ -69,8 +69,17 @@
 	
 	message_browser = MESSAGE_BROWSER (object);
 	
+	if (message_browser->ml_built_id) {
+		g_signal_handler_disconnect (message_browser->fb->message_list, message_browser->ml_built_id);
+		message_browser->ml_built_id = 0;
+	}
+	
+	if (message_browser->loaded_id) {
+		g_signal_handler_disconnect (message_browser->fb, message_browser->loaded_id);
+		message_browser->loaded_id = 0;
+	}
+	
 	if (message_browser->fb) {
-		g_signal_handlers_disconnect_matched (message_browser->fb, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, message_browser);
 		g_object_unref (message_browser->fb);
 		message_browser->fb = NULL;
 	}
@@ -212,7 +221,7 @@
 	CamelMimeMessage *message;
 	char *subject = NULL;
 	char *title;
-
+	
 	folder_browser_ui_message_loaded(fb);
 	
 	message = fb->mail_display->current_message;
@@ -234,17 +243,21 @@
 message_browser_message_list_built (MessageList *ml, MessageBrowser *mb)
 {
 	const char *uid = g_object_get_data (G_OBJECT (mb), "uid");
-
-	g_signal_handlers_disconnect_matched (ml, G_SIGNAL_MATCH_DATA|G_SIGNAL_MATCH_FUNC, 0, 0, NULL,
-					      message_browser_message_list_built, mb);
+	
+	g_signal_handler_disconnect (ml, mb->ml_built_id);
+	mb->ml_built_id = 0;
+	
 	message_list_select_uid (ml, uid);
 }
 
 static void
 message_browser_folder_loaded (FolderBrowser *fb, const char *uri, MessageBrowser *mb)
 {
-	g_signal_connect (fb->message_list, "message_list_built",
-			  G_CALLBACK (message_browser_message_list_built), mb);
+	g_signal_handler_disconnect (fb->message_list, mb->loaded_id);
+	mb->loaded_id = 0;
+	
+	mb->ml_built_id = g_signal_connect (fb->message_list, "message_list_built",
+					    G_CALLBACK (message_browser_message_list_built), mb);
 }
 
 static void
@@ -353,7 +366,7 @@
 	set_default_size (GTK_WIDGET (new));
 	
 	/* more evil hackery... */
-	g_signal_connect (fb, "folder_loaded", G_CALLBACK (message_browser_folder_loaded), new);
+	new->loaded_id = g_signal_connect (fb, "folder_loaded", G_CALLBACK (message_browser_folder_loaded), new);
 	g_signal_connect (fb, "message_loaded", G_CALLBACK (message_browser_message_loaded), new);
 	
 	return GTK_WIDGET (new);
Index: message-browser.h
===================================================================
RCS file: /cvs/gnome/evolution/mail/message-browser.h,v
retrieving revision 1.7
diff -u -r1.7 message-browser.h
--- message-browser.h	2 Dec 2002 03:16:54 -0000	1.7
+++ message-browser.h	24 Jun 2003 20:38:54 -0000
@@ -44,6 +44,8 @@
 	 * The current URI being displayed by the MessageBrowser
 	 */
 	FolderBrowser *fb;
+	gulong ml_built_id;
+	gulong loaded_id;
 };
 
 


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