1
1
namespace Audience.Widgets {
2
public class VolumeScale : Sound.Widgets.Scale, IController {
3
public VolumeScale () {
2
public class VolumeScale : Sound.Widgets.Scale {
5
return get_scale().get_value();
8
get_scale ().set_value (value);
9
update_volume_icon (value);
15
return !get_switch ().active;
18
get_switch ().active = !value;
19
get_image ().set_sensitive (!value);
20
get_scale ().set_sensitive (!value);
24
public VolumeScale (VolumeController controller) {
4
25
base("audio-volume-high-symbolic", true, 0.0, 1.0, 0.01);
27
controller.notify.connect(on_controller_changed);
6
29
get_scale ().value_changed.connect (() => {
7
volume_changed (get_scale ().get_value ());
30
controller.volume = get_scale ().get_value ();
10
33
get_switch ().notify["active"].connect (() => {
11
mute_changed (get_mute());
34
controller.mute = !get_switch().active;
15
public void set_volume (double volume) {
17
get_scale ().set_value (volume);
18
update_volume_icon (volume);
21
public double get_volume () {
22
return get_scale ().get_value ();
25
public bool get_mute () {
26
return !get_switch ().active;
29
public void set_mute (bool mute) {
30
message("set_mute"+(mute?"true":"false"));
31
get_switch ().active = !mute;
32
get_image ().set_sensitive (!mute);
33
get_scale ().set_sensitive (!mute);
36
private void update_volume_icon (double v) {
38
void on_controller_changed (Object o, ParamSpec p) {
41
mute=((VolumeController)o).mute;
44
volume=((VolumeController)o).volume;
51
void update_volume_icon (double v) {
39
54
icon = "audio-volume-muted-symbolic";