summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorYorhel <git@yorhel.nl>2012-09-06 09:45:52 +0200
committerYorhel <git@yorhel.nl>2012-09-06 09:45:52 +0200
commit7d2cb84e707fdfffee9f99531990735e890558b5 (patch)
tree1c8c4b03ae7e5d977dedca776c659f914397a903 /src
parentc298e32942b60d786587ebe1bdd1d117d3745031 (diff)
Display "Loading..." instead of "Scanning..." when importing a file
Diffstat (limited to 'src')
-rw-r--r--src/dir.h1
-rw-r--r--src/dir_common.c8
-rw-r--r--src/dir_import.c4
-rw-r--r--src/util.c2
-rw-r--r--src/util.h2
5 files changed, 12 insertions, 5 deletions
diff --git a/src/dir.h b/src/dir.h
index 0ef7875..c9473f1 100644
--- a/src/dir.h
+++ b/src/dir.h
@@ -109,6 +109,7 @@ extern int dir_scan_smfs;
void dir_scan_init(const char *path);
/* Importing a file */
+extern int dir_import_active;
int dir_import_init(const char *fn);
diff --git a/src/dir_common.c b/src/dir_common.c
index c338c77..1ef2308 100644
--- a/src/dir_common.c
+++ b/src/dir_common.c
@@ -120,13 +120,15 @@ struct dir *dir_createstruct(const char *name) {
static void draw_progress() {
- static const char antext[] = "Scanning...";
+ static const char scantext[] = "Scanning...";
+ static const char loadtext[] = "Loading...";
static size_t anpos = 0;
- char ani[20] = {};
+ const char *antext = dir_import_active ? loadtext : scantext;
+ char ani[16] = {};
size_t i;
int width = wincols-5;
- nccreate(10, width, "Scanning...");
+ nccreate(10, width, antext);
ncprint(2, 2, "Total items: %-8d", dir_output.items);
if(dir_output.size)
diff --git a/src/dir_import.c b/src/dir_import.c
index 334ec28..a7e93d5 100644
--- a/src/dir_import.c
+++ b/src/dir_import.c
@@ -61,6 +61,9 @@
#define MAX_LEVEL 100
+int dir_import_active = 0;
+
+
/* Use a struct for easy batch-allocation and deallocation of state data. */
struct ctx {
FILE *stream;
@@ -594,6 +597,7 @@ int dir_import_init(const char *fn) {
dir_curpath_set(fn);
dir_process = process;
+ dir_import_active = 1;
return 0;
}
diff --git a/src/util.c b/src/util.c
index b931898..480e91b 100644
--- a/src/util.c
+++ b/src/util.c
@@ -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;
subwinr = winrows/2-height/2;
diff --git a/src/util.h b/src/util.h
index 1213f98..8b1b959 100644
--- a/src/util.h
+++ b/src/util.h
@@ -52,7 +52,7 @@ extern int subwinr, subwinc;
int ncresize(int, int);
/* 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 */
void ncprint(int, int, char *, ...);