Display "Loading..." instead of "Scanning..." when importing a file

This commit is contained in:
Yorhel 2012-09-06 09:45:52 +02:00
parent c298e32942
commit 7d2cb84e70
5 changed files with 12 additions and 5 deletions

View file

@ -109,6 +109,7 @@ extern int dir_scan_smfs;
void dir_scan_init(const char *path); void dir_scan_init(const char *path);
/* Importing a file */ /* Importing a file */
extern int dir_import_active;
int dir_import_init(const char *fn); int dir_import_init(const char *fn);

View file

@ -120,13 +120,15 @@ struct dir *dir_createstruct(const char *name) {
static void draw_progress() { static void draw_progress() {
static const char antext[] = "Scanning..."; static const char scantext[] = "Scanning...";
static const char loadtext[] = "Loading...";
static size_t anpos = 0; static size_t anpos = 0;
char ani[20] = {}; const char *antext = dir_import_active ? loadtext : scantext;
char ani[16] = {};
size_t i; size_t i;
int width = wincols-5; int width = wincols-5;
nccreate(10, width, "Scanning..."); nccreate(10, width, antext);
ncprint(2, 2, "Total items: %-8d", dir_output.items); ncprint(2, 2, "Total items: %-8d", dir_output.items);
if(dir_output.size) if(dir_output.size)

View file

@ -61,6 +61,9 @@
#define MAX_LEVEL 100 #define MAX_LEVEL 100
int dir_import_active = 0;
/* Use a struct for easy batch-allocation and deallocation of state data. */ /* Use a struct for easy batch-allocation and deallocation of state data. */
struct ctx { struct ctx {
FILE *stream; FILE *stream;
@ -594,6 +597,7 @@ int dir_import_init(const char *fn) {
dir_curpath_set(fn); dir_curpath_set(fn);
dir_process = process; dir_process = process;
dir_import_active = 1;
return 0; return 0;
} }

View file

@ -121,7 +121,7 @@ int ncresize(int minrows, int mincols) {
} }
void nccreate(int height, int width, char *title) { void nccreate(int height, int width, const char *title) {
int i; int i;
subwinr = winrows/2-height/2; subwinr = winrows/2-height/2;

View file

@ -52,7 +52,7 @@ extern int subwinr, subwinc;
int ncresize(int, int); int ncresize(int, int);
/* creates a new centered window with border */ /* creates a new centered window with border */
void nccreate(int, int, char *); void nccreate(int, int, const char *);
/* printf something somewhere in the last created window */ /* printf something somewhere in the last created window */
void ncprint(int, int, char *, ...); void ncprint(int, int, char *, ...);