From 5760a65c1ae4f58fd3ce73049e95144d154ab816 Mon Sep 17 00:00:00 2001 From: Benjamin Franzke Date: Mon, 19 Dec 2011 10:22:30 +0100 Subject: Make main_ctl_childs_len a vol_ctl vfunc --- src/command.c | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) (limited to 'src/command.c') diff --git a/src/command.c b/src/command.c index 47e42a4..7ab68cb 100644 --- a/src/command.c +++ b/src/command.c @@ -24,19 +24,6 @@ #include "ctl.h" #include "command.h" -static int -main_ctl_childs_len(struct context *ctx, struct main_ctl *ctl) -{ - struct slave_ctl *sctl; - int len = 0; - - list_foreach(*ctl->childs_list, sctl) - if (sctl->parent_index == ctl->base.index) - len++; - - return len; -} - static void up(struct context *ctx, int key) { @@ -53,7 +40,7 @@ up(struct context *ctx, int key) ctl = (struct main_ctl *) interface_get_current_ctl(ifc, NULL); /* autoassigment to SELECTED_MAIN_CTL (=-1) if length = 0 */ - ifc->chooser_child = main_ctl_childs_len(ctx, ctl) - 1; + ifc->chooser_child = ctl->base.childs_len(&ctl->base) - 1; } else if (ifc->chooser_child >= 0) --ifc->chooser_child; @@ -77,7 +64,7 @@ down(struct context *ctx, int key) if (parent) ctl = parent; - max_ctl_childs = main_ctl_childs_len(ctx, (struct main_ctl *) ctl) -1; + max_ctl_childs = ctl->childs_len(ctl) -1; if (ifc->chooser_child == max_ctl_childs) { if (ifc->chooser_main_ctl < max_len -1) { -- cgit