From 1eb323545606e7380e508600797b1f56238a51f6 Mon Sep 17 00:00:00 2001 From: Emiliano Necciari Date: Wed, 11 Sep 2024 14:52:55 +0200 Subject: [PATCH] changes for review https://extensions.gnome.org/review/49525 --- radio@hslbck.gmail.com/prefs.js | 2 +- radio@hslbck.gmail.com/radioMenu.js | 18 ++++++++++++++---- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/radio@hslbck.gmail.com/prefs.js b/radio@hslbck.gmail.com/prefs.js index 2945f9d..749312e 100644 --- a/radio@hslbck.gmail.com/prefs.js +++ b/radio@hslbck.gmail.com/prefs.js @@ -13,7 +13,7 @@ import Adw from 'gi://Adw'; import GLib from 'gi://GLib'; import Gio from 'gi://Gio'; import * as Io from './io.js'; -import Soup from 'gi://Soup?version=3.0'; +import Soup from 'gi://Soup'; import * as Convert from './convertCharset.js'; const SETTING_USE_MEDIA_KEYS = 'use-media-keys'; diff --git a/radio@hslbck.gmail.com/radioMenu.js b/radio@hslbck.gmail.com/radioMenu.js index 24c3c7f..f00943b 100644 --- a/radio@hslbck.gmail.com/radioMenu.js +++ b/radio@hslbck.gmail.com/radioMenu.js @@ -68,8 +68,6 @@ const MediaKeysInterface = ' \ \ \ '; -const MediaKeysProxy = Gio.DBusProxy.makeProxyWrapper(MediaKeysInterface); -const Clipboard = St.Clipboard.get_default(); let RadioMenuButton = GObject.registerClass( class RadioMenuButton extends PanelMenu.Button { @@ -233,7 +231,10 @@ let RadioMenuButton = GObject.registerClass( this._mediaKeysProxy.GrabMediaPlayerKeysRemote('GSE Radio', 0); } else { - new MediaKeysProxy(Gio.DBus.session, BUS_NAME, OBJECT_PATH, + if(!this.MediaKeysProxy) { + this.MediaKeysProxy = Gio.DBusProxy.makeProxyWrapper(MediaKeysInterface); + } + new this.MediaKeysProxy(Gio.DBus.session, BUS_NAME, OBJECT_PATH, (proxy, error) => { if (error) { global.log(error.message); @@ -295,7 +296,10 @@ let RadioMenuButton = GObject.registerClass( } _copyTagToClipboard() { - Clipboard.set_text(St.ClipboardType.CLIPBOARD, this.player._getTag()); + if(!this.Clipboard) { + this.Clipboard = St.Clipboard.get_default(); + } + this.Clipboard.set_text(St.ClipboardType.CLIPBOARD, this.player._getTag()); } _onVolumeSliderValueChanged(actor, event) { @@ -559,6 +563,12 @@ let RadioMenuButton = GObject.registerClass( if (this.player !== null) { this.player._disconnectSourceBus(); } + if(this.MediaKeysProxy !== null) { + this.MediaKeysProxy = null; + } + if(this.Clipboard != null ){ + this.Clipboard = null; + } super.destroy(); }