From 361f95a9760d7d74213b62be79be016d528bbaec Mon Sep 17 00:00:00 2001 From: Andrew Borodin Date: Thu, 4 Feb 2010 11:08:15 +0000 Subject: [PATCH] Minor optimization of listbox_key() function. Signed-off-by: Andrew Borodin --- src/widget.c | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/src/widget.c b/src/widget.c index 7340933af..2084035f2 100644 --- a/src/widget.c +++ b/src/widget.c @@ -2284,6 +2284,9 @@ listbox_key (WListbox *l, int key) cb_ret_t j = MSG_NOT_HANDLED; + if (l->list == NULL) + return MSG_NOT_HANDLED; + /* focus on listbox item N by '0'..'9' keys */ if (key >= '0' && key <= '9') { int oldpos = l->pos; @@ -2296,9 +2299,6 @@ listbox_key (WListbox *l, int key) return MSG_HANDLED; } - if (l->list == NULL) - return MSG_NOT_HANDLED; - switch (key){ case KEY_HOME: case KEY_A1: @@ -2328,7 +2328,7 @@ listbox_key (WListbox *l, int key) listbox_fwd (l); j = MSG_HANDLED; } - return j; + break; case KEY_PPAGE: case ALT('v'): @@ -2336,7 +2336,7 @@ listbox_key (WListbox *l, int key) listbox_back (l); j = MSG_HANDLED; } - return j; + break; case KEY_DC: case 'd': @@ -2352,17 +2352,20 @@ listbox_key (WListbox *l, int key) case (KEY_M_SHIFT | KEY_DC): case 'D': if (l->deletable && confirm_history_cleanup - && (query_dialog (Q_("DialogTitle|Clean history"), + /* TRANSLATORS: no need to translate 'DialogTitle', it's just a context prefix */ + && (query_dialog (Q_("DialogTitle|History cleanup"), _("Do you want clean this history?"), - D_ERROR, 2, _("&Yes"), _("&No")) == 0)) + D_ERROR, 2, _("&Yes"), _("&No")) == 0)) { listbox_remove_list (l); - return MSG_HANDLED; + j = MSG_HANDLED; + } + break; default: break; } - return MSG_NOT_HANDLED; + return j; } static inline void