chiark / gitweb /
Merge compact mode volume slider changes.
[disorder] / disobedience / control.c
CommitLineData
460b9539 1/*
2 * This file is part of DisOrder.
3849817f 3 * Copyright (C) 2006-2008 Richard Kettlewell
460b9539 4 *
e7eb3a27 5 * This program is free software: you can redistribute it and/or modify
460b9539 6 * it under the terms of the GNU General Public License as published by
e7eb3a27 7 * the Free Software Foundation, either version 3 of the License, or
460b9539 8 * (at your option) any later version.
9 *
e7eb3a27
RK
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
460b9539 15 * You should have received a copy of the GNU General Public License
e7eb3a27 16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
460b9539 17 */
219dc95c
RK
18/** @file disobedience/control.c
19 * @brief Volume control and buttons
20 */
460b9539 21
22#include "disobedience.h"
23
e9b70a84 24/* Forward declarations ---------------------------------------------------- */
25
460b9539 26struct icon;
27
460b9539 28static void clicked_icon(GtkButton *, gpointer);
ac6bf2ba 29static void clicked_menu(GtkMenuItem *, gpointer userdata);
2d504956 30static void toggled_menu(GtkCheckMenuItem *, gpointer userdata);
460b9539 31
a99c4e9a
RK
32static int enable_rtp(disorder_eclient *c,
33 disorder_eclient_no_response *completed,
34 void *v);
35static int disable_rtp(disorder_eclient *c,
36 disorder_eclient_no_response *completed,
37 void *v);
38
460b9539 39static double left(double v, double b);
40static double right(double v, double b);
41static double volume(double l, double r);
42static double balance(double l, double r);
43
44static void volume_adjusted(GtkAdjustment *a, gpointer user_data);
45static gchar *format_volume(GtkScale *scale, gdouble value);
46static gchar *format_balance(GtkScale *scale, gdouble value);
47
6856f665
RK
48static void icon_changed(const char *event,
49 void *evendata,
50 void *callbackdata);
1f868ca3
RK
51static void volume_changed(const char *event,
52 void *eventdata,
53 void *callbackdata);
96295b25
RK
54static void control_minimode(const char *event,
55 void *eventdata,
56 void *callbackdata);
1f868ca3 57
460b9539 58/* Control bar ------------------------------------------------------------- */
59
fb44b59e
RK
60/** @brief Guard against feedback */
61int suppress_actions = 1;
460b9539 62
219dc95c
RK
63/** @brief Definition of an icon
64 *
3849817f
RK
65 * We have two kinds of icon:
66 * - action icons, which just do something but don't have a state as such
67 * - toggle icons, which toggle between two states ("on" and "off").
68 *
69 * The scratch button is an action icon; currently all the others are toggle
70 * icons.
71 *
72 * (All icons can be sensitive or insensitive, separately to the above.)
219dc95c
RK
73 */
74struct icon {
3849817f
RK
75 /** @brief Filename for 'on' image */
76 const char *icon_on;
77
78 /** @brief Text for 'on' tooltip */
79 const char *tip_on;
219dc95c 80
3849817f
RK
81 /** @brief Filename for 'off' image or NULL for an action icon */
82 const char *icon_off;
83
84 /** @brief Text for 'off tooltip */
85 const char *tip_off;
219dc95c 86
ac6bf2ba
RK
87 /** @brief Associated menu item or NULL */
88 const char *menuitem;
219dc95c 89
6856f665
RK
90 /** @brief Events that change this icon, separated by spaces */
91 const char *events;
92
3849817f
RK
93 /** @brief @ref eclient.h function to call to go from off to on
94 *
95 * For action buttons, this should be NULL.
96 */
97 int (*action_go_on)(disorder_eclient *c,
98 disorder_eclient_no_response *completed,
99 void *v);
219dc95c 100
3849817f
RK
101 /** @brief @ref eclient.h function to call to go from on to off
102 *
103 * For action buttons, this action is used.
104 */
105 int (*action_go_off)(disorder_eclient *c,
106 disorder_eclient_no_response *completed,
107 void *v);
219dc95c 108
3849817f
RK
109 /** @brief Get button state
110 * @return 1 for on, 0 for off
111 */
112 int (*on)(void);
113
114 /** @brief Get button sensitivity
115 * @return 1 for sensitive, 0 for insensitive
116 *
117 * Can be NULL for always sensitive.
118 */
119 int (*sensitive)(void);
2d504956 120
219dc95c 121 /** @brief Pointer to button */
460b9539 122 GtkWidget *button;
ac6bf2ba
RK
123
124 /** @brief Pointer to menu item */
125 GtkWidget *item;
3849817f
RK
126
127 GtkWidget *image_on;
128 GtkWidget *image_off;
219dc95c
RK
129};
130
3849817f
RK
131static int pause_resume_on(void) {
132 return !(last_state & DISORDER_TRACK_PAUSED);
133}
134
135static int pause_resume_sensitive(void) {
6f09d54d
RK
136 return !!(last_state & DISORDER_PLAYING)
137 && (last_rights & RIGHT_PAUSE);
3849817f
RK
138}
139
140static int scratch_sensitive(void) {
6f09d54d 141 return !!(last_state & DISORDER_PLAYING)
afe9f743 142 && right_scratchable(last_rights, config->username, playing_track);
6f09d54d
RK
143}
144
145static int random_sensitive(void) {
146 return !!(last_rights & RIGHT_GLOBAL_PREFS);
3849817f
RK
147}
148
149static int random_enabled(void) {
150 return !!(last_state & DISORDER_RANDOM_ENABLED);
151}
152
6f09d54d
RK
153static int playing_sensitive(void) {
154 return !!(last_rights & RIGHT_GLOBAL_PREFS);
155}
156
3849817f
RK
157static int playing_enabled(void) {
158 return !!(last_state & DISORDER_PLAYING_ENABLED);
159}
2d504956 160
3849817f
RK
161static int rtp_enabled(void) {
162 return rtp_is_running;
163}
164
165static int rtp_sensitive(void) {
166 return rtp_supported;
167}
2d504956 168
219dc95c
RK
169/** @brief Table of all icons */
170static struct icon icons[] = {
2d504956 171 {
5c739b23 172 icon_on: "pause32.png",
3849817f 173 tip_on: "Pause playing track",
5c739b23 174 icon_off: "play32.png",
3849817f
RK
175 tip_off: "Resume playing track",
176 menuitem: "<GdisorderMain>/Control/Playing",
177 on: pause_resume_on,
178 sensitive: pause_resume_sensitive,
179 action_go_on: disorder_eclient_resume,
180 action_go_off: disorder_eclient_pause,
6856f665 181 events: "pause-changed playing-changed rights-changed",
2d504956
RK
182 },
183 {
5c739b23 184 icon_on: "cross32.png",
3849817f
RK
185 tip_on: "Cancel playing track",
186 menuitem: "<GdisorderMain>/Control/Scratch",
187 sensitive: scratch_sensitive,
188 action_go_off: disorder_eclient_scratch_playing,
6856f665 189 events: "playing-track-changed rights-changed",
2d504956
RK
190 },
191 {
5c739b23 192 icon_on: "randomenabled32.png",
3849817f 193 tip_on: "Disable random play",
5c739b23 194 icon_off: "randomdisabled32.png",
3849817f
RK
195 tip_off: "Enable random play",
196 menuitem: "<GdisorderMain>/Control/Random play",
197 on: random_enabled,
6f09d54d 198 sensitive: random_sensitive,
3849817f
RK
199 action_go_on: disorder_eclient_random_enable,
200 action_go_off: disorder_eclient_random_disable,
6856f665 201 events: "random-changed rights-changed",
2d504956
RK
202 },
203 {
5c739b23 204 icon_on: "playenabled32.png",
3849817f 205 tip_on: "Disable play",
5c739b23 206 icon_off: "playdisabled32.png",
3849817f
RK
207 tip_off: "Enable play",
208 on: playing_enabled,
6f09d54d 209 sensitive: playing_sensitive,
3849817f
RK
210 action_go_on: disorder_eclient_enable,
211 action_go_off: disorder_eclient_disable,
6856f665 212 events: "enabled-changed rights-changed",
2d504956
RK
213 },
214 {
5c739b23 215 icon_on: "rtpenabled32.png",
3849817f 216 tip_on: "Stop playing network stream",
5c739b23 217 icon_off: "rtpdisabled32.png",
3849817f
RK
218 tip_off: "Play network stream",
219 menuitem: "<GdisorderMain>/Control/Network player",
220 on: rtp_enabled,
221 sensitive: rtp_sensitive,
222 action_go_on: enable_rtp,
6856f665
RK
223 action_go_off: disable_rtp,
224 events: "rtp-changed",
2d504956 225 },
460b9539 226};
219dc95c
RK
227
228/** @brief Count of icons */
460b9539 229#define NICONS (int)(sizeof icons / sizeof *icons)
230
219dc95c
RK
231static GtkAdjustment *volume_adj;
232static GtkAdjustment *balance_adj;
3c499fe7
RK
233static GtkWidget *volume_widget;
234static GtkWidget *balance_widget;
460b9539 235
219dc95c 236/** @brief Create the control bar */
e9b70a84 237GtkWidget *control_widget(void) {
460b9539 238 GtkWidget *hbox = gtk_hbox_new(FALSE, 1), *vbox;
460b9539 239 int n;
240
241 D(("control_widget"));
ac6bf2ba 242 assert(mainmenufactory); /* ordering must be right */
460b9539 243 for(n = 0; n < NICONS; ++n) {
3849817f 244 /* Create the button */
3849817f
RK
245 icons[n].button = gtk_button_new();
246 gtk_widget_set_style(icons[n].button, tool_style);
247 icons[n].image_on = gtk_image_new_from_pixbuf(find_image(icons[n].icon_on));
248 gtk_widget_set_style(icons[n].image_on, tool_style);
249 g_object_ref(icons[n].image_on);
250 /* If it's a toggle icon, create the 'off' half too */
251 if(icons[n].icon_off) {
252 icons[n].image_off = gtk_image_new_from_pixbuf(find_image(icons[n].icon_off));
253 gtk_widget_set_style(icons[n].image_off, tool_style);
254 g_object_ref(icons[n].image_off);
255 }
460b9539 256 g_signal_connect(G_OBJECT(icons[n].button), "clicked",
ac6bf2ba 257 G_CALLBACK(clicked_icon), &icons[n]);
460b9539 258 /* pop the icon in a vbox so it doesn't get vertically stretch if there are
259 * taller things in the control bar */
260 vbox = gtk_vbox_new(FALSE, 0);
261 gtk_box_pack_start(GTK_BOX(vbox), icons[n].button, TRUE, FALSE, 0);
262 gtk_box_pack_start(GTK_BOX(hbox), vbox, FALSE, FALSE, 0);
ac6bf2ba 263 if(icons[n].menuitem) {
3849817f 264 /* Find the menu item */
ac6bf2ba
RK
265 icons[n].item = gtk_item_factory_get_widget(mainmenufactory,
266 icons[n].menuitem);
3849817f 267 if(icons[n].icon_off)
2d504956
RK
268 g_signal_connect(G_OBJECT(icons[n].item), "toggled",
269 G_CALLBACK(toggled_menu), &icons[n]);
3849817f 270 else
2d504956
RK
271 g_signal_connect(G_OBJECT(icons[n].item), "activate",
272 G_CALLBACK(clicked_menu), &icons[n]);
ac6bf2ba 273 }
6856f665
RK
274 /* Make sure the icon is updated when relevant things changed */
275 char **events = split(icons[n].events, 0, 0, 0, 0);
276 while(*events)
277 event_register(*events++, icon_changed, &icons[n]);
f513e538 278 event_register("connected-changed", icon_changed, &icons[n]);
460b9539 279 }
280 /* create the adjustments for the volume control */
281 volume_adj = GTK_ADJUSTMENT(gtk_adjustment_new(0, 0, goesupto,
282 goesupto / 20, goesupto / 20,
283 0));
284 balance_adj = GTK_ADJUSTMENT(gtk_adjustment_new(0, -1, 1,
285 0.2, 0.2, 0));
286 /* the volume control */
3c499fe7 287 volume_widget = gtk_hscale_new(volume_adj);
3c499fe7
RK
288 balance_widget = gtk_hscale_new(balance_adj);
289 gtk_widget_set_style(volume_widget, tool_style);
290 gtk_widget_set_style(balance_widget, tool_style);
291 gtk_scale_set_digits(GTK_SCALE(volume_widget), 10);
292 gtk_scale_set_digits(GTK_SCALE(balance_widget), 10);
293 gtk_widget_set_size_request(volume_widget, 192, -1);
294 gtk_widget_set_size_request(balance_widget, 192, -1);
a31f7a72
RK
295 gtk_widget_set_tooltip_text(volume_widget, "Volume");
296 gtk_widget_set_tooltip_text(balance_widget, "Balance");
3c499fe7
RK
297 gtk_box_pack_start(GTK_BOX(hbox), volume_widget, FALSE, TRUE, 0);
298 gtk_box_pack_start(GTK_BOX(hbox), balance_widget, FALSE, TRUE, 0);
460b9539 299 /* space updates rather than hammering the server */
3c499fe7
RK
300 gtk_range_set_update_policy(GTK_RANGE(volume_widget), GTK_UPDATE_DELAYED);
301 gtk_range_set_update_policy(GTK_RANGE(balance_widget), GTK_UPDATE_DELAYED);
460b9539 302 /* notice when the adjustments are changed */
303 g_signal_connect(G_OBJECT(volume_adj), "value-changed",
304 G_CALLBACK(volume_adjusted), 0);
305 g_signal_connect(G_OBJECT(balance_adj), "value-changed",
306 G_CALLBACK(volume_adjusted), 0);
307 /* format the volume/balance values ourselves */
3c499fe7 308 g_signal_connect(G_OBJECT(volume_widget), "format-value",
460b9539 309 G_CALLBACK(format_volume), 0);
3c499fe7 310 g_signal_connect(G_OBJECT(balance_widget), "format-value",
460b9539 311 G_CALLBACK(format_balance), 0);
1f868ca3 312 event_register("volume-changed", volume_changed, 0);
6856f665 313 event_register("rtp-changed", volume_changed, 0);
96295b25 314 event_register("mini-mode-changed", control_minimode, 0);
460b9539 315 return hbox;
316}
317
96295b25
RK
318/** @brief Return TRUE if volume setting is supported */
319static int volume_supported(void) {
320 /* TODO: if the server doesn't know how to set the volume [but isn't using
321 * network play] then we should have volume_supported = FALSE */
322 return (!rtp_supported
323 || (rtp_supported && backend && backend->set_volume));
324}
325
6d1302f0 326/** @brief Update the volume control when it changes */
1f868ca3
RK
327static void volume_changed(const char attribute((unused)) *event,
328 void attribute((unused)) *eventdata,
329 void attribute((unused)) *callbackdata) {
460b9539 330 double l, r;
331
1f868ca3 332 D(("volume_changed"));
fb44b59e 333 ++suppress_actions;
6856f665 334 /* Only display volume/balance controls if they will work */
96295b25 335 if(volume_supported()) {
6856f665 336 gtk_widget_show(volume_widget);
1b0a811c
RK
337 if(full_mode)
338 gtk_widget_show(balance_widget);
6856f665
RK
339 l = volume_l / 100.0;
340 r = volume_r / 100.0;
341 gtk_adjustment_set_value(volume_adj, volume(l, r) * goesupto);
342 gtk_adjustment_set_value(balance_adj, balance(l, r));
343 } else {
344 gtk_widget_hide(volume_widget);
345 gtk_widget_hide(balance_widget);
346 }
fb44b59e 347 --suppress_actions;
460b9539 348}
349
ad58ebcc 350/** @brief Update the state of one of the control icons
ad58ebcc 351 */
6856f665
RK
352static void icon_changed(const char attribute((unused)) *event,
353 void attribute((unused)) *evendata,
354 void *callbackdata) {
00e0c652 355 //fprintf(stderr, "icon_changed (%s)\n", event);
6856f665 356 const struct icon *const icon = callbackdata;
3849817f
RK
357 int on = icon->on ? icon->on() : 1;
358 int sensitive = icon->sensitive ? icon->sensitive() : 1;
00e0c652 359 //fprintf(stderr, "sensitive->%d\n", sensitive);
3849817f
RK
360 GtkWidget *child, *newchild;
361
362 ++suppress_actions;
ad58ebcc 363 /* If the connection is down nothing is ever usable */
00959300 364 if(!(last_state & DISORDER_CONNECTED))
3849817f 365 sensitive = 0;
00e0c652 366 //fprintf(stderr, "(checked connected) sensitive->%d\n", sensitive);
3849817f
RK
367 /* Replace the child */
368 newchild = on ? icon->image_on : icon->image_off;
369 child = gtk_bin_get_child(GTK_BIN(icon->button));
370 if(child != newchild) {
371 if(child)
372 gtk_container_remove(GTK_CONTAINER(icon->button), child);
373 gtk_container_add(GTK_CONTAINER(icon->button), newchild);
374 gtk_widget_show(newchild);
375 }
7392b131
RK
376 /* If you disable play or random play NOT via the icon (for instance, via the
377 * edit menu or via a completely separate command line invocation) then the
00e0c652 378 * icon shows up as insensitive. Hover the mouse over it and the correct
7392b131
RK
379 * state is immediately displayed. sensitive and GTK_WIDGET_SENSITIVE show
380 * it to be in the correct state, so I think this is may be a GTK+ bug. */
3849817f 381 if(icon->tip_on)
a31f7a72
RK
382 gtk_widget_set_tooltip_text(icon->button,
383 on ? icon->tip_on : icon->tip_off);
3849817f
RK
384 gtk_widget_set_sensitive(icon->button, sensitive);
385 /* Icons with an associated menu item */
ac6bf2ba 386 if(icon->item) {
3849817f
RK
387 if(icon->icon_off)
388 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(icon->item), on);
389 gtk_widget_set_sensitive(icon->item, sensitive);
ac6bf2ba 390 }
3849817f 391 --suppress_actions;
a99c4e9a
RK
392}
393
53fa91bb 394static void icon_action_completed(void attribute((unused)) *v,
abf99697
RK
395 const char *err) {
396 if(err)
397 popup_protocol_error(0, err);
53fa91bb
RK
398}
399
460b9539 400static void clicked_icon(GtkButton attribute((unused)) *button,
401 gpointer userdata) {
402 const struct icon *icon = userdata;
403
3849817f
RK
404 if(suppress_actions)
405 return;
406 if(!icon->on || icon->on())
407 icon->action_go_off(client, icon_action_completed, 0);
408 else
409 icon->action_go_on(client, icon_action_completed, 0);
460b9539 410}
411
ac6bf2ba
RK
412static void clicked_menu(GtkMenuItem attribute((unused)) *menuitem,
413 gpointer userdata) {
3849817f 414 clicked_icon(NULL, userdata);
ac6bf2ba
RK
415}
416
3849817f 417static void toggled_menu(GtkCheckMenuItem attribute((unused)) *menuitem,
2d504956 418 gpointer userdata) {
3849817f 419 clicked_icon(NULL, userdata);
2d504956
RK
420}
421
699517af
RK
422/** @brief Called when a volume command completes */
423static void volume_completed(void attribute((unused)) *v,
abf99697 424 const char *err,
699517af
RK
425 int attribute((unused)) l,
426 int attribute((unused)) r) {
abf99697
RK
427 if(err)
428 popup_protocol_error(0, err);
699517af
RK
429 /* We don't set the UI's notion of the volume here, it is set from the log
430 * regardless of the reason it changed */
431}
432
219dc95c 433/** @brief Called when the volume has been adjusted */
460b9539 434static void volume_adjusted(GtkAdjustment attribute((unused)) *a,
435 gpointer attribute((unused)) user_data) {
436 double v = gtk_adjustment_get_value(volume_adj) / goesupto;
437 double b = gtk_adjustment_get_value(balance_adj);
438
fb44b59e 439 if(suppress_actions)
460b9539 440 /* This is the result of an update from the server, not a change from the
441 * user. Don't feedback! */
442 return;
443 D(("volume_adjusted"));
444 /* force to 'stereotypical' values */
445 v = nearbyint(100 * v) / 100;
446 b = nearbyint(5 * b) / 5;
447 /* Set the volume. We don't want a reply, we'll get the actual new volume
448 * from the log. */
321f7536
RK
449 if(rtp_supported) {
450 int l = nearbyint(left(v, b) * 100), r = nearbyint(right(v, b) * 100);
b50cfb8a
RK
451 if(backend && backend->set_volume)
452 backend->set_volume(&l, &r);
321f7536 453 } else
699517af 454 disorder_eclient_volume(client, volume_completed,
321f7536
RK
455 nearbyint(left(v, b) * 100),
456 nearbyint(right(v, b) * 100),
457 0);
460b9539 458}
459
219dc95c 460/** @brief Formats the volume value */
460b9539 461static gchar *format_volume(GtkScale attribute((unused)) *scale,
462 gdouble value) {
463 char s[32];
464
465 snprintf(s, sizeof s, "%.1f", (double)value);
2fc4475d 466 return g_strdup(s);
460b9539 467}
468
219dc95c 469/** @brief Formats the balance value */
460b9539 470static gchar *format_balance(GtkScale attribute((unused)) *scale,
471 gdouble value) {
472 char s[32];
473
474 if(fabs(value) < 0.1)
2fc4475d 475 return g_strdup("0");
460b9539 476 snprintf(s, sizeof s, "%+.1f", (double)value);
2fc4475d 477 return g_strdup(s);
460b9539 478}
479
480/* Volume mapping. We consider left, right, volume to be in [0,1]
481 * and balance to be in [-1,1].
482 *
483 * First, we just have volume = max(left, right).
484 *
485 * Balance we consider to linearly represent the amount by which the quieter
486 * channel differs from the louder. In detail:
487 *
488 * if right > left then balance > 0:
489 * balance = 0 => left = right (as an endpoint, not an instance)
490 * balance = 1 => left = 0
491 * fitting to linear, left = right * (1 - balance)
492 * so balance = 1 - left / right
493 * (right > left => right > 0 so no division by 0.)
494 *
495 * if left > right then balance < 0:
496 * balance = 0 => right = left (same caveat as above)
497 * balance = -1 => right = 0
498 * again fitting to linear, right = left * (1 + balance)
499 * so balance = right / left - 1
500 * (left > right => left > 0 so no division by 0.)
501 *
502 * if left = right then we just have balance = 0.
503 *
504 * Thanks to Clive and Andrew.
505 */
506
219dc95c 507/** @brief Return the greater of @p x and @p y */
460b9539 508static double max(double x, double y) {
509 return x > y ? x : y;
510}
511
219dc95c 512/** @brief Compute the left channel volume */
460b9539 513static double left(double v, double b) {
514 if(b > 0) /* volume = right */
515 return v * (1 - b);
516 else /* volume = left */
517 return v;
518}
519
219dc95c 520/** @brief Compute the right channel volume */
460b9539 521static double right(double v, double b) {
522 if(b > 0) /* volume = right */
523 return v;
524 else /* volume = left */
525 return v * (1 + b);
526}
527
219dc95c 528/** @brief Compute the overall volume */
460b9539 529static double volume(double l, double r) {
530 return max(l, r);
531}
532
219dc95c 533/** @brief Compute the balance */
460b9539 534static double balance(double l, double r) {
535 if(l > r)
536 return r / l - 1;
537 else if(r > l)
538 return 1 - l / r;
539 else /* left = right */
540 return 0;
541}
542
a99c4e9a
RK
543/** @brief Called to enable RTP play
544 *
545 * Rather odd signature is to fit in with the other icons which all call @ref
546 * lib/eclient.h functions.
547 */
548static int enable_rtp(disorder_eclient attribute((unused)) *c,
549 disorder_eclient_no_response attribute((unused)) *completed,
550 void attribute((unused)) *v) {
551 start_rtp();
552 return 0;
553}
554
555/** @brief Called to disable RTP play
556 *
557 * Rather odd signature is to fit in with the other icons which all call @ref
558 * lib/eclient.h functions.
559 */
560static int disable_rtp(disorder_eclient attribute((unused)) *c,
561 disorder_eclient_no_response attribute((unused)) *completed,
562 void attribute((unused)) *v) {
563 stop_rtp();
564 return 0;
565}
566
96295b25
RK
567static void control_minimode(const char attribute((unused)) *event,
568 void attribute((unused)) *evendata,
569 void attribute((unused)) *callbackdata) {
faa19503 570 if(full_mode && volume_supported()) {
96295b25 571 gtk_widget_show(balance_widget);
faa19503
RK
572 gtk_scale_set_value_pos(GTK_SCALE(volume_widget), GTK_POS_TOP);
573 } else {
96295b25 574 gtk_widget_hide(balance_widget);
faa19503
RK
575 gtk_scale_set_value_pos(GTK_SCALE(volume_widget), GTK_POS_RIGHT);
576 }
96295b25
RK
577}
578
460b9539 579/*
580Local Variables:
581c-basic-offset:2
582comment-column:40
583fill-column:79
584indent-tabs-mode:nil
585End:
586*/