Skip to content

Commit 5c8fd05

Browse files
authored
Radio3.0 v3.10.1: Repairs notifications (#8154)
1 parent e6753c0 commit 5c8fd05

File tree

24 files changed

+4163
-2358
lines changed

24 files changed

+4163
-2358
lines changed

Radio3.0@claudiux/files/Radio3.0@claudiux/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
### v3.10.1~20260105
2+
* Repairs notifications.
3+
* Add option "Fastest" for "Quality of downloaded Album Art".
4+
15
### v3.10.0~20251211
26
* Working well with Cinnamon 6.6.
37

Radio3.0@claudiux/files/Radio3.0@claudiux/applet.js

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,8 @@ const { Icon, IconType, Button, Widget, ScrollView, Align, Label, BoxLayout, Bin
3535
//Tooltips:
3636
const { Tooltip } = imports.ui.tooltips;
3737
//MessageTray:
38-
const { Urgency, MessageTray, SystemNotificationSource, Notification } = imports.ui.messageTray;
38+
//~ const { Urgency, MessageTray, SystemNotificationSource, Notification } = imports.ui.messageTray;
39+
const { Urgency, MessageTray, SystemNotificationSource, Notification } = require("./lib/messageTray");
3940

4041
const TABS = ["Radios", "Search", "Import", "Menu", "Behavior", "Network", "Recording", "YT", "Scheduling", "Alarm Clock"];
4142
var RADIO_NOTIFICATION_TIMEOUT = 2;
@@ -702,7 +703,8 @@ RadioMessageTray.prototype = {
702703

703704
if (this._notification.urgency != Urgency.CRITICAL) {
704705
this._updateNotificationTimeout(RADIO_NOTIFICATION_TIMEOUT * 1000);
705-
} else if (AppletManager.get_role_provider_exists(AppletManager.Roles.NOTIFICATIONS)) {
706+
//~ } else if (AppletManager.get_role_provider_exists(AppletManager.Roles.NOTIFICATIONS)) {
707+
} else {
706708
this._updateNotificationTimeout(RADIO_NOTIFICATION_CRITICAL_TIMEOUT_WITH_APPLET * 1000);
707709
}
708710
}
@@ -724,7 +726,11 @@ RadioNotificationSource.prototype = {
724726
if (this.notifications.length > 0) {
725727
for (let i = this.notifications.length - 1; i >= 0; i--) {
726728
if (this.notifications[i]) {
727-
this.notifications[i].destroy();
729+
try {
730+
this.notifications[i].destroy();
731+
} catch(e) {
732+
logError("Unable to destroy notification number "+i+". "+e);
733+
}
728734
} else {
729735
// Do nothing.
730736
logError("Unable to destroy notification number "+i);
@@ -738,8 +744,9 @@ RadioNotificationSource.prototype = {
738744
}
739745

740746
const messageTray = new RadioMessageTray();
741-
const source = new RadioNotificationSource("Radio3.0");
742-
messageTray.add(source);
747+
//~ const SOURCE = new RadioNotificationSource("Radio3.0");
748+
const SOURCE = new RadioNotificationSource();
749+
messageTray.add(SOURCE);
743750

744751
class TitleSeparatorMenuItem extends PopupBaseMenuItem {
745752
constructor(title, icon_name, reactive=false) {
@@ -3354,7 +3361,7 @@ class WebRadioReceiverAndRecorder extends TextIconApplet {
33543361

33553362
on_song_changed(radio="", title="") {
33563363
//log("on_song_changed");
3357-
source.destroyAllNotifications();
3364+
SOURCE.destroyAllNotifications();
33583365
let pid = this.record_pid;
33593366

33603367
let is_recording = pid != null;
@@ -3479,8 +3486,8 @@ class WebRadioReceiverAndRecorder extends TextIconApplet {
34793486
this.download_songArt(title, res);
34803487
} else {
34813488
let size = child.get_size();
3482-
if (size == 0 && res != "sd")
3483-
this.download_songArt(title, res="sd");
3489+
if (size == 0 && res != "default")
3490+
this.download_songArt(title, res="default");
34843491
}
34853492
children.close(null);
34863493
return false;
@@ -3539,7 +3546,7 @@ class WebRadioReceiverAndRecorder extends TextIconApplet {
35393546

35403547
start_mpv_radio(id) {
35413548
this.showOSD = this.volume_show_osd && this.showOSDonStartup;
3542-
source.destroyAllNotifications();
3549+
SOURCE.destroyAllNotifications();
35433550
let _id = ""+id;
35443551
//log("start_mpv_radio: " + _id);
35453552
if (_id.length === 0) return;
@@ -3639,7 +3646,7 @@ class WebRadioReceiverAndRecorder extends TextIconApplet {
36393646
this.updateUI();
36403647

36413648
if (notify_user) {
3642-
source.destroyAllNotifications();
3649+
SOURCE.destroyAllNotifications();
36433650
this.radio_notify(_("Radio OFF"));
36443651
}
36453652

@@ -5436,16 +5443,14 @@ class WebRadioReceiverAndRecorder extends TextIconApplet {
54365443
}
54375444

54385445
radio_notify(msg, submsg="", button=[]) {
5439-
//log("radio_notify: msg:" + msg + " - submsg: " + submsg);
5440-
54415446
RADIO_NOTIFICATION_TIMEOUT = 2;
54425447

54435448
let icon = new Icon();
54445449
icon.set_icon_name("webradioreceiver");
54455450
icon.set_icon_type(IconType.SYMBOLIC);
54465451
icon.set_icon_size(24);
54475452

5448-
let notification = new Notification(source, msg, submsg, { icon: icon, silent: true });
5453+
let notification = new Notification(SOURCE, msg, submsg, { icon: icon, silent: true });
54495454
notification.setTransient(false);
54505455

54515456
if (button.length === 3 && this.notif_buttons_allowed) {
@@ -5454,7 +5459,7 @@ class WebRadioReceiverAndRecorder extends TextIconApplet {
54545459
if (button[1] === "callback") {
54555460
notification.addButton("callback", button[0]); // button[0]: label
54565461
notification.connect("action-invoked", button[2]); // button[2]: callback
5457-
source.notify(notification);
5462+
SOURCE.notify(notification);
54585463
return notification;
54595464
} else if (this.record_pid != null && !this.get_recording_ends_auto() && button[1] !== "stop-recording") {
54605465
notification.addButton("stop-recording", _("Stop Current Recording"));
@@ -5522,7 +5527,7 @@ class WebRadioReceiverAndRecorder extends TextIconApplet {
55225527
});
55235528
}
55245529

5525-
source.notify(notification);
5530+
SOURCE.notify(notification);
55265531
return notification;
55275532
}
55285533

Lines changed: 7 additions & 0 deletions
Loading
Lines changed: 4 additions & 0 deletions
Loading
Lines changed: 4 additions & 0 deletions
Loading

0 commit comments

Comments
 (0)