diff --git a/metadata.json b/metadata.json index 2c3803e..76964f8 100644 --- a/metadata.json +++ b/metadata.json @@ -5,6 +5,8 @@ "gettext-domain": "burn-my-windows", "settings-schema": "org.gnome.shell.extensions.burn-my-windows", "shell-version": [ + "3.36", + "3.38", "40", "41" ], diff --git a/prefs.js b/prefs.js index 85b9e80..1d35945 100644 --- a/prefs.js +++ b/prefs.js @@ -34,7 +34,7 @@ var PreferencesDialog = class PreferencesDialog { // Load the user interface file. this._builder = new Gtk.Builder(); - this._builder.add_from_resource(`/ui/settings.ui`); + this._builder.add_from_resource(`/ui/${utils.gtk4() ? "gtk4" : "gtk3"}.ui`); // This is our top-level widget which we will return later. this._widget = this._builder.get_object('settings-widget'); @@ -70,6 +70,11 @@ var PreferencesDialog = class PreferencesDialog { // Unregister our resources. Gio.resources_unregister(this._resources); }); + + // Show the widgets on GTK3. + if (!utils.gtk4()) { + this._widget.show_all(); + } } // -------------------------------------------------------------------- public interface @@ -210,7 +215,9 @@ var PreferencesDialog = class PreferencesDialog { }); this._builder.get_object('fire-preset-button').set_menu_model(menu); - widget.get_root().insert_action_group(groupName, group); + + const root = utils.gtk4() ? widget.get_root() : widget.get_toplevel(); + root.insert_action_group(groupName, group); }); } } diff --git a/resources/ui/gtk3.ui b/resources/ui/gtk3.ui new file mode 100644 index 0000000..b45ec41 --- /dev/null +++ b/resources/ui/gtk3.ui @@ -0,0 +1,342 @@ + + + + + + 10000 + 500 + 10 + 100 + + + + 3 + 0.1 + 0.01 + 0.1 + + + + 2.0 + -2.0 + 0.01 + 0.1 + + + + never + 200 + 0 + 1 + + + + + vertical + 60 + 60 + 30 + 30 + + + + 30 + 10 + General Options + 0 + + + + + + + + + + none + + + + 10 + 10 + 10 + 10 + 0 + + + 8 + + + Animation Time [ms] + 0 + start + center + 1 + + + + + end + center + 1 + 0 + left + 300 + destroy-animation-time + + + + + + + edit-clear-symbolic + 1 + + + Reset to Default Value + + + + + + + + + + + + + + + + + 30 + 10 + + + Fire Options + 0 + 1 + + + + + + none + + + 8 + + + Choose a Preset + + + + + pan-down-symbolic + 1 + + + + + + + + + + + + + + none + + + + + 10 + 10 + 10 + 10 + 0 + + + 8 + + + Flame Scale + 0 + start + center + 1 + + + + + end + center + 1 + 2 + left + 300 + flame-scale + + + + + + + edit-clear-symbolic + 1 + + + Reset to Default Value + + + + + + + + + + + 10 + 10 + 10 + 10 + 0 + + + 8 + + + Flame Movement Speed + 0 + start + center + 1 + + + + + end + center + 1 + 2 + left + 300 + flame-movement-speed + + + + + + + edit-clear-symbolic + 1 + + + Reset to Default Value + + + + + + + + + + + 10 + 10 + 10 + 10 + 0 + + + + 8 + + + Fire Gradient + 0 + start + center + 1 + + + + + 1 + 1 + + + + + 1 + 1 + + + + + 1 + 1 + + + + + 1 + 1 + + + + + 1 + 1 + + + + + + + edit-clear-symbolic + 1 + + + Reset to Default Value + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/resources/ui/settings.ui b/resources/ui/gtk4.ui similarity index 100% rename from resources/ui/settings.ui rename to resources/ui/gtk4.ui diff --git a/utils.js b/utils.js index e94953c..b661814 100644 --- a/utils.js +++ b/utils.js @@ -13,6 +13,8 @@ 'use strict'; +const {Gtk} = imports.gi; + const ExtensionUtils = imports.misc.extensionUtils; const Me = imports.misc.extensionUtils.getCurrentExtension(); @@ -35,3 +37,8 @@ function debug(message) { log('[' + stack[0].slice(extensionRoot) + '] ' + message); } + +// This method simply returns true if we are currently using GTK4. +function gtk4() { + return Gtk.get_major_version() == 4; +}