sync with 0.9.4cvs4
authorPaul Mangan <paul@claws-mail.org>
Fri, 8 Aug 2003 09:04:41 +0000 (09:04 +0000)
committerPaul Mangan <paul@claws-mail.org>
Fri, 8 Aug 2003 09:04:41 +0000 (09:04 +0000)
12 files changed:
ChangeLog
ChangeLog.claws
ChangeLog.jp
configure.ac
src/compose.c
src/folderview.c
src/imap.c
src/inc.c
src/mh.c
src/procmsg.c
src/summaryview.c
src/summaryview.h

index cc26d60..30e71c4 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2003-07-31
+
+       * minor code cleanups for the folder system.
+       * src/compose.c: compose_queue(), compose_draft_cb(): code cleanup.
+       * src/folder.c: code cleanups.
+       * src/imap.c
+         src/mh.c: calculate message numbers inside the functions.
+       * src/procmsg.c: procmsg_set_flags(): calculate message numbers.
+       * src/summaryview.[ch]: don't calculate and preserve message numbers
+         inside SummaryView,
+
 2003-07-30
 
        * src/folder.[ch]
index e57e81c..acacc54 100644 (file)
@@ -1,3 +1,8 @@
+2003-08-08 [paul]      0.9.4claws9
+
+       * sync with 0.9.4cvs4
+               see ChangeLog 2003-07-31
+
 2003-08-07 [christoph] 0.9.4claws8
 
        * configure.ac
index 35191ef..814630f 100644 (file)
@@ -1,3 +1,14 @@
+2003-07-31
+
+       * ¥Õ¥©¥ë¥À¥·¥¹¥Æ¥à¤Î¥³¡¼¥É¤ò¾¯¤·À°Íý¡£
+       * src/compose.c: compose_queue(), compose_draft_cb(): ¥³¡¼¥É¤ÎÀ°Íý¡£
+       * src/folder.c: ¥³¡¼¥É¤ÎÀ°Íý¡£
+       * src/imap.c
+         src/mh.c: ´Ø¿ôÆâ¤Ç¥á¥Ã¥»¡¼¥¸¿ô¤ò·×»»¡£
+       * src/procmsg.c: procmsg_set_flags(): ¥á¥Ã¥»¡¼¥¸¿ô¤ò·×»»¡£
+       * src/summaryview.[ch]: SummaryView Æâ¤Ç¥á¥Ã¥»¡¼¥¸¿ô¤ò·×»»¡¦ÊÝ»ý
+         ¤·¤Ê¤¤¤è¤¦¤Ë¤·¤¿¡£
+
 2003-07-30
 
        * src/folder.[ch]
index 5896b47..851e160 100644 (file)
@@ -11,7 +11,7 @@ MINOR_VERSION=9
 MICRO_VERSION=4
 INTERFACE_AGE=0
 BINARY_AGE=0
-EXTRA_VERSION=8
+EXTRA_VERSION=9
 if test $EXTRA_VERSION -eq 0; then
     VERSION=${MAJOR_VERSION}.${MINOR_VERSION}.${MICRO_VERSION}claws
 else
index 6d824bf..906c4a3 100644 (file)
@@ -2997,6 +2997,8 @@ gint compose_send(Compose *compose)
        g_free(msgpath);
 
        folder_item_remove_msg(folder, msgnum);
+       
+       folder_item_scan(folder);
 
        return val;
 }
@@ -3680,6 +3682,7 @@ static gint compose_queue_sub(Compose *compose, gint *msgnum, FolderItem **item,
        GSList *cur;
        gchar buf[BUFFSIZE];
        gint num;
+       MsgFlags flag = {0, 0};
         static gboolean lock = FALSE;
        PrefsAccount *mailac = NULL, *newsac = NULL;
        
@@ -6258,6 +6261,7 @@ static void compose_draft_cb(gpointer data, guint action, GtkWidget *widget)
        FolderItem *draft;
        gchar *tmp;
        gint msgnum;
+       MsgFlags flag = {0, 0};
        static gboolean lock = FALSE;
        MsgInfo *newmsginfo;
        
@@ -6277,7 +6281,8 @@ static void compose_draft_cb(gpointer data, guint action, GtkWidget *widget)
                return;
        }
 
