Skip to content

Commit 482bb23

Browse files
committed
#20 show badge on vinyl button if playing
1 parent 134abd5 commit 482bb23

File tree

4 files changed

+88
-89
lines changed

4 files changed

+88
-89
lines changed

addon/lib/ToggleButton.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ exports.init = function () {
1111
id: "local-music-player-widget",
1212
label: 'Local Music Player',
1313
icon: Data.get("images/ico-64.png"),
14-
onChange: handleChange
14+
onChange: handleChange,
15+
badgeColor: "#000000"
1516
});
1617
};
1718

addon/lib/Toolbar.js

+28-25
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ var {
99
} = require("sdk/ui/frame");
1010
var Data = require("./Data"),
1111
Localisation = require("./Localisation"),
12+
ToggleButton = require("./ToggleButton"),
1213
Panel = require("./Panel"),
1314
frameObject,
1415
playButton,
@@ -37,31 +38,29 @@ exports.init = function () {
3738
});
3839

3940
var previous = ActionButton({
40-
id: "localmusicplayer-prev",
41-
label: Localisation.getString("hotkeyPrev_title"),
42-
icon: Data.get("images/previous-24.png"),
43-
onClick: function (state) {
44-
Panel.get().port.emit("prevTrack", '');
45-
}
46-
});
47-
48-
var stop = ActionButton({
49-
id: "localmusicplayer-stop",
50-
label: Localisation.getString("hotkeyStop_title"),
51-
icon: Data.get("images/stop-24.png"),
52-
onClick: function (state) {
53-
Panel.get().port.emit("stopTrack", '');
54-
}
55-
});
56-
57-
var next = ActionButton({
58-
id: "localmusicplayer-next",
59-
label: Localisation.getString("hotkeyNext_title"),
60-
icon: Data.get("images/next-24.png"),
61-
onClick: function (state) {
62-
Panel.get().port.emit("nextTrack", '');
63-
}
64-
});
41+
id: "localmusicplayer-prev",
42+
label: Localisation.getString("hotkeyPrev_title"),
43+
icon: Data.get("images/previous-24.png"),
44+
onClick: function (state) {
45+
Panel.get().port.emit("prevTrack", '');
46+
}
47+
}),
48+
stop = ActionButton({
49+
id: "localmusicplayer-stop",
50+
label: Localisation.getString("hotkeyStop_title"),
51+
icon: Data.get("images/stop-24.png"),
52+
onClick: function (state) {
53+
Panel.get().port.emit("stopTrack", '');
54+
}
55+
}),
56+
next = ActionButton({
57+
id: "localmusicplayer-next",
58+
label: Localisation.getString("hotkeyNext_title"),
59+
icon: Data.get("images/next-24.png"),
60+
onClick: function (state) {
61+
Panel.get().port.emit("nextTrack", '');
62+
}
63+
});
6564

