summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrederic Culot <calcurse@culot.org>2007-03-24 23:20:49 +0000
committerFrederic Culot <calcurse@culot.org>2007-03-24 23:20:49 +0000
commitac6dfd27b8c62e05a2cc7b3622748e0c4a01840f (patch)
treeb49373ed58f70af5ee946e93b08aa6e6af59f9d4
parente71a6eff0637412736cb38d8edef0875b0311755 (diff)
downloadcalcurse-ac6dfd27b8c62e05a2cc7b3622748e0c4a01840f.zip
extract_data() renamed to io_extract_data() and save_cal() to io_save_cal()
-rwxr-xr-xsrc/io.c40
1 files changed, 18 insertions, 22 deletions
diff --git a/src/io.c b/src/io.c
index 3698b3e..17ae4b5 100755
--- a/src/io.c
+++ b/src/io.c
@@ -1,4 +1,4 @@
-/* $calcurse: io.c,v 1.12 2007/03/17 16:55:27 culot Exp $ */
+/* $calcurse: io.c,v 1.13 2007/03/24 23:20:49 culot Exp $ */
/*
* Calcurse - text-based organizer
@@ -44,7 +44,6 @@
#include "apoint.h"
#include "recur.h"
#include "io.h"
-#include "vars.h"
typedef enum {
PROGRESS_BAR_SAVE,
@@ -384,7 +383,8 @@ io_init(char *cfile)
}
/* get data from file */
-void extract_data(char *dst_data, const char *org, int len)
+void
+io_extract_data(char *dst_data, const char *org, int len)
{
for (;;) {
if (*org == '\n' || *org == '\0')
@@ -396,9 +396,7 @@ void extract_data(char *dst_data, const char *org, int len)
/* Save the calendar data */
void
-save_cal(bool auto_save, bool confirm_quit, bool confirm_delete,
- bool skip_system_dialogs, bool skip_progress_bar,
- bool week_begins_on_monday, int layout)
+io_save_cal(conf_t *conf, int layout)
{
FILE *data_file;
struct event_s *k;
@@ -412,7 +410,7 @@ save_cal(bool auto_save, bool confirm_quit, bool confirm_delete,
char *enter = _("Press [ENTER] to continue");
bool show_bar = false;
- if (!skip_progress_bar)
+ if (!conf->skip_progress_bar)
show_bar = true;
/* Save the user configuration. */
@@ -430,38 +428,36 @@ save_cal(bool auto_save, bool confirm_quit, bool confirm_delete,
fprintf(data_file,
"# If this option is set to yes, automatic save is done when quitting\n");
fprintf(data_file, "auto_save=\n");
- fprintf(data_file, "%s\n",
- (auto_save) ? "yes" : "no");
+ fprintf(data_file, "%s\n", (conf->auto_save) ? "yes" : "no");
fprintf(data_file,
"\n# If this option is set to yes, confirmation is required before quitting\n");
fprintf(data_file, "confirm_quit=\n");
- fprintf(data_file, "%s\n",
- (confirm_quit) ? "yes" : "no");
+ fprintf(data_file, "%s\n", (conf->confirm_quit) ? "yes" : "no");
fprintf(data_file,
"\n# If this option is set to yes, confirmation is required before deleting an event\n");
fprintf(data_file, "confirm_delete=\n");
fprintf(data_file, "%s\n",
- (confirm_delete) ? "yes" : "no");
+ (conf->confirm_delete) ? "yes" : "no");
fprintf(data_file,
"\n# If this option is set to yes, messages about loaded and saved data will not be displayed\n");
fprintf(data_file, "skip_system_dialogs=\n");
fprintf(data_file, "%s\n",
- (skip_system_dialogs) ? "yes" : "no");
+ (conf->skip_system_dialogs) ? "yes" : "no");
fprintf(data_file,
"\n# If this option is set to yes, progress bar appearing when saving data will not be displayed\n");
fprintf(data_file, "skip_progress_bar=\n");
fprintf(data_file, "%s\n",
- (skip_progress_bar) ? "yes" : "no");
+ (conf->skip_progress_bar) ? "yes" : "no");
fprintf(data_file,
"\n# If this option is set to yes, monday is the first day of the week, else it is sunday\n");
fprintf(data_file, "week_begins_on_monday=\n");
fprintf(data_file, "%s\n",
- (week_begins_on_monday) ? "yes" : "no");
+ (conf->week_begins_on_monday) ? "yes" : "no");
fprintf(data_file,
"\n# This is the color theme used for menus :\n");
@@ -539,7 +535,7 @@ save_cal(bool auto_save, bool confirm_quit, bool confirm_delete,
/* Print a message telling data were saved */
- if (!skip_system_dialogs){
+ if (!conf->skip_system_dialogs) {
status_mesg(save_success, enter);
wgetch(swin);
}
@@ -721,7 +717,7 @@ load_todo(void)
if (nl) {
*nl = '\0';
}
- extract_data(e_todo, buf, strlen(buf));
+ io_extract_data(e_todo, buf, strlen(buf));
todo_add(e_todo, id);
++nb_tod;
}
@@ -795,7 +791,7 @@ startup_screen(bool skip_dialogs, int no_data_file)
/* Export calcurse data. */
void
-io_export_data(export_mode_t mode, bool skip_dialogs, bool skip_bar)
+io_export_data(export_mode_t mode, conf_t *conf)
{
FILE *stream;
char *wrong_mode =
@@ -818,17 +814,17 @@ io_export_data(export_mode_t mode, bool skip_dialogs, bool skip_bar)
io_export_header(stream);
- if (!skip_bar)
+ if (!conf->skip_progress_bar && mode == IO_EXPORT_INTERACTIVE)
progress_bar(PROGRESS_BAR_EXPORT, 0);
io_export_recur_events(stream);
io_export_events(stream);
- if (!skip_bar)
+ if (!conf->skip_progress_bar && mode == IO_EXPORT_INTERACTIVE)
progress_bar(PROGRESS_BAR_EXPORT, 1);
io_export_recur_apoints(stream);
io_export_apoints(stream);
- if (!skip_bar)
+ if (!conf->skip_progress_bar && mode == IO_EXPORT_INTERACTIVE)
progress_bar(PROGRESS_BAR_EXPORT, 2);
io_export_todo(stream);
@@ -837,7 +833,7 @@ io_export_data(export_mode_t mode, bool skip_dialogs, bool skip_bar)
if (stream != stdout)
fclose(stream);
- if (!skip_dialogs) {
+ if (!conf->skip_system_dialogs && mode == IO_EXPORT_INTERACTIVE) {
status_mesg(success, enter);
wgetch(swin);
}