Skip to content
Snippets Groups Projects
Commit 7d2cb84e authored by Yorhel's avatar Yorhel
Browse files

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

parent c298e329
No related branches found
No related tags found
No related merge requests found
...@@ -109,6 +109,7 @@ extern int dir_scan_smfs; ...@@ -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);
......
...@@ -120,13 +120,15 @@ struct dir *dir_createstruct(const char *name) { ...@@ -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)
......
...@@ -61,6 +61,9 @@ ...@@ -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) { ...@@ -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;
} }
...@@ -121,7 +121,7 @@ int ncresize(int minrows, int mincols) { ...@@ -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;
......
...@@ -52,7 +52,7 @@ extern int subwinr, subwinc; ...@@ -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 *, ...);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment