[Commits] [SCM] claws branch, master, updated. 3.17.4-7-g6da2dcbcf

colin at claws-mail.org colin at claws-mail.org
Tue Aug 13 10:14:12 CEST 2019


The branch, master has been updated
       via  6da2dcbcffad85cc5f415d9889413e1863f64e8a (commit)
      from  34e6bd711aa14605f7e0106d6ed9bd9ea36d6e49 (commit)

Summary of changes:
 src/import.c |  8 ++++++++
 src/mbox.c   | 19 +++++++++++++++----
 2 files changed, 23 insertions(+), 4 deletions(-)


- Log -----------------------------------------------------------------
commit 6da2dcbcffad85cc5f415d9889413e1863f64e8a
Author: Colin Leroy <colin at colino.net>
Date:   Tue Aug 13 10:13:29 2019 +0200

    MBOX import: give a better estimation of the time left and grey out widgets while importing

diff --git a/src/import.c b/src/import.c
index 1dcd12a3c..e6b2f3179 100644
--- a/src/import.c
+++ b/src/import.c
@@ -231,6 +231,14 @@ static void import_ok_cb(GtkWidget *widget, gpointer data)
 		g_free(mbox);
 		return;
 	} else {
+		gtk_widget_set_sensitive(file_entry, FALSE);
+		gtk_widget_set_sensitive(dest_entry, FALSE);
+		gtk_widget_set_sensitive(file_button, FALSE);
+		gtk_widget_set_sensitive(dest_button, FALSE);
+		gtk_widget_set_sensitive(ok_button, FALSE);
+		gtk_widget_set_sensitive(cancel_button, FALSE);
+		GTK_EVENTS_FLUSH();
+
 		import_ok = proc_mbox(dest, mbox, FALSE, NULL);
 	}
 
diff --git a/src/mbox.c b/src/mbox.c
index 9047fbb87..6375615a6 100644
--- a/src/mbox.c
+++ b/src/mbox.c
@@ -86,12 +86,19 @@ gint proc_mbox(FolderItem *dest, const gchar *mbox, gboolean apply_filter,
 	GSList *to_filter = NULL, *filtered = NULL, *unfiltered = NULL, *cur, *to_add = NULL;
 	gboolean printed = FALSE;
 	FolderItem *dropfolder;
+	GStatBuf src_stat;
 
 	cm_return_val_if_fail(dest != NULL, -1);
 	cm_return_val_if_fail(mbox != NULL, -1);
 
 	debug_print("Getting messages from %s into %s...\n", mbox, dest->path);
 
+	if (g_stat(mbox, &src_stat) < 0) {
+		FILE_OP_ERROR(mbox, "g_stat");
+		alertpanel_error(_("Could not stat mbox file:\n%s\n"), mbox);
+		return -1;
+	}
+
 	if ((mbox_fp = claws_fopen(mbox, "rb")) == NULL) {
 		FILE_OP_ERROR(mbox, "claws_fopen");
 		alertpanel_error(_("Could not open mbox file:\n%s\n"), mbox);
@@ -127,12 +134,14 @@ gint proc_mbox(FolderItem *dest, const gchar *mbox, gboolean apply_filter,
 		gint empty_lines;
 		gint msgnum;
 		
-		if (msgs > 0 && msgs%500 == 0) {
+		if (msgs%500 == 0) {
+			long cur_offset_mb = ftell(mbox_fp) / (1024 * 1024);
 			if (printed)
 				statusbar_pop_all();
 			statusbar_print_all(
-					ngettext("Importing from mbox... (%d mail imported)",
-						"Importing from mbox... (%d mails imported)", msgs), msgs);
+					ngettext("Importing from mbox... (%ld MB imported)",
+						"Importing from mbox... (%ld MB imported)", cur_offset_mb), cur_offset_mb);
+			statusbar_progress_all(cur_offset_mb, src_stat.st_size / (1024*1024), 1);
 			printed=TRUE;
 			GTK_EVENTS_FLUSH();
 		}
@@ -255,8 +264,10 @@ gint proc_mbox(FolderItem *dest, const gchar *mbox, gboolean apply_filter,
 		msgs++;
 	} while (more);
 
-	if (printed)
+	if (printed) {
 		statusbar_pop_all();
+		statusbar_progress_all(0, 0, 0);
+	}
 
 	if (apply_filter) {
 

-----------------------------------------------------------------------


hooks/post-receive
-- 
Claws Mail


More information about the Commits mailing list