[Commits] folder.c 1.213.2.205 1.213.2.206 messageview.c 1.94.2.228 1.94.2.229 messageview.h 1.19.2.28 1.19.2.29 procmsg.h 1.60.2.59 1.60.2.60 summaryview.c 1.395.2.444 1.395.2.445 textview.c 1.96.2.237 1.96.2.238 textview.h 1.12.2.29 1.12.2.30

pawel at claws-mail.org pawel at claws-mail.org
Thu Mar 15 00:00:58 CET 2012


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

Modified Files:
      Tag: gtk2
	folder.c messageview.c messageview.h procmsg.h summaryview.c 
	textview.c textview.h 
Log Message:
2012-03-14 [pawel]	3.8.0cvs32

	* src/folder.c
	* src/messageview.c
	* src/messageview.h
	* src/procmsg.h
	* src/summaryview.c
	* src/textview.c
	* src/textview.h
		Better fix for bug #2501
		Instead of leaving blank window after message move or delete,
		update separate view to next message in message list or
		display info why view is blank. This was discussed
		in bug #2621 comments.

Index: procmsg.h
===================================================================
RCS file: /home/claws-mail/claws/src/procmsg.h,v
retrieving revision 1.60.2.59
retrieving revision 1.60.2.60
diff -u -d -r1.60.2.59 -r1.60.2.60
--- procmsg.h	5 Feb 2012 20:00:35 -0000	1.60.2.59
+++ procmsg.h	14 Mar 2012 23:00:54 -0000	1.60.2.60
@@ -174,8 +174,7 @@
 
 typedef enum {
 	MSGINFO_UPDATE_FLAGS = 1 << 0,
-	MSGINFO_UPDATE_DELETED = 1 << 1,
-	MSGINFO_UPDATE_ADDED = 1 << 2
+	MSGINFO_UPDATE_DELETED = 1 << 1
 } MsgInfoUpdateFlags;
 
 #include "procmime.h"

Index: folder.c
===================================================================
RCS file: /home/claws-mail/claws/src/folder.c,v
retrieving revision 1.213.2.205
retrieving revision 1.213.2.206
diff -u -d -r1.213.2.205 -r1.213.2.206
--- folder.c	2 Feb 2012 16:12:16 -0000	1.213.2.205
+++ folder.c	14 Mar 2012 23:00:54 -0000	1.213.2.206
@@ -3066,8 +3066,6 @@
 
 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++;
@@ -3094,10 +3092,6 @@
 	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);

Index: textview.h
===================================================================
RCS file: /home/claws-mail/claws/src/textview.h,v
retrieving revision 1.12.2.29
retrieving revision 1.12.2.30
diff -u -d -r1.12.2.29 -r1.12.2.30
--- textview.h	19 Nov 2011 17:47:47 -0000	1.12.2.29
+++ textview.h	14 Mar 2012 23:00:55 -0000	1.12.2.30
@@ -90,6 +90,8 @@
 				 MimeInfo	*mimeinfo,
 				 FILE		*fp);
 void textview_show_error	(TextView	*textview);
+void textview_show_info		(TextView	*textview,
+				 const gchar	*info_str);
 void textview_show_mime_part	(TextView	*textview,
 				 MimeInfo	*partinfo);
 void textview_clear		(TextView	*textview);

Index: summaryview.c
===================================================================
RCS file: /home/claws-mail/claws/src/summaryview.c,v
retrieving revision 1.395.2.444
retrieving revision 1.395.2.445
diff -u -d -r1.395.2.444 -r1.395.2.445
--- summaryview.c	5 Feb 2012 20:00:35 -0000	1.395.2.444
+++ summaryview.c	14 Mar 2012 23:00:55 -0000	1.395.2.445
@@ -6817,6 +6817,8 @@
 static void summary_selected(GtkCMCTree *ctree, GtkCMCTreeNode *row,
 			     gint column, SummaryView *summaryview)
 {
+	GList *list, *cur;
+	MessageView *msgview;
 	MsgInfo *msginfo;
 	gboolean marked_unread = FALSE;
 
@@ -6908,6 +6910,17 @@
 		break;
 	}
 
+	list = messageview_get_msgview_list();
+	for (cur = list; cur != NULL; cur = cur->next) {
+		msgview = (MessageView *) cur->data;
+		
+		if (msgview->new_window && msgview->update_needed) {
+			MsgInfo *new_msginfo = summary_get_selected_msg(summaryview);
+			messageview_show(msgview, new_msginfo, msgview->all_headers);
+			msgview->update_needed = FALSE;		
+		}
+	}
+
 	if (summaryview->display_msg ||
 	    (prefs_common.always_show_msg &&
 	     messageview_is_visible(summaryview->messageview))) {

Index: textview.c
===================================================================
RCS file: /home/claws-mail/claws/src/textview.c,v
retrieving revision 1.96.2.237
retrieving revision 1.96.2.238
diff -u -d -r1.96.2.237 -r1.96.2.238
--- textview.c	19 Nov 2011 17:47:47 -0000	1.96.2.237
+++ textview.c	14 Mar 2012 23:00:55 -0000	1.96.2.238
@@ -862,6 +862,23 @@
 	textview_show_icon(textview, GTK_STOCK_DIALOG_ERROR);
 }
 
