Move all old shell versions compatibility code to a single file
This commit is contained in:
+30
-13
@@ -16,27 +16,44 @@ You should have received a copy of the GNU General Public License along with
|
|||||||
this program. If not, see <http s ://www.gnu.org/licenses/>.
|
this program. If not, see <http s ://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const Meta = imports.gi.Meta;
|
const { extensionUtils } = imports.misc;
|
||||||
|
const Me = extensionUtils.getCurrentExtension();
|
||||||
|
|
||||||
const shell_minor_version = parseInt(imports.misc.config.PACKAGE_VERSION.split('.')[1]);
|
const shell_minor_version = parseInt(imports.misc.config.PACKAGE_VERSION.split('.')[1]);
|
||||||
|
|
||||||
|
|
||||||
|
function init_translations(domain) {
|
||||||
|
if ( shell_minor_version <= 30 ) return Me.imports.convenience.initTranslations(domain);
|
||||||
|
else return extensionUtils.initTranslations(domain);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function extension_manager_initialized() {
|
||||||
|
if ( shell_minor_version > 32 ) return imports.ui.main.extensionManager._initialized;
|
||||||
|
else return imports.ui.extensionSystem.initted;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function extension_manager_lookup(uuid) {
|
||||||
|
if ( shell_minor_version > 32 ) return imports.ui.main.extensionManager.lookup(uuid);
|
||||||
|
else return extensionUtils.extensions[uuid] || null;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function get_extension_settings() {
|
||||||
|
if ( shell_minor_version <= 30 ) return Me.imports.convenience.getSettings();
|
||||||
|
else return extensionUtils.getSettings();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
function key_binding_auto_repeat() {
|
function key_binding_auto_repeat() {
|
||||||
// if version is less then 3.30 the keybinding flags are NONE
|
// if version is less then 3.30 the keybinding flags are NONE
|
||||||
if (shell_minor_version < 30) {
|
if (shell_minor_version < 30) return imports.gi.Meta.KeyBindingFlags.NONE;
|
||||||
return Meta.KeyBindingFlags.NONE;
|
else return imports.gi.Meta.KeyBindingFlags.IGNORE_AUTOREPEAT;
|
||||||
}
|
|
||||||
else {
|
|
||||||
return Meta.KeyBindingFlags.IGNORE_AUTOREPEAT;
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
function get_actor(subject) {
|
function get_actor(subject) {
|
||||||
if (shell_minor_version > 34) {
|
if (shell_minor_version > 34) return subject;
|
||||||
return subject;
|
else return subject.actor;
|
||||||
}
|
|
||||||
else {
|
|
||||||
return subject.actor;
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|||||||
+5
-18
@@ -23,6 +23,7 @@ const { main } = imports.ui;
|
|||||||
|
|
||||||
const Me = extensionUtils.getCurrentExtension();
|
const Me = extensionUtils.getCurrentExtension();
|
||||||
|
|
||||||
|
const compat = Me.imports.compat;
|
||||||
const { log_debug } = Me.imports.utils;
|
const { log_debug } = Me.imports.utils;
|
||||||
const { SettingsManager } = Me.imports.modules.SettingsManager;
|
const { SettingsManager } = Me.imports.modules.SettingsManager;
|
||||||
const { Timer } = Me.imports.modules.Timer;
|
const { Timer } = Me.imports.modules.Timer;
|
||||||
@@ -34,12 +35,6 @@ const { Backgrounder } = Me.imports.modules.Backgrounder;
|
|||||||
const { Commander } = Me.imports.modules.Commander;
|
const { Commander } = Me.imports.modules.Commander;
|
||||||
|
|
||||||
|
|
||||||
const shell_minor_version = parseInt(imports.misc.config.PACKAGE_VERSION.split('.')[1]);
|
|
||||||
if ( shell_minor_version <= 30 ) {
|
|
||||||
extensionUtils.initTranslations = Me.imports.convenience.initTranslations;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
var enabled = false;
|
var enabled = false;
|
||||||
var settingsManager = null;
|
var settingsManager = null;
|
||||||
var timer = null;
|
var timer = null;
|
||||||
@@ -53,7 +48,7 @@ var commander = null;
|
|||||||
|
|
||||||
function init() {
|
function init() {
|
||||||
log_debug('Initializing extension...');
|
log_debug('Initializing extension...');
|
||||||
extensionUtils.initTranslations(Me.metadata.uuid);
|
compat.init_translations(Me.metadata.uuid);
|
||||||
log_debug('Extension initialized.');
|
log_debug('Extension initialized.');
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -109,16 +104,8 @@ function disable() {
|
|||||||
|
|
||||||
async function _await_extensionManager_init() {
|
async function _await_extensionManager_init() {
|
||||||
log_debug('Waiting for the Extension Manager to be initialized...');
|
log_debug('Waiting for the Extension Manager to be initialized...');
|
||||||
if ( shell_minor_version > 32 ) {
|
while ( true ) {
|
||||||
while ( true ) {
|
if ( compat.extension_manager_initialized() ) return;
|
||||||
if ( main.extensionManager._initialized ) return;
|
await null;
|
||||||
await null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
while ( true ) {
|
|
||||||
if ( imports.ui.extensionSystem.initted ) return;
|
|
||||||
await null;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ this program. If not, see <http s ://www.gnu.org/licenses/>.
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
const { Gio, GLib } = imports.gi;
|
const { Gio, GLib } = imports.gi;
|
||||||
const { extensionUtils, fileUtils } = imports.misc;
|
const { extensionUtils } = imports.misc;
|
||||||
const Signals = imports.signals;
|
const Signals = imports.signals;
|
||||||
|
|
||||||
const Me = extensionUtils.getCurrentExtension();
|
const Me = extensionUtils.getCurrentExtension();
|
||||||
@@ -25,12 +25,6 @@ const Me = extensionUtils.getCurrentExtension();
|
|||||||
const { log_debug } = Me.imports.utils;
|
const { log_debug } = Me.imports.utils;
|
||||||
|
|
||||||
|
|
||||||
const shell_minor_version = parseInt(imports.misc.config.PACKAGE_VERSION.split('.')[1]);
|
|
||||||
if ( shell_minor_version <= 30 ) {
|
|
||||||
fileUtils.loadInterfaceXML = Me.imports.convenience.loadInterfaceXML;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
const COLOR_INTERFACE = `
|
const COLOR_INTERFACE = `
|
||||||
<node>
|
<node>
|
||||||
<interface name="org.gnome.SettingsDaemon.Color">
|
<interface name="org.gnome.SettingsDaemon.Color">
|
||||||
|
|||||||
@@ -21,22 +21,17 @@ const { extensionUtils } = imports.misc;
|
|||||||
|
|
||||||
const Me = extensionUtils.getCurrentExtension();
|
const Me = extensionUtils.getCurrentExtension();
|
||||||
|
|
||||||
|
const compat = Me.imports.compat;
|
||||||
const { SettingsPage, SettingsList, SettingsListRow } = Me.imports.preferences.bases;
|
const { SettingsPage, SettingsList, SettingsListRow } = Me.imports.preferences.bases;
|
||||||
|
|
||||||
const Gettext = imports.gettext.domain(Me.metadata.uuid);
|
const Gettext = imports.gettext.domain(Me.metadata.uuid);
|
||||||
const _ = Gettext.gettext;
|
const _ = Gettext.gettext;
|
||||||
|
|
||||||
|
|
||||||
const shell_minor_version = parseInt(imports.misc.config.PACKAGE_VERSION.split('.')[1]);
|
|
||||||
if ( shell_minor_version <= 30 ) {
|
|
||||||
extensionUtils.getSettings = Me.imports.convenience.getSettings;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
var BackgroundsPreferences = class {
|
var BackgroundsPreferences = class {
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
const settings = extensionUtils.getSettings();
|
const settings = compat.get_extension_settings();
|
||||||
|
|
||||||
const label = _('Backgrounds');
|
const label = _('Backgrounds');
|
||||||
const description = _('You can set different backgrounds for day and night.');
|
const description = _('You can set different backgrounds for day and night.');
|
||||||
@@ -71,7 +66,7 @@ var BackgroundsPreferences = class {
|
|||||||
class BackgroundsEnabledControl {
|
class BackgroundsEnabledControl {
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
const settings = extensionUtils.getSettings();
|
const settings = compat.get_extension_settings();
|
||||||
const toggle = new Gtk.Switch({
|
const toggle = new Gtk.Switch({
|
||||||
active: settings.get_boolean('backgrounds-enabled')
|
active: settings.get_boolean('backgrounds-enabled')
|
||||||
});
|
});
|
||||||
@@ -90,7 +85,7 @@ class BackgroundsEnabledControl {
|
|||||||
class TimeBackgroundControl {
|
class TimeBackgroundControl {
|
||||||
|
|
||||||
constructor(time) {
|
constructor(time) {
|
||||||
const settings = extensionUtils.getSettings();
|
const settings = compat.get_extension_settings();
|
||||||
|
|
||||||
const filter = new Gtk.FileFilter();
|
const filter = new Gtk.FileFilter();
|
||||||
filter.add_mime_type('image/jpeg');
|
filter.add_mime_type('image/jpeg');
|
||||||
|
|||||||
@@ -21,22 +21,17 @@ const { extensionUtils } = imports.misc;
|
|||||||
|
|
||||||
const Me = extensionUtils.getCurrentExtension();
|
const Me = extensionUtils.getCurrentExtension();
|
||||||
|
|
||||||
|
const compat = Me.imports.compat;
|
||||||
const { SettingsPage, SettingsList, SettingsListRow } = Me.imports.preferences.bases;
|
const { SettingsPage, SettingsList, SettingsListRow } = Me.imports.preferences.bases;
|
||||||
|
|
||||||
const Gettext = imports.gettext.domain(Me.metadata.uuid);
|
const Gettext = imports.gettext.domain(Me.metadata.uuid);
|
||||||
const _ = Gettext.gettext;
|
const _ = Gettext.gettext;
|
||||||
|
|
||||||
|
|
||||||
const shell_minor_version = parseInt(imports.misc.config.PACKAGE_VERSION.split('.')[1]);
|
|
||||||
if ( shell_minor_version <= 30 ) {
|
|
||||||
extensionUtils.getSettings = Me.imports.convenience.getSettings;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
var CommandsPreferences = class {
|
var CommandsPreferences = class {
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
const settings = extensionUtils.getSettings();
|
const settings = compat.get_extension_settings();
|
||||||
|
|
||||||
const label = _('Commands');
|
const label = _('Commands');
|
||||||
const description = _('You can set custom commands that will be run when the time of the day changes.');
|
const description = _('You can set custom commands that will be run when the time of the day changes.');
|
||||||
@@ -71,7 +66,7 @@ var CommandsPreferences = class {
|
|||||||
class CommandsEnabledControl {
|
class CommandsEnabledControl {
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
const settings = extensionUtils.getSettings();
|
const settings = compat.get_extension_settings();
|
||||||
const toggle = new Gtk.Switch({
|
const toggle = new Gtk.Switch({
|
||||||
active: settings.get_boolean('commands-enabled')
|
active: settings.get_boolean('commands-enabled')
|
||||||
});
|
});
|
||||||
@@ -94,7 +89,7 @@ class SuntimeCommandControl {
|
|||||||
['sunrise', _('Hello sunshine!')],
|
['sunrise', _('Hello sunshine!')],
|
||||||
['sunset', _('Hello moonshine!')]
|
['sunset', _('Hello moonshine!')]
|
||||||
]);
|
]);
|
||||||
const settings = extensionUtils.getSettings();
|
const settings = compat.get_extension_settings();
|
||||||
const entry = new Gtk.Entry({
|
const entry = new Gtk.Entry({
|
||||||
width_request: 300,
|
width_request: 300,
|
||||||
placeholder_text: _(`notify-send "${message.get(suntime)}"`)
|
placeholder_text: _(`notify-send "${message.get(suntime)}"`)
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ const { extensionUtils } = imports.misc;
|
|||||||
|
|
||||||
const Me = extensionUtils.getCurrentExtension();
|
const Me = extensionUtils.getCurrentExtension();
|
||||||
|
|
||||||
|
const compat = Me.imports.compat;
|
||||||
const { SettingsPage, SettingsList, SettingsListRow } = Me.imports.preferences.bases;
|
const { SettingsPage, SettingsList, SettingsListRow } = Me.imports.preferences.bases;
|
||||||
const { get_installed_cursor_themes } = Me.imports.utils;
|
const { get_installed_cursor_themes } = Me.imports.utils;
|
||||||
|
|
||||||
@@ -28,16 +29,10 @@ const Gettext = imports.gettext.domain(Me.metadata.uuid);
|
|||||||
const _ = Gettext.gettext;
|
const _ = Gettext.gettext;
|
||||||
|
|
||||||
|
|
||||||
const shell_minor_version = parseInt(imports.misc.config.PACKAGE_VERSION.split('.')[1]);
|
|
||||||
if ( shell_minor_version <= 30 ) {
|
|
||||||
extensionUtils.getSettings = Me.imports.convenience.getSettings;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
var CursorThemePreferences = class {
|
var CursorThemePreferences = class {
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
const settings = extensionUtils.getSettings();
|
const settings = compat.get_extension_settings();
|
||||||
|
|
||||||
const label = _('Cursor theme');
|
const label = _('Cursor theme');
|
||||||
const description = _('You can set different cursor themes for day and night.');
|
const description = _('You can set different cursor themes for day and night.');
|
||||||
@@ -72,7 +67,7 @@ var CursorThemePreferences = class {
|
|||||||
class CursorVariantsEnabledControl {
|
class CursorVariantsEnabledControl {
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
const settings = extensionUtils.getSettings();
|
const settings = compat.get_extension_settings();
|
||||||
const toggle = new Gtk.Switch({
|
const toggle = new Gtk.Switch({
|
||||||
active: settings.get_boolean('cursor-variants-enabled')
|
active: settings.get_boolean('cursor-variants-enabled')
|
||||||
});
|
});
|
||||||
@@ -91,7 +86,7 @@ class CursorVariantsEnabledControl {
|
|||||||
class TimeCursorVariantControl {
|
class TimeCursorVariantControl {
|
||||||
|
|
||||||
constructor(time) {
|
constructor(time) {
|
||||||
const settings = extensionUtils.getSettings();
|
const settings = compat.get_extension_settings();
|
||||||
const combo = new Gtk.ComboBoxText();
|
const combo = new Gtk.ComboBoxText();
|
||||||
const themes = Array.from(get_installed_cursor_themes()).sort();
|
const themes = Array.from(get_installed_cursor_themes()).sort();
|
||||||
themes.forEach(theme => combo.append(theme, theme));
|
themes.forEach(theme => combo.append(theme, theme));
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ const { extensionUtils } = imports.misc;
|
|||||||
|
|
||||||
const Me = extensionUtils.getCurrentExtension();
|
const Me = extensionUtils.getCurrentExtension();
|
||||||
|
|
||||||
|
const compat = Me.imports.compat;
|
||||||
const { SettingsPage, SettingsList, SettingsListRow } = Me.imports.preferences.bases;
|
const { SettingsPage, SettingsList, SettingsListRow } = Me.imports.preferences.bases;
|
||||||
const { get_installed_gtk_themes } = Me.imports.utils;
|
const { get_installed_gtk_themes } = Me.imports.utils;
|
||||||
|
|
||||||
@@ -28,16 +29,10 @@ const Gettext = imports.gettext.domain(Me.metadata.uuid);
|
|||||||
const _ = Gettext.gettext;
|
const _ = Gettext.gettext;
|
||||||
|
|
||||||
|
|
||||||
const shell_minor_version = parseInt(imports.misc.config.PACKAGE_VERSION.split('.')[1]);
|
|
||||||
if ( shell_minor_version <= 30 ) {
|
|
||||||
extensionUtils.getSettings = Me.imports.convenience.getSettings;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
var GtkThemePreferences = class {
|
var GtkThemePreferences = class {
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
const settings = extensionUtils.getSettings();
|
const settings = compat.get_extension_settings();
|
||||||
|
|
||||||
const label = _('GTK theme');
|
const label = _('GTK theme');
|
||||||
const description = _('The extension will try to automatically detect the day and night variants of your GTK theme.\n\nIf the theme you use isn\'t supported, please <a href="https://gitlab.com/rmnvgr/nightthemeswitcher-gnome-shell-extension/-/issues">submit a request</a>. You can also manually set variants.');
|
const description = _('The extension will try to automatically detect the day and night variants of your GTK theme.\n\nIf the theme you use isn\'t supported, please <a href="https://gitlab.com/rmnvgr/nightthemeswitcher-gnome-shell-extension/-/issues">submit a request</a>. You can also manually set variants.');
|
||||||
@@ -77,7 +72,7 @@ var GtkThemePreferences = class {
|
|||||||
class GtkVariantsEnabledControl {
|
class GtkVariantsEnabledControl {
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
const settings = extensionUtils.getSettings();
|
const settings = compat.get_extension_settings();
|
||||||
const toggle = new Gtk.Switch({
|
const toggle = new Gtk.Switch({
|
||||||
active: settings.get_boolean('gtk-variants-enabled')
|
active: settings.get_boolean('gtk-variants-enabled')
|
||||||
});
|
});
|
||||||
@@ -96,7 +91,7 @@ class GtkVariantsEnabledControl {
|
|||||||
class ManualGtkVariantsControl {
|
class ManualGtkVariantsControl {
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
const settings = extensionUtils.getSettings();
|
const settings = compat.get_extension_settings();
|
||||||
const toggle = new Gtk.Switch({
|
const toggle = new Gtk.Switch({
|
||||||
active: false
|
active: false
|
||||||
});
|
});
|
||||||
@@ -115,7 +110,7 @@ class ManualGtkVariantsControl {
|
|||||||
class TimeGtkVariantControl {
|
class TimeGtkVariantControl {
|
||||||
|
|
||||||
constructor(time) {
|
constructor(time) {
|
||||||
const settings = extensionUtils.getSettings();
|
const settings = compat.get_extension_settings();
|
||||||
const combo = new Gtk.ComboBoxText();
|
const combo = new Gtk.ComboBoxText();
|
||||||
const themes = Array.from(get_installed_gtk_themes()).sort();
|
const themes = Array.from(get_installed_gtk_themes()).sort();
|
||||||
themes.forEach(theme => combo.append(theme, theme));
|
themes.forEach(theme => combo.append(theme, theme));
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ const { extensionUtils } = imports.misc;
|
|||||||
|
|
||||||
const Me = extensionUtils.getCurrentExtension();
|
const Me = extensionUtils.getCurrentExtension();
|
||||||
|
|
||||||
|
const compat = Me.imports.compat;
|
||||||
const { SettingsPage, SettingsList, SettingsListRow } = Me.imports.preferences.bases;
|
const { SettingsPage, SettingsList, SettingsListRow } = Me.imports.preferences.bases;
|
||||||
const { get_installed_icon_themes } = Me.imports.utils;
|
const { get_installed_icon_themes } = Me.imports.utils;
|
||||||
|
|
||||||
@@ -28,16 +29,10 @@ const Gettext = imports.gettext.domain(Me.metadata.uuid);
|
|||||||
const _ = Gettext.gettext;
|
const _ = Gettext.gettext;
|
||||||
|
|
||||||
|
|
||||||
const shell_minor_version = parseInt(imports.misc.config.PACKAGE_VERSION.split('.')[1]);
|
|
||||||
if ( shell_minor_version <= 30 ) {
|
|
||||||
extensionUtils.getSettings = Me.imports.convenience.getSettings;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
var IconThemePreferences = class {
|
var IconThemePreferences = class {
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
const settings = extensionUtils.getSettings();
|
const settings = compat.get_extension_settings();
|
||||||
|
|
||||||
const label = _('Icon theme');
|
const label = _('Icon theme');
|
||||||
const description = _('You can set different icon themes for day and night.');
|
const description = _('You can set different icon themes for day and night.');
|
||||||
@@ -72,7 +67,7 @@ var IconThemePreferences = class {
|
|||||||
class IconVariantsEnabledControl {
|
class IconVariantsEnabledControl {
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
const settings = extensionUtils.getSettings();
|
const settings = compat.get_extension_settings();
|
||||||
const toggle = new Gtk.Switch({
|
const toggle = new Gtk.Switch({
|
||||||
active: settings.get_boolean('icon-variants-enabled')
|
active: settings.get_boolean('icon-variants-enabled')
|
||||||
});
|
});
|
||||||
@@ -91,7 +86,7 @@ class IconVariantsEnabledControl {
|
|||||||
class TimeIconVariantControl {
|
class TimeIconVariantControl {
|
||||||
|
|
||||||
constructor(time) {
|
constructor(time) {
|
||||||
const settings = extensionUtils.getSettings();
|
const settings = compat.get_extension_settings();
|
||||||
const combo = new Gtk.ComboBoxText();
|
const combo = new Gtk.ComboBoxText();
|
||||||
const themes = Array.from(get_installed_icon_themes()).sort();
|
const themes = Array.from(get_installed_icon_themes()).sort();
|
||||||
themes.forEach(theme => combo.append(theme, theme));
|
themes.forEach(theme => combo.append(theme, theme));
|
||||||
|
|||||||
@@ -21,22 +21,17 @@ const { extensionUtils } = imports.misc;
|
|||||||
|
|
||||||
const Me = extensionUtils.getCurrentExtension();
|
const Me = extensionUtils.getCurrentExtension();
|
||||||
|
|
||||||
|
const compat = Me.imports.compat;
|
||||||
const { SettingsPage, SettingsList, SettingsListRow } = Me.imports.preferences.bases;
|
const { SettingsPage, SettingsList, SettingsListRow } = Me.imports.preferences.bases;
|
||||||
|
|
||||||
const Gettext = imports.gettext.domain(Me.metadata.uuid);
|
const Gettext = imports.gettext.domain(Me.metadata.uuid);
|
||||||
const _ = Gettext.gettext;
|
const _ = Gettext.gettext;
|
||||||
|
|
||||||
|
|
||||||
const shell_minor_version = parseInt(imports.misc.config.PACKAGE_VERSION.split('.')[1]);
|
|
||||||
if ( shell_minor_version <= 30 ) {
|
|
||||||
extensionUtils.getSettings = Me.imports.convenience.getSettings;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
var SchedulePreferences = class {
|
var SchedulePreferences = class {
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
const settings = extensionUtils.getSettings();
|
const settings = compat.get_extension_settings();
|
||||||
|
|
||||||
const label = _('Schedule');
|
const label = _('Schedule');
|
||||||
const description = _('The extension will try to use Night Light or Location Services to automatically set your current sunrise and sunset times if they are enabled.\n\nIf you prefer, you can manually choose a time source.');
|
const description = _('The extension will try to use Night Light or Location Services to automatically set your current sunrise and sunset times if they are enabled.\n\nIf you prefer, you can manually choose a time source.');
|
||||||
@@ -82,7 +77,7 @@ var SchedulePreferences = class {
|
|||||||
class ManualTimeSourceControl {
|
class ManualTimeSourceControl {
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
const settings = extensionUtils.getSettings();
|
const settings = compat.get_extension_settings();
|
||||||
const toggle = new Gtk.Switch({
|
const toggle = new Gtk.Switch({
|
||||||
active: false
|
active: false
|
||||||
});
|
});
|
||||||
@@ -101,7 +96,7 @@ class ManualTimeSourceControl {
|
|||||||
class TimeSourceControl {
|
class TimeSourceControl {
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
const settings = extensionUtils.getSettings();
|
const settings = compat.get_extension_settings();
|
||||||
const colorSettings = new Gio.Settings({ schema: 'org.gnome.settings-daemon.plugins.color' });
|
const colorSettings = new Gio.Settings({ schema: 'org.gnome.settings-daemon.plugins.color' });
|
||||||
const locationSettings = new Gio.Settings({ schema: 'org.gnome.system.location' });
|
const locationSettings = new Gio.Settings({ schema: 'org.gnome.system.location' });
|
||||||
|
|
||||||
@@ -189,7 +184,7 @@ class TimeSourceControl {
|
|||||||
class KeyBindingControl {
|
class KeyBindingControl {
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
const settings = extensionUtils.getSettings();
|
const settings = compat.get_extension_settings();
|
||||||
const KEYBINDING_KEY = 'nightthemeswitcher-ondemand-keybinding';
|
const KEYBINDING_KEY = 'nightthemeswitcher-ondemand-keybinding';
|
||||||
const COLUMN_KEY = 0;
|
const COLUMN_KEY = 0;
|
||||||
const COLUMN_MODS = 1;
|
const COLUMN_MODS = 1;
|
||||||
@@ -239,7 +234,7 @@ class KeyBindingControl {
|
|||||||
class SuntimeControl {
|
class SuntimeControl {
|
||||||
|
|
||||||
constructor(suntime) {
|
constructor(suntime) {
|
||||||
const settings = extensionUtils.getSettings();
|
const settings = compat.get_extension_settings();
|
||||||
const box = new Gtk.Box({
|
const box = new Gtk.Box({
|
||||||
spacing: 8,
|
spacing: 8,
|
||||||
orientation: Gtk.Orientation.HORIZONTAL,
|
orientation: Gtk.Orientation.HORIZONTAL,
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ const { extensionUtils } = imports.misc;
|
|||||||
|
|
||||||
const Me = extensionUtils.getCurrentExtension();
|
const Me = extensionUtils.getCurrentExtension();
|
||||||
|
|
||||||
|
const compat = Me.imports.compat;
|
||||||
const { SettingsPage, SettingsList, SettingsListRow } = Me.imports.preferences.bases;
|
const { SettingsPage, SettingsList, SettingsListRow } = Me.imports.preferences.bases;
|
||||||
const { get_installed_shell_themes } = Me.imports.utils;
|
const { get_installed_shell_themes } = Me.imports.utils;
|
||||||
|
|
||||||
@@ -28,16 +29,10 @@ const Gettext = imports.gettext.domain(Me.metadata.uuid);
|
|||||||
const _ = Gettext.gettext;
|
const _ = Gettext.gettext;
|
||||||
|
|
||||||
|
|
||||||
const shell_minor_version = parseInt(imports.misc.config.PACKAGE_VERSION.split('.')[1]);
|
|
||||||
if ( shell_minor_version <= 30 ) {
|
|
||||||
extensionUtils.getSettings = Me.imports.convenience.getSettings;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
var ShellThemePreferences = class {
|
var ShellThemePreferences = class {
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
const settings = extensionUtils.getSettings();
|
const settings = compat.get_extension_settings();
|
||||||
|
|
||||||
const label = _('Shell theme');
|
const label = _('Shell theme');
|
||||||
const description = _('The extension will try to automatically detect the day and night variants of your GNOME Shell theme.\n\nIf the theme you use isn\'t supported, please <a href="https://gitlab.com/rmnvgr/nightthemeswitcher-gnome-shell-extension/-/issues">submit a request</a>. You can also manually set variants.');
|
const description = _('The extension will try to automatically detect the day and night variants of your GNOME Shell theme.\n\nIf the theme you use isn\'t supported, please <a href="https://gitlab.com/rmnvgr/nightthemeswitcher-gnome-shell-extension/-/issues">submit a request</a>. You can also manually set variants.');
|
||||||
@@ -77,7 +72,7 @@ var ShellThemePreferences = class {
|
|||||||
class ShellVariantsEnabledControl {
|
class ShellVariantsEnabledControl {
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
const settings = extensionUtils.getSettings();
|
const settings = compat.get_extension_settings();
|
||||||
const toggle = new Gtk.Switch({
|
const toggle = new Gtk.Switch({
|
||||||
active: settings.get_boolean('shell-variants-enabled')
|
active: settings.get_boolean('shell-variants-enabled')
|
||||||
});
|
});
|
||||||
@@ -96,7 +91,7 @@ class ShellVariantsEnabledControl {
|
|||||||
class ManualShellVariantsControl {
|
class ManualShellVariantsControl {
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
const settings = extensionUtils.getSettings();
|
const settings = compat.get_extension_settings();
|
||||||
const toggle = new Gtk.Switch({
|
const toggle = new Gtk.Switch({
|
||||||
active: false
|
active: false
|
||||||
});
|
});
|
||||||
@@ -115,7 +110,7 @@ class ManualShellVariantsControl {
|
|||||||
class TimeShellVariantControl {
|
class TimeShellVariantControl {
|
||||||
|
|
||||||
constructor(time) {
|
constructor(time) {
|
||||||
const settings = extensionUtils.getSettings();
|
const settings = compat.get_extension_settings();
|
||||||
const combo = new Gtk.ComboBoxText();
|
const combo = new Gtk.ComboBoxText();
|
||||||
const themes = Array.from(get_installed_shell_themes()).sort();
|
const themes = Array.from(get_installed_shell_themes()).sort();
|
||||||
themes.forEach(theme => combo.append(theme, (theme === '' ? _('Default') : theme)));
|
themes.forEach(theme => combo.append(theme, (theme === '' ? _('Default') : theme)));
|
||||||
|
|||||||
+2
-7
@@ -23,6 +23,7 @@ const { extensionUtils } = imports.misc;
|
|||||||
|
|
||||||
const Me = extensionUtils.getCurrentExtension();
|
const Me = extensionUtils.getCurrentExtension();
|
||||||
|
|
||||||
|
const compat = Me.imports.compat;
|
||||||
const { BackgroundsPreferences } = Me.imports.preferences.Backgrounds;
|
const { BackgroundsPreferences } = Me.imports.preferences.Backgrounds;
|
||||||
const { CommandsPreferences } = Me.imports.preferences.Commands;
|
const { CommandsPreferences } = Me.imports.preferences.Commands;
|
||||||
const { CursorThemePreferences } = Me.imports.preferences.CursorTheme;
|
const { CursorThemePreferences } = Me.imports.preferences.CursorTheme;
|
||||||
@@ -32,14 +33,8 @@ const { SchedulePreferences } = Me.imports.preferences.Schedule;
|
|||||||
const { ShellThemePreferences } = Me.imports.preferences.ShellTheme;
|
const { ShellThemePreferences } = Me.imports.preferences.ShellTheme;
|
||||||
|
|
||||||
|
|
||||||
const shell_minor_version = parseInt(imports.misc.config.PACKAGE_VERSION.split('.')[1]);
|
|
||||||
if ( shell_minor_version <= 30 ) {
|
|
||||||
extensionUtils.initTranslations = Me.imports.convenience.initTranslations;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
function init() {
|
function init() {
|
||||||
extensionUtils.initTranslations(Me.metadata.uuid);
|
compat.init_translations(Me.metadata.uuid);
|
||||||
}
|
}
|
||||||
|
|
||||||
function buildPrefsWidget() {
|
function buildPrefsWidget() {
|
||||||
|
|||||||
+2
-6
@@ -20,6 +20,7 @@ const { Gio, GLib, Gtk } = imports.gi;
|
|||||||
const { extensionUtils } = imports.misc;
|
const { extensionUtils } = imports.misc;
|
||||||
|
|
||||||
const Me = extensionUtils.getCurrentExtension();
|
const Me = extensionUtils.getCurrentExtension();
|
||||||
|
const compat = Me.imports.compat;
|
||||||
const config = Me.imports.config;
|
const config = Me.imports.config;
|
||||||
|
|
||||||
const Gettext = imports.gettext.domain(Me.metadata.uuid);
|
const Gettext = imports.gettext.domain(Me.metadata.uuid);
|
||||||
@@ -178,12 +179,7 @@ function get_installed_cursor_themes() {
|
|||||||
* it isn't installed.
|
* it isn't installed.
|
||||||
*/
|
*/
|
||||||
function get_userthemes_extension() {
|
function get_userthemes_extension() {
|
||||||
if ( shell_minor_version > 32 ) {
|
return compat.extension_manager_lookup('user-theme@gnome-shell-extensions.gcampax.github.com');
|
||||||
return imports.ui.main.extensionManager.lookup('user-theme@gnome-shell-extensions.gcampax.github.com');
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return extensionUtils.extensions['user-theme@gnome-shell-extensions.gcampax.github.com'] || null;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user