save_cal() modified to record the notification command option
load_app() updated to read item state
This commit is contained in:
parent
929adf9154
commit
276d25d9e6
41
src/io.c
41
src/io.c
@ -1,8 +1,8 @@
|
|||||||
/* $calcurse: io.c,v 1.8 2006/12/15 15:31:46 culot Exp $ */
|
/* $calcurse: io.c,v 1.9 2007/02/24 17:34:18 culot Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Calcurse - text-based organizer
|
* Calcurse - text-based organizer
|
||||||
* Copyright (c) 2004-2006 Frederic Culot
|
* Copyright (c) 2004-2007 Frederic Culot
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -192,7 +192,6 @@ save_cal(bool auto_save, bool confirm_quit,
|
|||||||
fprintf(data_file, "layout=\n");
|
fprintf(data_file, "layout=\n");
|
||||||
fprintf(data_file, "%d\n", layout);
|
fprintf(data_file, "%d\n", layout);
|
||||||
|
|
||||||
// notify-bar user settings
|
|
||||||
pthread_mutex_lock(&nbar->mutex);
|
pthread_mutex_lock(&nbar->mutex);
|
||||||
fprintf(data_file,
|
fprintf(data_file,
|
||||||
"\n# If this option is set to yes, notify-bar will be displayed :\n");
|
"\n# If this option is set to yes, notify-bar will be displayed :\n");
|
||||||
@ -213,6 +212,12 @@ save_cal(bool auto_save, bool confirm_quit,
|
|||||||
"\n# Warn user if he has an appointment within next 'notify-bar_warning' seconds :\n");
|
"\n# Warn user if he has an appointment within next 'notify-bar_warning' seconds :\n");
|
||||||
fprintf(data_file, "notify-bar_warning=\n");
|
fprintf(data_file, "notify-bar_warning=\n");
|
||||||
fprintf(data_file, "%d\n", nbar->cntdwn);
|
fprintf(data_file, "%d\n", nbar->cntdwn);
|
||||||
|
|
||||||
|
fprintf(data_file,
|
||||||
|
"\n# Command used to notify user of an upcoming appointment :\n");
|
||||||
|
fprintf(data_file, "notify-bar_command=\n");
|
||||||
|
fprintf(data_file, "%s\n", nbar->cmd);
|
||||||
|
|
||||||
pthread_mutex_unlock(&nbar->mutex);
|
pthread_mutex_unlock(&nbar->mutex);
|
||||||
|
|
||||||
fclose(data_file);
|
fclose(data_file);
|
||||||
@ -273,7 +278,7 @@ void load_app()
|
|||||||
time_t t;
|
time_t t;
|
||||||
int id = 0;
|
int id = 0;
|
||||||
int freq;
|
int freq;
|
||||||
char type;
|
char type, state;
|
||||||
char *error =
|
char *error =
|
||||||
_("FATAL ERROR in load_app: wrong format in the appointment or event\n");
|
_("FATAL ERROR in load_app: wrong format in the appointment or event\n");
|
||||||
|
|
||||||
@ -335,14 +340,12 @@ void load_app()
|
|||||||
ungetc(c, data_file);
|
ungetc(c, data_file);
|
||||||
is_recursive = 1;
|
is_recursive = 1;
|
||||||
fscanf(data_file, "{ %d%c ", &freq, &type);
|
fscanf(data_file, "{ %d%c ", &freq, &type);
|
||||||
/* Check if we have an endless recurrent item. */
|
|
||||||
c = getc(data_file);
|
c = getc(data_file);
|
||||||
if (c == '}') {
|
if (c == '}') { /* endless recurrent item */
|
||||||
ungetc(c, data_file);
|
ungetc(c, data_file);
|
||||||
fscanf(data_file, "} ");
|
fscanf(data_file, "} ");
|
||||||
until.tm_year = 0;
|
until.tm_year = 0;
|
||||||
if (is_appointment)
|
|
||||||
c = getc(data_file); // useless '|'
|
|
||||||
} else if (c == '-') {
|
} else if (c == '-') {
|
||||||
ungetc(c, data_file);
|
ungetc(c, data_file);
|
||||||
fscanf(data_file, " -> %u / %u / %u ",
|
fscanf(data_file, " -> %u / %u / %u ",
|
||||||
@ -357,33 +360,37 @@ void load_app()
|
|||||||
ungetc(c, data_file);
|
ungetc(c, data_file);
|
||||||
fscanf(data_file, "} ");
|
fscanf(data_file, "} ");
|
||||||
}
|
}
|
||||||
if (is_appointment)
|
|
||||||
fscanf(data_file, " | "); // useless '|'
|
|
||||||
} else if (c == '!') { // endless item with exceptions
|
} else if (c == '!') { // endless item with exceptions
|
||||||
ungetc(c, data_file);
|
ungetc(c, data_file);
|
||||||
exc = recur_exc_scan(data_file);
|
exc = recur_exc_scan(data_file);
|
||||||
if (is_appointment)
|
|
||||||
fscanf(data_file, " | "); // useless '|'
|
|
||||||
until.tm_year = 0;
|
until.tm_year = 0;
|
||||||
} else { /* NOT REACHED */
|
} else { /* NOT REACHED */
|
||||||
fputs(error, stderr);
|
fputs(error, stderr);
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
} else {
|
} else
|
||||||
if (is_event) // if appointment we have a useless '|'
|
|
||||||
ungetc(c, data_file);
|
ungetc(c, data_file);
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Last: read the item description and load it into its
|
* Last: read the item description and load it into its
|
||||||
* corresponding linked list, depending on the item type.
|
* corresponding linked list, depending on the item type.
|
||||||
*/
|
*/
|
||||||
if (is_appointment) {
|
if (is_appointment) {
|
||||||
|
c = getc(data_file);
|
||||||
|
if (c == '!') {
|
||||||
|
ungetc(c, data_file);
|
||||||
|
fscanf(data_file, "! ");
|
||||||
|
state |= APOINT_NOTIFY;
|
||||||
|
} else {
|
||||||
|
ungetc(c, data_file);
|
||||||
|
fscanf(data_file, "| ");
|
||||||
|
state = 0L;
|
||||||
|
}
|
||||||
if (is_recursive) {
|
if (is_recursive) {
|
||||||
recur_apoint_scan(data_file, start, end,
|
recur_apoint_scan(data_file, start, end,
|
||||||
type, freq, until, exc);
|
type, freq, until, exc, state);
|
||||||
} else {
|
} else {
|
||||||
apoint_scan(data_file, start, end);
|
apoint_scan(data_file, start, end, state);
|
||||||
}
|
}
|
||||||
} else if (is_event) {
|
} else if (is_event) {
|
||||||
if (is_recursive) {
|
if (is_recursive) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user