From c70a8487eebacb9d1e8629fb424e5eee874da4fe Mon Sep 17 00:00:00 2001
From: Florian Müllner <fmuellner@gnome.org>
Date: Feb 09 2019 04:09:21 +0000
Subject: [PATCH 1/6] cleanup: Stop using Lang.bind()


It is deprecated in favor of arrow functions or Function.prototype.bind().

https://pagure.io/background-logo-extension/pull-request/10

---

diff --git a/extension.js b/extension.js
index 13ae308..fd9d7ab 100644
--- a/extension.js
+++ b/extension.js
@@ -39,29 +39,28 @@ const BackgroundLogo = new Lang.Class({
         this._settings = Convenience.getSettings();
 
         this._settings.connect('changed::logo-file',
-                               Lang.bind(this, this._updateLogo));
+                               this._updateLogo.bind(this));
         this._settings.connect('changed::logo-size',
-                               Lang.bind(this, this._updateScale));
+                               this._updateScale.bind(this));
         this._settings.connect('changed::logo-position',
-                               Lang.bind(this, this._updatePosition));
+                               this._updatePosition.bind(this));
         this._settings.connect('changed::logo-border',
-                               Lang.bind(this, this._updateBorder));
+                               this._updateBorder.bind(this));
         this._settings.connect('changed::logo-always-visible',
-                               Lang.bind(this, this._updateVisibility));
+                               this._updateVisibility.bind(this));
 
         this._textureCache = St.TextureCache.get_default();
-        this._textureCache.connect('texture-file-changed', Lang.bind(this,
-            function(cache, file) {
-                if (!this._logoFile || !this._logoFile.equal(file))
-                    return;
-                this._updateLogoTexture();
-            }));
+        this._textureCache.connect('texture-file-changed', (cache, file) => {
+            if (!this._logoFile || !this._logoFile.equal(file))
+                return;
+            this._updateLogoTexture();
+        });
 
         this.actor = new St.Widget({ layout_manager: new Clutter.BinLayout(),
                                      opacity: 0 });
         bgManager._container.add_actor(this.actor);
 
