[polari] cleanup: Use default exports
- From: Florian Müllner <fmuellner src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [polari] cleanup: Use default exports
- Date: Wed, 4 Aug 2021 16:38:01 +0000 (UTC)
commit 0f2cd19979f1df0b2d426b079975e3ccba82f6c5
Author: Florian Müllner <fmuellner gnome org>
Date: Wed Aug 4 16:40:46 2021 +0200
cleanup: Use default exports
Where we only export a single symbol (or where there's a clear
"main" export), it make sense to mark the export as default,
so that it can be imported without destructuring.
https://gitlab.gnome.org/GNOME/polari/-/merge_requests/208
src/accountsMonitor.js | 6 +++---
src/application.js | 20 ++++++++++----------
src/chatView.js | 6 +++---
src/connections.js | 4 ++--
src/entryArea.js | 6 +++---
src/initialSetup.js | 2 +-
src/ircParser.js | 6 +++---
src/joinDialog.js | 4 ++--
src/main.js | 2 +-
src/mainWindow.js | 12 ++++++------
src/networksManager.js | 4 ++--
src/pasteManager.js | 4 ++--
src/roomList.js | 8 ++++----
src/roomManager.js | 6 +++---
src/roomStack.js | 10 +++++-----
src/serverRoomManager.js | 8 ++++----
src/tabCompletion.js | 4 ++--
src/telepathyClient.js | 8 ++++----
src/urlPreview.js | 2 +-
src/userTracker.js | 8 ++++----
20 files changed, 65 insertions(+), 65 deletions(-)
---
diff --git a/src/accountsMonitor.js b/src/accountsMonitor.js
index a4be8180..685916d8 100644
--- a/src/accountsMonitor.js
+++ b/src/accountsMonitor.js
@@ -5,13 +5,13 @@ import Tp from 'gi://TelepathyGLib';
const Signals = imports.signals;
-import { NetworksManager } from './networksManager.js';
+import NetworksManager from './networksManager.js';
Gio._promisify(Tp.AccountManager.prototype, 'prepare_async', 'prepare_finish');
Gio._promisify(Tp.Account.prototype,
'request_presence_async', 'request_presence_finish');
-export const AccountsMonitor = class {
+export default class AccountsMonitor {
static getDefault() {
if (!this._singleton)
this._singleton = new AccountsMonitor();
@@ -211,7 +211,7 @@ export const AccountsMonitor = class {
});
});
}
-};
+}
Signals.addSignalMethods(AccountsMonitor.prototype);
const ClientFactory = GObject.registerClass(
diff --git a/src/application.js b/src/application.js
index 20d09d75..a8da49d2 100644
--- a/src/application.js
+++ b/src/application.js
@@ -6,17 +6,17 @@ import Gtk from 'gi://Gtk?version=3.0';
import Polari from 'gi://Polari';
import Tp from 'gi://TelepathyGLib';
-import { AccountsMonitor } from './accountsMonitor.js';
+import AccountsMonitor from './accountsMonitor.js';
import * as AppNotifications from './appNotifications.js';
import * as Connections from './connections.js';
-import { InitialSetupWindow } from './initialSetup.js';
-import { MainWindow } from './mainWindow.js';
-import { NetworksManager } from './networksManager.js';
-import { PasteManager } from './pasteManager.js';
-import { RoomManager } from './roomManager.js';
-import { ServerRoomManager } from './serverRoomManager.js';
-import { TelepathyClient } from './telepathyClient.js';
-import { UserStatusMonitor } from './userTracker.js';
+import InitialSetupWindow from './initialSetup.js';
+import MainWindow from './mainWindow.js';
+import NetworksManager from './networksManager.js';
+import PasteManager from './pasteManager.js';
+import RoomManager from './roomManager.js';
+import ServerRoomManager from './serverRoomManager.js';
+import TelepathyClient from './telepathyClient.js';
+import UserStatusMonitor from './userTracker.js';
import * as Utils from './utils.js';
Gio._promisify(Tp.AccountRequest.prototype,
@@ -35,7 +35,7 @@ const MAX_RETRIES = 3;
const IRC_SCHEMA_REGEX = /^(irc?:\/\/)([\da-z.-]+):?(\d+)?\/(?:%23)?([\w.+-]+)/i;
-export const Application = GObject.registerClass({
+export default GObject.registerClass({
Signals: {
'prepare-shutdown': {},
'room-focus-changed': {},
diff --git a/src/chatView.js b/src/chatView.js
index 26dd7daa..c06a75c4 100644
--- a/src/chatView.js
+++ b/src/chatView.js
@@ -11,8 +11,8 @@ import Tpl from 'gi://TelepathyLogger';
import { DropTargetIface } from './pasteManager.js';
import { UserPopover } from './userList.js';
-import { UserStatusMonitor } from './userTracker.js';
-import { URLPreview } from './urlPreview.js';
+import UserStatusMonitor from './userTracker.js';
+import URLPreview from './urlPreview.js';
import * as Utils from './utils.js';
Gio._promisify(Tpl.LogWalker.prototype,
@@ -280,7 +280,7 @@ const HoverFilterTag = GObject.registerClass({
}
});
-export const ChatView = GObject.registerClass({
+export default GObject.registerClass({
Implements: [DropTargetIface],
Properties: {
'can-drop': GObject.ParamSpec.override('can-drop', DropTargetIface),
diff --git a/src/connections.js b/src/connections.js
index 00e5f512..45ee74ec 100644
--- a/src/connections.js
+++ b/src/connections.js
@@ -4,8 +4,8 @@ import GObject from 'gi://GObject';
import Gtk from 'gi://Gtk';
import Tp from 'gi://TelepathyGLib';
-import { AccountsMonitor } from './accountsMonitor.js';
-import { NetworksManager } from './networksManager.js';
+import AccountsMonitor from './accountsMonitor.js';
+import NetworksManager from './networksManager.js';
import * as Utils from './utils.js';
Gio._promisify(Tp.Account.prototype,
diff --git a/src/entryArea.js b/src/entryArea.js
index 55642e66..d9042587 100644
--- a/src/entryArea.js
+++ b/src/entryArea.js
@@ -9,8 +9,8 @@ import Tp from 'gi://TelepathyGLib';
import { MAX_NICK_CHARS } from './chatView.js';
import { DropTargetIface } from './pasteManager.js';
-import { IrcParser } from './ircParser.js';
-import { TabCompletion } from './tabCompletion.js';
+import IrcParser from './ircParser.js';
+import TabCompletion from './tabCompletion.js';
const MAX_NICK_UPDATE_TIME = 5; /* s */
const MAX_LINES = 5;
@@ -157,7 +157,7 @@ export const NickPopover = GObject.registerClass({
}
});
-export const EntryArea = GObject.registerClass({
+export default GObject.registerClass({
Template: 'resource:///org/gnome/Polari/ui/entry-area.ui',
InternalChildren: [
'chatEntry',
diff --git a/src/initialSetup.js b/src/initialSetup.js
index 3c8c32d3..0b68a049 100644
--- a/src/initialSetup.js
+++ b/src/initialSetup.js
@@ -14,7 +14,7 @@ const SetupPage = {
OFFLINE: 2,
};
-export const InitialSetupWindow = GObject.registerClass({
+export default GObject.registerClass({
Template: 'resource:///org/gnome/Polari/ui/initial-setup-window.ui',
InternalChildren: [
'contentStack',
diff --git a/src/ircParser.js b/src/ircParser.js
index 3ada6b5e..1f4df73e 100644
--- a/src/ircParser.js
+++ b/src/ircParser.js
@@ -5,7 +5,7 @@ import Tp from 'gi://TelepathyGLib';
const Signals = imports.signals;
import * as AppNotifications from './appNotifications.js';
-import { RoomManager } from './roomManager.js';
+import RoomManager from './roomManager.js';
import * as Utils from './utils.js';
Gio._promisify(Tp.Account.prototype,
@@ -48,7 +48,7 @@ const UNKNOWN_COMMAND_MESSAGE =
const ROOM_PREFIXES = ['#', '&', '+', '!'];
-export const IrcParser = class IrcParser {
+export default class IrcParser {
constructor(room) {
this._app = Gio.Application.get_default();
this._roomManager = RoomManager.getDefault();
@@ -327,5 +327,5 @@ export const IrcParser = class IrcParser {
logError(e, 'Failed to send message');
}
}
-};
+}
Signals.addSignalMethods(IrcParser.prototype);
diff --git a/src/joinDialog.js b/src/joinDialog.js
index 38c53529..303020f4 100644
--- a/src/joinDialog.js
+++ b/src/joinDialog.js
@@ -4,7 +4,7 @@ import GLib from 'gi://GLib';
import GObject from 'gi://GObject';
import Gtk from 'gi://Gtk';
-import { AccountsMonitor } from './accountsMonitor.js';
+import AccountsMonitor from './accountsMonitor.js';
import * as Utils from './utils.js';
const DialogPage = {
@@ -12,7 +12,7 @@ const DialogPage = {
CONNECTION: 1,
};
-export const JoinDialog = GObject.registerClass({
+export default GObject.registerClass({
Template: 'resource:///org/gnome/Polari/ui/join-room-dialog.ui',
InternalChildren: [
'cancelButton',
diff --git a/src/main.js b/src/main.js
index f7905fbf..46cbc1fc 100755
--- a/src/main.js
+++ b/src/main.js
@@ -33,7 +33,7 @@ pkg.requireSymbol('Gtk', '3.0', 'ScrolledWindow.propagate_natural_width');
Log.init();
-import { Application } from './application.js';
+import Application from './application.js';
let application = new Application();
if (GLib.getenv('POLARI_PERSIST'))
diff --git a/src/mainWindow.js b/src/mainWindow.js
index 76db2019..a9831b1b 100644
--- a/src/mainWindow.js
+++ b/src/mainWindow.js
@@ -6,11 +6,11 @@ import Gtk from 'gi://Gtk';
import Polari from 'gi://Polari';
import Tp from 'gi://TelepathyGLib';
-import { AccountsMonitor } from './accountsMonitor.js';
-import { JoinDialog } from './joinDialog.js';
-import * as RoomList_ from './roomList.js'; // used in template
-import { RoomManager } from './roomManager.js';
-import * as RoomStack_ from './roomStack.js'; // used in template
+import AccountsMonitor from './accountsMonitor.js';
+import JoinDialog from './joinDialog.js';
+import RoomList_ from './roomList.js'; // used in template
+import RoomManager from './roomManager.js';
+import RoomStack_ from './roomStack.js'; // used in template
import * as UserList_ from './userList.js'; // used in template
import * as Utils from './utils.js';
@@ -77,7 +77,7 @@ export const FixedSizeFrame = GObject.registerClass({
}
});
-export const MainWindow = GObject.registerClass({
+export default GObject.registerClass({
Template: 'resource:///org/gnome/Polari/ui/main-window.ui',
InternalChildren: [
'titlebarRight',
diff --git a/src/networksManager.js b/src/networksManager.js
index 6b5807fa..6561a804 100644
--- a/src/networksManager.js
+++ b/src/networksManager.js
@@ -4,7 +4,7 @@ import GLib from 'gi://GLib';
const ByteArray = imports.byteArray;
const Signals = imports.signals;
-export const NetworksManager = class {
+export default class NetworksManager {
static getDefault() {
if (!this._singleton)
this._singleton = new NetworksManager();
@@ -109,5 +109,5 @@ export const NetworksManager = class {
});
return network ? network.id : null;
}
-};
+}
Signals.addSignalMethods(NetworksManager.prototype);
diff --git a/src/pasteManager.js b/src/pasteManager.js
index ec2ce1b2..4bc1422e 100644
--- a/src/pasteManager.js
+++ b/src/pasteManager.js
@@ -33,7 +33,7 @@ function _getTargetForContentType(contentType) {
}
-export const PasteManager = class {
+export default class PasteManager {
pasteContent(content, title) {
if (typeof content === 'string')
return Utils.gpaste(content, title);
@@ -66,7 +66,7 @@ export const PasteManager = class {
throw new Error('Unhandled content type');
}
}
-};
+}
export const DropTargetIface = GObject.registerClass({
Requires: [GObject.Object],
diff --git a/src/roomList.js b/src/roomList.js
index 8c3b2755..6b9274e8 100644
--- a/src/roomList.js
+++ b/src/roomList.js
@@ -5,9 +5,9 @@ import GObject from 'gi://GObject';
import Gtk from 'gi://Gtk';
import Tp from 'gi://TelepathyGLib';
-import { AccountsMonitor } from './accountsMonitor.js';
-import { RoomManager } from './roomManager.js';
-import { UserStatusMonitor } from './userTracker.js';
+import AccountsMonitor from './accountsMonitor.js';
+import RoomManager from './roomManager.js';
+import UserStatusMonitor from './userTracker.js';
const MIN_SPINNER_TIME = 1000000; // in microsecond
@@ -512,7 +512,7 @@ const RoomListHeader = GObject.registerClass({
}
});
-export const RoomList = GObject.registerClass(
+export default GObject.registerClass(
class RoomList extends Gtk.ListBox {
_init(params) {
super._init(params);
diff --git a/src/roomManager.js b/src/roomManager.js
index c4565d68..15608a84 100644
--- a/src/roomManager.js
+++ b/src/roomManager.js
@@ -5,9 +5,9 @@ import Tp from 'gi://TelepathyGLib';
const Signals = imports.signals;
-import { AccountsMonitor } from './accountsMonitor.js';
+import AccountsMonitor from './accountsMonitor.js';
-export const RoomManager = class {
+export default class RoomManager {
static getDefault() {
if (!this._singleton)
this._singleton = new RoomManager();
@@ -203,5 +203,5 @@ export const RoomManager = class {
if (this._rooms.delete(room.id))
this.emit('room-removed', room);
}
-};
+}
Signals.addSignalMethods(RoomManager.prototype);
diff --git a/src/roomStack.js b/src/roomStack.js
index 08c83178..cc00fa93 100644
--- a/src/roomStack.js
+++ b/src/roomStack.js
@@ -4,13 +4,13 @@ import GObject from 'gi://GObject';
import Gtk from 'gi://Gtk';
import Tp from 'gi://TelepathyGLib';
-import { AccountsMonitor } from './accountsMonitor.js';
-import { ChatView } from './chatView.js';
-import { EntryArea } from './entryArea.js';
+import AccountsMonitor from './accountsMonitor.js';
+import ChatView from './chatView.js';
+import EntryArea from './entryArea.js';
import { MessageInfoBar } from './appNotifications.js';
-import { RoomManager } from './roomManager.js';
+import RoomManager from './roomManager.js';
-export const RoomStack = GObject.registerClass({
+export default GObject.registerClass({
Properties: {
'entry-area-height': GObject.ParamSpec.uint(
'entry-area-height', 'entry-area-height', 'entry-area-height',
diff --git a/src/serverRoomManager.js b/src/serverRoomManager.js
index dcb6f57b..f6b4b985 100644
--- a/src/serverRoomManager.js
+++ b/src/serverRoomManager.js
@@ -7,8 +7,8 @@ import Tp from 'gi://TelepathyGLib';
const Signals = imports.signals;
-import { AccountsMonitor } from './accountsMonitor.js';
-import { RoomManager } from './roomManager.js';
+import AccountsMonitor from './accountsMonitor.js';
+import RoomManager from './roomManager.js';
import * as Utils from './utils.js';
Gio._promisify(Tp.RoomList.prototype, 'init_async', 'init_finish');
@@ -16,7 +16,7 @@ Gio._promisify(Tp.RoomList.prototype, 'init_async', 'init_finish');
const MS_PER_IDLE = 10; // max time spend in idle
const MS_PER_FILTER_IDLE = 5; // max time spend in idle while filtering
-export const ServerRoomManager = class {
+export default class ServerRoomManager {
static getDefault() {
if (!this._singleton)
this._singleton = new ServerRoomManager();
@@ -94,7 +94,7 @@ export const ServerRoomManager = class {
_onListingChanged(list) {
this.emit('loading-changed', list.account);
}
-};
+}
Signals.addSignalMethods(ServerRoomManager.prototype);
diff --git a/src/tabCompletion.js b/src/tabCompletion.js
index b44608fb..9807cd5e 100644
--- a/src/tabCompletion.js
+++ b/src/tabCompletion.js
@@ -4,7 +4,7 @@ import Pango from 'gi://Pango';
import * as IrcParser from './ircParser.js';
-export const TabCompletion = class {
+export default class TabCompletion {
constructor(entry) {
this._entry = entry;
this._canComplete = false;
@@ -246,4 +246,4 @@ export const TabCompletion = class {
this._insertCompletion('');
this._stop();
}
-};
+}
diff --git a/src/telepathyClient.js b/src/telepathyClient.js
index 9dd648ad..155d1e8d 100644
--- a/src/telepathyClient.js
+++ b/src/telepathyClient.js
@@ -4,9 +4,9 @@ import GObject from 'gi://GObject';
import Polari from 'gi://Polari';
import Tp from 'gi://TelepathyGLib';
-import { AccountsMonitor } from './accountsMonitor.js';
-import { RoomManager } from './roomManager.js';
-import { UserStatusMonitor } from './userTracker.js';
+import AccountsMonitor from './accountsMonitor.js';
+import RoomManager from './roomManager.js';
+import UserStatusMonitor from './userTracker.js';
import * as Utils from './utils.js';
Gio._promisify(Gio.DBusConnection.prototype, 'call', 'call_finish');
@@ -123,7 +123,7 @@ class SASLAuthHandler {
}
}
-export const TelepathyClient = GObject.registerClass(
+export default GObject.registerClass(
class TelepathyClient extends Tp.BaseClient {
_init(params) {
this._app = Gio.Application.get_default();
diff --git a/src/urlPreview.js b/src/urlPreview.js
index c1316888..1f8e37d6 100644
--- a/src/urlPreview.js
+++ b/src/urlPreview.js
@@ -98,7 +98,7 @@ class Thumbnailer {
}
}
-export const URLPreview = GObject.registerClass({
+export default GObject.registerClass({
Properties: {
'uri': GObject.ParamSpec.string(
'uri', 'uri', 'uri',
diff --git a/src/userTracker.js b/src/userTracker.js
index 478f4982..1881138a 100644
--- a/src/userTracker.js
+++ b/src/userTracker.js
@@ -4,11 +4,11 @@ import GObject from 'gi://GObject';
import Polari from 'gi://Polari';
import Tp from 'gi://TelepathyGLib';
-import { AccountsMonitor } from './accountsMonitor.js';
-import { RoomManager } from './roomManager.js';
+import AccountsMonitor from './accountsMonitor.js';
+import RoomManager from './roomManager.js';
import * as Utils from './utils.js';
-export const UserStatusMonitor = class {
+export default class UserStatusMonitor {
static getDefault() {
if (!this._singleton)
this._singleton = new UserStatusMonitor();
@@ -60,7 +60,7 @@ export const UserStatusMonitor = class {
getUserTrackerForAccount(account) {
return this._userTrackers.get(account);
}
-};
+}
const UserTracker = GObject.registerClass({
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]