AppOutputStreamSlider: Fixed scrolling and added description if stream has no name.
[AdvancedVolumeMixer.git] / panel.js
blob29cd6b5a605a46af0a381b26cd0edb9c761470c6
1 // vi: et sw=2 fileencoding=utf8
2 //
5 const Lang = imports.lang;
6 const Clutter = imports.gi.Clutter;
7 const St = imports.gi.St;
8 const PanelMenu = imports.ui.panelMenu;
9 const GLib = imports.gi.GLib;
11 const AVM = imports.misc.extensionUtils.getCurrentExtension();
12 const Settings = AVM.imports.settings;
14 const AdvancedVolumeMixerStatusButton = new Lang.Class({
15   Name: 'AdvancedVolumeMixerStatusButton',
16   Extends: PanelMenu.Button,
18   _init: function(mixer) {
19     this.parent(0.0, "AdvancedVolumeMixer");
21     this._mixer = mixer;
23     this._delegate = this._mixer;
25     this._coverPath = "";
26     this._coverSize = 22;
27     this._state = "";
29     this._box = new St.BoxLayout();
31     this._icon = new St.Icon({icon_name: this._mixer.getIcon(), // 'audio-x-generic-symbolic',
32                               style_class: 'system-status-icon'});
33     this._bin = new St.Bin({child: this._icon});
35     this._stateIcon = new St.Icon({icon_name: 'system-run-symbolic',
36                                    style_class: 'status-icon'});
37     this._stateIconBin = new St.Bin({child: this._stateIcon,
38                                      y_align: St.Align.END});
40     this._box.add(this._bin);
41     this._box.add(this._stateIconBin);
42     this.actor.add_actor(this._box);
43     this.actor.add_style_class_name('panel-status-button');
44     this.actor.connect('scroll-event', Lang.bind(this, this._onScrollEvent));
46     this._mixer.connect("icon-changed", Lang.bind(this, this._onIconChanged));
47     this.menu.addMenuItem(this._mixer);
48   },
50   setMixer: function (mixer) {
51   },
53   _onScrollEvent: function (actor, event) {
54     this._mixer.scroll(event);
55   },
57   _onIconChanged: function (mixer) {
58     this.setIcon(mixer.getIcon());
59   },
61   setIcon: function (icon_name) {
62     this._icon.icon_name = icon_name;
63   }
65 });