aboutsummaryrefslogtreecommitdiffstats
path: root/src/todo.c
diff options
context:
space:
mode:
authorLukas Fleischer <calcurse@cryptocrack.de>2012-06-26 14:07:14 +0200
committerLukas Fleischer <calcurse@cryptocrack.de>2012-06-30 14:34:36 +0200
commit954e3fd8ee08054e79013e6af69c8026bce929a7 (patch)
tree8c0555c2f8e522c32e94b5b462dd6ca59068e2b0 /src/todo.c
parent318e685ffe73587a01049d92aa0f60a46c1cfb16 (diff)
downloadcalcurse-954e3fd8ee08054e79013e6af69c8026bce929a7.tar.gz
calcurse-954e3fd8ee08054e79013e6af69c8026bce929a7.zip
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 <calcurse@cryptocrack.de>
Diffstat (limited to 'src/todo.c')
-rw-r--r--src/todo.c15
1 files changed, 4 insertions, 11 deletions
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);
}