summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBenjamin Franzke <benjaminfranzke@googlemail.com>2011-10-21 10:26:37 +0200
committerBenjamin Franzke <benjaminfranzke@googlemail.com>2011-10-21 10:28:01 +0200
commit478d7fe56a9927133b87b80e21d507c90bd8800d (patch)
treedda3bb56f74efd90442ae810ee11b4c34c72d037 /src
parent5f11a9e4ae70e091557f992dcc4f0bb87ea698ec (diff)
downloadpa-sink-ctl-478d7fe56a9927133b87b80e21d507c90bd8800d.tar.gz
pa-sink-ctl-478d7fe56a9927133b87b80e21d507c90bd8800d.tar.bz2
pa-sink-ctl-478d7fe56a9927133b87b80e21d507c90bd8800d.zip
interface: Cache some boolean expressions
Diffstat (limited to 'src')
-rw-r--r--src/interface.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/interface.c b/src/interface.c
index 385e5d9..d4b94be 100644
--- a/src/interface.c
+++ b/src/interface.c
@@ -96,7 +96,9 @@ print_input_list(gint sink_num)
offset += sink_list_get(i)->input_list->len;
for (gint i = 0; i < sink_list_get(sink_num)->input_list->len; ++i) {
- if (chooser_sink == sink_num && chooser_input == i)
+ gboolean selected = (chooser_sink == sink_num && chooser_input == i);
+
+ if (selected)
wattron(menu_win, A_REVERSE);
mvwprintw(menu_win, offset + i, 2, "%*s%-*s",
@@ -104,7 +106,7 @@ print_input_list(gint sink_num)
max_name_len - 1,
sink_input_get(sink_num, i)->name);
- if (chooser_sink == sink_num && chooser_input == i)
+ if (selected)
wattroff(menu_win, A_REVERSE);
print_volume(sink_input_get(sink_num, i)->vol,
@@ -169,7 +171,9 @@ print_sink_list(void)
}
for (i = 0; i < sink_list->len; ++i) {
- if (i == chooser_sink && chooser_input == SELECTED_SINK)
+ gboolean selected = (i == chooser_sink && chooser_input == SELECTED_SINK);
+
+ if (selected)
wattron(menu_win, A_REVERSE);
mvwprintw(menu_win, y+i+offset, x, "%2u %-*s",
@@ -177,7 +181,7 @@ print_sink_list(void)
max_name_len,
sink_list_get(i)->device != NULL ? sink_list_get(i)->device : sink_list_get(i)->name);
- if (i == chooser_sink && chooser_input == SELECTED_SINK)
+ if (selected)
wattroff(menu_win, A_REVERSE);
print_volume(sink_list_get(i)->vol, sink_list_get(i)->mute, y+i+offset);