aboutsummaryrefslogtreecommitdiff
path: root/libsylph/mbox.c
diff options
context:
space:
mode:
authorhiro <hiro@ee746299-78ed-0310-b773-934348b2243d>2009-08-04 07:08:14 +0000
committerhiro <hiro@ee746299-78ed-0310-b773-934348b2243d>2009-08-04 07:08:14 +0000
commitc24bf4d56469351ead16dd9d917bcddeff9d4fc7 (patch)
tree6b593d9e5828f695e072533975e79e3d0adaabf5 /libsylph/mbox.c
parentf9900e671911918612d952dd669aa2129c13227e (diff)
show progressbar on mbox import.
git-svn-id: svn://sylpheed.sraoss.jp/sylpheed/trunk@2196 ee746299-78ed-0310-b773-934348b2243d
Diffstat (limited to 'libsylph/mbox.c')
-rw-r--r--libsylph/mbox.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/libsylph/mbox.c b/libsylph/mbox.c
index 34aad016..cbc461d1 100644
--- a/libsylph/mbox.c
+++ b/libsylph/mbox.c
@@ -69,13 +69,18 @@ gint proc_mbox_full(FolderItem *dest, const gchar *mbox,
FILE *mbox_fp;
gchar buf[BUFFSIZE], from_line[BUFFSIZE];
gchar *tmp_file;
- gint msgs = 0;
+ gint new_msgs = 0;
+ gint count = 0;
+ Folder *folder;
g_return_val_if_fail(dest != NULL, -1);
+ g_return_val_if_fail(dest->folder != NULL, -1);
g_return_val_if_fail(mbox != NULL, -1);
debug_print(_("Getting messages from %s into %s...\n"), mbox, dest->path);
+ folder = dest->folder;
+
if ((mbox_fp = g_fopen(mbox, "rb")) == NULL) {
FILE_OP_ERROR(mbox, "fopen");
return -1;
@@ -114,6 +119,10 @@ gint proc_mbox_full(FolderItem *dest, const gchar *mbox,
gboolean is_junk = FALSE;
FilterInfo *fltinfo;
+ count++;
+ if (folder->ui_func)
+ folder->ui_func(folder, dest, folder->ui_func_data ? dest->folder->ui_func_data : GINT_TO_POINTER(count));
+
if ((tmp_fp = g_fopen(tmp_file, "wb")) == NULL) {
FILE_OP_ERROR(tmp_file, "fopen");
g_warning(_("can't open temporary file\n"));
@@ -268,7 +277,7 @@ gint proc_mbox_full(FolderItem *dest, const gchar *mbox,
if (!is_junk &&
fltinfo->actions[FLT_ACTION_DELETE] == FALSE &&
fltinfo->actions[FLT_ACTION_MARK_READ] == FALSE)
- msgs++;
+ new_msgs++;
filter_info_free(fltinfo);
g_unlink(tmp_file);
@@ -276,9 +285,9 @@ gint proc_mbox_full(FolderItem *dest, const gchar *mbox,
g_free(tmp_file);
fclose(mbox_fp);
- debug_print("%d new messages found.\n", msgs);
+ debug_print("%d new messages found.\n", new_msgs);
- return msgs;
+ return new_msgs;
}
gint lock_mbox(const gchar *base, LockType type)