summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/command.c44
-rw-r--r--src/interface.c44
-rw-r--r--src/interface.h3
3 files changed, 47 insertions, 44 deletions
diff --git a/src/command.c b/src/command.c
index bde585c..b3d9d2b 100644
--- a/src/command.c
+++ b/src/command.c
@@ -37,22 +37,6 @@ sink_input_len(struct context *ctx, struct sink_info *sink)
return len;
}
-static struct sink_input_info *
-sink_get_nth_input(struct context *ctx, struct sink_info *sink, int n)
-{
- struct sink_input_info *input;
- int i = 0;
-
- list_foreach(ctx->input_list, input) {
- if (input->sink != sink->base.index)
- continue;
- if (i++ == n)
- return input;
- }
-
- return NULL;
-}
-
static void
up(struct context *ctx, int key)
{
@@ -91,34 +75,6 @@ down(struct context *ctx, int key)
interface_redraw(ctx);
}
-static struct vol_ctl *
-interface_get_current_ctl(struct context *ctx, struct vol_ctl **parent)
-{
- struct sink_info *sink;
- struct sink_input_info *input;
-
- if (parent)
- *parent = NULL;
-
- sink = g_list_nth_data(ctx->sink_list, ctx->chooser_sink);
- if (sink == NULL)
- return NULL;
-
- if (ctx->chooser_input == SELECTED_SINK)
- return &sink->base;
- else if (ctx->chooser_input >= 0) {
- input = sink_get_nth_input(ctx, sink, ctx->chooser_input);
- if (input == NULL)
- return NULL;
- if (parent)
- *parent = &sink->base;
- return &input->base;
- }
-
- g_assert(0);
- return NULL;
-}
-
static void
volume_change(struct context *ctx, gboolean volume_increment)
{
diff --git a/src/interface.c b/src/interface.c
index 1d23a30..10a16e3 100644
--- a/src/interface.c
+++ b/src/interface.c
@@ -38,6 +38,50 @@
#include "unix_signal.h"
#endif
+static struct sink_input_info *
+sink_get_nth_input(struct context *ctx, struct sink_info *sink, int n)
+{
+ struct sink_input_info *input;
+ int i = 0;
+
+ list_foreach(ctx->input_list, input) {
+ if (input->sink != sink->base.index)
+ continue;
+ if (i++ == n)
+ return input;
+ }
+
+ return NULL;
+}
+
+struct vol_ctl *
+interface_get_current_ctl(struct context *ctx, struct vol_ctl **parent)
+{
+ struct sink_info *sink;
+ struct sink_input_info *input;
+
+ if (parent)
+ *parent = NULL;
+
+ sink = g_list_nth_data(ctx->sink_list, ctx->chooser_sink);
+ if (sink == NULL)
+ return NULL;
+
+ if (ctx->chooser_input == SELECTED_SINK)
+ return &sink->base;
+ else if (ctx->chooser_input >= 0) {
+ input = sink_get_nth_input(ctx, sink, ctx->chooser_input);
+ if (input == NULL)
+ return NULL;
+ if (parent)
+ *parent = &sink->base;
+ return &input->base;
+ }
+
+ g_assert(0);
+ return NULL;
+}
+
static gboolean
interface_resize(gpointer data)
{
diff --git a/src/interface.h b/src/interface.h
index d07f298..28f5276 100644
--- a/src/interface.h
+++ b/src/interface.h
@@ -28,6 +28,9 @@
struct context;
+struct vol_ctl *
+interface_get_current_ctl(struct context *ctx, struct vol_ctl **parent);
+
void
interface_redraw(struct context *ctx);