-        this.actor.connect('destroy', Lang.bind(this, this._onDestroy));
+        this.actor.connect('destroy', this._onDestroy.bind(this));
 
         let monitorIndex = bgManager._monitorIndex;
         let constraint = new Layout.MonitorConstraint({ index: monitorIndex,
@@ -80,10 +79,10 @@ const BackgroundLogo = new Lang.Class({
 
         this._bgDestroyedId =
             bgManager.backgroundActor.connect('destroy',
-                                              Lang.bind(this, this._backgroundDestroyed));
+                                              this._backgroundDestroyed.bind(this));
 
         this._bgChangedId =
-            bgManager.connect('changed', Lang.bind(this, this._updateVisibility));
+            bgManager.connect('changed', this._updateVisibility.bind(this));
         this._updateVisibility();
     },
 
@@ -109,7 +108,7 @@ const BackgroundLogo = new Lang.Class({
             this._icon = this._textureCache.load_uri_async(this._logoFile.get_uri(), -1, -1, scaleFactor);
         }
         this._icon.connect('allocation-changed',
-                           Lang.bind(this, this._updateScale));
+                           this._updateScale.bind(this));
         this._bin.add_actor(this._icon);
     },
 
@@ -188,7 +187,7 @@ const BackgroundLogo = new Lang.Class({
         if (this._bgManager._backgroundSource) // background swapped
             this._bgDestroyedId =
                 this._bgManager.backgroundActor.connect('destroy',
-                                                        Lang.bind(this, this._backgroundDestroyed));
+                                                        this._backgroundDestroyed.bind(this));
         else // bgManager destroyed
             this.actor.destroy();
     },
diff --git a/prefs.js b/prefs.js
index b6a794b..cb446ea 100644
--- a/prefs.js
+++ b/prefs.js
@@ -24,20 +24,19 @@ const BackgroundLogoPrefsWidget = new Lang.Class({
                       column_spacing: 12,
                       row_spacing: 6 });
 
-        this.connect('screen-changed', Lang.bind(this, this._onScreenChanged));
+        this.connect('screen-changed', this._onScreenChanged.bind(this));
 
         this._settings = Convenience.getSettings();
-        this._settings.connect('changed', Lang.bind(this,
-            function(settings, key) {
-                if (key == 'logo-file' ||
-                    key == 'logo-size')
-                    this._logo = null;
-                this._preview.queue_draw();
-            }));
+        this._settings.connect('changed', (settings, key) => {
+            if (key == 'logo-file' ||
+                key == 'logo-size')
+                this._logo = null;
+            this._preview.queue_draw();
+        });
 
         this._preview = new Gtk.DrawingArea({ halign: Gtk.Align.CENTER,
                                               margin_bottom: 18 });
-        this._preview.connect('draw', Lang.bind(this, this._drawPreview));
+        this._preview.connect('draw', this._drawPreview.bind(this));
         this.attach(this._preview, 0, 0, 2, 1);
 
         let filter = new Gtk.FileFilter();
@@ -46,11 +45,9 @@ const BackgroundLogoPrefsWidget = new Lang.Class({
         let fileChooser = new Gtk.FileChooserButton({ title: "Select an Image",
                                                       filter: filter });
         fileChooser.set_filename(this._settings.get_string('logo-file'));
-        fileChooser.connect('file-set', Lang.bind(this,
-            function() {
-                this._settings.set_string('logo-file',
-                                          fileChooser.get_filename());
-            }));
+        fileChooser.connect('file-set',  () => {
+            this._settings.set_string('logo-file', fileChooser.get_filename());
+        });
         this._addRow(1, "Logo image", fileChooser);
 
         let comboBox = new Gtk.ComboBoxText();

From d914cf5beb5a88a48164420f200418fe2f97bb72 Mon Sep 17 00:00:00 2001
From: Florian Müllner <fmuellner@gnome.org>
Date: Feb 09 2019 04:09:37 +0000
Subject: [PATCH 2/6] cleanup: Use method syntax


Modern javascript has a short-hand for function properties, embrace
it for better readability and to prepare for the upcoming port to
ES6 classes.

https://pagure.io/background-logo-extension/pull-request/10

---

diff --git a/extension.js b/extension.js
index fd9d7ab..3c88803 100644
--- a/extension.js
+++ b/extension.js
@@ -31,7 +31,7 @@ const Convenience = Me.imports.convenience;
 const BackgroundLogo = new Lang.Class({
     Name: 'BackgroundLogo',
 
-    _init: function(bgManager) {
+    _init(bgManager) {
         this._bgManager = bgManager;
 
         this._logoFile = null;
@@ -86,7 +86,7 @@ const BackgroundLogo = new Lang.Class({
         this._updateVisibility();
     },
 
-    _updateLogo: function() {
+    _updateLogo() {
         let filename = this._settings.get_string('logo-file');
         let file = Gio.File.new_for_commandline_arg(filename);
         if (this._logoFile && this._logoFile.equal(file))
@@ -97,7 +97,7 @@ const BackgroundLogo = new Lang.Class({
         this._updateLogoTexture();
     },
 
-    _updateLogoTexture: function() {
+    _updateLogoTexture() {
         if (this._icon)
             this._icon.destroy();
 
@@ -112,7 +112,7 @@ const BackgroundLogo = new Lang.Class({
         this._bin.add_actor(this._icon);
     },
 
-    _updateScale: function() {
+    _updateScale() {
         if (this._icon.width == 0)
             return;
 
@@ -130,7 +130,7 @@ const BackgroundLogo = new Lang.Class({
         this._icon.set_size(width, height);
     },
 
-    _updatePosition: function() {
+    _updatePosition() {
         let xAlign, yAlign;
         switch (this._settings.get_string('logo-position')) {
             case 'center':
@@ -154,12 +154,12 @@ const BackgroundLogo = new Lang.Class({
         this._bin.y_align = yAlign;
     },
 
-    _updateBorder: function() {
+    _updateBorder() {
         let border = this._settings.get_uint('logo-border');
         this.actor.style = 'padding: %dpx;'.format(border);
     },
 
-    _updateVisibility: function() {
+    _updateVisibility() {
         let background = this._bgManager.backgroundActor.background._delegate;
         let defaultUri = background._settings.get_default_value('picture-uri');
         let file = Gio.File.new_for_commandline_arg(defaultUri.deep_unpack());
@@ -181,7 +181,7 @@ const BackgroundLogo = new Lang.Class({
                          });
     },
 
-    _backgroundDestroyed: function() {
+    _backgroundDestroyed() {
         this._bgDestroyedId = 0;
 
         if (this._bgManager._backgroundSource) // background swapped
@@ -192,7 +192,7 @@ const BackgroundLogo = new Lang.Class({
             this.actor.destroy();
     },
 
-    _onDestroy: function() {
+    _onDestroy() {
         this._settings.run_dispose();
         this._settings = null;
 
diff --git a/prefs.js b/prefs.js
index cb446ea..ced697c 100644
--- a/prefs.js
+++ b/prefs.js
@@ -18,7 +18,7 @@ const BackgroundLogoPrefsWidget = new Lang.Class({
     Name: 'BackgroundLogoPrefsWidget',
     Extends: Gtk.Grid,
 
-    _init: function() {
+    _init() {
         this.parent({ halign: Gtk.Align.CENTER,
                       margin: 24,
                       column_spacing: 12,
@@ -78,7 +78,7 @@ const BackgroundLogoPrefsWidget = new Lang.Class({
         this.attach(checkWidget, 1, 6, 1, 1);
     },
 
-    _addRow: function(row, label, widget) {
+    _addRow(row, label, widget) {
         let margin = 48;
 
         widget.margin_end = margin;
@@ -93,7 +93,7 @@ const BackgroundLogoPrefsWidget = new Lang.Class({
         this.attach(widget, 1, row, 1, 1);
     },
 
-    _createAdjustment: function(key, step) {
+    _createAdjustment(key, step) {
         let schemaKey = this._settings.settings_schema.get_key(key);
         let [type, variant] = schemaKey.get_range().deep_unpack();
         if (type != 'range')
@@ -106,7 +106,7 @@ const BackgroundLogoPrefsWidget = new Lang.Class({
         return adj;
     },
 
-    _drawPreview: function(preview, cr) {
+    _drawPreview(preview, cr) {
         let width = preview.get_allocated_width();
         let height = preview.get_allocated_height();
 
@@ -123,7 +123,7 @@ const BackgroundLogoPrefsWidget = new Lang.Class({
         cr.paintWithAlpha(this._settings.get_uint('logo-opacity') / 255.0);
     },
 
-    _createBackgroundThumbnail: function(width, height) {
+    _createBackgroundThumbnail(width, height) {
         let settings = new Gio.Settings({ schema_id: BACKGROUND_SCHEMA });
         let uri = settings.get_default_value('picture-uri').deep_unpack();
         let file = Gio.File.new_for_commandline_arg(uri);
@@ -141,7 +141,7 @@ const BackgroundLogoPrefsWidget = new Lang.Class({
                                                GdkPixbuf.InterpType.BILINEAR);
     },
 
-    _createLogoThumbnail: function(width, height) {
+    _createLogoThumbnail(width, height) {
         let filename = this._settings.get_string('logo-file');
         let file = Gio.File.new_for_commandline_arg(filename);
         let pixbuf = GdkPixbuf.Pixbuf.new_from_file(file.get_path());
@@ -152,7 +152,7 @@ const BackgroundLogoPrefsWidget = new Lang.Class({
                                          GdkPixbuf.InterpType.BILINEAR);
     },
 
-    _getLogoPosition: function(width, height) {
+    _getLogoPosition(width, height) {
         let scaledBorder = this._settings.get_uint('logo-border') * this._scale;
         let x, y;
         switch (this._settings.get_string('logo-position')) {
@@ -176,7 +176,7 @@ const BackgroundLogoPrefsWidget = new Lang.Class({
         return [x, y];
     },
 
-    _onScreenChanged: function() {
+    _onScreenChanged() {
         let screen = this.get_screen();
         if (!screen)
             return;

From e09b63d5c84b115bee6ce684e92f0ceb2ac93acd Mon Sep 17 00:00:00 2001
From: Florian Müllner <fmuellner@gnome.org>
Date: Feb 09 2019 04:09:45 +0000
Subject: [PATCH 3/6] cleanup: Use ES6 classes


ES6 finally adds standard class syntax to the language, so we can
replace our custom Lang.Class framework with the new syntax.

https://pagure.io/background-logo-extension/pull-request/10

---

diff --git a/extension.js b/extension.js
index 3c88803..9bef8ed 100644
--- a/extension.js
+++ b/extension.js
@@ -16,7 +16,6 @@
  */
 const Clutter = imports.gi.Clutter;
 const Gio = imports.gi.Gio;
-const Lang = imports.lang;
 const St = imports.gi.St;
 
 const Background = imports.ui.background;
@@ -28,10 +27,8 @@ const ExtensionUtils = imports.misc.extensionUtils;
 const Me = ExtensionUtils.getCurrentExtension();
 const Convenience = Me.imports.convenience;
 
-const BackgroundLogo = new Lang.Class({
-    Name: 'BackgroundLogo',
-
-    _init(bgManager) {
+class BackgroundLogo {
+    constructor(bgManager) {
         this._bgManager = bgManager;
 
         this._logoFile = null;
@@ -84,7 +81,7 @@ const BackgroundLogo = new Lang.Class({
         this._bgChangedId =
             bgManager.connect('changed', this._updateVisibility.bind(this));
         this._updateVisibility();
-    },
+    }
 
     _updateLogo() {
         let filename = this._settings.get_string('logo-file');
@@ -95,7 +92,7 @@ const BackgroundLogo = new Lang.Class({
         this._logoFile = file;
 
         this._updateLogoTexture();
-    },
+    }
 
     _updateLogoTexture() {
         if (this._icon)
@@ -110,7 +107,7 @@ const BackgroundLogo = new Lang.Class({
         this._icon.connect('allocation-changed',
                            this._updateScale.bind(this));
         this._bin.add_actor(this._icon);
-    },
+    }
 
     _updateScale() {
         if (this._icon.width == 0)
@@ -128,7 +125,7 @@ const BackgroundLogo = new Lang.Class({
             return;
         }
         this._icon.set_size(width, height);
-    },
+    }
 
     _updatePosition() {
         let xAlign, yAlign;
@@ -152,12 +149,12 @@ const BackgroundLogo = new Lang.Class({
         }
         this._bin.x_align = xAlign;
         this._bin.y_align = yAlign;
-    },
+    }
 
     _updateBorder() {
         let border = this._settings.get_uint('logo-border');
         this.actor.style = 'padding: %dpx;'.format(border);
-    },
+    }
 
     _updateVisibility() {
         let background = this._bgManager.backgroundActor.background._delegate;
@@ -179,7 +176,7 @@ const BackgroundLogo = new Lang.Class({
                            time: Background.FADE_ANIMATION_TIME,
                            transition: 'easeOutQuad'
                          });
-    },
+    }
 
     _backgroundDestroyed() {
         this._bgDestroyedId = 0;
@@ -190,7 +187,7 @@ const BackgroundLogo = new Lang.Class({
                                                         this._backgroundDestroyed.bind(this));
         else // bgManager destroyed
             this.actor.destroy();
-    },
+    }
 
     _onDestroy() {
         this._settings.run_dispose();
@@ -208,7 +205,7 @@ const BackgroundLogo = new Lang.Class({
 
         this._logoFile = null;
     }
-});
+}
 
 
 let monitorsChangedId = 0;
diff --git a/prefs.js b/prefs.js
index ced697c..828d789 100644
--- a/prefs.js
+++ b/prefs.js
@@ -2,10 +2,9 @@ const Gdk = imports.gi.Gdk;
 const GdkPixbuf = imports.gi.GdkPixbuf;
 const Gio = imports.gi.Gio;
 const GnomeDesktop = imports.gi.GnomeDesktop;
+const GObject = imports.gi.GObject;
 const Gtk = imports.gi.Gtk;
 
-const Lang = imports.lang;
-
 const ExtensionUtils = imports.misc.extensionUtils;
 const Me = ExtensionUtils.getCurrentExtension();
 const Convenience = Me.imports.convenience;
@@ -14,15 +13,15 @@ const BACKGROUND_SCHEMA = 'org.gnome.desktop.background';
 
 const PREVIEW_WIDTH = 400;
 
-const BackgroundLogoPrefsWidget = new Lang.Class({
-    Name: 'BackgroundLogoPrefsWidget',
-    Extends: Gtk.Grid,
-
+let BackgroundLogoPrefsWidget = GObject.registerClass(
+class BackgroundLogoPrefsWidget extends Gtk.Grid {
     _init() {
-        this.parent({ halign: Gtk.Align.CENTER,
-                      margin: 24,
-                      column_spacing: 12,
-                      row_spacing: 6 });
+        super._init({
+            halign: Gtk.Align.CENTER,
+            margin: 24,
+            column_spacing: 12,
+            row_spacing: 6
+        });
 
         this.connect('screen-changed', this._onScreenChanged.bind(this));
 
@@ -76,7 +75,7 @@ const BackgroundLogoPrefsWidget = new Lang.Class({
         this._settings.bind('logo-always-visible', checkWidget, 'active',
                             Gio.SettingsBindFlags.DEFAULT);
         this.attach(checkWidget, 1, 6, 1, 1);
-    },
+    }
 
     _addRow(row, label, widget) {
         let margin = 48;
@@ -91,7 +90,7 @@ const BackgroundLogoPrefsWidget = new Lang.Class({
         this.attach(new Gtk.Label({ label: label, xalign: 1.0,
                                     margin_start: margin }), 0, row, 1, 1);
         this.attach(widget, 1, row, 1, 1);
-    },
+    }
 
     _createAdjustment(key, step) {
         let schemaKey = this._settings.settings_schema.get_key(key);
@@ -104,7 +103,7 @@ const BackgroundLogoPrefsWidget = new Lang.Class({
                                        page_increment: 10 * step });
         this._settings.bind(key, adj, 'value', Gio.SettingsBindFlags.DEFAULT);
         return adj;
-    },
+    }
 
     _drawPreview(preview, cr) {
         let width = preview.get_allocated_width();
@@ -121,7 +120,7 @@ const BackgroundLogoPrefsWidget = new Lang.Class({
         let [x, y] = this._getLogoPosition(width, height);
         Gdk.cairo_set_source_pixbuf(cr, this._logo, x, y);
         cr.paintWithAlpha(this._settings.get_uint('logo-opacity') / 255.0);
-    },
+    }
 
     _createBackgroundThumbnail(width, height) {
         let settings = new Gio.Settings({ schema_id: BACKGROUND_SCHEMA });
@@ -139,7 +138,7 @@ const BackgroundLogoPrefsWidget = new Lang.Class({
         let pixbuf = GdkPixbuf.Pixbuf.new_from_file(file.get_path());
         this._background = pixbuf.scale_simple(width, height,
                                                GdkPixbuf.InterpType.BILINEAR);
-    },
+    }
 
     _createLogoThumbnail(width, height) {
         let filename = this._settings.get_string('logo-file');
@@ -150,7 +149,7 @@ const BackgroundLogoPrefsWidget = new Lang.Class({
         this._logo = pixbuf.scale_simple(size * width,
                                          size * width / ratio,
                                          GdkPixbuf.InterpType.BILINEAR);
-    },
+    }
 
     _getLogoPosition(width, height) {
         let scaledBorder = this._settings.get_uint('logo-border') * this._scale;
@@ -174,7 +173,7 @@ const BackgroundLogoPrefsWidget = new Lang.Class({
                 break;
         }
         return [x, y];
-    },
+    }
 
     _onScreenChanged() {
         let screen = this.get_screen();

From f2365757073d498fd1f754a1d3e0ca6e58b90753 Mon Sep 17 00:00:00 2001
From: Florian Müllner <fmuellner@gnome.org>
Date: Feb 09 2019 04:09:55 +0000
Subject: [PATCH 4/6] cleanup: Use Extension object


... instead of polluting the (module-)global namespace.

https://pagure.io/background-logo-extension/pull-request/10

---

diff --git a/extension.js b/extension.js
index 9bef8ed..5e3e459 100644
--- a/extension.js
+++ b/extension.js
@@ -208,45 +208,51 @@ class BackgroundLogo {
 }
 
 
-let monitorsChangedId = 0;
-let startupPreparedId = 0;
-let logos = [];
-
-function forEachBackgroundManager(func) {
-    Main.overview._bgManagers.forEach(func);
-    Main.layoutManager._bgManagers.forEach(func);
-}
+class Extension {
+    constructor() {
+        this._monitorsChangedId = 0;
+        this._startupPreparedId = 0;
+        this._logos = [];
+    }
 
-function addLogo() {
-    destroyLogo();
-    forEachBackgroundManager(function(bgManager) {
-        logos.push(new BackgroundLogo(bgManager));
-    });
-}
+    _forEachBackgroundManager(func) {
+        Main.overview._bgManagers.forEach(func);
+        Main.layoutManager._bgManagers.forEach(func);
+    }
 
-function destroyLogo() {
-    logos.forEach(function(l) { l.actor.destroy(); });
-    logos = [];
-}
+    _addLogo() {
+        this._destroyLogo();
+        this._forEachBackgroundManager(bgManager => {
+            this._logos.push(new BackgroundLogo(bgManager));
+        });
+    }
 
-function init() {
-}
+    _destroyLogo() {
+        this._logos.forEach(l => { l.actor.destroy(); });
+        this._logos = [];
+    }
 
-function enable() {
+    enable() {
+        this._monitorsChangedId =
+            Main.layoutManager.connect('monitors-changed', this._addLogo.bind(this));
+        this._startupPreparedId =
+            Main.layoutManager.connect('startup-prepared', this._addLogo.bind(this));
+        this._addLogo();
+    }
 
-    monitorsChangedId = Main.layoutManager.connect('monitors-changed', addLogo);
-    startupPreparedId = Main.layoutManager.connect('startup-prepared', addLogo);
-    addLogo();
-}
+    disable() {
+        if (this._monitorsChangedId)
+            Main.layoutManager.disconnect(this._monitorsChangedId);
+        this._monitorsChangedId = 0;
 
-function disable() {
-    if (monitorsChangedId)
-        Main.layoutManager.disconnect(monitorsChangedId);
-    monitorsChangedId = 0;
+        if (this._startupPreparedId)
+            Main.layoutManager.disconnect(this._startupPreparedId);
+        this._startupPreparedId = 0;
 
-    if (startupPreparedId)
-        Main.layoutManager.disconnect(startupPreparedId);
-    startupPreparedId = 0;
+        this._destroyLogo();
+    }
+}
 
-    destroyLogo();
+function init() {
+    return new Extension();
 }

From c62deee1dda520dcfe44546fb253a4565362ef51 Mon Sep 17 00:00:00 2001
From: Florian Müllner <fmuellner@gnome.org>
Date: Feb 09 2019 04:10:04 +0000
Subject: [PATCH 5/6] cleanup: Remove old compatibility code


3.14 is ancient at this point. If someone really really needs it,
old branches/versions are still around.

https://pagure.io/background-logo-extension/pull-request/10

---

diff --git a/extension.js b/extension.js
index 5e3e459..4330d10 100644
--- a/extension.js
+++ b/extension.js
@@ -99,11 +99,7 @@ class BackgroundLogo {
             this._icon.destroy();
 
         let scaleFactor = St.ThemeContext.get_for_stage(global.stage).scale_factor;
-        if (this._textureCache.load_file_async) { // > 3.14
-            this._icon = this._textureCache.load_file_async(this._logoFile, -1, -1, scaleFactor);
-        } else { // <= 3.14
-            this._icon = this._textureCache.load_uri_async(this._logoFile.get_uri(), -1, -1, scaleFactor);
-        }
+        this._icon = this._textureCache.load_file_async(this._logoFile, -1, -1, scaleFactor);
         this._icon.connect('allocation-changed',
                            this._updateScale.bind(this));
         this._bin.add_actor(this._icon);

From 700e647d70fed733bc9457c76c69d9676585cccf Mon Sep 17 00:00:00 2001
From: Florian Müllner <fmuellner@gnome.org>
Date: Feb 09 2019 04:10:12 +0000
Subject: [PATCH 6/6] cleanup: Use destructuring for imports


This is *much* nicer than repetitive "imports.gi" lines ...

https://pagure.io/background-logo-extension/pull-request/10

---

diff --git a/extension.js b/extension.js
index 4330d10..b06751d 100644
--- a/extension.js
+++ b/extension.js
@@ -14,9 +14,7 @@
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
-const Clutter = imports.gi.Clutter;
-const Gio = imports.gi.Gio;
-const St = imports.gi.St;
+const { Clutter, Gio, St } = imports.gi;
 
 const Background = imports.ui.background;
 const Layout = imports.ui.layout;
diff --git a/prefs.js b/prefs.js
index 828d789..4470e75 100644
--- a/prefs.js
+++ b/prefs.js
@@ -1,9 +1,4 @@
-const Gdk = imports.gi.Gdk;
-const GdkPixbuf = imports.gi.GdkPixbuf;
-const Gio = imports.gi.Gio;
-const GnomeDesktop = imports.gi.GnomeDesktop;
-const GObject = imports.gi.GObject;
-const Gtk = imports.gi.Gtk;
+const { Gdk, GdkPixbuf, Gio, GnomeDesktop, GObject, Gtk } = imports.gi;
 
 const ExtensionUtils = imports.misc.extensionUtils;
 const Me = ExtensionUtils.getCurrentExtension();

