Add an item parameter to various day_*() functions

These functions operate on arbitrary items. Pull out the code that gets
the currently selected item, get the current selection when one of the
functions is called and pass it as a parameter.

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
This commit is contained in:
Lukas Fleischer
2012-06-26 13:54:52 +02:00
parent 02c90ba53a
commit 318e685ffe
3 changed files with 12 additions and 19 deletions

View File

@@ -219,7 +219,7 @@ int main(int argc, char **argv)
case KEY_VIEW_ITEM:
if ((wins_slctd() == APP) && (apoint_hilt() != 0))
day_popup_item();
day_popup_item(day_get_item(apoint_hilt()));
else if ((wins_slctd() == TOD) && (todo_hilt() != 0))
item_in_popup(NULL, NULL, todo_saved_mesg(), _("To do :"));
wins_update(FLAG_ALL);
@@ -311,7 +311,7 @@ int main(int argc, char **argv)
case KEY_FLAG_ITEM:
if (wins_slctd() == APP && apoint_hilt() != 0) {
day_item_switch_notify();
day_item_switch_notify(day_get_item(apoint_hilt()));
inday = do_storage(0);
wins_update(FLAG_APP);
} else if (wins_slctd() == TOD && todo_hilt() != 0) {
@@ -342,7 +342,7 @@ int main(int argc, char **argv)
case KEY_EDIT_NOTE:
if (wins_slctd() == APP && apoint_hilt() != 0) {
day_edit_note(conf.editor);
day_edit_note(day_get_item(apoint_hilt()), conf.editor);
inday = do_storage(0);
} else if (wins_slctd() == TOD && todo_hilt() != 0)
todo_edit_note(conf.editor);
@@ -351,7 +351,7 @@ int main(int argc, char **argv)
case KEY_VIEW_NOTE:
if (wins_slctd() == APP && apoint_hilt() != 0)
day_view_note(conf.pager);
day_view_note(day_get_item(apoint_hilt()), conf.pager);
else if (wins_slctd() == TOD && todo_hilt() != 0)
todo_view_note(conf.pager);
wins_update(FLAG_ALL);