From 8c32812fe1b08d819cb62727dbe8f00d5afbba10 Mon Sep 17 00:00:00 2001 From: Lukas Fleischer Date: Tue, 16 Feb 2016 07:55:19 +0100 Subject: ui-day.c: Simplify code using ui_day_selitem() Use the new ui_day_selitem() utility function to retrieve the currently selected item. Signed-off-by: Lukas Fleischer --- src/ui-day.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/ui-day.c b/src/ui-day.c index 4b004f7..f424563 100644 --- a/src/ui-day.c +++ b/src/ui-day.c @@ -315,7 +315,7 @@ void ui_day_item_edit(void) if (day_item_count(0) <= 0) return; - struct day_item *p = day_get_item(listbox_get_sel(&lb_apt)); + struct day_item *p = ui_day_selitem(); switch (p->type) { case RECUR_EVNT: @@ -441,7 +441,7 @@ void ui_day_item_pipe(void) if (day_item_count(0) <= 0) return; - struct day_item *p = day_get_item(listbox_get_sel(&lb_apt)); + struct day_item *p = ui_day_selitem(); status_mesg(_("Pipe item to external command:"), ""); if (getstring(win[STA].p, cmd, BUFSIZ, 0, 1) != GETSTRING_VALID) @@ -605,7 +605,7 @@ void ui_day_item_delete(unsigned reg) if (day_item_count(0) <= 0) return; - struct day_item *p = day_get_item(listbox_get_sel(&lb_apt)); + struct day_item *p = ui_day_selitem(); if (conf.confirm_delete) { if (status_ask_bool(del_app_str) != 1) { @@ -834,7 +834,7 @@ void ui_day_item_copy(unsigned reg) if (day_item_count(0) <= 0 || reg == REG_BLACK_HOLE) return; - struct day_item *item = day_get_item(listbox_get_sel(&lb_apt)); + struct day_item *item = ui_day_selitem(); ui_day_item_cut_free(reg); day_item_fork(item, &day_cut[reg]); } @@ -929,7 +929,7 @@ void ui_day_popup_item(void) if (day_item_count(0) <= 0) return; - struct day_item *item = day_get_item(listbox_get_sel(&lb_apt)); + struct day_item *item = ui_day_selitem(); day_popup_item(item); } @@ -938,7 +938,7 @@ void ui_day_flag(void) if (day_item_count(0) <= 0) return; - struct day_item *item = day_get_item(listbox_get_sel(&lb_apt)); + struct day_item *item = ui_day_selitem(); day_item_switch_notify(item); io_set_modified(); } @@ -948,7 +948,7 @@ void ui_day_view_note(void) if (day_item_count(0) <= 0) return; - struct day_item *item = day_get_item(listbox_get_sel(&lb_apt)); + struct day_item *item = ui_day_selitem(); day_view_note(item, conf.pager); } @@ -957,7 +957,7 @@ void ui_day_edit_note(void) if (day_item_count(0) <= 0) return; - struct day_item *item = day_get_item(listbox_get_sel(&lb_apt)); + struct day_item *item = ui_day_selitem(); day_edit_note(item, conf.editor); io_set_modified(); } -- cgit v1.2.3