2012-03-14 [pawel] 3.8.0cvs32
authorPaweł Pękala <c0rn@gazeta.pl>
Wed, 14 Mar 2012 23:01:00 +0000 (23:01 +0000)
committerPaweł Pękala <c0rn@gazeta.pl>
Wed, 14 Mar 2012 23:01:00 +0000 (23:01 +0000)
* 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.

ChangeLog
PATCHSETS
configure.ac
src/folder.c
src/messageview.c
src/messageview.h
src/procmsg.h
src/summaryview.c
src/textview.c
src/textview.h

index 368b4e9023bd0fc159340a471d3f37d3059eb618..62c03c2701217a2a4ca397b3ecfe28721904bc98 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,18 @@
+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.
+
 2012-03-11 [colin]     3.8.0cvs31
 
        * src/gtk/gtkcmctree.c
index f072abf20eb5d503886bae974f301885509a55c9..6c5a2488eebc84bf076b3295fa9de986c02564be 100644 (file)
--- a/PATCHSETS
+++ b/PATCHSETS
 ( cvs diff -u -r 1.94.2.227 -r 1.94.2.228 src/messageview.c;  ) > 3.8.0cvs29.patchset
 ( cvs diff -u -r 1.1.2.28 -r 1.1.2.29 src/gtk/gtkcmctree.c;  ) > 3.8.0cvs30.patchset
 ( cvs diff -u -r 1.1.2.29 -r 1.1.2.30 src/gtk/gtkcmctree.c;  cvs diff -u -r 1.1.2.76 -r 1.1.2.77 src/gtk/authors.h;  cvs diff -u -r 1.100.2.81 -r 1.100.2.82 AUTHORS;  ) > 3.8.0cvs31.patchset
+( cvs diff -u -r 1.213.2.205 -r 1.213.2.206 src/folder.c;  cvs diff -u -r 1.94.2.228 -r 1.94.2.229 src/messageview.c;  cvs diff -u -r 1.19.2.28 -r 1.19.2.29 src/messageview.h;  cvs diff -u -r 1.60.2.59 -r 1.60.2.60 src/procmsg.h;  cvs diff -u -r 1.395.2.444 -r 1.395.2.445 src/summaryview.c;  cvs diff -u -r 1.96.2.237 -r 1.96.2.238 src/textview.c;  cvs diff -u -r 1.12.2.29 -r 1.12.2.30 src/textview.h;  ) > 3.8.0cvs32.patchset
index b1241752824493eac4144d9a4c39cf2ccc1a4dca..b34f56431a4283c918f66780b7f7e808079a88e8 100644 (file)
@@ -12,7 +12,7 @@ MINOR_VERSION=8
 MICRO_VERSION=0
 INTERFACE_AGE=0
 BINARY_AGE=0
-EXTRA_VERSION=31
+EXTRA_VERSION=32
 EXTRA_RELEASE=
 EXTRA_GTK2_VERSION=
 
index f6f961fe032660844952009aa23398f7f2919649..3887cbbfb582227c679d17d90ee83d480c6943f2 100644 (file)
@@ -3066,8 +3066,6 @@ static void copy_msginfo_flags(MsgInfo *source, MsgInfo *dest)
 
 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 @@ static void add_msginfo_to_cache(FolderItem *item, MsgInfo *newmsginfo, MsgInfo
        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 a2afb1ed36b3e82ffcc806fbfa7489d410f74576..e04e62c6052b74bf7e05da53409844ca6c67f68d 100644 (file)
@@ -180,7 +180,6 @@ static void about_cb                        (GtkAction      *action,
 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 *messageview_create(MainWindow *mainwin)
        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 @@ static MessageView *messageview_create_with_new_window_visible(MainWindow *mainw
        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 @@ void messageview_clear(MessageView *messageview)
        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 @@ void messageview_destroy(MessageView *messageview)
                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 @@ static gboolean messageview_update_msg(gpointer source, gpointer data)
 {
        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;
 }
 
index d4ae59ac7a6dac73a5c5a31ec9f60e2352fb6486..42fdfa13247d78c151d74038f3e26178a26f872b 100644 (file)
@@ -75,12 +75,12 @@ struct _MessageView
        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 db488ff5032cdba1ad146438c775b7587dfa2e24..33926f93ba60ee7645959f344d13cd702a17052d 100644 (file)
@@ -174,8 +174,7 @@ typedef guint32 MsgTmpFlags;
 
 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 16c53ebf00821a135ba5ac6c5185d620693e754f..e9732129d6f38d2ff4cfd7866f5c9df9b858518d 100644 (file)
@@ -6817,6 +6817,8 @@ static void summary_unselected(GtkCMCTree *ctree, GtkCMCTreeNode *row,
 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 @@ static void summary_selected(GtkCMCTree *ctree, GtkCMCTreeNode *row,
                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 c65afdfcef32470ff82743ed63f729b6fdbb68c6..d2f73c7ec45452a0ff057ca9e4efbd38cc925f09 100644 (file)
@@ -862,6 +862,23 @@ void textview_show_error(TextView *textview)
        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 8110f46446f5fd8073a0c78abbc2c8eb50c8d4cf..11b892ffdfa243f220d4d406cfa83c36225faaf6 100644 (file)
@@ -90,6 +90,8 @@ void textview_show_part               (TextView       *textview,
                                 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);