aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLukas Fleischer <calcurse@cryptocrack.de>2012-11-18 22:07:23 +0100
committerLukas Fleischer <calcurse@cryptocrack.de>2012-11-18 22:51:14 +0100
commit2a5a1a2b744263d88c73f4694a1cc2bcfd759ed4 (patch)
treec5e6ebb82eed36c629f4af6b740588c1afe8bf5a
parent2cd7d7e175f01b5f3c148265062d377a92a6f960 (diff)
downloadcalcurse-2a5a1a2b744263d88c73f4694a1cc2bcfd759ed4.tar.gz
calcurse-2a5a1a2b744263d88c73f4694a1cc2bcfd759ed4.zip
calcurse.c: Break up key_change_priority()
Split up key_change_priority() into key_raise_priority(), key_lower_priority() which are wrappers around a new convenience function change_priority(). Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
-rw-r--r--src/calcurse.c19
1 files changed, 14 insertions, 5 deletions
diff --git a/src/calcurse.c b/src/calcurse.c
index 6a91e74..fefe18e 100644
--- a/src/calcurse.c
+++ b/src/calcurse.c
@@ -224,11 +224,10 @@ static inline void key_pipe_item(int key)
wins_update(FLAG_ALL);
}
-static inline void key_change_priority(int key)
+static inline void change_priority(int diff)
{
if (wins_slctd() == TOD && todo_hilt() != 0) {
- todo_chg_priority(todo_get_item(todo_hilt()),
- key == KEY_RAISE_PRIORITY ? 1 : -1);
+ todo_chg_priority(todo_get_item(todo_hilt()), diff);
if (todo_hilt_pos() < 0)
todo_set_first(todo_hilt());
else if (todo_hilt_pos() >= win[TOD].h - 4)
@@ -237,6 +236,16 @@ static inline void key_change_priority(int key)
}
}
+static inline void key_raise_priority(int key)
+{
+ change_priority(1);
+}
+
+static inline void key_lower_priority(int key)
+{
+ change_priority(-1);
+}
+
static inline void key_edit_note(int key)
{
if (wins_slctd() == APP && apoint_hilt() != 0) {
@@ -584,8 +593,8 @@ int main(int argc, char **argv)
HANDLE_KEY(KEY_REPEAT_ITEM, key_repeat_item);
HANDLE_KEY(KEY_FLAG_ITEM, key_flag_item);
HANDLE_KEY(KEY_PIPE_ITEM, key_pipe_item);
- HANDLE_KEY(KEY_RAISE_PRIORITY, key_change_priority);
- HANDLE_KEY(KEY_LOWER_PRIORITY, key_change_priority);
+ HANDLE_KEY(KEY_RAISE_PRIORITY, key_raise_priority);
+ HANDLE_KEY(KEY_LOWER_PRIORITY, key_lower_priority);
HANDLE_KEY(KEY_EDIT_NOTE, key_edit_note);
HANDLE_KEY(KEY_VIEW_NOTE, key_view_note);
HANDLE_KEY(KEY_GENERIC_HELP, key_generic_help);