summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/args.c6
-rw-r--r--src/calcurse.c2
-rw-r--r--src/calcurse.h2
-rw-r--r--src/io.c8
-rw-r--r--src/utils.c5
-rw-r--r--src/vars.c3
6 files changed, 20 insertions, 6 deletions
diff --git a/src/args.c b/src/args.c
index 751a41a..78a7058 100644
--- a/src/args.c
+++ b/src/args.c
@@ -459,7 +459,7 @@ int parse_args(int argc, char **argv)
int ch;
regex_t reg;
- static const char *optstr = "FgGhvnNax::t::d:c:r::s::S:D:i:l:Q";
+ static const char *optstr = "FgGhvnNax::t::d:c:r::s::S:D:i:l:qQ";
struct option longopts[] = {
{"appointment", no_argument, NULL, 'a'},
@@ -480,6 +480,7 @@ int parse_args(int argc, char **argv)
{"todo", optional_argument, NULL, 't'},
{"version", no_argument, NULL, 'v'},
{"export", optional_argument, NULL, 'x'},
+ {"quiet", no_argument, NULL, 'q'},
{"query", optional_argument, NULL, 'Q'},
{"filter-type", required_argument, NULL, OPT_FILTER_TYPE},
@@ -602,6 +603,9 @@ int parse_args(int argc, char **argv)
optarg);
}
break;
+ case 'q':
+ quiet = 1;
+ break;
case 'Q':
query = 1;
break;
diff --git a/src/calcurse.c b/src/calcurse.c
index 3b7b7ff..72c8fe3 100644
--- a/src/calcurse.c
+++ b/src/calcurse.c
@@ -610,7 +610,7 @@ int main(int argc, char **argv)
* implicitly calling wrefresh() later (causing ncurses race conditions).
*/
wins_wrefresh(win[KEY].p);
- if (conf.system_dialogs) {
+ if (show_dialogs()) {
wins_update(FLAG_ALL);
io_startup_screen(no_data_file);
}
diff --git a/src/calcurse.h b/src/calcurse.h
index 41f7681..7693d79 100644
--- a/src/calcurse.h
+++ b/src/calcurse.h
@@ -1122,6 +1122,7 @@ int asprintf(char **, const char *, ...);
int starts_with(const char *, const char *);
int starts_with_ci(const char *, const char *);
int hash_matches(const char *, const char *);
+int show_dialogs(void);
/* vars.c */
extern int col, row;
@@ -1130,6 +1131,7 @@ extern unsigned colorize;
extern int foreground, background;
extern enum ui_mode ui_mode;
extern int read_only;
+extern int quiet;
extern int want_reload;
extern const char *datefmt_str[DATE_FORMATS];
extern int days[12];
diff --git a/src/io.c b/src/io.c
index d25180a..2639da5 100644
--- a/src/io.c
+++ b/src/io.c
@@ -425,7 +425,7 @@ void io_save_cal(enum save_display display)
/* Print a message telling data were saved */
if (ui_mode == UI_CURSES && display == IO_SAVE_DISPLAY_BAR &&
- conf.system_dialogs) {
+ show_dialogs()) {
status_mesg(save_success, enter);
wgetch(win[KEY].p);
}
@@ -794,7 +794,7 @@ void io_reload_data(void)
ui_todo_load_items();
ui_todo_sel_reset();
- if (conf.system_dialogs) {
+ if (show_dialogs()) {
status_mesg(reload_success, enter);
wgetch(win[KEY].p);
}
@@ -1113,7 +1113,7 @@ void io_export_data(enum export_type type)
else if (type == IO_EXPORT_PCAL)
pcal_export_data(stream);
- if (conf.system_dialogs && ui_mode == UI_CURSES) {
+ if (show_dialogs() && ui_mode == UI_CURSES) {
status_mesg(success, enter);
wgetch(win[KEY].p);
}
@@ -1211,7 +1211,7 @@ void io_import_data(enum import_type type, const char *stream_name)
stats.todos);
asprintf(&stats_str[3], _("%d skipped"), stats.skipped);
- if (ui_mode == UI_CURSES && conf.system_dialogs) {
+ if (ui_mode == UI_CURSES && show_dialogs()) {
char *read, *stat;
asprintf(&read, proc_report, stats.lines);
diff --git a/src/utils.c b/src/utils.c
index 528657e..deff631 100644
--- a/src/utils.c
+++ b/src/utils.c
@@ -1653,3 +1653,8 @@ int hash_matches(const char *pattern, const char *hash)
return (starts_with(hash, pattern) != invert);
}
+
+int show_dialogs(void)
+{
+ return (!quiet) && conf.system_dialogs;
+}
diff --git a/src/vars.c b/src/vars.c
index d674393..f7a8fa9 100644
--- a/src/vars.c
+++ b/src/vars.c
@@ -61,6 +61,9 @@ enum ui_mode ui_mode = UI_CMDLINE;
/* Don't save anything if this is set. */
int read_only = 0;
+/* Hide system dialogs if set. */
+int quiet = 0;
+
/* Applications can trigger a reload by sending SIGUSR1. */
int want_reload = 0;