diff options
author | Jonathan McCrohan <jmccrohan@gmail.com> | 2014-01-25 00:07:30 +0000 |
---|---|---|
committer | Jonathan McCrohan <jmccrohan@gmail.com> | 2014-01-25 00:07:30 +0000 |
commit | d7ca0c3e555ef0b5250873ddce48ccf2326b017a (patch) | |
tree | 52fc801f0893eb7752524b2602d420afbda4ed59 /conf_scr.c | |
parent | 3645c236e9720deb696e7aebc33cd9a6d8cbbdc6 (diff) | |
download | wavemon-d7ca0c3e555ef0b5250873ddce48ccf2326b017a.tar.gz |
Imported Upstream version 0.7.6upstream/0.7.6
Diffstat (limited to '')
-rw-r--r-- | conf_scr.c | 15 |
1 files changed, 12 insertions, 3 deletions
@@ -33,7 +33,6 @@ extern int conf_items; /* index into array storing menu items */ static WINDOW *w_conf, *w_confpad; static int first_item, active_item; static int num_items, list_offset; -static struct conf_item *item; static void waddstr_item(WINDOW *w, int y, struct conf_item *item, char hilight) { @@ -133,13 +132,13 @@ static int select_item(int rv, int incr) /* Perform selection, return offset value to ensure pad fits inside window */ static int m_pref(WINDOW *w_conf, int list_offset, int active_item, int num_items) { - struct conf_item *item; int active_line, i, j; werase(w_conf); for (active_line = i = j = 0; i < num_items; i++) { - item = ll_get(conf_items, i); + struct conf_item *item = ll_get(conf_items, i); + if (!item->dep || *item->dep) { if (i != active_item) waddstr_item(w_conf, j++, item, 0); @@ -159,6 +158,7 @@ static int m_pref(WINDOW *w_conf, int list_offset, int active_item, int num_item void scr_conf_init(void) { + struct conf_item *item; conf_get_interface_list(false); /* may have changed in the meantime */ num_items = ll_size(conf_items); @@ -174,6 +174,7 @@ void scr_conf_init(void) int scr_conf_loop(WINDOW *w_menu) { + struct conf_item *item; int key; list_offset = m_pref(w_confpad, list_offset, active_item, num_items); @@ -185,7 +186,14 @@ int scr_conf_loop(WINDOW *w_menu) key = wgetch(w_menu); switch (key) { + case KEY_HOME: + active_item = first_item; + break; + case KEY_END: + active_item = num_items - 1; + break; case KEY_DOWN: + case KEY_NPAGE: active_item = select_item(active_item, 1); if (active_item >= num_items) { active_item = first_item; @@ -193,6 +201,7 @@ int scr_conf_loop(WINDOW *w_menu) } break; case KEY_UP: + case KEY_PPAGE: active_item = select_item(active_item, -1); if (active_item < first_item) active_item = num_items - 1; |