From e470e2f40dfeaf767bb61e8f9bbd2ea18bfac709 Mon Sep 17 00:00:00 2001 From: abakkk Date: Sat, 20 Feb 2021 00:01:08 +0100 Subject: [PATCH] fixes for old GS versions --- extension.js | 2 +- prefs.js | 9 +++++---- shortcuts.js | 2 +- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/extension.js b/extension.js index 3b96f5c..2535a5e 100644 --- a/extension.js +++ b/extension.js @@ -171,7 +171,7 @@ const AreaManager = new Lang.Class({ let loadPersistent = i == Main.layoutManager.primaryIndex && this.persistentOverRestarts; // Some utils for the drawing area menus. let areaManagerUtils = { - getHiddenList: () => this.hiddenList, + getHiddenList: () => this.hiddenList || null, togglePanelAndDockOpacity: this.togglePanelAndDockOpacity.bind(this), openPreferences: this.openPreferences.bind(this) }; diff --git a/prefs.js b/prefs.js index 3b7f9f5..2c93299 100644 --- a/prefs.js +++ b/prefs.js @@ -26,7 +26,7 @@ const Gio = imports.gi.Gio; const GLib = imports.gi.GLib; const GObject = imports.gi.GObject; const Gtk = imports.gi.Gtk; -const IS_GTK3 = imports.gi.versions.Gtk == 3; +const IS_GTK3 = Gtk.get_major_version() == 3; const ExtensionUtils = imports.misc.extensionUtils; const Me = ExtensionUtils.getCurrentExtension(); @@ -72,7 +72,7 @@ const getChildrenOf = function(widget) { let i = 0; let children = []; let child; - while (child = listModel.get_item(i)) { + while (!!(child = listModel.get_item(i))) { children.push(child); i++; } @@ -107,7 +107,8 @@ const TopStack = new GObject.Class({ Extends: Gtk.Stack, _init: function(params) { - this.parent({ transition_type: Gtk.StackTransitionType.CROSSFADE, transition_duration: 500 }); + this.parent({ transition_type: Gtk.StackTransitionType.CROSSFADE, transition_duration: 500, hexpand: true, vexpand: true }); + this.prefsPage = new PrefsPage(); // Translators: "Preferences" page in preferences this.add_titled(this.prefsPage, 'prefs', _("Preferences")); @@ -710,7 +711,7 @@ const FileChooserButton = new GObject.Class({ }, set location(location) { - if (this._location != location) { + if (!this._location || this._location != location) { this._location = location; this.label = location ? Gio.File.new_for_commandline_arg(location).query_info('standard::display-name', Gio.FileQueryInfoFlags.NONE, null).get_display_name() : diff --git a/shortcuts.js b/shortcuts.js index 73ef95b..9b3b5c2 100644 --- a/shortcuts.js +++ b/shortcuts.js @@ -22,7 +22,7 @@ */ const Gtk = imports.gi.Gtk; -const IS_GTK3 = imports.gi.versions.Gtk == 3; +const IS_GTK3 = Gtk.get_major_version() == 3; const GS_VERSION = imports.misc.config.PACKAGE_VERSION; const ExtensionUtils = imports.misc.extensionUtils;