[Commits] folder.c 1.213.2.204 1.213.2.205 messageview.c 1.94.2.225 1.94.2.226 messageview.h 1.19.2.26 1.19.2.27 procmsg.h 1.60.2.57 1.60.2.58

pawel at claws-mail.org pawel at claws-mail.org
Thu Feb 2 17:12:18 CET 2012


Update of /home/claws-mail/claws/src
In directory srv:/tmp/cvs-serv15620/src

Modified Files:
      Tag: gtk2
	folder.c messageview.c messageview.h procmsg.h 
Log Message:
2012-02-02 [pawel]	3.8.0cvs21

	* src/folder.c
	* src/messageview.c
	* src/messageview.h
	* src/procmsg.h
		Fix bug #2501 'opened message blanks when moved to other folder'
		Detect message move and update message window contents 
		accordingly, if	message is moved to trash close window

Index: messageview.h
===================================================================
RCS file: /home/claws-mail/claws/src/messageview.h,v
retrieving revision 1.19.2.26
retrieving revision 1.19.2.27
diff -u -d -r1.19.2.26 -r1.19.2.27
--- messageview.h	16 Feb 2011 07:16:10 -0000	1.19.2.26
+++ messageview.h	2 Feb 2012 16:12:16 -0000	1.19.2.27
@@ -75,6 +75,7 @@
 	gboolean all_headers;
 
 	gint msginfo_update_callback_id;
+	gint msginfo_moved_callback_id;
 	gboolean updating;
 	gboolean deferred_destroy;
 	

Index: messageview.c
===================================================================
RCS file: /home/claws-mail/claws/src/messageview.c,v
retrieving revision 1.94.2.225
retrieving revision 1.94.2.226
diff -u -d -r1.94.2.225 -r1.94.2.226
--- messageview.c	2 Dec 2011 12:50:09 -0000	1.94.2.225
+++ messageview.c	2 Feb 2012 16:12:16 -0000	1.94.2.226
@@ -178,6 +178,7 @@
 static void messageview_update		(MessageView	*msgview,
 					 MsgInfo	*old_msginfo);
 static gboolean messageview_update_msg	(gpointer source, gpointer data);
+static gboolean messageview_msg_moved	(gpointer source, gpointer data);
 
 static void messageview_nothing_cb	   (GtkAction *action, gpointer data)
 {
@@ -408,6 +409,7 @@
 
 	messageview->msginfo_update_callback_id =
 		hooks_register_hook(MSGINFO_UPDATE_HOOKLIST, messageview_update_msg, (gpointer) messageview);
+	messageview->msginfo_moved_callback_id = 0;
 
 	return messageview;
 }
@@ -710,6 +712,8 @@
 	g_signal_connect(G_OBJECT(window), "key_press_event",
 			 G_CALLBACK(key_pressed), msgview);
 #endif
+	msgview->msginfo_moved_callback_id = hooks_register_hook(MSGINFO_UPDATE_HOOKLIST,
+					messageview_msg_moved, (gpointer) msgview);
 	messageview_add_toolbar(msgview, window);
 
 	if (show) {
@@ -1454,6 +1458,9 @@
 	if (!messageview->deferred_destroy) {
 		hooks_unregister_hook(MSGINFO_UPDATE_HOOKLIST,
 			      messageview->msginfo_update_callback_id);
+		if (messageview->new_window)
+			hooks_unregister_hook(MSGINFO_UPDATE_HOOKLIST,
+				messageview->msginfo_moved_callback_id);
 	}
 
 	if (messageview->updating) {
@@ -2741,7 +2748,9 @@
 	if (messageview->msginfo != msginfo_update->msginfo)
 		return FALSE;
 
-	if (msginfo_update->flags & MSGINFO_UPDATE_DELETED) {
+	if ((msginfo_update->flags & MSGINFO_UPDATE_DELETED) &&
+		!messageview->new_window)
+	{
 		MsgInfo *old_msginfo = messageview->msginfo;
 		messageview_clear(messageview);
 		messageview_update(messageview, old_msginfo);
@@ -2750,6 +2759,29 @@
 	return FALSE;
 }
 
+static gboolean messageview_msg_moved(gpointer source, gpointer data)
+{
+	MsgInfoUpdate *msginfo_update = (MsgInfoUpdate *) source;
+	MessageView *messageview = (MessageView *) data;
+	MsgInfo *msg_old = messageview->msginfo;
+	MsgInfo *msg_new = msginfo_update->msginfo;
+
+	if (strcmp2(msg_new->msgid, msg_old->msgid))
+		return FALSE;
+
+	if ((msginfo_update->flags & MSGINFO_UPDATE_ADDED) &&
+	    (folder_item_get_msginfo(msg_old->folder, msg_old->msgnum) == NULL))
+	{
+		if (folder_has_parent_of_type(msg_new->folder, F_TRASH))
+			messageview_destroy(messageview);
+		else
+			messageview_show(messageview, msg_new,
+					 messageview->all_headers);
+	}
+	
+	return FALSE;
+}
+
 void messageview_set_menu_sensitive(MessageView *messageview)
 {
 	if (!messageview || !messageview->new_window) 

Index: procmsg.h
===================================================================
RCS file: /home/claws-mail/claws/src/procmsg.h,v
retrieving revision 1.60.2.57
retrieving revision 1.60.2.58
diff -u -d -r1.60.2.57 -r1.60.2.58
--- procmsg.h	25 Oct 2011 07:22:55 -0000	1.60.2.57
+++ procmsg.h	2 Feb 2012 16:12:16 -0000	1.60.2.58
@@ -174,7 +174,8 @@
 
 typedef enum {
 	MSGINFO_UPDATE_FLAGS = 1 << 0,
-	MSGINFO_UPDATE_DELETED = 1 << 1
+	MSGINFO_UPDATE_DELETED = 1 << 1,
+	MSGINFO_UPDATE_ADDED = 1 << 2
 } MsgInfoUpdateFlags;
 
 #include "procmime.h"

Index: folder.c
===================================================================
RCS file: /home/claws-mail/claws/src/folder.c,v
retrieving revision 1.213.2.204
retrieving revision 1.213.2.205
diff -u -d -r1.213.2.204 -r1.213.2.205
--- folder.c	26 Nov 2011 13:18:54 -0000	1.213.2.204
+++ folder.c	2 Feb 2012 16:12:16 -0000	1.213.2.205
@@ -3066,6 +3066,8 @@
 
 static void add_msginfo_to_cache(FolderItem *item, MsgInfo *newmsginfo, MsgInfo *flagsource)
 {
+	MsgInfoUpdate msginfo_update;
+
 	/* update folder stats */
 	if (MSG_IS_NEW(newmsginfo->flags))
 		item->new_msgs++;
@@ -3092,6 +3094,10 @@
 	if (!item->cache)
 		folder_item_read_cache(item);
 
+	msginfo_update.msginfo = newmsginfo;
+	msginfo_update.flags = MSGINFO_UPDATE_ADDED;
+	hooks_invoke(MSGINFO_UPDATE_HOOKLIST, &msginfo_update);
+
 	msgcache_add_msg(item->cache, newmsginfo);
 	copy_msginfo_flags(flagsource, newmsginfo);
 	folder_item_update_with_msg(item,  F_ITEM_UPDATE_MSGCNT | F_ITEM_UPDATE_CONTENT | F_ITEM_UPDATE_ADDMSG, newmsginfo);



More information about the Commits mailing list