summaryrefslogtreecommitdiffstats
path: root/src/custom.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/custom.c')
-rw-r--r--src/custom.c474
1 files changed, 62 insertions, 412 deletions
diff --git a/src/custom.c b/src/custom.c
index 1f75978..7e5ded3 100644
--- a/src/custom.c
+++ b/src/custom.c
@@ -37,35 +37,10 @@
#include <string.h>
#include <stdlib.h>
#include <math.h>
+#include <ctype.h>
#include "calcurse.h"
-/* Available configuration variables. */
-enum conf_var {
- CUSTOM_CONF_NOVARIABLE,
- CUSTOM_CONF_AUTOSAVE,
- CUSTOM_CONF_PERIODICSAVE,
- CUSTOM_CONF_CONFIRMQUIT,
- CUSTOM_CONF_CONFIRMDELETE,
- CUSTOM_CONF_SKIPSYSTEMDIALOGS,
- CUSTOM_CONF_SKIPPROGRESSBAR,
- CUSTOM_CONF_CALENDAR_DEFAULTVIEW,
- CUSTOM_CONF_WEEKBEGINSONMONDAY,
- CUSTOM_CONF_COLORTHEME,
- CUSTOM_CONF_LAYOUT,
- CUSTOM_CONF_SBAR_WIDTH,
- CUSTOM_CONF_NOTIFYBARSHOW,
- CUSTOM_CONF_NOTIFYBARDATE,
- CUSTOM_CONF_NOTIFYBARCLOCK,
- CUSTOM_CONF_NOTIFYBARWARNING,
- CUSTOM_CONF_NOTIFYBARCOMMAND,
- CUSTOM_CONF_OUTPUTDATEFMT,
- CUSTOM_CONF_INPUTDATEFMT,
- CUSTOM_CONF_DMON_ENABLE,
- CUSTOM_CONF_DMON_LOG,
- CUSTOM_CONF_VARIABLES
-};
-
struct attribute {
int color[7];
int nocolor[7];
@@ -73,118 +48,6 @@ struct attribute {
static struct attribute attr;
-static unsigned
-fill_config_var (char *string)
-{
- if (strncmp (string, "yes", 3) == 0)
- return 1;
- else if (strncmp (string, "no", 2) == 0)
- return 0;
- else
- {
- EXIT (_("wrong configuration variable format."));
- return 0;
- }
-}
-
-/*
- * Load user color theme from file.
- * Need to handle calcurse versions prior to 1.8, where colors where handled
- * differently (number between 1 and 8).
- */
-static void
-custom_load_color (char *color, int background)
-{
-#define AWAITED_COLORS 2
-
- int i, len, color_num;
- char c[AWAITED_COLORS][BUFSIZ];
- int colr[AWAITED_COLORS];
-
- len = strlen (color);
- if (len > 1)
- {
- /* New version configuration */
- if (sscanf (color, "%s on %s", c[0], c[1]) != AWAITED_COLORS)
- {
- EXIT (_("missing colors in config file"));
- /* NOTREACHED */
- }
-
- for (i = 0; i < AWAITED_COLORS; i++)
- {
- if (!strncmp (c[i], "black", 5))
- colr[i] = COLOR_BLACK;
- else if (!strncmp (c[i], "red", 3))
- colr[i] = COLOR_RED;
- else if (!strncmp (c[i], "green", 5))
- colr[i] = COLOR_GREEN;
- else if (!strncmp (c[i], "yellow", 6))
- colr[i] = COLOR_YELLOW;
- else if (!strncmp (c[i], "blue", 4))
- colr[i] = COLOR_BLUE;
- else if (!strncmp (c[i], "magenta", 7))
- colr[i] = COLOR_MAGENTA;
- else if (!strncmp (c[i], "cyan", 4))
- colr[i] = COLOR_CYAN;
- else if (!strncmp (c[i], "white", 5))
- colr[i] = COLOR_WHITE;
- else if (!strncmp (c[i], "default", 7))
- colr[i] = background;
- else
- {
- EXIT (_("wrong color name"));
- /* NOTREACHED */
- }
- }
- init_pair (COLR_CUSTOM, colr[0], colr[1]);
- }
- else if (len > 0 && len < 2)
- {
- /* Old version configuration */
- color_num = atoi (color);
-
- switch (color_num)
- {
- case 0:
- colorize = 0;
- break;
- case 1:
- init_pair (COLR_CUSTOM, COLOR_RED, background);
- break;
- case 2:
- init_pair (COLR_CUSTOM, COLOR_GREEN, background);
- break;
- case 3:
- init_pair (COLR_CUSTOM, COLOR_BLUE, background);
- break;
- case 4:
- init_pair (COLR_CUSTOM, COLOR_CYAN, background);
- break;
- case 5:
- init_pair (COLR_CUSTOM, COLOR_YELLOW, background);
- break;
- case 6:
- init_pair (COLR_CUSTOM, COLOR_BLACK, COLR_GREEN);
- break;
- case 7:
- init_pair (COLR_CUSTOM, COLOR_BLACK, COLR_YELLOW);
- break;
- case 8:
- init_pair (COLR_CUSTOM, COLOR_RED, COLR_BLUE);
- break;
- default:
- EXIT (_("wrong color number"));
- /* NOTREACHED */
- }
- }
- else
- {
- EXIT (_("wrong configuration variable format"));
- /* NOTREACHED */
- }
-}
-
/*
* Define window attributes (for both color and non-color terminals):
* ATTR_HIGHEST are for window titles
@@ -233,177 +96,6 @@ custom_remove_attr (WINDOW *win, int attr_num)
wattroff (win, attr.nocolor[attr_num]);
}
-/* Load the user configuration. */
-void
-custom_load_conf (struct conf *conf, int background)
-{
- FILE *data_file;
- char *mesg_line1 = _("Failed to open config file");
- char *mesg_line2 = _("Press [ENTER] to continue");
- char buf[BUFSIZ], e_conf[BUFSIZ];
- enum conf_var var;
-
- data_file = fopen (path_conf, "r");
- if (data_file == NULL)
- {
- status_mesg (mesg_line1, mesg_line2);
- wnoutrefresh (win[STA].p);
- wins_doupdate ();
- (void)keys_getch (win[STA].p);
- }
- var = CUSTOM_CONF_NOVARIABLE;
- pthread_mutex_lock (&nbar.mutex);
- for (;;)
- {
- if (fgets (buf, sizeof buf, data_file) == NULL)
- {
- break;
- }
- io_extract_data (e_conf, buf, sizeof buf);
-
- switch (var)
- {
- case CUSTOM_CONF_NOVARIABLE:
- break;
- case CUSTOM_CONF_AUTOSAVE:
- conf->auto_save = fill_config_var (e_conf);
- var = 0;
- break;
- case CUSTOM_CONF_PERIODICSAVE:
- if (atoi (e_conf) < 0)
- conf->periodic_save = 0;
- else
- conf->periodic_save = atoi (e_conf);
- var = 0;
- break;
- case CUSTOM_CONF_CONFIRMQUIT:
- conf->confirm_quit = fill_config_var (e_conf);
- var = 0;
- break;
- case CUSTOM_CONF_CONFIRMDELETE:
- conf->confirm_delete = fill_config_var (e_conf);
- var = 0;
- break;
- case CUSTOM_CONF_SKIPSYSTEMDIALOGS:
- conf->skip_system_dialogs = fill_config_var (e_conf);
- var = 0;
- break;
- case CUSTOM_CONF_SKIPPROGRESSBAR:
- conf->skip_progress_bar = fill_config_var (e_conf);
- var = 0;
- break;
- case CUSTOM_CONF_CALENDAR_DEFAULTVIEW:
- calendar_set_view (atoi (e_conf));
- var = 0;
- break;
- case CUSTOM_CONF_WEEKBEGINSONMONDAY:
- if (fill_config_var (e_conf))
- calendar_set_first_day_of_week (MONDAY);
- else
- calendar_set_first_day_of_week (SUNDAY);
- var = 0;
- break;
- case CUSTOM_CONF_COLORTHEME:
- custom_load_color (e_conf, background);
- var = 0;
- break;
- case CUSTOM_CONF_LAYOUT:
- wins_set_layout (atoi (e_conf));
- var = 0;
- break;
- case CUSTOM_CONF_SBAR_WIDTH:
- wins_set_sbar_width (atoi (e_conf));
- var = 0;
- break;
- case CUSTOM_CONF_NOTIFYBARSHOW:
- nbar.show = fill_config_var (e_conf);
- var = 0;
- break;
- case CUSTOM_CONF_NOTIFYBARDATE:
- (void)strncpy (nbar.datefmt, e_conf, strlen (e_conf) + 1);
- var = 0;
- break;
- case CUSTOM_CONF_NOTIFYBARCLOCK:
- (void)strncpy (nbar.timefmt, e_conf, strlen (e_conf) + 1);
- var = 0;
- break;
- case CUSTOM_CONF_NOTIFYBARWARNING:
- nbar.cntdwn = atoi (e_conf);
- var = 0;
- break;
- case CUSTOM_CONF_NOTIFYBARCOMMAND:
- (void)strncpy (nbar.cmd, e_conf, strlen (e_conf) + 1);
- var = 0;
- break;
- case CUSTOM_CONF_OUTPUTDATEFMT:
- if (e_conf[0] != '\0')
- (void)strncpy (conf->output_datefmt, e_conf, strlen (e_conf) + 1);
- var = 0;
- break;
- case CUSTOM_CONF_INPUTDATEFMT:
- conf->input_datefmt = atoi (e_conf);
- if (conf->input_datefmt <= 0 || conf->input_datefmt >= DATE_FORMATS)
- conf->input_datefmt = 1;
- var = 0;
- break;
- case CUSTOM_CONF_DMON_ENABLE:
- dmon.enable = fill_config_var (e_conf);
- var = 0;
- break;
- case CUSTOM_CONF_DMON_LOG:
- dmon.log = fill_config_var (e_conf);
- var = 0;
- break;
- default:
- EXIT (_("configuration variable unknown"));
- /* NOTREACHED */
- }
-
- if (strncmp (e_conf, "auto_save=", 10) == 0)
- var = CUSTOM_CONF_AUTOSAVE;
- else if (strncmp (e_conf, "periodic_save=", 14) == 0)
- var = CUSTOM_CONF_PERIODICSAVE;
- else if (strncmp (e_conf, "confirm_quit=", 13) == 0)
- var = CUSTOM_CONF_CONFIRMQUIT;
- else if (strncmp (e_conf, "confirm_delete=", 15) == 0)
- var = CUSTOM_CONF_CONFIRMDELETE;
- else if (strncmp (e_conf, "skip_system_dialogs=", 20) == 0)
- var = CUSTOM_CONF_SKIPSYSTEMDIALOGS;
- else if (strncmp (e_conf, "skip_progress_bar=", 18) == 0)
- var = CUSTOM_CONF_SKIPPROGRESSBAR;
- else if (strncmp (e_conf, "calendar_default_view=", 22) == 0)
- var = CUSTOM_CONF_CALENDAR_DEFAULTVIEW;
- else if (strncmp (e_conf, "week_begins_on_monday=", 22) == 0)
- var = CUSTOM_CONF_WEEKBEGINSONMONDAY;
- else if (strncmp (e_conf, "color-theme=", 12) == 0)
- var = CUSTOM_CONF_COLORTHEME;
- else if (strncmp (e_conf, "layout=", 7) == 0)
- var = CUSTOM_CONF_LAYOUT;
- else if (strncmp (e_conf, "side-bar_width=", 15) == 0)
- var = CUSTOM_CONF_SBAR_WIDTH;
- else if (strncmp (e_conf, "notify-bar_show=", 16) == 0)
- var = CUSTOM_CONF_NOTIFYBARSHOW;
- else if (strncmp (e_conf, "notify-bar_date=", 16) == 0)
- var = CUSTOM_CONF_NOTIFYBARDATE;
- else if (strncmp (e_conf, "notify-bar_clock=", 17) == 0)
- var = CUSTOM_CONF_NOTIFYBARCLOCK;
- else if (strncmp (e_conf, "notify-bar_warning=", 19) == 0)
- var = CUSTOM_CONF_NOTIFYBARWARNING;
- else if (strncmp (e_conf, "notify-bar_command=", 19) == 0)
- var = CUSTOM_CONF_NOTIFYBARCOMMAND;
- else if (strncmp (e_conf, "output_datefmt=", 15) == 0)
- var = CUSTOM_CONF_OUTPUTDATEFMT;
- else if (strncmp (e_conf, "input_datefmt=", 14) == 0)
- var = CUSTOM_CONF_INPUTDATEFMT;
- else if (strncmp (e_conf, "notify-daemon_enable=", 21) == 0)
- var = CUSTOM_CONF_DMON_ENABLE;
- else if (strncmp (e_conf, "notify-daemon_log=", 18) == 0)
- var = CUSTOM_CONF_DMON_LOG;
- }
- file_close (data_file, __FILE_POS__);
- pthread_mutex_unlock (&nbar.mutex);
-}
-
/* Draws the configuration bar */
void
custom_config_bar (void)
@@ -530,14 +222,14 @@ custom_layout_config (void)
" 'a' -> appointment panel\n\n"
" 't' -> todo panel\n\n");
- conf_win.p = (WINDOW *)0;
- (void)snprintf (label, BUFSIZ, _("layout configuration"));
+ conf_win.p = NULL;
+ strncpy (label, _("layout configuration"), BUFSIZ);
custom_confwin_init (&conf_win, label);
cursor = mark = wins_layout () - 1;
display_layout_config (&conf_win, mark, cursor);
clear ();
- while ((ch = keys_getch (win[STA].p)) != KEY_GENERIC_QUIT)
+ while ((ch = keys_getch (win[STA].p, NULL)) != KEY_GENERIC_QUIT)
{
need_reset = 0;
switch (ch)
@@ -621,7 +313,7 @@ custom_sidebar_config (void)
keys_display_bindings_bar (win[STA].p, binding, 0, binding_size);
wins_doupdate ();
- while ((ch = keys_getch (win[STA].p)) != KEY_GENERIC_QUIT)
+ while ((ch = keys_getch (win[STA].p, NULL)) != KEY_GENERIC_QUIT)
{
switch (ch)
{
@@ -654,8 +346,8 @@ custom_sidebar_config (void)
else
{
wins_reinit_panels ();
- wins_update_border ();
- wins_update_panels ();
+ wins_update_border (FLAG_ALL);
+ wins_update_panels (FLAG_ALL);
keys_display_bindings_bar (win[STA].p, binding, 0, binding_size);
wins_doupdate ();
}
@@ -681,7 +373,7 @@ custom_confwin_init (struct window *confwin, char *label)
{
erase_window_part (confwin->p, confwin->x, confwin->y,
confwin->x + confwin->w, confwin->y + confwin->h);
- (void)delwin (confwin->p);
+ delwin (confwin->p);
}
wins_get_config ();
@@ -851,7 +543,7 @@ custom_color_config (void)
char label[BUFSIZ];
conf_win.p = 0;
- (void)snprintf (label, BUFSIZ, _("color theme"));
+ strncpy (label, _("color theme"), BUFSIZ);
custom_confwin_init (&conf_win, label);
mark_fore = NBUSERCOLORS;
mark_back = SIZE - 1;
@@ -860,7 +552,7 @@ custom_color_config (void)
display_color_config (&conf_win, &mark_fore, &mark_back, cursor, theme_changed);
clear ();
- while ((ch = keys_getch (win[STA].p)) != KEY_GENERIC_QUIT)
+ while ((ch = keys_getch (win[STA].p, NULL)) != KEY_GENERIC_QUIT)
{
need_reset = 0;
theme_changed = 0;
@@ -921,65 +613,13 @@ custom_color_config (void)
delwin (conf_win.p);
}
-/*
- * Return a string defining the color theme in the form:
- * foreground color 'on' background color
- * in order to dump this data in the configuration file.
- * Color numbers follow the ncurses library definitions.
- * If ncurses library was compiled with --enable-ext-funcs,
- * then default color is -1.
- */
-void
-custom_color_theme_name (char *theme_name)
-{
-#define MAXCOLORS 8
-#define NBCOLORS 2
-#define DEFAULTCOLOR 255
-#define DEFAULTCOLOR_EXT -1
-
- int i;
- short color[NBCOLORS];
- char *color_name[NBCOLORS];
- char *default_color = "default";
- char *name[MAXCOLORS] = {
- "black",
- "red",
- "green",
- "yellow",
- "blue",
- "magenta",
- "cyan",
- "white"
- };
-
- if (!colorize)
- (void)snprintf (theme_name, BUFSIZ, "0");
- else
- {
- pair_content (COLR_CUSTOM, &color[0], &color[1]);
- for (i = 0; i < NBCOLORS; i++)
- {
- if ((color[i] == DEFAULTCOLOR) || (color[i] == DEFAULTCOLOR_EXT))
- color_name[i] = default_color;
- else if (color[i] >= 0 && color[i] <= MAXCOLORS)
- color_name[i] = name[color[i]];
- else
- {
- EXIT (_("unknown color"));
- /* NOTREACHED */
- }
- }
- (void)snprintf (theme_name, BUFSIZ, "%s on %s", color_name[0],
- color_name[1]);
- }
-}
-
/* Prints the general options. */
static int
-print_general_options (WINDOW *win, struct conf *conf)
+print_general_options (WINDOW *win)
{
enum {
AUTO_SAVE,
+ AUTO_GC,
PERIODIC_SAVE,
CONFIRM_QUIT,
CONFIRM_DELETE,
@@ -995,6 +635,7 @@ print_general_options (WINDOW *win, struct conf *conf)
int y;
char *opt[NB_OPTIONS] = {
_("auto_save = "),
+ _("auto_gc = "),
_("periodic_save = "),
_("confirm_quit = "),
_("confirm_delete = "),
@@ -1007,66 +648,72 @@ print_general_options (WINDOW *win, struct conf *conf)
y = 0;
mvwprintw (win, y, XPOS, "[1] %s ", opt[AUTO_SAVE]);
- print_bool_option_incolor (win, conf->auto_save, y,
+ print_bool_option_incolor (win, conf.auto_save, y,
XPOS + 4 + strlen (opt[AUTO_SAVE]));
mvwprintw (win, y + 1, XPOS,
_("(if set to YES, automatic save is done when quitting)"));
y += YOFF;
- mvwprintw (win, y, XPOS, "[2] %s ", opt[PERIODIC_SAVE]);
+ mvwprintw (win, y, XPOS, "[2] %s ", opt[AUTO_GC]);
+ print_bool_option_incolor (win, conf.auto_gc, y,
+ XPOS + 4 + strlen (opt[AUTO_GC]));
+ mvwprintw (win, y + 1, XPOS,
+ _("(run the garbage collector when quitting)"));
+ y += YOFF;
+ mvwprintw (win, y, XPOS, "[3] %s ", opt[PERIODIC_SAVE]);
custom_apply_attr (win, ATTR_HIGHEST);
mvwprintw (win, y, XPOS + 4 + strlen (opt[PERIODIC_SAVE]), "%d",
- conf->periodic_save);
+ conf.periodic_save);
custom_remove_attr (win, ATTR_HIGHEST);
mvwprintw (win, y + 1, XPOS,
_("(if not null, automatically save data every 'periodic_save' "
"minutes)"));
y += YOFF;
- mvwprintw (win, y, XPOS, "[3] %s ", opt[CONFIRM_QUIT]);
- print_bool_option_incolor (win, conf->confirm_quit, y,
+ mvwprintw (win, y, XPOS, "[4] %s ", opt[CONFIRM_QUIT]);
+ print_bool_option_incolor (win, conf.confirm_quit, y,
XPOS + 4 + strlen (opt[CONFIRM_QUIT]));
mvwprintw (win, y + 1, XPOS,
_("(if set to YES, confirmation is required before quitting)"));
y += YOFF;
- mvwprintw (win, y, XPOS, "[4] %s ", opt[CONFIRM_DELETE]);
- print_bool_option_incolor (win, conf->confirm_delete, y,
+ mvwprintw (win, y, XPOS, "[5] %s ", opt[CONFIRM_DELETE]);
+ print_bool_option_incolor (win, conf.confirm_delete, y,
XPOS + 4 + strlen (opt[CONFIRM_DELETE]));
mvwprintw (win, y + 1, XPOS,
_("(if set to YES, confirmation is required "
"before deleting an event)"));
y += YOFF;
- mvwprintw (win, y, XPOS, "[5] %s ", opt[SKIP_SYSTEM_DIAGS]);
- print_bool_option_incolor (win, conf->skip_system_dialogs, y,
+ mvwprintw (win, y, XPOS, "[6] %s ", opt[SKIP_SYSTEM_DIAGS]);
+ print_bool_option_incolor (win, conf.skip_system_dialogs, y,
XPOS + 4 + strlen (opt[SKIP_SYSTEM_DIAGS]));
mvwprintw (win, y + 1, XPOS,
_("(if set to YES, messages about loaded "
"and saved data will not be displayed)"));
y += YOFF;
- mvwprintw (win, y, XPOS, "[6] %s ", opt[SKIP_PROGRESS_BAR]);
- print_bool_option_incolor (win, conf->skip_progress_bar, y,
+ mvwprintw (win, y, XPOS, "[7] %s ", opt[SKIP_PROGRESS_BAR]);
+ print_bool_option_incolor (win, conf.skip_progress_bar, y,
XPOS + 4 + strlen (opt[SKIP_PROGRESS_BAR]));
mvwprintw (win, y + 1, XPOS,
_("(if set to YES, progress bar will not be displayed "
"when saving data)"));
y += YOFF;
- mvwprintw (win, y, XPOS, "[7] %s ", opt[WEEK_BEGINS_MONDAY]);
+ mvwprintw (win, y, XPOS, "[8] %s ", opt[WEEK_BEGINS_MONDAY]);
print_bool_option_incolor (win, calendar_week_begins_on_monday (), y,
XPOS + 4 + strlen (opt[WEEK_BEGINS_MONDAY]));
mvwprintw (win, y + 1, XPOS,
_("(if set to YES, monday is the first day of the week, "
"else it is sunday)"));
y += YOFF;
- mvwprintw (win, y, XPOS, "[8] %s ", opt[OUTPUT_DATE_FMT]);
+ mvwprintw (win, y, XPOS, "[9] %s ", opt[OUTPUT_DATE_FMT]);
custom_apply_attr (win, ATTR_HIGHEST);
mvwprintw (win, y, XPOS + 4 + strlen (opt[OUTPUT_DATE_FMT]), "%s",
- conf->output_datefmt);
+ conf.output_datefmt);
custom_remove_attr (win, ATTR_HIGHEST);
mvwprintw (win, y + 1, XPOS,
_("(Format of the date to be displayed in non-interactive mode)"));
y += YOFF;
- mvwprintw (win, y, XPOS, "[9] %s ", opt[INPUT_DATE_FMT]);
+ mvwprintw (win, y, XPOS, "[0] %s ", opt[INPUT_DATE_FMT]);
custom_apply_attr (win, ATTR_HIGHEST);
mvwprintw (win, y, XPOS + 4 + strlen (opt[INPUT_DATE_FMT]), "%d",
- conf->input_datefmt);
+ conf.input_datefmt);
custom_remove_attr (win, ATTR_HIGHEST);
mvwprintw (win, y + 1, XPOS, _("(Format to be used when entering a date: "));
mvwprintw (win, y + 2, XPOS,
@@ -1091,7 +738,7 @@ custom_set_swsiz (struct scrollwin *sw)
/* General configuration. */
void
-custom_general_config (struct conf *conf)
+custom_general_config (void)
{
struct scrollwin cwin;
char *number_str =
@@ -1110,11 +757,11 @@ custom_general_config (struct conf *conf)
clear ();
custom_set_swsiz (&cwin);
- (void)snprintf (cwin.label, BUFSIZ, _("general options"));
+ strncpy (cwin.label, _("general options"), BUFSIZ);
wins_scrollwin_init (&cwin);
wins_show (cwin.win.p, cwin.label);
status_mesg (number_str, keys);
- cwin.total_lines = print_general_options (cwin.pad.p, conf);
+ cwin.total_lines = print_general_options (cwin.pad.p);
wins_scrollwin_display (&cwin);
buf = mem_malloc (BUFSIZ);
@@ -1131,54 +778,57 @@ custom_general_config (struct conf *conf)
wins_scrollwin_up (&cwin, 1);
break;
case '1':
- conf->auto_save = !conf->auto_save;
+ conf.auto_save = !conf.auto_save;
break;
case '2':
+ conf.auto_gc = !conf.auto_gc;
+ break;
+ case '3':
status_mesg (periodic_save_str, "");
if (updatestring (win[STA].p, &buf, 0, 1) == 0)
{
int val = atoi (buf);
if (val >= 0)
- conf->periodic_save = val;
- if (conf->periodic_save > 0)
- io_start_psave_thread (conf);
- else if (conf->periodic_save == 0)
+ conf.periodic_save = val;
+ if (conf.periodic_save > 0)
+ io_start_psave_thread ();
+ else if (conf.periodic_save == 0)
io_stop_psave_thread ();
}
status_mesg (number_str, keys);
break;
- case '3':
- conf->confirm_quit = !conf->confirm_quit;
- break;
case '4':
- conf->confirm_delete = !conf->confirm_delete;
+ conf.confirm_quit = !conf.confirm_quit;
break;
case '5':
- conf->skip_system_dialogs = !conf->skip_system_dialogs;
+ conf.confirm_delete = !conf.confirm_delete;
break;
case '6':
- conf->skip_progress_bar = !conf->skip_progress_bar;
+ conf.skip_system_dialogs = !conf.skip_system_dialogs;
break;
case '7':
- calendar_change_first_day_of_week ();
+ conf.skip_progress_bar = !conf.skip_progress_bar;
break;
case '8':
+ calendar_change_first_day_of_week ();
+ break;
+ case '9':
status_mesg (output_datefmt_str, "");
- (void)strncpy (buf, conf->output_datefmt,
- strlen (conf->output_datefmt) + 1);
+ strncpy (buf, conf.output_datefmt,
+ strlen (conf.output_datefmt) + 1);
if (updatestring (win[STA].p, &buf, 0, 1) == 0)
{
- (void)strncpy (conf->output_datefmt, buf, strlen (buf) + 1);
+ strncpy (conf.output_datefmt, buf, strlen (buf) + 1);
}
status_mesg (number_str, keys);
break;
- case '9':
+ case '0':
status_mesg (input_datefmt_str, "");
if (updatestring (win[STA].p, &buf, 0, 1) == 0)
{
int val = atoi (buf);
if (val > 0 && val <= DATE_FORMATS)
- conf->input_datefmt = val;
+ conf.input_datefmt = val;
}
status_mesg (number_str, keys);
break;
@@ -1205,7 +855,7 @@ custom_general_config (struct conf *conf)
}
status_mesg (number_str, keys);
- cwin.total_lines = print_general_options (cwin.pad.p, conf);
+ cwin.total_lines = print_general_options (cwin.pad.p);
wins_scrollwin_display (&cwin);
}
mem_free (buf);
@@ -1240,7 +890,7 @@ print_keys_bindings (WINDOW *win, int selected_row, int selected_elm, int yoff)
int nbkeys;
nbkeys = keys_action_count_keys (action);
- (void)snprintf (actionstr, BUFSIZ, "%s", keys_get_label (action));
+ snprintf (actionstr, BUFSIZ, "%s", keys_get_label (action));
if (action == selected_row)
custom_apply_attr (win, ATTR_HIGHEST);
mvwprintw (win, y, XPOS, "%s ", actionstr);
@@ -1312,7 +962,7 @@ custom_keys_config (void)
clear ();
custom_set_swsiz (&kwin);
nbdisplayed = (kwin.win.h - LABELLINES) / LINESPERKEY;
- (void)snprintf (kwin.label, BUFSIZ, _("keys configuration"));
+ strncpy (kwin.label, _("keys configuration"), BUFSIZ);
wins_scrollwin_init (&kwin);
wins_show (kwin.win.p, kwin.label);
custom_keys_config_bar ();
@@ -1326,7 +976,7 @@ custom_keys_config (void)
{
int ch;
- ch = keys_getch (win[STA].p);
+ ch = keys_getch (win[STA].p, NULL);
switch (ch)
{
case KEY_MOVE_UP: