aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog7
-rw-r--r--NEWS6
-rw-r--r--libsylph/mh.c74
-rw-r--r--src/summaryview.c2
4 files changed, 77 insertions, 12 deletions
diff --git a/ChangeLog b/ChangeLog
index 2b8c797b..2f3b6289 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2006-06-25
+
+ * src/summaryview.c: summary_execute_move(), summary_execute_copy():
+ removed redundant folder scan.
+ * libsylph/mh.c: mh_scan_folder_full(): win32: supported non-unicode
+ platforms (not tested).
+
2006-06-23
* libsylph/mh.c: mh_scan_folder_full(): win32: optimized scanning of
diff --git a/NEWS b/NEWS
index 386273c5..516d062f 100644
--- a/NEWS
+++ b/NEWS
@@ -1,5 +1,11 @@
Changes of Sylpheed
+* 2.2.7 (stable)
+
+ * "Mark all read" was added to the folder context menu.
+ * Win32: The scanning of folders was optimized so that receiving or moving
+ of messages becomes faster when folders contain large number of messages.
+
* 2.2.6 (stable)
* The 8-bit literal (literal8) in IMAP4 response was supported.
diff --git a/libsylph/mh.c b/libsylph/mh.c
index 67c87595..cdfb99c5 100644
--- a/libsylph/mh.c
+++ b/libsylph/mh.c
@@ -739,14 +739,66 @@ static gint mh_close(Folder *folder, FolderItem *item)
return 0;
}
+#ifdef G_OS_WIN32
+struct wfddata {
+ WIN32_FIND_DATAA wfda;
+ WIN32_FIND_DATAW wfdw;
+ DWORD file_attr;
+ gchar *file_name;
+};
+
+static HANDLE find_first_file(struct wfddata *wfd)
+{
+ HANDLE hfind;
+
+ if (G_WIN32_HAVE_WIDECHAR_API()) {
+ hfind = FindFirstFileW(L"*", &wfd->wfdw);
+ if (hfind != INVALID_HANDLE_VALUE) {
+ wfd->file_attr = wfd->wfdw.dwFileAttributes;
+ wfd->file_name = g_utf16_to_utf8(wfd->wfdw.cFileName, -1,
+ NULL, NULL, NULL);
+ }
+ } else {
+ hfind = FindFirstFileA("*", &wfd->wfda);
+ if (hfind != INVALID_HANDLE_VALUE) {
+ wfd->file_attr = wfd->wfda.dwFileAttributes;
+ wfd->file_name = g_strdup(wfd->wfda.cFileName);
+ }
+ }
+
+ return hfind;
+}
+
+static BOOL find_next_file(HANDLE hfind, struct wfddata *wfd)
+{
+ BOOL retval;
+
+ if (G_WIN32_HAVE_WIDECHAR_API()) {
+ retval = FindNextFileW(hfind, &wfd->wfdw);
+ if (retval) {
+ wfd->file_attr = wfd->wfdw.dwFileAttributes;
+ wfd->file_name = g_utf16_to_utf8(wfd->wfdw.cFileName, -1,
+ NULL, NULL, NULL);
+ }
+ } else {
+ retval = FindNextFileA(hfind, &wfd->wfda);
+ if (retval) {
+ wfd->file_attr = wfd->wfda.dwFileAttributes;
+ wfd->file_name = g_strdup(wfd->wfda.cFileName);
+ }
+ }
+
+ return retval;
+}
+#endif
+
static gint mh_scan_folder_full(Folder *folder, FolderItem *item,
gboolean count_sum)
{
gchar *path;
#ifdef G_OS_WIN32
- WIN32_FIND_DATAW wfd;
+ struct wfddata wfd;
HANDLE hfind;
- gchar *dir_name;
#else
DIR *dp;
struct dirent *d;
@@ -768,7 +820,7 @@ static gint mh_scan_folder_full(Folder *folder, FolderItem *item,
g_free(path);
#ifdef G_OS_WIN32
- if ((hfind = FindFirstFileW(L"*", &wfd)) == INVALID_HANDLE_VALUE) {
+ if ((hfind = find_first_file(&wfd)) == INVALID_HANDLE_VALUE) {
g_warning("failed to open directory\n");
#else
if ((dp = opendir(".")) == NULL) {
@@ -782,20 +834,22 @@ static gint mh_scan_folder_full(Folder *folder, FolderItem *item,
#ifdef G_OS_WIN32
do {
- if ((wfd.dwFileAttributes &
+ if ((wfd.file_attr &
(FILE_ATTRIBUTE_DIRECTORY | FILE_ATTRIBUTE_DEVICE)) == 0) {
- dir_name = g_utf16_to_utf8(wfd.cFileName, -1,
- NULL, NULL, NULL);
- if (dir_name) {
- if ((num = to_number(dir_name)) > 0) {
+ if (wfd.file_name) {
+ if ((num = to_number(wfd.file_name)) > 0) {
n_msg++;
if (max < num)
max = num;
}
- g_free(dir_name);
}
}
- } while (FindNextFileW(hfind, &wfd));
+
+ if (wfd.file_name) {
+ g_free(wfd.file_name);
+ wfd.file_name = NULL;
+ }
+ } while (find_next_file(hfind, &wfd));
FindClose(hfind);
#else
diff --git a/src/summaryview.c b/src/summaryview.c
index 8aeba1ed..b620f6a1 100644
--- a/src/summaryview.c
+++ b/src/summaryview.c
@@ -3712,7 +3712,6 @@ static gint summary_execute_move(SummaryView *summaryview)
g_slist_reverse(summaryview->tmp_mlist);
val = procmsg_move_messages(summaryview->tmp_mlist);
- folder_item_scan_foreach(summaryview->folder_table);
folderview_update_item_foreach(summaryview->folder_table,
FALSE);
@@ -3764,7 +3763,6 @@ static gint summary_execute_copy(SummaryView *summaryview)
g_slist_reverse(summaryview->tmp_mlist);
val = procmsg_copy_messages(summaryview->tmp_mlist);
- folder_item_scan_foreach(summaryview->folder_table);
folderview_update_item_foreach(summaryview->folder_table,
FALSE);