-       if ((msgnum = folder_item_add_msg(draft, tmp, NULL, TRUE)) < 0) {
+       folder_item_scan(draft);
+       if ((msgnum = folder_item_add_msg(draft, tmp, &flag, TRUE)) < 0) {
                unlink(tmp);
                g_free(tmp);
                lock = FALSE;
@@ -6297,6 +6302,8 @@ static void compose_draft_cb(gpointer data, guint action, GtkWidget *widget)
                procmsg_msginfo_free(newmsginfo);
        }
        
+       folder_item_scan(draft);
+       
        lock = FALSE;
 
        /* 0: quit editing  1: keep editing  2: keep editing (autosave) */
index 9d317cf..9626d85 100644 (file)
@@ -690,7 +690,8 @@ static void folderview_select_node(FolderView *folderview, GtkCTreeNode *node)
        folderview->open_folder = TRUE;
        gtkut_ctree_set_focus_row(ctree, node);
        gtk_ctree_select(ctree, node);
-       if (folderview->summaryview->messages > 0)
+       if (folderview->summaryview->folder_item &&
+           folderview->summaryview->folder_item->total_msgs > 0)
                gtk_widget_grab_focus(folderview->summaryview->ctree);
        else
                gtk_widget_grab_focus(folderview->ctree);
@@ -1599,7 +1600,8 @@ static void folderview_key_pressed(GtkWidget *widget, GdkEventKey *event,
        case GDK_space:
                if (folderview->selected) {
                        if (folderview->opened == folderview->selected &&
-                           folderview->summaryview->messages == 0)
+                           (!folderview->summaryview->folder_item ||
+                            folderview->summaryview->folder_item->total_msgs == 0))
                                folderview_select_next_unread(folderview);
                        else
                                folderview_select_node(folderview,
index 732b80d..2a81bb6 100644 (file)
@@ -923,6 +923,7 @@ gint imap_add_msgs(Folder *folder, FolderItem *dest, GSList *file_list,
 static gint imap_do_copy_msgs(Folder *folder, FolderItem *dest, 
                              MsgInfoList *msglist, GRelation *relation)
 {
+       FolderItem *src;
        gchar *destdir;
        GSList *seq_list, *cur;
        MsgInfo *msginfo;
@@ -939,7 +940,9 @@ static gint imap_do_copy_msgs(Folder *folder, FolderItem *dest,
        if (!session) return -1;
 
        msginfo = (MsgInfo *)msglist->data;
-       if (msginfo->folder == dest) {
+
+       src = msginfo->folder;
+       if (src == dest) {
                g_warning("the src folder is identical to the dest.\n");
                return -1;
        }
@@ -958,7 +961,7 @@ static gint imap_do_copy_msgs(Folder *folder, FolderItem *dest,
                gchar *seq_set = (gchar *)cur->data;
 
                debug_print("Copying message %s%c[%s] to %s ...\n",
-                           msginfo->folder->path, G_DIR_SEPARATOR,
+                           src->path, G_DIR_SEPARATOR,
                            seq_set, destdir);
 
                ok = imap_cmd_copy(session, seq_set, destdir, uid_mapping);
@@ -1083,8 +1086,6 @@ gint imap_remove_msg(Folder *folder, FolderItem *item, gint uid)
 
 gint imap_remove_all_msg(Folder *folder, FolderItem *item)
 {
-        gint exists, recent, unseen;
-        guint32 uid_validity;
        gint ok;
        IMAPSession *session;
        gchar *dir;
@@ -1096,17 +1097,14 @@ gint imap_remove_all_msg(Folder *folder, FolderItem *item)
        if (!session) return -1;
 
        ok = imap_select(session, IMAP_FOLDER(folder), item->path,
-                        &exists, &recent, &unseen, &uid_validity);
+                        NULL, NULL, NULL, NULL);
        if (ok != IMAP_SUCCESS)
                return ok;
-       if (exists == 0)
-               return IMAP_SUCCESS;
 
-       imap_gen_send(session,
-                     "STORE 1:%d +FLAGS.SILENT (\\Deleted)", exists);
+       imap_gen_send(session, "STORE 1:* +FLAGS.SILENT (\\Deleted)");
        ok = imap_cmd_ok(session, NULL);
        if (ok != IMAP_SUCCESS) {
-               log_warning(_("can't set deleted flags: 1:%d\n"), exists);
+               log_warning(_("can't set deleted flags: 1:*\n"));
                return ok;
        }
 
index 1f22dbb..c792e45 100644 (file)
--- a/src/inc.c
+++ b/src/inc.c
@@ -128,10 +128,6 @@ static gint inc_autocheck_func                     (gpointer        data);
 
 static void inc_notify_cmd             (gint new_msgs, 
                                         gboolean notify);
-
-#define FOLDER_SUMMARY_MISMATCH(f, s) \
-       (f) && (s) ? ((s)->newmsgs != (f)->new_msgs) || ((f)->unread_msgs != (s)->unread) || ((f)->total_msgs != (s)->messages) \
-       : FALSE
        
 /**
  * inc_finished:
@@ -155,10 +151,6 @@ static void inc_finished(MainWindow *mainwin, gboolean new_messages)
                item = cur_account && cur_account->inbox
                        ? folder_find_item_from_identifier(cur_account->inbox)
                        : folder_get_default_inbox();
-               if (FOLDER_SUMMARY_MISMATCH(item, mainwin->summaryview)) {      
-                       folderview_unselect(mainwin->folderview);
-                       folderview_select(mainwin->folderview, item);
-               }       
        }
 }
 
index b7b95da..8f6b46a 100644 (file)
--- a/src/mh.c
+++ b/src/mh.c
@@ -1,6 +1,6 @@
 /*
  * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
- * Copyright (C) 1999-2002 Hiroyuki Yamamoto
+ * Copyright (C) 1999-2003 Hiroyuki Yamamoto
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -295,22 +295,6 @@ gchar *mh_get_new_msg_filename(FolderItem *dest)
        return destfile;
 }
 
-#define SET_DEST_MSG_FLAGS(fp, dest, msginfo) \
-{ \
-       MsgInfo newmsginfo; \
- \
-       newmsginfo.msgnum = dest->last_num; \
-       newmsginfo.flags = msginfo->flags; \
-       if (dest->stype == F_OUTBOX || \
-           dest->stype == F_QUEUE  || \
-           dest->stype == F_DRAFT  || \
-           dest->stype == F_TRASH) \
-               MSG_UNSET_PERM_FLAGS(newmsginfo.flags, \
-                                    MSG_NEW|MSG_UNREAD|MSG_DELETED); \
- \
-       procmsg_write_flags(&newmsginfo, fp); \
-}
-
 gint mh_add_msg(Folder *folder, FolderItem *dest, const gchar *file, MsgFlags *flags)
 {
        gint ret;
index 42eb564..d89b35e 100644 (file)
@@ -731,6 +731,7 @@ gint procmsg_save_to_outbox(FolderItem *outbox, const gchar *file,
 {
        gint num;
        MsgInfo *msginfo, *tmp_msginfo;
+       MsgFlags flag = {0, 0};
 
        debug_print("saving sent message...\n");
 
@@ -749,14 +750,15 @@ gint procmsg_save_to_outbox(FolderItem *outbox, const gchar *file,
                        return -1;
 
                folder_item_scan(outbox);
-               if ((num = folder_item_add_msg(outbox, tmp, NULL, TRUE)) < 0) {
+               if ((num = folder_item_add_msg(outbox, tmp, &flag, TRUE)) < 0) {
                        g_warning("can't save message\n");
                        unlink(tmp);
                        return -1;
                }
        } else {
                folder_item_scan(outbox);
-               if ((num = folder_item_add_msg(outbox, file, NULL, FALSE)) < 0) {
+               if ((num = folder_item_add_msg
+                       (outbox, file, &flag, FALSE)) < 0) {
                        g_warning("can't save message\n");
                        return -1;
                }
index 2311ca6..65707ac 100644 (file)
@@ -1092,9 +1092,8 @@ gboolean summary_show(SummaryView *summaryview, FolderItem *item)
 
        STATUSBAR_POP(summaryview->mainwin);
 
-       /* set ctree and hash table from the msginfo list
-          creating thread, and count the number of messages */
-       
+       /* set ctree and hash table from the msginfo list, and
+          create the thread */
        summary_set_ctree_from_list(summaryview, mlist);
 
        g_slist_free(mlist);
@@ -1182,12 +1181,11 @@ void summary_clear_list(SummaryView *summaryview)
 
        summaryview->display_msg = FALSE;
 
-       summaryview->selected  = NULL;
+       summaryview->selected = NULL;
        summaryview->displayed = NULL;
-       summaryview->newmsgs   = summaryview->unread     = 0;
-       summaryview->messages  = summaryview->total_size = 0;
-       summaryview->deleted   = summaryview->moved      = 0;
-       summaryview->copied    = 0;
+       summaryview->total_size = 0;
+       summaryview->deleted = summaryview->moved = 0;
+       summaryview->copied = 0;
        if (summaryview->msgid_table) {
                g_hash_table_destroy(summaryview->msgid_table);
                summaryview->msgid_table = NULL;
@@ -1876,10 +1874,6 @@ static void summary_set_marks_func(GtkCTree *ctree, GtkCTreeNode *node,
        if (MSG_IS_NEWS(msginfo->flags))
                news_flag_crosspost(msginfo);
 
-       if (MSG_IS_NEW(msginfo->flags) && !MSG_IS_IGNORE_THREAD(msginfo->flags))
-               summaryview->newmsgs++;
-       if (MSG_IS_UNREAD(msginfo->flags) && !MSG_IS_IGNORE_THREAD(msginfo->flags))
-               summaryview->unread++;
        if (MSG_IS_UNREAD(msginfo->flags) && !MSG_IS_IGNORE_THREAD(msginfo->flags)
        && procmsg_msg_has_marked_parent(msginfo))
                summaryview->unreadmarked++;
@@ -1887,7 +1881,6 @@ static void summary_set_marks_func(GtkCTree *ctree, GtkCTreeNode *node,
        if (MSG_IS_DELETED(msginfo->flags))
                summaryview->deleted++;
 
-       summaryview->messages++;
        summaryview->total_size += msginfo->size;
 
        summary_set_row_marks(summaryview, node);
@@ -1899,18 +1892,13 @@ static void summary_update_status(SummaryView *summaryview)
        GtkCTreeNode *node;
        MsgInfo *msginfo;
 
-       summaryview->newmsgs = summaryview->unread =
-       summaryview->messages = summaryview->total_size =
+       summaryview->total_size =
        summaryview->deleted = summaryview->moved = summaryview->copied = 0;
 
        for (node = GTK_CTREE_NODE(GTK_CLIST(ctree)->row_list);
             node != NULL; node = gtkut_ctree_node_next(ctree, node)) {
                msginfo = GTKUT_CTREE_NODE_GET_ROW_DATA(node);
 
-               if (MSG_IS_NEW(msginfo->flags) && !MSG_IS_IGNORE_THREAD(msginfo->flags))
-                       summaryview->newmsgs++;
-               if (MSG_IS_UNREAD(msginfo->flags)&& !MSG_IS_IGNORE_THREAD(msginfo->flags))
-                       summaryview->unread++;
                if (MSG_IS_UNREAD(msginfo->flags) && !MSG_IS_IGNORE_THREAD(msginfo->flags)
                && procmsg_msg_has_marked_parent(msginfo))
                        summaryview->unreadmarked++;
@@ -1920,7 +1908,6 @@ static void summary_update_status(SummaryView *summaryview)
                        summaryview->moved++;
                if (MSG_IS_COPY(msginfo->flags))
                        summaryview->copied++;
-               summaryview->messages++;
                summaryview->total_size += msginfo->size;
        }
 }
@@ -2007,11 +1994,11 @@ static void summary_status_show(SummaryView *summaryview)
        g_free(itstr);
 
        str = g_strdup_printf(_("%d new, %d unread, %d total (%s)"),
-                             summaryview->newmsgs,
-                             summaryview->unread,
-                             summaryview->messages,
-                             to_human_readable(summaryview->total_size));
 
+                                     summaryview->folder_item->new_msgs,
+                                     summaryview->folder_item->unread_msgs,
+                                     summaryview->folder_item->total_msgs,
+                                     to_human_readable(summaryview->total_size));
        gtk_label_set(GTK_LABEL(summaryview->statlabel_msgs), str);
        g_free(str);
 }
@@ -2457,10 +2444,6 @@ static void summary_display_msg_full(SummaryView *summaryview,
        msginfo = gtk_ctree_node_get_row_data(ctree, row);
 
        if (new_window || !prefs_common.mark_as_read_on_new_window) {
-               if (MSG_IS_NEW(msginfo->flags) && !MSG_IS_IGNORE_THREAD(msginfo->flags))
-                       summaryview->newmsgs--;
-               if (MSG_IS_UNREAD(msginfo->flags) && !MSG_IS_IGNORE_THREAD(msginfo->flags))
-                       summaryview->unread--;
                if (MSG_IS_UNREAD(msginfo->flags) && !MSG_IS_IGNORE_THREAD(msginfo->flags) 
                && procmsg_msg_has_marked_parent(msginfo))
                        summaryview->unreadmarked--;
@@ -2856,10 +2839,6 @@ static void summary_mark_row_as_read(SummaryView *summaryview,
        if(!(MSG_IS_NEW(msginfo->flags) || MSG_IS_UNREAD(msginfo->flags)))
                return;
 
-       if (MSG_IS_NEW(msginfo->flags) && !MSG_IS_IGNORE_THREAD(msginfo->flags))
-               summaryview->newmsgs--;
-       if (MSG_IS_UNREAD(msginfo->flags) && !MSG_IS_IGNORE_THREAD(msginfo->flags))
-               summaryview->unread--;
        if (MSG_IS_UNREAD(msginfo->flags) && !MSG_IS_IGNORE_THREAD(msginfo->flags)
        && procmsg_msg_has_marked_parent(msginfo))
                summaryview->unreadmarked--;
@@ -2942,9 +2921,6 @@ static void summary_mark_row_as_unread(SummaryView *summaryview,
                summaryview->deleted--;
        }
 
-       if (!MSG_IS_UNREAD(msginfo->flags) && !MSG_IS_IGNORE_THREAD(msginfo->flags))
-               summaryview->unread++;
-
        if (!MSG_IS_UNREAD(msginfo->flags) && !MSG_IS_IGNORE_THREAD(msginfo->flags)
        && procmsg_msg_has_marked_parent(msginfo))
                summaryview->unreadmarked++;
@@ -3380,7 +3356,9 @@ void summary_add_address(SummaryView *summaryview)
 
 void summary_select_all(SummaryView *summaryview)
 {
-       if (summaryview->messages >= 500) {
+       if (!summaryview->folder_item) return;
+
+       if (summaryview->folder_item->total_msgs >= 500) {
                STATUSBAR_PUSH(summaryview->mainwin,
                               _("Selecting all messages..."));
                main_window_cursor_wait(summaryview->mainwin);
@@ -3388,7 +3366,7 @@ void summary_select_all(SummaryView *summaryview)
 
        gtk_clist_select_all(GTK_CLIST(summaryview->ctree));
 
-       if (summaryview->messages >= 500) {
+       if (summaryview->folder_item->total_msgs >= 500) {
                STATUSBAR_POP(summaryview->mainwin);
                main_window_cursor_normal(summaryview->mainwin);
        }
@@ -5070,10 +5048,6 @@ static void summary_ignore_thread_func(GtkCTree *ctree, GtkCTreeNode *row, gpoin
 
        msginfo = gtk_ctree_node_get_row_data(ctree, row);
 
-       if (MSG_IS_NEW(msginfo->flags))
-               summaryview->newmsgs--;
-       if (MSG_IS_UNREAD(msginfo->flags))
-               summaryview->unread--;
        if (MSG_IS_UNREAD(msginfo->flags) && procmsg_msg_has_marked_parent(msginfo))
                summaryview->unreadmarked--;
 
@@ -5109,10 +5083,6 @@ static void summary_unignore_thread_func(GtkCTree *ctree, GtkCTreeNode *row, gpo
 
        msginfo = gtk_ctree_node_get_row_data(ctree, row);
 
-       if (MSG_IS_NEW(msginfo->flags))
-               summaryview->newmsgs++;
-       if (MSG_IS_UNREAD(msginfo->flags))
-               summaryview->unread++;
        if (MSG_IS_UNREAD(msginfo->flags) && procmsg_msg_has_marked_parent(msginfo))
                summaryview->unreadmarked++;
 
index c2cfa5b..11a2f19 100644 (file)
@@ -146,10 +146,7 @@ struct _SummaryView
        regex_t *simplify_subject_preg;
 
        /* current message status */
-       gint   newmsgs;
-       gint   unread;
        gint   unreadmarked;
-       gint   messages;
        off_t  total_size;
        gint   deleted;
        gint   moved;