[gnome-shell-extensions/minor-cleanups: 1/2] cleanup: Use destructuring for imports from GI
- From: Florian Müllner <fmuellner src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell-extensions/minor-cleanups: 1/2] cleanup: Use destructuring for imports from GI
- Date: Fri, 15 Feb 2019 23:50:24 +0000 (UTC)
commit 0d4164386690608869407717782fa0740ea2c0f2
Author: Florian Müllner <fmuellner gnome org>
Date: Fri Feb 15 23:48:24 2019 +0100
cleanup: Use destructuring for imports from GI
This is *much* nicer than repetitive "imports.gi" lines ...
https://gitlab.gnome.org/GNOME/gnome-shell-extensions/merge_requests/54
extensions/apps-menu/extension.js | 12 ++----------
extensions/auto-move-windows/prefs.js | 4 +---
extensions/drive-menu/extension.js | 5 +----
extensions/places-menu/extension.js | 4 +---
extensions/places-menu/placeDisplay.js | 4 +---
extensions/screenshot-window-sizer/extension.js | 4 +---
extensions/user-theme/extension.js | 3 +--
extensions/window-list/extension.js | 9 +--------
extensions/window-list/prefs.js | 4 +---
extensions/windowsNavigator/extension.js | 3 +--
extensions/workspace-indicator/extension.js | 6 +-----
extensions/workspace-indicator/prefs.js | 4 +---
12 files changed, 13 insertions(+), 49 deletions(-)
---
diff --git a/extensions/apps-menu/extension.js b/extensions/apps-menu/extension.js
index ad25a59..171b788 100644
--- a/extensions/apps-menu/extension.js
+++ b/extensions/apps-menu/extension.js
@@ -1,20 +1,12 @@
/* -*- mode: js2; js2-basic-offset: 4; indent-tabs-mode: nil -*- */
/* exported init enable disable */
-const Atk = imports.gi.Atk;
+const { Atk, Clutter, Gio, GLib, GMenu,
+ GObject, Gtk, Meta, Shell, St } = imports.gi;
const DND = imports.ui.dnd;
-const GMenu = imports.gi.GMenu;
-const GObject = imports.gi.GObject;
-const Shell = imports.gi.Shell;
-const St = imports.gi.St;
-const Clutter = imports.gi.Clutter;
const Main = imports.ui.main;
-const Meta = imports.gi.Meta;
const PanelMenu = imports.ui.panelMenu;
const PopupMenu = imports.ui.popupMenu;
-const Gtk = imports.gi.Gtk;
-const GLib = imports.gi.GLib;
-const Gio = imports.gi.Gio;
const Signals = imports.signals;
const Gettext = imports.gettext.domain('gnome-shell-extensions');
diff --git a/extensions/auto-move-windows/prefs.js b/extensions/auto-move-windows/prefs.js
index e0aa3b3..fd448f0 100644
--- a/extensions/auto-move-windows/prefs.js
+++ b/extensions/auto-move-windows/prefs.js
@@ -2,9 +2,7 @@
// Start apps on custom workspaces
/* exported init buildPrefsWidget */
-const Gio = imports.gi.Gio;
-const GObject = imports.gi.GObject;
-const Gtk = imports.gi.Gtk;
+const { Gio, GObject, Gtk } = imports.gi;
const Gettext = imports.gettext.domain('gnome-shell-extensions');
const _ = Gettext.gettext;
diff --git a/extensions/drive-menu/extension.js b/extensions/drive-menu/extension.js
index 89747ec..4c1fdbf 100644
--- a/extensions/drive-menu/extension.js
+++ b/extensions/drive-menu/extension.js
@@ -1,9 +1,6 @@
/* exported init enable disable */
// Drive menu extension
-const Gio = imports.gi.Gio;
-const GObject = imports.gi.GObject;
-const St = imports.gi.St;
-const Shell = imports.gi.Shell;
+const { Gio, GObject, Shell, St } = imports.gi;
const Gettext = imports.gettext.domain('gnome-shell-extensions');
const _ = Gettext.gettext;
diff --git a/extensions/places-menu/extension.js b/extensions/places-menu/extension.js
index 9fced35..b98d385 100644
--- a/extensions/places-menu/extension.js
+++ b/extensions/places-menu/extension.js
@@ -1,9 +1,7 @@
/* -*- mode: js2; js2-basic-offset: 4; indent-tabs-mode: nil -*- */
/* exported init enable disable */
-const Clutter = imports.gi.Clutter;
-const GObject = imports.gi.GObject;
-const St = imports.gi.St;
+const { Clutter, GObject, St } = imports.gi;
const Main = imports.ui.main;
const PanelMenu = imports.ui.panelMenu;
diff --git a/extensions/places-menu/placeDisplay.js b/extensions/places-menu/placeDisplay.js
index 133e778..dd00bbf 100644
--- a/extensions/places-menu/placeDisplay.js
+++ b/extensions/places-menu/placeDisplay.js
@@ -1,8 +1,6 @@
// -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
-const GLib = imports.gi.GLib;
-const Gio = imports.gi.Gio;
-const Shell = imports.gi.Shell;
+const { Gio, GLib, Shell } = imports.gi;
const Mainloop = imports.mainloop;
const Signals = imports.signals;
diff --git a/extensions/screenshot-window-sizer/extension.js b/extensions/screenshot-window-sizer/extension.js
index c00fb99..bf31f81 100644
--- a/extensions/screenshot-window-sizer/extension.js
+++ b/extensions/screenshot-window-sizer/extension.js
@@ -19,9 +19,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-const Meta = imports.gi.Meta;
-const Shell = imports.gi.Shell;
-const St = imports.gi.St;
+const { Meta, Shell, St } = imports.gi;
const Main = imports.ui.main;
const Tweener = imports.ui.tweener;
diff --git a/extensions/user-theme/extension.js b/extensions/user-theme/extension.js
index 9ffaf6f..9849731 100644
--- a/extensions/user-theme/extension.js
+++ b/extensions/user-theme/extension.js
@@ -2,8 +2,7 @@
// Load shell theme from ~/.themes/name/gnome-shell
/* exported init */
-const GLib = imports.gi.GLib;
-const Gio = imports.gi.Gio;
+const { Gio, GLib } = imports.gi;
const Main = imports.ui.main;
const SETTINGS_KEY = 'name';
diff --git a/extensions/window-list/extension.js b/extensions/window-list/extension.js
index e4633e2..cb2edb0 100644
--- a/extensions/window-list/extension.js
+++ b/extensions/window-list/extension.js
@@ -1,12 +1,5 @@
/* exported init */
-const Clutter = imports.gi.Clutter;
-const GLib = imports.gi.GLib;
-const Gio = imports.gi.Gio;
-const GObject = imports.gi.GObject;
-const Gtk = imports.gi.Gtk;
-const Meta = imports.gi.Meta;
-const Shell = imports.gi.Shell;
-const St = imports.gi.St;
+const { Clutter, Gio, GLib, GObject, Gtk, Meta, Shell, St } = imports.gi;
const DND = imports.ui.dnd;
const Main = imports.ui.main;
diff --git a/extensions/window-list/prefs.js b/extensions/window-list/prefs.js
index 639ec56..59fd697 100644
--- a/extensions/window-list/prefs.js
+++ b/extensions/window-list/prefs.js
@@ -1,9 +1,7 @@
// -*- mode: js2; indent-tabs-mode: nil; js2-basic-offset: 4 -*-
/* exported init buildPrefsWidget */
-const Gio = imports.gi.Gio;
-const GObject = imports.gi.GObject;
-const Gtk = imports.gi.Gtk;
+const { Gio, GObject, Gtk } = imports.gi;
const Gettext = imports.gettext.domain('gnome-shell-extensions');
const _ = Gettext.gettext;
diff --git a/extensions/windowsNavigator/extension.js b/extensions/windowsNavigator/extension.js
index a4d7474..13de1bc 100644
--- a/extensions/windowsNavigator/extension.js
+++ b/extensions/windowsNavigator/extension.js
@@ -1,7 +1,6 @@
/* -*- mode: js2; js2-basic-offset: 4; indent-tabs-mode: nil -*- */
/* exported enable disable */
-const Clutter = imports.gi.Clutter;
-const St = imports.gi.St;
+const { Clutter, St } = imports.gi;
const Main = imports.ui.main;
const Workspace = imports.ui.workspace;
diff --git a/extensions/workspace-indicator/extension.js b/extensions/workspace-indicator/extension.js
index ea891e0..9e1dfd7 100644
--- a/extensions/workspace-indicator/extension.js
+++ b/extensions/workspace-indicator/extension.js
@@ -1,11 +1,7 @@
// -*- mode: js2; indent-tabs-mode: nil; js2-basic-offset: 4 -*-
/* exported init enable disable */
-const Gio = imports.gi.Gio;
-const GObject = imports.gi.GObject;
-const Meta = imports.gi.Meta;
-const Clutter = imports.gi.Clutter;
-const St = imports.gi.St;
+const { Clutter, Gio, GObject, Meta, St } = imports.gi;
const PanelMenu = imports.ui.panelMenu;
const PopupMenu = imports.ui.popupMenu;
diff --git a/extensions/workspace-indicator/prefs.js b/extensions/workspace-indicator/prefs.js
index dae2e95..64a64fd 100644
--- a/extensions/workspace-indicator/prefs.js
+++ b/extensions/workspace-indicator/prefs.js
@@ -1,9 +1,7 @@
// -*- mode: js2; indent-tabs-mode: nil; js2-basic-offset: 4 -*-
/* exported init buildPrefsWidget */
-const Gio = imports.gi.Gio;
-const GObject = imports.gi.GObject;
-const Gtk = imports.gi.Gtk;
+const { Gio, GObject, Gtk } = imports.gi;
const Gettext = imports.gettext.domain('gnome-shell-extensions');
const _ = Gettext.gettext;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]