Skip to content

Commit 80b8a78

Browse files
authored
sound150 v9.1.0: Functional improvement (#6841)
1 parent acb96d4 commit 80b8a78

File tree

4 files changed

+44
-18
lines changed

4 files changed

+44
-18
lines changed

sound150@claudiux/files/sound150@claudiux/6.4/applet.js

Lines changed: 37 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ let x = _("Playing");
198198
x = _("Paused");
199199
x = _("Stopped");
200200

201-
let VOLUME_ADJUSTMENT_STEP = 0.02; /* Volume adjustment step in % */
201+
let VOLUME_ADJUSTMENT_STEP = 0.05; /* Volume adjustment step in % */
202202

203203
const ICON_SIZE = Math.trunc(28*global.ui_scale);
204204

@@ -807,7 +807,7 @@ class Seeker extends Slider.Slider {
807807
}
808808

809809
_updateValue() {
810-
if (this.destroyed) return; // GLib.SOURCE_REMOVE; //???
810+
if (this.destroyed) return;
811811
//~ this._currentTime = (Date.now() - this.startingDate) / 1000;
812812

813813
if (this.canSeek) {
@@ -852,8 +852,8 @@ class Seeker extends Slider.Slider {
852852
this._timeoutId_timerCallback = null;
853853

854854
if (!this.destroyed) {
855-
this._timeoutId = timeout_add_seconds(1, this._updateValue.bind(this));
856-
this._timeoutId_timerCallback = timeout_add_seconds(1, this._timerCallback.bind(this));
855+
this._timeoutId = timeout_add_seconds(1, () => { this._updateValue(); return !this.destroyed });
856+
this._timeoutId_timerCallback = timeout_add_seconds(1, () => { return this._timerCallback() });
857857
}
858858
//return (!this.destroyed && this.status === "Playing") ? GLib.SOURCE_CONTINUE : GLib.SOURCE_REMOVE; //???
859859
}
@@ -899,11 +899,11 @@ class Seeker extends Slider.Slider {
899899
if (this.canSeek) {
900900
this._getPosition();
901901
this._timerTicker = 0;
902-
this._timeoutId_timerCallback = timeout_add_seconds(1, this._timerCallback.bind(this));
902+
this._timeoutId_timerCallback = timeout_add_seconds(1, () => { return this._timerCallback() });
903903
} else if (this._length > 0) {
904904
this._getPosition();
905905
this._timerTicker = 0;
906-
this._timeoutId_timerCallback = timeout_add_seconds(1, this._timerCallback.bind(this));
906+
this._timeoutId_timerCallback = timeout_add_seconds(1, () => { return this._timerCallback() });
907907
}
908908
} else {
909909
if (this.status === "Stopped") {
@@ -1089,7 +1089,7 @@ class Player extends PopupMenu.PopupMenuSection {
10891089

10901090
let asyncReadyCb = (proxy, error, property) => {
10911091
if (error)
1092-
log(error);
1092+
logError(error);
10931093
else {
10941094
this[property] = proxy;
10951095
this._dbus_acquired();
@@ -1123,14 +1123,15 @@ class Player extends PopupMenu.PopupMenuSection {
11231123
}
11241124

11251125
let mainBox = new PopupMenu.PopupMenuSection();
1126-
this.addMenuItem(mainBox);
1126+
//~ this.addMenuItem(mainBox);
11271127

11281128
this.vertBox = new St.BoxLayout({
11291129
style_class: "sound-player",
11301130
important: true,
11311131
vertical: true
11321132
});
11331133
mainBox.addActor(this.vertBox, { expand: false });
1134+
this.addMenuItem(mainBox);
11341135

11351136
// Player info
11361137
this._playerBox = new St.BoxLayout();
@@ -1725,7 +1726,7 @@ class Player extends PopupMenu.PopupMenuSection {
17251726
cover_path,
17261727
Math.trunc(300*global.ui_scale),
17271728
Math.trunc(300*global.ui_scale),
1728-
this._on_cover_loaded.bind(this)
1729+
(cache, handle, actor) => { this._on_cover_loaded(cache, handle, actor) }
17291730
);
17301731
this._applet.setIcon();
17311732

@@ -1819,6 +1820,7 @@ class Player extends PopupMenu.PopupMenuSection {
18191820
if (this._seeker)
18201821
this._seeker.destroy();
18211822

1823+
//FIXME!!! Error when a media is playing:
18221824
try {
18231825
PopupMenu.PopupMenuSection.prototype.destroy.call(this);
18241826
} catch(e) {logError("Error destroying Player!!!: "+e)}
@@ -1918,13 +1920,6 @@ class Sound150Applet extends Applet.TextIconApplet {
19181920
this.settings.bind("keyOpen", "keyOpen", () => { this._setKeybinding() });
19191921
this.settings.bind("keySwitchPlayer", "keySwitchPlayer", () => { this._setKeybinding() });
19201922

1921-
this.settings.bind("stepVolume", "stepVolume", () => {
1922-
VOLUME_ADJUSTMENT_STEP = this.settings.getValue("stepVolume") / 100;
1923-
//~ log("VOLUME_ADJUSTMENT_STEP = " + VOLUME_ADJUSTMENT_STEP);
1924-
});
1925-
VOLUME_ADJUSTMENT_STEP = this.settings.getValue("stepVolume") / 100;
1926-
//~ log("VOLUME_ADJUSTMENT_STEP = " + VOLUME_ADJUSTMENT_STEP);
1927-
19281923
this.settings.bind("magneticOn", "magneticOn", () => this._on_sound_settings_change());
19291924
this.settings.bind("magnetic25On", "magnetic25On", () => this._on_sound_settings_change());
19301925

@@ -1968,6 +1963,21 @@ class Sound150Applet extends Applet.TextIconApplet {
19681963
this.settings.bind("audio-next", "audio_next", () => { this._setKeybinding() });
19691964
this.settings.bind("audio-prev", "audio_prev", () => { this._setKeybinding() });
19701965

1966+
this.settings.bind("stepVolume", "stepVolume", () => {
1967+
let sv = this.settings.getValue("stepVolume");
1968+
let vu = this.settings.getValue("volume-up");
1969+
let old_VAS = Math.round(VOLUME_ADJUSTMENT_STEP*100);
1970+
VOLUME_ADJUSTMENT_STEP = sv / 100;
1971+
if (old_VAS == 5 && sv != 5 && vu.length <= 2) {
1972+
this.settings.setValue("redefine-volume-keybindings", true);
1973+
this._set_shortcuts_as_default();
1974+
this._setKeybinding();
1975+
}
1976+
//~ log("VOLUME_ADJUSTMENT_STEP = " + VOLUME_ADJUSTMENT_STEP);
1977+
});
1978+
VOLUME_ADJUSTMENT_STEP = this.settings.getValue("stepVolume") / 100;
1979+
//~ log("VOLUME_ADJUSTMENT_STEP = " + VOLUME_ADJUSTMENT_STEP);
1980+
19711981
// Whether sound@cinnamon.org is loaded:
19721982
let enabledApplets = global.settings.get_strv(ENABLED_APPLETS_KEY);
19731983
var _soundATcinnamonDOTorg_is_loaded = false;
@@ -2428,6 +2438,9 @@ class Sound150Applet extends Applet.TextIconApplet {
24282438
this._iconLooping = false;
24292439
this._artLooping = false;
24302440
this.startingUp = true;
2441+
//~ if (GLib.file_test(R30MPVSOCKET, GLib.FileTest.EXISTS)) {
2442+
//~ GLib.file_set_contents(RUNTIME_DIR + "/R30Stop", "");
2443+
//~ }
24312444

24322445

24332446
if (this.actor && (this.actor.get_stage() != null) && this._control && (this._control.get_state() != Cvc.MixerControlState.CLOSED)) {
@@ -2495,6 +2508,14 @@ class Sound150Applet extends Applet.TextIconApplet {
24952508
//~ logDebug("this._iconLooping = false;");
24962509
this._artLooping = false;
24972510
//~ logDebug("this._artLooping = false;");
2511+
2512+
if (this._control) {
2513+
for (let i = 0, l = this._streams.length; i < l; ++i) {
2514+
let id = this._streams[i].id;
2515+
this._control.emit("stream-removed", id);
2516+
}
2517+
}
2518+
24982519
if (this._seeker) {
24992520
this._seeker.destroy();
25002521
//~ logDebug("Seeker destroyed");

sound150@claudiux/files/sound150@claudiux/CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
### v9.1.0~20250203
2+
* Functional improvement.
3+
* When the volume step differs from 5, multimedia key shortcuts are automatically redefined.
4+
* Code: Avoid using 'bind' calls.
5+
16
### v9.0.0~20250201
27
* Major changes for OSD and menu.
38
* OSD: Volume value can be displayed beside the volume bar.

sound150@claudiux/files/sound150@claudiux/metadata.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"max-instances": "1",
66
"description": "Enhanced sound applet",
77
"hide-configuration": false,
8-
"version": "9.0.0",
8+
"version": "9.1.0",
99
"cinnamon-version": [
1010
"2.8",
1111
"3.0",

sound150@claudiux/files/sound150@claudiux/po/fr.po

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ msgstr ""
99
"Report-Msgid-Bugs-To: https://github.com/linuxmint/cinnamon-spices-applets/"
1010
"issues\n"
1111
"POT-Creation-Date: 2025-02-01 14:52+0100\n"
12-
"PO-Revision-Date: 2025-02-01 14:54+0100\n"
12+
"PO-Revision-Date: 2025-02-02 02:25+0100\n"
1313
"Last-Translator: claudiux\n"
1414
"Language-Team: \n"
1515
"Language: fr\n"

0 commit comments

Comments
 (0)