diff options
author | Lukas Fleischer <calcurse@cryptocrack.de> | 2012-07-07 18:10:12 +0200 |
---|---|---|
committer | Lukas Fleischer <calcurse@cryptocrack.de> | 2012-07-07 21:36:38 +0200 |
commit | 88588ad704329939834b45eb2058fb48f0a5068f (patch) | |
tree | 37156cf05dd7ce803d381089cbca977135790b7d /src/interaction.c | |
parent | 7fb25a84d427f4a3cb79ea02908daf9ce8ba07ca (diff) | |
download | calcurse-88588ad704329939834b45eb2058fb48f0a5068f.zip |
Refactor exception handling
Remove the exception handling code from recur_*_erase() and move it to
separate functions recur_*_add_exc(). Create a wrapper function
day_item_add_exc() that can be used to add an exception to generic
items.
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
Diffstat (limited to 'src/interaction.c')
-rw-r--r-- | src/interaction.c | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/src/interaction.c b/src/interaction.c index 4d71520..d61ea4e 100644 --- a/src/interaction.c +++ b/src/interaction.c @@ -385,8 +385,6 @@ static int day_erase_item(long date, int item_number, enum eraseflg flag) "Delete (i)tem or just its (n)ote ?"); const char *note_choices = _("[in]"); const int nb_note_choices = 2; - int ans; - unsigned delete_whole; p = day_get_item(item_number); if (flag == ERASE_DONT_FORCE && day_item_get_note(p)) { @@ -408,23 +406,20 @@ static int day_erase_item(long date, int item_number, enum eraseflg flag) } else if (p->type == APPT) { apoint_delete(p->item.apt, flag); } else { - ans = status_ask_choice(erase_warning, erase_choices, nb_erase_choices); - - switch (ans) { + switch (status_ask_choice(erase_warning, erase_choices, nb_erase_choices)) { case 1: - delete_whole = 1; break; case 2: - delete_whole = 0; - break; + day_item_add_exc(p, date); + return 0; default: return 0; } if (p->type == RECUR_EVNT) { - recur_event_erase(p->item.rev, date, delete_whole, flag); + recur_event_erase(p->item.rev, flag); } else { - recur_apoint_erase(p->item.rapt, date, delete_whole, flag); + recur_apoint_erase(p->item.rapt, flag); } } |