[polari] cleanup: Use destructuring for imports from GI
- From: Florian Müllner <fmuellner src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [polari] cleanup: Use destructuring for imports from GI
- Date: Thu, 26 Jul 2018 16:13:21 +0000 (UTC)
commit 2709f898d7858e5236e77a2a70e420924c5b7543
Author: Florian Müllner <fmuellner gnome org>
Date: Thu Jul 26 04:20:03 2018 +0200
cleanup: Use destructuring for imports from GI
This is *much* nicer than repetitive "imports.gi" lines ...
src/accountsMonitor.js | 4 +---
src/appNotifications.js | 4 +---
src/application.js | 7 +------
src/chatView.js | 9 +--------
src/connections.js | 4 +---
src/emojiPicker.js | 5 +----
src/entryArea.js | 8 +-------
src/initialSetup.js | 5 +----
src/ircParser.js | 3 +--
src/joinDialog.js | 6 +-----
src/main.js | 2 +-
src/mainWindow.js | 7 +------
src/networksManager.js | 3 +--
src/pasteManager.js | 8 +-------
src/roomList.js | 6 +-----
src/roomManager.js | 4 +---
src/roomStack.js | 6 +-----
src/serverRoomManager.js | 5 +----
src/tabCompletion.js | 4 +---
src/telepathyClient.js | 5 +----
src/userList.js | 7 +------
src/userTracker.js | 5 +----
src/utils.js | 7 +------
23 files changed, 23 insertions(+), 101 deletions(-)
---
diff --git a/src/accountsMonitor.js b/src/accountsMonitor.js
index b6c3288..2d3dfde 100644
--- a/src/accountsMonitor.js
+++ b/src/accountsMonitor.js
@@ -1,6 +1,4 @@
-const Gio = imports.gi.Gio;
-const GObject = imports.gi.GObject;
-const Polari = imports.gi.Polari;
+const { Gio, GObject, Polari } = imports.gi;
const Signals = imports.signals;
const Tp = imports.gi.TelepathyGLib;
diff --git a/src/appNotifications.js b/src/appNotifications.js
index 9c57cfa..9527ca5 100644
--- a/src/appNotifications.js
+++ b/src/appNotifications.js
@@ -1,7 +1,5 @@
-const GObject = imports.gi.GObject;
-const Gtk = imports.gi.Gtk;
+const { GObject, Gtk, Pango } = imports.gi;
const Mainloop = imports.mainloop;
-const Pango = imports.gi.Pango;
const TIMEOUT = 7;
const COMMAND_OUTPUT_REVEAL_TIME = 3;
diff --git a/src/application.js b/src/application.js
index 62806d7..2350922 100644
--- a/src/application.js
+++ b/src/application.js
@@ -1,9 +1,4 @@
-const Gdk = imports.gi.Gdk;
-const Gio = imports.gi.Gio;
-const GLib = imports.gi.GLib;
-const GObject = imports.gi.GObject;
-const Gtk = imports.gi.Gtk;
-const Polari = imports.gi.Polari;
+const { Gdk, Gio, GLib, GObject, Gtk, Polari } = imports.gi;
const Tp = imports.gi.TelepathyGLib;
const {AccountsMonitor} = imports.accountsMonitor;
diff --git a/src/chatView.js b/src/chatView.js
index 09cf902..98fad0b 100644
--- a/src/chatView.js
+++ b/src/chatView.js
@@ -1,12 +1,5 @@
-const Gdk = imports.gi.Gdk;
-const Gio = imports.gi.Gio;
-const GLib = imports.gi.GLib;
-const GObject = imports.gi.GObject;
-const Gtk = imports.gi.Gtk;
+const { Gdk, Gio, GLib, GObject, Gtk, Pango, PangoCairo, Polari } = imports.gi;
const Mainloop = imports.mainloop;
-const Pango = imports.gi.Pango;
-const PangoCairo = imports.gi.PangoCairo;
-const Polari = imports.gi.Polari;
const Tp = imports.gi.TelepathyGLib;
const Tpl = imports.gi.TelepathyLogger;
diff --git a/src/connections.js b/src/connections.js
index be7e1a8..930a604 100644
--- a/src/connections.js
+++ b/src/connections.js
@@ -1,6 +1,4 @@
-const GLib = imports.gi.GLib;
-const GObject = imports.gi.GObject;
-const Gtk = imports.gi.Gtk;
+const { GLib, GObject, Gtk } = imports.gi;
const Tp = imports.gi.TelepathyGLib;
const {AccountsMonitor} = imports.accountsMonitor;
diff --git a/src/emojiPicker.js b/src/emojiPicker.js
index 590161d..5261db5 100644
--- a/src/emojiPicker.js
+++ b/src/emojiPicker.js
@@ -1,7 +1,4 @@
-const Gdk = imports.gi.Gdk;
-const Gio = imports.gi.Gio;
-const GObject = imports.gi.GObject;
-const Gtk = imports.gi.Gtk;
+const { Gdk, Gio, GObject, Gtk } = imports.gi;
const modifierBlacklist = [
'child',
diff --git a/src/entryArea.js b/src/entryArea.js
index 5545245..191c26f 100644
--- a/src/entryArea.js
+++ b/src/entryArea.js
@@ -1,10 +1,4 @@
-const Gdk = imports.gi.Gdk;
-const GdkPixbuf = imports.gi.GdkPixbuf;
-const Gio = imports.gi.Gio;
-const GLib = imports.gi.GLib;
-const GObject = imports.gi.GObject;
-const Gspell = imports.gi.Gspell;
-const Gtk = imports.gi.Gtk;
+const { Gdk, GdkPixbuf, Gio, GLib, GObject, Gspell, Gtk } = imports.gi;
const Mainloop = imports.mainloop;
const Tp = imports.gi.TelepathyGLib;
diff --git a/src/initialSetup.js b/src/initialSetup.js
index 4c103dc..7d7021f 100644
--- a/src/initialSetup.js
+++ b/src/initialSetup.js
@@ -1,7 +1,4 @@
-const Gio = imports.gi.Gio;
-const GLib = imports.gi.GLib;
-const GObject = imports.gi.GObject;
-const Gtk = imports.gi.Gtk;
+const { Gio, GLib, GObject, Gtk } = imports.gi;
const Utils = imports.utils;
diff --git a/src/ircParser.js b/src/ircParser.js
index 1c19a41..1154339 100644
--- a/src/ircParser.js
+++ b/src/ircParser.js
@@ -1,5 +1,4 @@
-const Gio = imports.gi.Gio;
-const GLib = imports.gi.GLib;
+const { Gio, GLib } = imports.gi;
const Signals = imports.signals;
const Tp = imports.gi.TelepathyGLib;
diff --git a/src/joinDialog.js b/src/joinDialog.js
index 6da6c4b..76f1a3d 100644
--- a/src/joinDialog.js
+++ b/src/joinDialog.js
@@ -1,8 +1,4 @@
-const Gdk = imports.gi.Gdk;
-const Gio = imports.gi.Gio;
-const GLib = imports.gi.GLib;
-const GObject = imports.gi.GObject;
-const Gtk = imports.gi.Gtk;
+const { Gdk, Gio, GLib, GObject, Gtk } = imports.gi;
const {AccountsMonitor} = imports.accountsMonitor;
const Utils = imports.utils;
diff --git a/src/main.js b/src/main.js
index 4e64275..cbe105f 100755
--- a/src/main.js
+++ b/src/main.js
@@ -15,7 +15,7 @@ pkg.requireSymbol('GLib', '2.0', 'log_variant');
pkg.requireSymbol('Gspell', '1', 'Entry');
pkg.requireSymbol('Gtk', '3.0', 'ScrolledWindow.propagate_natural_width');
-const GLib = imports.gi.GLib;
+const {GLib} = imports.gi;
const {Application} = imports.application;
diff --git a/src/mainWindow.js b/src/mainWindow.js
index 11d4dae..b8bdc47 100644
--- a/src/mainWindow.js
+++ b/src/mainWindow.js
@@ -1,10 +1,5 @@
-const Gdk = imports.gi.Gdk;
-const Gio = imports.gi.Gio;
-const GLib = imports.gi.GLib;
-const GObject = imports.gi.GObject;
-const Gtk = imports.gi.Gtk;
+const { Gdk, Gio, GLib, GObject, Gtk, Polari } = imports.gi;
const Mainloop = imports.mainloop;
-const Polari = imports.gi.Polari;
const Tp = imports.gi.TelepathyGLib;
const {AccountsMonitor} = imports.accountsMonitor;
diff --git a/src/networksManager.js b/src/networksManager.js
index 7532a70..fdce79c 100644
--- a/src/networksManager.js
+++ b/src/networksManager.js
@@ -1,5 +1,4 @@
-const Gio = imports.gi.Gio;
-const GLib = imports.gi.GLib;
+const { Gio, GLib } = imports.gi;
const Signals = imports.signals;
var NetworksManager = class {
diff --git a/src/pasteManager.js b/src/pasteManager.js
index 210411c..cfb083d 100644
--- a/src/pasteManager.js
+++ b/src/pasteManager.js
@@ -1,10 +1,4 @@
-const Gdk = imports.gi.Gdk;
-const GdkPixbuf = imports.gi.GdkPixbuf;
-const Gio = imports.gi.Gio;
-const GLib = imports.gi.GLib;
-const GObject = imports.gi.GObject;
-const Gtk = imports.gi.Gtk;
-const Polari = imports.gi.Polari;
+const { Gdk, GdkPixbuf, Gio, GLib, GObject, Gtk, Polari } = imports.gi;
const Utils = imports.utils;
diff --git a/src/roomList.js b/src/roomList.js
index f96eb91..49cd0c8 100644
--- a/src/roomList.js
+++ b/src/roomList.js
@@ -1,8 +1,4 @@
-const Gdk = imports.gi.Gdk;
-const Gio = imports.gi.Gio;
-const GLib = imports.gi.GLib;
-const GObject = imports.gi.GObject;
-const Gtk = imports.gi.Gtk;
+const { Gdk, Gio, GLib, GObject, Gtk } = imports.gi;
const Mainloop = imports.mainloop;
const Tp = imports.gi.TelepathyGLib;
diff --git a/src/roomManager.js b/src/roomManager.js
index 9daeb4e..cabe2c2 100644
--- a/src/roomManager.js
+++ b/src/roomManager.js
@@ -1,6 +1,4 @@
-const Gio = imports.gi.Gio;
-const GLib = imports.gi.GLib;
-const Polari = imports.gi.Polari;
+const { Gio, GLib, Polari } = imports.gi;
const Signals = imports.signals;
const Tp = imports.gi.TelepathyGLib;
diff --git a/src/roomStack.js b/src/roomStack.js
index 67ff9d7..2957d86 100644
--- a/src/roomStack.js
+++ b/src/roomStack.js
@@ -1,8 +1,4 @@
-const Gio = imports.gi.Gio;
-const GLib = imports.gi.GLib;
-const GObject = imports.gi.GObject;
-const Gtk = imports.gi.Gtk;
-const Pango = imports.gi.Pango;
+const { Gio, GLib, GObject, Gtk, Pango } = imports.gi;
const Tp = imports.gi.TelepathyGLib;
const {AccountsMonitor} = imports.accountsMonitor;
diff --git a/src/serverRoomManager.js b/src/serverRoomManager.js
index 1abb2be..671a868 100644
--- a/src/serverRoomManager.js
+++ b/src/serverRoomManager.js
@@ -1,7 +1,4 @@
-const Gdk = imports.gi.Gdk;
-const GLib = imports.gi.GLib;
-const GObject = imports.gi.GObject;
-const Gtk = imports.gi.Gtk;
+const { Gdk, GLib, GObject, Gtk } = imports.gi;
const Mainloop = imports.mainloop;
const Signals = imports.signals;
const Tp = imports.gi.TelepathyGLib;
diff --git a/src/tabCompletion.js b/src/tabCompletion.js
index 72695cf..5e3f850 100644
--- a/src/tabCompletion.js
+++ b/src/tabCompletion.js
@@ -1,6 +1,4 @@
-const Gdk = imports.gi.Gdk;
-const Gtk = imports.gi.Gtk;
-const Pango = imports.gi.Pango;
+const { Gdk, Gtk, Pango } = imports.gi;
const IrcParser = imports.ircParser;
diff --git a/src/telepathyClient.js b/src/telepathyClient.js
index 07d793e..a961f14 100644
--- a/src/telepathyClient.js
+++ b/src/telepathyClient.js
@@ -1,7 +1,4 @@
-const Gio = imports.gi.Gio;
-const GLib = imports.gi.GLib;
-const GObject = imports.gi.GObject;
-const Polari = imports.gi.Polari;
+const { Gio, GLib, GObject, Polari } = imports.gi;
const Tp = imports.gi.TelepathyGLib;
const {AccountsMonitor} = imports.accountsMonitor;
diff --git a/src/userList.js b/src/userList.js
index a198ceb..c809716 100644
--- a/src/userList.js
+++ b/src/userList.js
@@ -1,10 +1,5 @@
-const Gio = imports.gi.Gio;
-const GLib = imports.gi.GLib;
-const GObject = imports.gi.GObject;
-const Gtk = imports.gi.Gtk;
+const { Gio, GLib, GObject, Gtk, Pango, Polari } = imports.gi;
const Mainloop = imports.mainloop;
-const Pango = imports.gi.Pango;
-const Polari = imports.gi.Polari;
const Tp = imports.gi.TelepathyGLib;
const READWRITE = GObject.ParamFlags.READABLE | GObject.ParamFlags.WRITABLE;
diff --git a/src/userTracker.js b/src/userTracker.js
index aeb0cee..2b0e0ad 100644
--- a/src/userTracker.js
+++ b/src/userTracker.js
@@ -1,7 +1,4 @@
-const Gio = imports.gi.Gio;
-const GLib = imports.gi.GLib;
-const GObject = imports.gi.GObject;
-const Polari = imports.gi.Polari;
+const { Gio, GLib, GObject, Polari } = imports.gi;
const Tp = imports.gi.TelepathyGLib;
const {AccountsMonitor} = imports.accountsMonitor;
diff --git a/src/utils.js b/src/utils.js
index ea1f75e..676e39e 100644
--- a/src/utils.js
+++ b/src/utils.js
@@ -20,12 +20,7 @@
*
*/
-const Gdk = imports.gi.Gdk;
-const Gio = imports.gi.Gio;
-const GLib = imports.gi.GLib;
-const Gtk = imports.gi.Gtk;
-const Secret = imports.gi.Secret;
-const Soup = imports.gi.Soup;
+const { Gdk, Gio, GLib, Gtk, Secret, Soup } = imports.gi;
const Tp = imports.gi.TelepathyGLib;
const AppNotifications = imports.appNotifications;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]