6665
frameObject = new Frame({
6766
url: Data.get("html/FrameView.html")
@@ -71,6 +70,7 @@ exports.init = function () {
7170
id: "localmusicplayer-repeatAll",
7271
label: Localisation.getString("repeatAll_title"),
7372
icon: Data.get("images/repeatAll-24.png"),
73+
badgeColor: "#000000",
7474
onClick: function (state) {
7575
Panel.get().port.emit("repeatAll", '');
7676

@@ -88,6 +88,7 @@ exports.init = function () {
8888
id: "localmusicplayer-random",
8989
label: Localisation.getString("random_title"),
9090
icon: Data.get("images/random-24.png"),
91+
badgeColor: "#000000",
9192
onClick: function (state) {
9293
Panel.get().port.emit("random", '');
9394

@@ -118,8 +119,10 @@ exports.setPlaying = function (value) {
118119
// if play clicked from a panel row
119120
if (playing) {
120121
playButton.icon = Data.get("images/pause-24.png");
122+
ToggleButton.get().badge = ">";
121123
} else {
122124
playButton.icon = Data.get("images/play-24.png");
125+
ToggleButton.get().badge = "";
123126
}
124127
};
125128

addon/package.json

+31-36
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,33 @@
11
{
2-
"name": "local-music-player-firefox",
3-
"title": "Local Music Player",
4-
"id": "jid1-nCt6CO1kXSzfAg",
5-
"description": "Browse and listen to your local music",
6-
"author": "Robert Byrne",
7-
"license": "GNU GPL v3",
8-
"version": "0.10.3",
9-
"permissions": {
10-
"private-browsing": true
11-
},
12-
"preferences": [
13-
{
14-
"name": "hotkeyPlay",
15-
"title": "Play",
16-
"type": "string",
17-
"value": "accel-shift-p"
18-
},
19-
{
20-
"name": "hotkeyStop",
21-
"title": "Stop",
22-
"type": "string",
23-
"value": "accel-shift-s"
24-
},
25-
{
26-
"name": "hotkeyNext",
27-
"title": "Next",
28-
"type": "string",
29-
"value": "accel-shift-right"
30-
},
31-
{
32-
"name": "hotkeyPrev",
33-
"title": "Previous",
34-
"type": "string",
35-
"value": "accel-shift-left"
36-
}
37-
]
2+
"name": "local-music-player-firefox",
3+
"title": "Local Music Player",
4+
"id": "jid1-nCt6CO1kXSzfAg",
5+
"description": "Browse and listen to your local music",
6+
"author": "Robert Byrne",
7+
"license": "GNU GPL v3",
8+
"version": "0.10.3",
9+
"permissions": {
10+
"private-browsing": true
11+
},
12+
"preferences": [{
13+
"name": "hotkeyPlay",
14+
"title": "Play",
15+
"type": "string",
16+
"value": "accel-shift-p"
17+
}, {
18+
"name": "hotkeyStop",
19+
"title": "Stop",
20+
"type": "string",
21+
"value": "accel-shift-s"
22+
}, {
23+
"name": "hotkeyNext",
24+
"title": "Next",
25+
"type": "string",
26+
"value": "accel-shift-right"
27+
}, {
28+
"name": "hotkeyPrev",
29+
"title": "Previous",
30+
"type": "string",
31+
"value": "accel-shift-left"
32+
}]
3833
}

package.json

+27-27
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,29 @@
11
{
2-
"name": "local-music-player-firefox",
3-
"version": "0.10.3",
4-
"description": "Browse and listen to your local music",
5-
"main": "addon/lib/main.js",
6-
"scripts": {
7-
"test": "echo \"Error: no test specified\" && exit 1"
8-
},
9-
"repository": {
10-
"type": "git",
11-
"url": "https://github.com/bobbyrne01/local-music-player-firefox.git"
12-
},
13-
"author": "Robert Byrne",
14-
"license": "GNU GPL v3",
15-
"bugs": {
16-
"url": "https://github.com/bobbyrne01/local-music-player-firefox/issues"
17-
},
18-
"homepage": "https://github.com/bobbyrne01/local-music-player-firefox",
19-
"devDependencies": {
20-
"grunt": "^0.4.5",
21-
"grunt-contrib-csslint": "^0.4.0",
22-
"grunt-contrib-jshint": "^0.11.0",
23-
"grunt-contrib-watch": "^0.6.1",
24-
"grunt-html-validation": "^0.1.18",
25-
"grunt-jsbeautifier": "^0.2.7",
26-
"grunt-notify": "^0.4.1",
27-
"grunt-release": "^0.10.0"
28-
}
2+
"name": "local-music-player-firefox",
3+
"version": "0.10.3",
4+
"description": "Browse and listen to your local music",
5+
"main": "addon/lib/main.js",
6+
"scripts": {
7+
"test": "echo \"Error: no test specified\" && exit 1"
8+
},
9+
"repository": {
10+
"type": "git",
11+
"url": "https://github.com/bobbyrne01/local-music-player-firefox.git"
12+
},
13+
"author": "Robert Byrne",
14+
"license": "GNU GPL v3",
15+
"bugs": {
16+
"url": "https://github.com/bobbyrne01/local-music-player-firefox/issues"
17+
},
18+
"homepage": "https://github.com/bobbyrne01/local-music-player-firefox",
19+
"devDependencies": {
20+
"grunt": "^0.4.5",
21+
"grunt-contrib-csslint": "^0.4.0",
22+
"grunt-contrib-jshint": "^0.11.0",
23+
"grunt-contrib-watch": "^0.6.1",
24+
"grunt-html-validation": "^0.1.18",
25+
"grunt-jsbeautifier": "^0.2.7",
26+
"grunt-notify": "^0.4.1",
27+
"grunt-release": "^0.10.0"
28+
}
2929
}

0 commit comments

Comments
 (0)