summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/command.c7
-rw-r--r--src/interface.c8
-rw-r--r--src/interface.h3
3 files changed, 13 insertions, 5 deletions
diff --git a/src/command.c b/src/command.c
index 9b9116a..f16e0b0 100644
--- a/src/command.c
+++ b/src/command.c
@@ -54,21 +54,18 @@ down(struct context *ctx, int key)
struct interface *ifc = &ctx->interface;
int max_ctl_childs;
struct vol_ctl *ctl, *parent;
- int max_len;
if (!ctx->context_ready)
return;
- max_len = g_list_length(ctx->sink_list) + g_list_length(ctx->source_list);
-
ctl = interface_get_current_ctl(&ctx->interface, &parent);
if (parent)
ctl = parent;
max_ctl_childs = ctl->childs_len(ctl) -1;
-
if (ifc->chooser_child == max_ctl_childs) {
- if (ifc->chooser_main_ctl < max_len -1) {
+ if (ifc->chooser_main_ctl <
+ interface_get_main_ctl_length(ifc) -1) {
++ifc->chooser_main_ctl;
ifc->chooser_child = SELECTED_MAIN_CTL;
}
diff --git a/src/interface.c b/src/interface.c
index d4b65e7..8c39e06 100644
--- a/src/interface.c
+++ b/src/interface.c
@@ -190,6 +190,14 @@ interface_redraw(struct interface *ifc)
wrefresh(ifc->menu_win);
}
+int
+interface_get_main_ctl_length(struct interface *ifc)
+{
+ struct context *ctx = container_of(ifc, struct context, interface);
+
+ return g_list_length(ctx->sink_list) + g_list_length(ctx->source_list);
+}
+
static gboolean
interface_get_input(GIOChannel *source, GIOCondition condition, gpointer data)
{
diff --git a/src/interface.h b/src/interface.h
index 5b3ebf8..c177c15 100644
--- a/src/interface.h
+++ b/src/interface.h
@@ -50,6 +50,9 @@ struct interface {
struct vol_ctl *
interface_get_current_ctl(struct interface *ifc, struct vol_ctl **parent);
+int
+interface_get_main_ctl_length(struct interface *ifc);
+
void
interface_redraw(struct interface *ifc);