From 954e3fd8ee08054e79013e6af69c8026bce929a7 Mon Sep 17 00:00:00 2001 From: Lukas Fleischer Date: Tue, 26 Jun 2012 14:07:14 +0200 Subject: Add an item parameter to various todo_*() 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 --- src/todo.c | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) (limited to 'src/todo.c') diff --git a/src/todo.c b/src/todo.c index 2ca648d..5352eb8 100644 --- a/src/todo.c +++ b/src/todo.c @@ -189,11 +189,8 @@ void todo_delete(struct todo *todo) * This way, it is easy to retrive its original priority if the user decides * that in fact it was not completed. */ -void todo_flag(void) +void todo_flag(struct todo *t) { - struct todo *t; - - t = todo_get_item(hilt); t->id = -t->id; } @@ -217,14 +214,12 @@ static int todo_get_position(struct todo *needle) } /* Change an item priority by pressing '+' or '-' inside TODO panel. */ -void todo_chg_priority(int action) +void todo_chg_priority(struct todo *backup, int action) { - struct todo *backup; char backup_mesg[BUFSIZ]; int backup_id; char backup_note[MAX_NOTESIZ + 1]; - backup = todo_get_item(hilt); strncpy(backup_mesg, backup->mesg, strlen(backup->mesg) + 1); backup_id = backup->id; if (backup->note) @@ -338,16 +333,14 @@ void todo_update_panel(int which_pan) } /* Attach a note to a todo */ -void todo_edit_note(const char *editor) +void todo_edit_note(struct todo *i, const char *editor) { - struct todo *i = todo_get_item(hilt); edit_note(&i->note, editor); } /* View a note previously attached to a todo */ -void todo_view_note(const char *pager) +void todo_view_note(struct todo *i, const char *pager) { - struct todo *i = todo_get_item(hilt); view_note(i->note, pager); } -- cgit v1.2.3-54-g00ecf