Rocco Rutte:
[apps/madmutt.git] / curs_lib.c
index b9c4557..3e03810 100644 (file)
@@ -16,6 +16,7 @@
 #endif
 
 #include "mutt.h"
+#include "enter.h"
 #include "mutt_menu.h"
 #include "mutt_curses.h"
 #include "pager.h"
@@ -275,7 +276,7 @@ void mutt_query_exit (void)
   if (Timeout)
     timeout (-1);               /* restore blocking operation */
   if (mutt_yesorno (_("Exit Mutt-ng?"), M_YES) == M_YES) {
-    endwin ();
+    mutt_endwin (NULL);
     exit (1);
   }
   mutt_clear_error ();
@@ -309,6 +310,30 @@ void mutt_curses_error (const char *fmt, ...)
   set_option (OPTMSGERR);
 }
 
+void mutt_progress_bar (progress_t* progress, long pos) {
+  char posstr[SHORT_STRING];
+
+  if (!pos) {
+    if (!NetInc)
+      mutt_message (progress->msg);
+    else {
+      mutt_pretty_size (progress->sizestr, sizeof (progress->sizestr),
+                        progress->size);
+      progress->pos = 0;
+    }
+  }
+
+  if (!NetInc)
+    return;
+
+  if (pos > progress->pos + (NetInc << 10)) {
+    progress->pos = pos;
+    pos = pos / (NetInc << 10) * (NetInc << 10);
+    mutt_pretty_size (posstr, sizeof (posstr), pos);
+    mutt_message ("%s %s/%s", progress->msg, posstr, progress->sizestr);
+  }
+}
+
 void mutt_curses_message (const char *fmt, ...)
 {
   char TmpErrorbuf[STRING];