[gnome-shell/ewlsh/esm: 7/8] Remove unneccessary usage of 'new' operator
- From: Evan Welsh <ewlsh src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell/ewlsh/esm: 7/8] Remove unneccessary usage of 'new' operator
- Date: Fri, 24 Sep 2021 01:29:04 +0000 (UTC)
commit ff88b5ab91452d5f36b5ddb622ebac54d205b959
Author: Evan Welsh <contact evanwelsh com>
Date: Thu Jul 22 12:18:50 2021 -0700
Remove unneccessary usage of 'new' operator
js/dbusServices/extensions/extensionsService.js | 2 +-
.../notifications/notificationDaemon.js | 2 +-
js/dbusServices/screencast/screencastService.js | 8 ++---
js/dbusServices/screensaver/screenSaverService.js | 2 +-
js/gdm/oVirt.js | 2 +-
js/gdm/util.js | 2 +-
js/gdm/vmware.js | 2 +-
js/misc/modemManager.js | 10 +++----
js/misc/permissionStore.js | 8 ++---
js/ui/calendar.js | 2 +-
js/ui/components/autorunManager.js | 8 ++---
js/ui/dateMenu.js | 2 +-
js/ui/endSessionDialog.js | 34 +++++++++++-----------
js/ui/inhibitShortcutsDialog.js | 2 +-
js/ui/mpris.js | 4 +--
js/ui/notificationDaemon.js | 2 +-
js/ui/scripting.js | 4 +--
js/ui/status/bluetooth.js | 18 ++++++------
js/ui/status/brightness.js | 18 ++++++------
js/ui/status/location.js | 2 +-
js/ui/status/nightLight.js | 20 ++++++-------
js/ui/status/power.js | 2 +-
js/ui/windowManager.js | 12 ++++----
23 files changed, 84 insertions(+), 84 deletions(-)
---
diff --git a/js/dbusServices/extensions/extensionsService.js b/js/dbusServices/extensions/extensionsService.js
index 6556d3cf31..67ff12e202 100644
--- a/js/dbusServices/extensions/extensionsService.js
+++ b/js/dbusServices/extensions/extensionsService.js
@@ -15,7 +15,7 @@ var ExtensionsService = class extends ServiceImplementation {
constructor() {
super(ExtensionsIface, '/org/gnome/Shell/Extensions');
- this._proxy = new ExtensionsProxy(Gio.DBus.session,
+ this._proxy = ExtensionsProxy(Gio.DBus.session,
'org.gnome.Shell', '/org/gnome/Shell');
this._proxy.connectSignal('ExtensionStateChanged',
diff --git a/js/dbusServices/notifications/notificationDaemon.js
b/js/dbusServices/notifications/notificationDaemon.js
index bf0f85b1c3..185a74e504 100644
--- a/js/dbusServices/notifications/notificationDaemon.js
+++ b/js/dbusServices/notifications/notificationDaemon.js
@@ -17,7 +17,7 @@ var NotificationDaemon = class extends ServiceImplementation {
this._autoShutdown = false;
- this._proxy = new NotificationsProxy(Gio.DBus.session,
+ this._proxy = NotificationsProxy(Gio.DBus.session,
'org.gnome.Shell',
'/org/freedesktop/Notifications',
(proxy, error) => {
diff --git a/js/dbusServices/screencast/screencastService.js b/js/dbusServices/screencast/screencastService.js
index 708a15c84e..7126d38df0 100644
--- a/js/dbusServices/screencast/screencastService.js
+++ b/js/dbusServices/screencast/screencastService.js
@@ -129,7 +129,7 @@ var Recorder = class {
}
_initSession(sessionPath) {
- this._sessionProxy = new ScreenCastSessionProxy(Gio.DBus.session,
+ this._sessionProxy = ScreenCastSessionProxy(Gio.DBus.session,
'org.gnome.Mutter.ScreenCast',
sessionPath);
this._sessionProxy.connectSignal('Closed', this._onSessionClosed.bind(this));
@@ -160,7 +160,7 @@ var Recorder = class {
'cursor-mode': GLib.Variant.new('u', this._drawCursor ? 1 : 0),
});
- this._streamProxy = new ScreenCastStreamProxy(Gio.DBus.session,
+ this._streamProxy = ScreenCastStreamProxy(Gio.DBus.session,
'org.gnome.ScreenCast.Stream',
streamPath);
@@ -261,11 +261,11 @@ var ScreencastService = class extends ServiceImplementation {
schema_id: 'org.gnome.desktop.lockdown',
});
- this._proxy = new ScreenCastProxy(Gio.DBus.session,
+ this._proxy = ScreenCastProxy(Gio.DBus.session,
'org.gnome.Mutter.ScreenCast',
'/org/gnome/Mutter/ScreenCast');
- this._introspectProxy = new IntrospectProxy(Gio.DBus.session,
+ this._introspectProxy = IntrospectProxy(Gio.DBus.session,
'org.gnome.Shell.Introspect',
'/org/gnome/Shell/Introspect');
}
diff --git a/js/dbusServices/screensaver/screenSaverService.js
b/js/dbusServices/screensaver/screenSaverService.js
index bd3687ef60..c40521ffe7 100644
--- a/js/dbusServices/screensaver/screenSaverService.js
+++ b/js/dbusServices/screensaver/screenSaverService.js
@@ -15,7 +15,7 @@ var ScreenSaverService = class extends ServiceImplementation {
this._autoShutdown = false;
- this._proxy = new ScreenSaverProxy(Gio.DBus.session,
+ this._proxy = ScreenSaverProxy(Gio.DBus.session,
'org.gnome.Shell.ScreenShield',
'/org/gnome/ScreenSaver',
(proxy, error) => {
diff --git a/js/gdm/oVirt.js b/js/gdm/oVirt.js
index a90d76f271..4cf17d99e2 100644
--- a/js/gdm/oVirt.js
+++ b/js/gdm/oVirt.js
@@ -33,7 +33,7 @@ function OVirtCredentials() {
var OVirtCredentialsManager = class OVirtCredentialsManager extends Credential.CredentialManager {
constructor() {
super(SERVICE_NAME);
- this._credentials = new OVirtCredentials();
+ this._credentials = OVirtCredentials();
this._credentials.connectSignal('UserAuthenticated',
(proxy, sender, [token]) => {
this.token = token;
diff --git a/js/gdm/util.js b/js/gdm/util.js
index 736bdbde50..0adb22adde 100644
--- a/js/gdm/util.js
+++ b/js/gdm/util.js
@@ -385,7 +385,7 @@ var ShellUserVerifier = class extends Signals.EventEmitter {
(params, error) => {
if (!error && params) {
const [device] = params;
- const fprintDeviceProxy = new FprintDeviceProxy(Gio.DBus.system,
+ const fprintDeviceProxy = FprintDeviceProxy(Gio.DBus.system,
'net.reactivated.Fprint',
device);
const fprintDeviceType = fprintDeviceProxy['scan-type'];
diff --git a/js/gdm/vmware.js b/js/gdm/vmware.js
index eeedabe43c..118b8af391 100644
--- a/js/gdm/vmware.js
+++ b/js/gdm/vmware.js
@@ -36,7 +36,7 @@ function VmwareCredentials() {
var VmwareCredentialsManager = class VmwareCredentialsManager extends Credential.CredentialManager {
constructor() {
super(SERVICE_NAME);
- this._credentials = new VmwareCredentials();
+ this._credentials = VmwareCredentials();
this._credentials.connectSignal('UserAuthenticated',
(proxy, sender, [token]) => {
this.token = token;
diff --git a/js/misc/modemManager.js b/js/misc/modemManager.js
index c73c93e7fd..912acd349e 100644
--- a/js/misc/modemManager.js
+++ b/js/misc/modemManager.js
@@ -144,7 +144,7 @@ var ModemGsm = GObject.registerClass(
class ModemGsm extends ModemBase {
_init(path) {
super._init();
- this._proxy = new ModemGsmNetworkProxy(Gio.DBus.system, 'org.freedesktop.ModemManager', path);
+ this._proxy = ModemGsmNetworkProxy(Gio.DBus.system, 'org.freedesktop.ModemManager', path);
// Code is duplicated because the function have different signatures
this._proxy.connectSignal('SignalQuality', (proxy, sender, [quality]) => {
@@ -178,7 +178,7 @@ var ModemCdma = GObject.registerClass(
class ModemCdma extends ModemBase {
_init(path) {
super._init();
- this._proxy = new ModemCdmaProxy(Gio.DBus.system, 'org.freedesktop.ModemManager', path);
+ this._proxy = ModemCdmaProxy(Gio.DBus.system, 'org.freedesktop.ModemManager', path);
this._proxy.connectSignal('SignalQuality', (proxy, sender, params) => {
this._setSignalQuality(params[0]);
@@ -237,9 +237,9 @@ var BroadbandModem = GObject.registerClass({
}, class BroadbandModem extends ModemBase {
_init(path, capabilities) {
super._init({ capabilities });
- this._proxy = new BroadbandModemProxy(Gio.DBus.system, 'org.freedesktop.ModemManager1', path);
- this._proxy_3gpp = new BroadbandModem3gppProxy(Gio.DBus.system, 'org.freedesktop.ModemManager1',
path);
- this._proxy_cdma = new BroadbandModemCdmaProxy(Gio.DBus.system, 'org.freedesktop.ModemManager1',
path);
+ this._proxy = BroadbandModemProxy(Gio.DBus.system, 'org.freedesktop.ModemManager1', path);
+ this._proxy_3gpp = BroadbandModem3gppProxy(Gio.DBus.system, 'org.freedesktop.ModemManager1', path);
+ this._proxy_cdma = BroadbandModemCdmaProxy(Gio.DBus.system, 'org.freedesktop.ModemManager1', path);
this._proxy.connect('g-properties-changed', (proxy, properties) => {
if ('SignalQuality' in properties.deep_unpack())
diff --git a/js/misc/permissionStore.js b/js/misc/permissionStore.js
index 46c5d5412d..14fc47f7e8 100644
--- a/js/misc/permissionStore.js
+++ b/js/misc/permissionStore.js
@@ -9,8 +9,8 @@ const PermissionStoreIface = loadInterfaceXML('org.freedesktop.impl.portal.Permi
const PermissionStoreProxy = Gio.DBusProxy.makeProxyWrapper(PermissionStoreIface);
function PermissionStore(initCallback, cancellable) {
- return new PermissionStoreProxy(Gio.DBus.session,
- 'org.freedesktop.impl.portal.PermissionStore',
- '/org/freedesktop/impl/portal/PermissionStore',
- initCallback, cancellable);
+ return PermissionStoreProxy(Gio.DBus.session,
+ 'org.freedesktop.impl.portal.PermissionStore',
+ '/org/freedesktop/impl/portal/PermissionStore',
+ initCallback, cancellable);
}
diff --git a/js/ui/calendar.js b/js/ui/calendar.js
index ae312c6c08..b3eb21dc8a 100644
--- a/js/ui/calendar.js
+++ b/js/ui/calendar.js
@@ -193,7 +193,7 @@ class DBusEventSource extends EventSourceBase {
this._isLoading = false;
this._initialized = false;
- this._dbusProxy = new CalendarServer();
+ this._dbusProxy = CalendarServer();
this._initProxy();
}
diff --git a/js/ui/components/autorunManager.js b/js/ui/components/autorunManager.js
index cc7b41274f..16b52cfe3e 100644
--- a/js/ui/components/autorunManager.js
+++ b/js/ui/components/autorunManager.js
@@ -75,9 +75,9 @@ function startAppForMount(app, mount) {
const HotplugSnifferIface = loadInterfaceXML('org.gnome.Shell.HotplugSniffer');
const HotplugSnifferProxy = Gio.DBusProxy.makeProxyWrapper(HotplugSnifferIface);
function HotplugSniffer() {
- return new HotplugSnifferProxy(Gio.DBus.session,
- 'org.gnome.Shell.HotplugSniffer',
- '/org/gnome/Shell/HotplugSniffer');
+ return HotplugSnifferProxy(Gio.DBus.session,
+ 'org.gnome.Shell.HotplugSniffer',
+ '/org/gnome/Shell/HotplugSniffer');
}
var ContentTypeDiscoverer = class {
@@ -113,7 +113,7 @@ var ContentTypeDiscoverer = class {
} else {
let root = mount.get_root();
- let hotplugSniffer = new HotplugSniffer();
+ let hotplugSniffer = HotplugSniffer();
hotplugSniffer.SniffURIRemote(root.get_uri(),
result => {
[contentTypes] = result;
diff --git a/js/ui/dateMenu.js b/js/ui/dateMenu.js
index 33c054c12f..d202e84363 100644
--- a/js/ui/dateMenu.js
+++ b/js/ui/dateMenu.js
@@ -293,7 +293,7 @@ class WorldClocksSection extends St.Button {
this.child = this._grid;
this._clocksApp = null;
- this._clocksProxy = new ClocksProxy(
+ this._clocksProxy = ClocksProxy(
Gio.DBus.session,
'org.gnome.clocks',
'/org/gnome/clocks',
diff --git a/js/ui/endSessionDialog.js b/js/ui/endSessionDialog.js
index 1fdbd11b93..c2a3142063 100644
--- a/js/ui/endSessionDialog.js
+++ b/js/ui/endSessionDialog.js
@@ -239,23 +239,23 @@ class EndSessionDialog extends ModalDialog.ModalDialog {
this._user = this._userManager.get_user(GLib.get_user_name());
this._updatesPermission = null;
- this._pkOfflineProxy = new PkOfflineProxy(Gio.DBus.system,
- 'org.freedesktop.PackageKit',
- '/org/freedesktop/PackageKit',
- this._onPkOfflineProxyCreated.bind(this));
-
- this._powerProxy = new UPowerProxy(Gio.DBus.system,
- 'org.freedesktop.UPower',
- '/org/freedesktop/UPower/devices/DisplayDevice',
- (proxy, error) => {
- if (error) {
- log(error.message);
- return;
- }
- this._powerProxy.connect('g-properties-changed',
- this._sync.bind(this));
- this._sync();
- });
+ this._pkOfflineProxy = PkOfflineProxy(Gio.DBus.system,
+ 'org.freedesktop.PackageKit',
+ '/org/freedesktop/PackageKit',
+ this._onPkOfflineProxyCreated.bind(this));
+
+ this._powerProxy = UPowerProxy(Gio.DBus.system,
+ 'org.freedesktop.UPower',
+ '/org/freedesktop/UPower/devices/DisplayDevice',
+ (proxy, error) => {
+ if (error) {
+ log(error.message);
+ return;
+ }
+ this._powerProxy.connect('g-properties-changed',
+ this._sync.bind(this));
+ this._sync();
+ });
this._secondsLeft = 0;
this._totalSecondsToStayOpen = 0;
diff --git a/js/ui/inhibitShortcutsDialog.js b/js/ui/inhibitShortcutsDialog.js
index c59544eaf9..b20e67285e 100644
--- a/js/ui/inhibitShortcutsDialog.js
+++ b/js/ui/inhibitShortcutsDialog.js
@@ -130,7 +130,7 @@ var InhibitShortcutsDialog = GObject.registerClass({
/* Check with the permission store */
let appId = this._app.get_id();
- this._permStore = new PermissionStore.PermissionStore((proxy, error) => {
+ this._permStore = PermissionStore.PermissionStore((proxy, error) => {
if (error) {
log(error.message);
this._dialog.open();
diff --git a/js/ui/mpris.js b/js/ui/mpris.js
index 7a5b1e8651..6038142c6d 100644
--- a/js/ui/mpris.js
+++ b/js/ui/mpris.js
@@ -97,10 +97,10 @@ var MprisPlayer = class MprisPlayer extends Signals.EventEmitter {
constructor(busName) {
super();
- this._mprisProxy = new MprisProxy(Gio.DBus.session, busName,
+ this._mprisProxy = MprisProxy(Gio.DBus.session, busName,
'/org/mpris/MediaPlayer2',
this._onMprisProxyReady.bind(this));
- this._playerProxy = new MprisPlayerProxy(Gio.DBus.session, busName,
+ this._playerProxy = MprisPlayerProxy(Gio.DBus.session, busName,
'/org/mpris/MediaPlayer2',
this._onPlayerProxyReady.bind(this));
diff --git a/js/ui/notificationDaemon.js b/js/ui/notificationDaemon.js
index 0f0ba9cf55..e75c2fdc0e 100644
--- a/js/ui/notificationDaemon.js
+++ b/js/ui/notificationDaemon.js
@@ -579,7 +579,7 @@ class GtkNotificationDaemonAppSource extends MessageTray.Source {
}
_createApp(callback) {
- return new FdoApplicationProxy(Gio.DBus.session, this._appId, this._objectPath, callback);
+ return FdoApplicationProxy(Gio.DBus.session, this._appId, this._objectPath, callback);
}
_createNotification(params) {
diff --git a/js/ui/scripting.js b/js/ui/scripting.js
index 69bd229df5..aa405330c0 100644
--- a/js/ui/scripting.js
+++ b/js/ui/scripting.js
@@ -64,13 +64,13 @@ function waitLeisure() {
const PerfHelperIface = loadInterfaceXML('org.gnome.Shell.PerfHelper');
var PerfHelperProxy = Gio.DBusProxy.makeProxyWrapper(PerfHelperIface);
function PerfHelper() {
- return new PerfHelperProxy(Gio.DBus.session, 'org.gnome.Shell.PerfHelper',
'/org/gnome/Shell/PerfHelper');
+ return PerfHelperProxy(Gio.DBus.session, 'org.gnome.Shell.PerfHelper', '/org/gnome/Shell/PerfHelper');
}
let _perfHelper = null;
function _getPerfHelper() {
if (_perfHelper == null)
- _perfHelper = new PerfHelper();
+ _perfHelper = PerfHelper();
return _perfHelper;
}
diff --git a/js/ui/status/bluetooth.js b/js/ui/status/bluetooth.js
index 98ccc3d314..d4db93ea77 100644
--- a/js/ui/status/bluetooth.js
+++ b/js/ui/status/bluetooth.js
@@ -26,15 +26,15 @@ class Indicator extends PanelMenu.SystemIndicator {
this._indicator.icon_name = 'bluetooth-active-symbolic';
this._hadSetupDevices = global.settings.get_boolean(HAD_BLUETOOTH_DEVICES_SETUP);
- this._proxy = new RfkillManagerProxy(Gio.DBus.session, BUS_NAME, OBJECT_PATH,
- (proxy, error) => {
- if (error) {
- log(error.message);
- return;
- }
-
- this._sync();
- });
+ this._proxy = RfkillManagerProxy(Gio.DBus.session, BUS_NAME, OBJECT_PATH,
+ (proxy, error) => {
+ if (error) {
+ log(error.message);
+ return;
+ }
+
+ this._sync();
+ });
this._proxy.connect('g-properties-changed', this._queueSync.bind(this));
this._item = new PopupMenu.PopupSubMenuMenuItem(_("Bluetooth"), true);
diff --git a/js/ui/status/brightness.js b/js/ui/status/brightness.js
index 17247880f5..2a27e78442 100644
--- a/js/ui/status/brightness.js
+++ b/js/ui/status/brightness.js
@@ -19,16 +19,16 @@ var Indicator = GObject.registerClass(
class Indicator extends PanelMenu.SystemIndicator {
_init() {
super._init();
- this._proxy = new BrightnessProxy(Gio.DBus.session, BUS_NAME, OBJECT_PATH,
- (proxy, error) => {
- if (error) {
- log(error.message);
- return;
- }
+ this._proxy = BrightnessProxy(Gio.DBus.session, BUS_NAME, OBJECT_PATH,
+ (proxy, error) => {
+ if (error) {
+ log(error.message);
+ return;
+ }
- this._proxy.connect('g-properties-changed',
this._sync.bind(this));
- this._sync();
- });
+ this._proxy.connect('g-properties-changed', this._sync.bind(this));
+ this._sync();
+ });
this._item = new PopupMenu.PopupBaseMenuItem({ activate: false });
this.menu.addMenuItem(this._item);
diff --git a/js/ui/status/location.js b/js/ui/status/location.js
index 7e0222b72c..6b399793c9 100644
--- a/js/ui/status/location.js
+++ b/js/ui/status/location.js
@@ -197,7 +197,7 @@ var GeoclueAgent = GObject.registerClass({
_connectToPermissionStore() {
this._permStoreProxy = null;
- new PermissionStore.PermissionStore(this._onPermStoreProxyReady.bind(this));
+ PermissionStore.PermissionStore(this._onPermStoreProxyReady.bind(this));
}
_onPermStoreProxyReady(proxy, error) {
diff --git a/js/ui/status/nightLight.js b/js/ui/status/nightLight.js
index c595c3da02..7fcbfe5c24 100644
--- a/js/ui/status/nightLight.js
+++ b/js/ui/status/nightLight.js
@@ -22,16 +22,16 @@ class Indicator extends PanelMenu.SystemIndicator {
this._indicator = this._addIndicator();
this._indicator.icon_name = 'night-light-symbolic';
- this._proxy = new ColorProxy(Gio.DBus.session, BUS_NAME, OBJECT_PATH,
- (proxy, error) => {
- if (error) {
- log(error.message);
- return;
- }
- this._proxy.connect('g-properties-changed',
- this._sync.bind(this));
- this._sync();
- });
+ this._proxy = ColorProxy(Gio.DBus.session, BUS_NAME, OBJECT_PATH,
+ (proxy, error) => {
+ if (error) {
+ log(error.message);
+ return;
+ }
+ this._proxy.connect('g-properties-changed',
+ this._sync.bind(this));
+ this._sync();
+ });
this._item = new PopupMenu.PopupSubMenuMenuItem("", true);
this._item.icon.icon_name = 'night-light-symbolic';
diff --git a/js/ui/status/power.js b/js/ui/status/power.js
index c79ff798e9..ed6a46a636 100644
--- a/js/ui/status/power.js
+++ b/js/ui/status/power.js
@@ -36,7 +36,7 @@ class Indicator extends PanelMenu.SystemIndicator {
this.add_child(this._percentageLabel);
this.add_style_class_name('power-status');
- this._proxy = new PowerManagerProxy(Gio.DBus.system, BUS_NAME, OBJECT_PATH,
+ this._proxy = PowerManagerProxy(Gio.DBus.system, BUS_NAME, OBJECT_PATH,
(proxy, error) => {
if (error) {
log(error.message);
diff --git a/js/ui/windowManager.js b/js/ui/windowManager.js
index caaecec410..2e3e125b68 100644
--- a/js/ui/windowManager.js
+++ b/js/ui/windowManager.js
@@ -884,12 +884,12 @@ var WindowManager = class {
Main.osdWindowManager.show(monitorIndex, icon, label, null);
});
- this._gsdWacomProxy = new GsdWacomProxy(Gio.DBus.session, GSD_WACOM_BUS_NAME,
- GSD_WACOM_OBJECT_PATH,
- (proxy, error) => {
- if (error)
- log(error.message);
- });
+ this._gsdWacomProxy = GsdWacomProxy(Gio.DBus.session, GSD_WACOM_BUS_NAME,
+ GSD_WACOM_OBJECT_PATH,
+ (proxy, error) => {
+ if (error)
+ log(error.message);
+ });
global.display.connect('pad-mode-switch', (display, pad, _group, _mode) => {
let labels = [];
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]