summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBenjamin Franzke <benjaminfranzke@googlemail.com>2011-12-19 10:13:19 +0100
committerBenjamin Franzke <benjaminfranzke@googlemail.com>2011-12-19 10:13:19 +0100
commite393945ada46c8737911ebe66cd14be59e12e6b8 (patch)
tree89e656b6d6c9efa7cb8a2cabea082961a4cbe352 /src
parentc97b9a060d63ed1d88bec37a48bd20b4b7df160d (diff)
downloadpa-sink-ctl-e393945ada46c8737911ebe66cd14be59e12e6b8.tar.gz
pa-sink-ctl-e393945ada46c8737911ebe66cd14be59e12e6b8.tar.bz2
pa-sink-ctl-e393945ada46c8737911ebe66cd14be59e12e6b8.zip
Rename chooser_{sink,input} to chooser_{main_ctl,child}
Diffstat (limited to 'src')
-rw-r--r--src/command.c46
-rw-r--r--src/interface.c18
-rw-r--r--src/interface.h6
3 files changed, 36 insertions, 34 deletions
diff --git a/src/command.c b/src/command.c
index 577932c..4da2aa2 100644
--- a/src/command.c
+++ b/src/command.c
@@ -46,16 +46,16 @@ up(struct context *ctx, int key)
if (!ctx->context_ready)
return;
- if (ifc->chooser_input == SELECTED_SINK &&
- ifc->chooser_sink > 0) {
+ if (ifc->chooser_child == SELECTED_MAIN_CTL &&
+ ifc->chooser_main_ctl > 0) {
- --ifc->chooser_sink;
+ --ifc->chooser_main_ctl;
ctl = (struct main_ctl *) interface_get_current_ctl(ifc, NULL);
- /* autoassigment to SELECTED_SINK (=-1) if length = 0 */
- ifc->chooser_input = main_ctl_childs_len(ctx, ctl) - 1;
- } else if (ifc->chooser_input >= 0)
- --ifc->chooser_input;
+ /* autoassigment to SELECTED_MAIN_CTL (=-1) if length = 0 */
+ ifc->chooser_child = main_ctl_childs_len(ctx, ctl) - 1;
+ } else if (ifc->chooser_child >= 0)
+ --ifc->chooser_child;
interface_redraw(ifc);
}
@@ -64,7 +64,7 @@ static void
down(struct context *ctx, int key)
{
struct interface *ifc = &ctx->interface;
- int max_input;
+ int max_ctl_childs;
struct vol_ctl *ctl, *parent;
int max_len;
@@ -77,15 +77,15 @@ down(struct context *ctx, int key)
if (parent)
ctl = parent;
- max_input = main_ctl_childs_len(ctx, (struct main_ctl *) ctl) -1;
+ max_ctl_childs = main_ctl_childs_len(ctx, (struct main_ctl *) ctl) -1;
- if (ifc->chooser_input == max_input) {
- if (ifc->chooser_sink < max_len -1) {
- ++ifc->chooser_sink;
- ifc->chooser_input = SELECTED_SINK;
+ if (ifc->chooser_child == max_ctl_childs) {
+ if (ifc->chooser_main_ctl < max_len -1) {
+ ++ifc->chooser_main_ctl;
+ ifc->chooser_child = SELECTED_MAIN_CTL;
}
- } else if (ifc->chooser_input < max_input)
- ++ifc->chooser_input;
+ } else if (ifc->chooser_child < max_ctl_childs)
+ ++ifc->chooser_child;
interface_redraw(ifc);
}
@@ -183,24 +183,24 @@ switch_sink(struct context *ctx, int key)
if (g_list_length(*list) <= 1)
return;
- if (ifc->chooser_sink < (gint) (offset + g_list_length(*list) - 1))
- ifc->chooser_sink++;
+ if (ifc->chooser_main_ctl < (gint) (offset + g_list_length(*list) - 1))
+ ifc->chooser_main_ctl++;
else
- ifc->chooser_sink = offset;
+ ifc->chooser_main_ctl = offset;
- mcparent = g_list_nth_data(*list, ifc->chooser_sink - offset);
- /* chooser_input needs to be derived from $selected_index */
+ mcparent = g_list_nth_data(*list, ifc->chooser_main_ctl - offset);
+ /* chooser_child needs to be derived from $selected_index */
o = mcparent->move_child(ctx->context,
cslave->index, mcparent->base.index,
NULL, NULL);
pa_operation_unref(o);
- /* get new chooser_input, if non, select sink as fallback */
- ifc->chooser_input = SELECTED_SINK;
+ /* get new chooser_child, if non, select sink as fallback */
+ ifc->chooser_child = SELECTED_MAIN_CTL;
i = -1;
list_foreach(*mcparent->childs_list, t) {
if (t->base.index == cslave->index) {
- ifc->chooser_input = ++i;
+ ifc->chooser_child = ++i;
break;
}
if (t->parent_index == mcparent->base.index)
diff --git a/src/interface.c b/src/interface.c
index 0246222..f168b71 100644
--- a/src/interface.c
+++ b/src/interface.c
@@ -63,18 +63,20 @@ interface_get_current_ctl(struct interface *ifc, struct vol_ctl **parent)
if (parent)
*parent = NULL;
- main_ctl = g_list_nth_data(ctx->sink_list, ifc->chooser_sink);
+ main_ctl = g_list_nth_data(ctx->sink_list, ifc->chooser_main_ctl);
if (main_ctl == NULL) {
main_ctl = g_list_nth_data(ctx->source_list,
- ifc->chooser_sink - g_list_length(ctx->sink_list));
+ ifc->chooser_main_ctl -
+ g_list_length(ctx->sink_list));
if (main_ctl == NULL)
return NULL;
}
- if (ifc->chooser_input == SELECTED_SINK)
+ if (ifc->chooser_child == SELECTED_MAIN_CTL)
return &main_ctl->base;
- else if (ifc->chooser_input >= 0) {
- sctl = main_ctl_get_nth_child(ctx, (struct main_ctl *) main_ctl, ifc->chooser_input);
+ else if (ifc->chooser_child >= 0) {
+ sctl = main_ctl_get_nth_child(ctx, (struct main_ctl *) main_ctl,
+ ifc->chooser_child);
if (sctl == NULL)
return NULL;
if (parent)
@@ -276,10 +278,10 @@ interface_init(struct interface *ifc)
GIOChannel *input_channel;
/* Selected sink-device. 0 is the first device */
- ifc->chooser_sink = 0;
+ ifc->chooser_main_ctl = 0;
/* Selected input of the current sink-device. */
- /* SELECTED_SINK refers to sink-device itself */
- ifc->chooser_input = SELECTED_SINK;
+ /* SELECTED_MAIN_CTL refers to sink-device itself */
+ ifc->chooser_child = SELECTED_MAIN_CTL;
initscr();
clear();
diff --git a/src/interface.h b/src/interface.h
index da52be6..5b3ebf8 100644
--- a/src/interface.h
+++ b/src/interface.h
@@ -24,7 +24,7 @@
#include <pulse/pulseaudio.h>
#include <ncurses.h>
-#define SELECTED_SINK -1
+#define SELECTED_MAIN_CTL -1
#define H_MSG_BOX 3
struct interface {
@@ -39,8 +39,8 @@ struct interface {
#endif
guint input_source_id;
- gint chooser_sink;
- gint chooser_input;
+ gint chooser_main_ctl;
+ gint chooser_child;
guint max_name_len;