+void textview_show_info(TextView *textview, const gchar *info_str)
+{
+	GtkTextView *text;
+	GtkTextBuffer *buffer;
+	GtkTextIter iter;
+
+	textview_set_font(textview, NULL);
+	textview_clear(textview);
+
+	text = GTK_TEXT_VIEW(textview->text);
+	buffer = gtk_text_view_get_buffer(text);
+	gtk_text_buffer_get_start_iter(buffer, &iter);
+
+	TEXTVIEW_INSERT(info_str);
+	textview_show_icon(textview, GTK_STOCK_DIALOG_INFO);
+}
+
 void textview_show_mime_part(TextView *textview, MimeInfo *partinfo)
 {
 	GtkTextView *text;

Index: messageview.h
===================================================================
RCS file: /home/claws-mail/claws/src/messageview.h,v
retrieving revision 1.19.2.28
retrieving revision 1.19.2.29
diff -u -d -r1.19.2.28 -r1.19.2.29
--- messageview.h	5 Feb 2012 20:00:35 -0000	1.19.2.28
+++ messageview.h	14 Mar 2012 23:00:54 -0000	1.19.2.29
@@ -75,12 +75,12 @@
 	gboolean all_headers;
 
 	gint msginfo_update_callback_id;
-	gint msginfo_moved_callback_id;
 	gboolean updating;
 	gboolean deferred_destroy;
 	
 	gboolean show_full_text;
 	gboolean partial_display_shown;
+	gboolean update_needed;
 	GtkUIManager *ui_manager;
 	GList *trail;
 	gint trail_pos;

Index: messageview.c
===================================================================
RCS file: /home/claws-mail/claws/src/messageview.c,v
retrieving revision 1.94.2.228
retrieving revision 1.94.2.229
diff -u -d -r1.94.2.228 -r1.94.2.229
--- messageview.c	13 Feb 2012 18:31:09 -0000	1.94.2.228
+++ messageview.c	14 Mar 2012 23:00:54 -0000	1.94.2.229
@@ -180,7 +180,6 @@
 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)
 {
@@ -410,10 +409,10 @@
 	messageview->statusbar_cid = 0;
 
 	messageview->show_full_text= FALSE;
+	messageview->update_needed = FALSE;
 
 	messageview->msginfo_update_callback_id =
 		hooks_register_hook(MSGINFO_UPDATE_HOOKLIST, messageview_update_msg, (gpointer) messageview);
-	messageview->msginfo_moved_callback_id = 0;
 
 	return messageview;
 }
@@ -718,8 +717,6 @@
 	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) {
@@ -1556,6 +1553,13 @@
 	procmsg_msginfo_free(messageview->msginfo);
 	messageview->msginfo = NULL;
 	messageview->filtered = FALSE;
+
+	if (messageview->window) {
+		gtk_window_set_title(GTK_WINDOW(messageview->window), 
+				_("Claws Mail - Message View"));
+		GTK_EVENTS_FLUSH();
+	}
+
 	mimeview_clear(messageview->mimeview);
 	headerview_clear(messageview->headerview);
 	noticeview_hide(messageview->noticeview);
@@ -1574,13 +1578,9 @@
 		messageview->mainwin->summaryview->displayed = NULL;
 		messageview->mainwin->summaryview->ext_messageview = NULL;
 	}
-	if (!messageview->deferred_destroy) {
+	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) {
 		debug_print("uh oh, better not touch that now (fetching)\n");
@@ -2876,44 +2876,35 @@
 {
 	MsgInfoUpdate *msginfo_update = (MsgInfoUpdate *) source;
 	MessageView *messageview = (MessageView *)data;
+	MsgInfo *old_msginfo = messageview->msginfo;
 
 	if (messageview->msginfo != msginfo_update->msginfo)
 		return FALSE;
 
-	if ((msginfo_update->flags & MSGINFO_UPDATE_DELETED) &&
-		!messageview->new_window)
+	if ((msginfo_update->flags & MSGINFO_UPDATE_DELETED) ||
+	    MSG_IS_DELETED(old_msginfo->flags))
 	{
-		MsgInfo *old_msginfo = messageview->msginfo;
-		messageview_clear(messageview);
-		messageview_update(messageview, old_msginfo);
-	}
-
-	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 (msg_new == NULL || msg_old == NULL)
-		return FALSE;
+		if (messageview->new_window) {
+			if (old_msginfo->folder && old_msginfo->folder->total_msgs == 0) {
+				messageview_clear(messageview);
+				textview_show_info(messageview->mimeview->textview,
+					_("\n  There are no messages in this folder"));
+				return FALSE;
+			}
+			
+			if (!prefs_common.always_show_msg) {
+				messageview_clear(messageview);
+				textview_show_info(messageview->mimeview->textview,
+					_("\n  Message has been deleted"));
+			} else
+				messageview->update_needed = TRUE;
 
-	if (strcmp2(msg_new->msgid, msg_old->msgid))
-		return FALSE;
+		} else {
+			messageview_clear(messageview);
+			messageview_update(messageview, old_msginfo);
+		}
+	} 
 
-	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;
 }
 



More information about the Commits mailing list