From a3571e3879306ecdddc10271441c63008c4ac44c Mon Sep 17 00:00:00 2001 From: Simon Schneegans Date: Sat, 8 Jan 2022 13:05:17 +0100 Subject: [PATCH 01/30] :lipstick: Use GtkStackSidebar for settings (Gtk3 port still pending) --- prefs.js | 2 +- resources/ui/{gtk3.ui => gtk3/prefs.ui} | 8 +- resources/ui/gtk4.ui | 948 ----------------------- resources/ui/gtk4/prefs.ui | 981 ++++++++++++++++++++++++ 4 files changed, 984 insertions(+), 955 deletions(-) rename resources/ui/{gtk3.ui => gtk3/prefs.ui} (99%) delete mode 100644 resources/ui/gtk4.ui create mode 100644 resources/ui/gtk4/prefs.ui diff --git a/prefs.js b/prefs.js index 9dc4ae4..d39d906 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/${utils.isGTK4() ? 'gtk4' : 'gtk3'}.ui`); + this._builder.add_from_resource(`/ui/${utils.isGTK4() ? 'gtk4' : 'gtk3'}/prefs.ui`); // This is our top-level widget which we will return later. this._widget = this._builder.get_object('settings-widget'); diff --git a/resources/ui/gtk3.ui b/resources/ui/gtk3/prefs.ui similarity index 99% rename from resources/ui/gtk3.ui rename to resources/ui/gtk3/prefs.ui index a99b1c7..e02b59d 100644 --- a/resources/ui/gtk3.ui +++ b/resources/ui/gtk3/prefs.ui @@ -96,13 +96,9 @@ 0.1 - - never - 200 - 0 - 1 + - + vertical diff --git a/resources/ui/gtk4.ui b/resources/ui/gtk4.ui deleted file mode 100644 index 20b4805..0000000 --- a/resources/ui/gtk4.ui +++ /dev/null @@ -1,948 +0,0 @@ - - - - - - - - - - - - Fire - fire - - - Matrix - matrix - - - TV Effect - tv - - - T-Rex Attack - trex - - - - - -
- - Visit Homepage - prefs.homepage - - - View Changelog - prefs.changelog - - - Report a Bug - prefs.bugs - -
-
- - Donate - - Via PayPal - prefs.donate-paypal - - - Via GitHub - prefs.donate-github - - -
-
- - - main-menu - open-menu-symbolic - - - - never - 200 - 0 - 1 - - - 1 - - - vertical - 60 - 60 - 30 - 30 - - - - 30 - 10 - General Options - 0 - - - - - - - - - - none - 1 - - - - - - 0 - - - - - Close Window Animation - 0 - start - center - 1 - - - - - center - animation-mode-list - 1 - fire - - - - 0 - - - - - - - edit-clear-symbolic - Reset to Default Value - - - - - - - - - - - 0 - - - - - Animation Time [ms] - 0 - start - center - 1 - - - - - end - center - 1 - 0 - left - 300 - - - 10000 - 500 - 10 - 100 - - - - - - - edit-clear-symbolic - Reset to Default Value - - - - - - - - - - - 0 - - - - - Also Burn Dialogs - 0 - start - center - 1 - - - - - end - center - - - - - edit-clear-symbolic - Reset to Default Value - - - - - - - - - - - - - - - - - 30 - 10 - - - Fire Animation Options - 0 - 1 - - - - - - Choose a Preset - 0 - - - - - - - - - - none - 1 - - - - - 0 - - - - - Scale - 0 - start - center - 1 - - - - - end - center - 1 - 2 - left - 300 - - - 3 - 0.1 - 0.01 - 0.1 - - - - - - - edit-clear-symbolic - Reset to Default Value - - - - - - - - - - - 0 - - - - - Speed - 0 - start - center - 1 - - - - - end - center - 1 - 2 - left - 300 - - - 2.0 - -2.0 - 0.01 - 0.1 - - - - - - - edit-clear-symbolic - Reset to Default Value - - - - - - - - - - - 0 - - - - - vertical - 3 - - - 3D Noise - 0 - start - center - 1 - - - - - Creates a more dynamic fire but requires more GPU power. - 0 - start - center - 1 - - - - - - - - end - center - - - - - edit-clear-symbolic - Reset to Default Value - - - - - - - - - - - 0 - - - - - Gradient - 0 - start - center - 1 - - - - - 1 - 1 - - - - - 1 - 1 - - - - - 1 - 1 - - - - - 1 - 1 - - - - - 1 - 1 - - - - - edit-clear-symbolic - Reset to Default Value - - - - - - - - - - - - - - - - - 30 - 10 - - - Matrix Animation Options - 0 - 1 - - - - - - - - - - - none - 1 - - - - - 0 - - - - - Scale - 0 - start - center - 1 - - - - - end - center - 1 - 0 - left - 300 - - - 50 - 5 - 1 - 5 - - - - - - - edit-clear-symbolic - Reset to Default Value - - - - - - - - - - - 0 - - - - - Randomness - 0 - start - center - 1 - - - - - end - center - 1 - 2 - left - 300 - - - 1.0 - 0.0 - 0.01 - 0.1 - - - - - - - edit-clear-symbolic - Reset to Default Value - - - - - - - - - - - 0 - - - - - Trail Color - 0 - start - center - 1 - - - - - 0 - 1 - - - - - edit-clear-symbolic - Reset to Default Value - - - - - - - - - - - 0 - - - - - Tip Color - 0 - start - center - 1 - - - - - 0 - 1 - - - - - edit-clear-symbolic - Reset to Default Value - - - - - - - - - - - - - - - - - - 30 - 10 - - - T-Rex Attack Options - 0 - 1 - - - - - - - - - - - none - 1 - - - - - 0 - - - - - Claw Scratch Scale - 0 - start - center - 1 - - - - - end - center - 1 - 1 - left - 300 - - - 10 - 0.1 - 0.1 - 1 - - - - - - - edit-clear-symbolic - Reset to Default Value - - - - - - - - - - - 0 - - - - - Claw Scratch Count - 0 - start - center - 1 - - - - - end - center - 1 - 0 - left - 300 - - - 50 - 1 - 1 - 10 - - - - - - - edit-clear-symbolic - Reset to Default Value - - - - - - - - - - - 0 - - - - - Warp Effect - 0 - start - center - 1 - - - - - end - center - 1 - 2 - left - 300 - - - 1 - 0 - 0.01 - 0.1 - - - - - - - edit-clear-symbolic - Reset to Default Value - - - - - - - - - - - 0 - - - - - Flash Color - 0 - start - center - 1 - - - - - 1 - 1 - - - - - edit-clear-symbolic - Reset to Default Value - - - - - - - - - - - - - - - - - 30 - 10 - - - TV Effect Options - 0 - 1 - - - - - - - - - - - none - 1 - - - - - 0 - - - - - Color - 0 - start - center - 1 - - - - - 0 - 1 - - - - - edit-clear-symbolic - Reset to Default Value - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/resources/ui/gtk4/prefs.ui b/resources/ui/gtk4/prefs.ui new file mode 100644 index 0000000..857d2f8 --- /dev/null +++ b/resources/ui/gtk4/prefs.ui @@ -0,0 +1,981 @@ + + + + + + + + + + + + Fire + fire + + + Matrix + matrix + + + TV Effect + tv + + + T-Rex Attack + trex + + + + + +
+ + Visit Homepage + prefs.homepage + + + View Changelog + prefs.changelog + + + Report a Bug + prefs.bugs + +
+
+ + Donate + + Via PayPal + prefs.donate-paypal + + + Via GitHub + prefs.donate-github + + +
+
+ + + main-menu + open-menu-symbolic + + + + + + main-stack + + + + + slide-up-down + 1 + + + + General Options + + + + vertical + 60 + 60 + 60 + 60 + + + + + + none + 1 + + + + + + 0 + + + + + Close Window Animation + 0 + start + center + 1 + + + + + center + animation-mode-list + 1 + fire + + + + 0 + + + + + + + edit-clear-symbolic + Reset to Default Value + + + + + + + + + + + 0 + + + + + Animation Time [ms] + 0 + start + center + 1 + + + + + end + center + 1 + 0 + left + 300 + + + 10000 + 500 + 10 + 100 + + + + + + + edit-clear-symbolic + Reset to Default Value + + + + + + + + + + + 0 + + + + + Also Burn Dialogs + 0 + start + center + 1 + + + + + end + center + + + + + edit-clear-symbolic + Reset to Default Value + + + + + + + + + + + + + + + + + + + + + + Fire + + + + vertical + 60 + 60 + 60 + 60 + + + + 20 + + + none + 1 + + + + + 0 + + + + + Presets + 0 + start + center + 1 + + + + + Choose a Preset + 0 + + + + + + + + + + + + + + + + + none + 1 + + + + + 0 + + + + + Scale + 0 + start + center + 1 + + + + + end + center + 1 + 2 + left + 300 + + + 3 + 0.1 + 0.01 + 0.1 + + + + + + + edit-clear-symbolic + Reset to Default Value + + + + + + + + + + + 0 + + + + + Speed + 0 + start + center + 1 + + + + + end + center + 1 + 2 + left + 300 + + + 2.0 + -2.0 + 0.01 + 0.1 + + + + + + + edit-clear-symbolic + Reset to Default Value + + + + + + + + + + + 0 + + + + + vertical + 3 + + + 3D Noise + 0 + start + center + 1 + + + + + Creates a more dynamic fire but requires more GPU power. + 0 + start + center + 1 + + + + + + + + end + center + + + + + edit-clear-symbolic + Reset to Default Value + + + + + + + + + + + 0 + + + + + Gradient + 0 + start + center + 1 + + + + + 1 + 1 + + + + + 1 + 1 + + + + + 1 + 1 + + + + + 1 + 1 + + + + + 1 + 1 + + + + + edit-clear-symbolic + Reset to Default Value + + + + + + + + + + + + + + + + + + + + + + + Matrix + + + + vertical + 60 + 60 + 60 + 60 + + + + + + none + 1 + + + + + 0 + + + + + Scale + 0 + start + center + 1 + + + + + end + center + 1 + 0 + left + 300 + + + 50 + 5 + 1 + 5 + + + + + + + edit-clear-symbolic + Reset to Default Value + + + + + + + + + + + 0 + + + + + Randomness + 0 + start + center + 1 + + + + + end + center + 1 + 2 + left + 300 + + + 1.0 + 0.0 + 0.01 + 0.1 + + + + + + + edit-clear-symbolic + Reset to Default Value + + + + + + + + + + + 0 + + + + + Trail Color + 0 + start + center + 1 + + + + + 0 + 1 + + + + + edit-clear-symbolic + Reset to Default Value + + + + + + + + + + + 0 + + + + + Tip Color + 0 + start + center + 1 + + + + + 0 + 1 + + + + + edit-clear-symbolic + Reset to Default Value + + + + + + + + + + + + + + + + + + + + + + + TV Effect + + + + vertical + 60 + 60 + 60 + 60 + + + + + + none + 1 + + + + + 0 + + + + + Color + 0 + start + center + 1 + + + + + 0 + 1 + + + + + edit-clear-symbolic + Reset to Default Value + + + + + + + + + + + + + + + + + + + + + + + T-Rex Attack + + + + vertical + 60 + 60 + 60 + 60 + + + + + + none + 1 + + + + + 0 + + + + + Claw Scratch Scale + 0 + start + center + 1 + + + + + end + center + 1 + 1 + left + 300 + + + 10 + 0.1 + 0.1 + 1 + + + + + + + edit-clear-symbolic + Reset to Default Value + + + + + + + + + + + 0 + + + + + Claw Scratch Count + 0 + start + center + 1 + + + + + end + center + 1 + 0 + left + 300 + + + 50 + 1 + 1 + 10 + + + + + + + edit-clear-symbolic + Reset to Default Value + + + + + + + + + + + 0 + + + + + Warp Effect + 0 + start + center + 1 + + + + + end + center + 1 + 2 + left + 300 + + + 1 + 0 + 0.01 + 0.1 + + + + + + + edit-clear-symbolic + Reset to Default Value + + + + + + + + + + + 0 + + + + + Flash Color + 0 + start + center + 1 + + + + + 1 + 1 + + + + + edit-clear-symbolic + Reset to Default Value + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file From 91daabd791c033eb1361d1547009683b2dd91917 Mon Sep 17 00:00:00 2001 From: Simon Schneegans Date: Sat, 8 Jan 2022 13:24:54 +0100 Subject: [PATCH 02/30] :recycle: Split settings to separate ui files --- prefs.js | 14 +- resources/ui/gtk3/prefs.ui | 2 +- resources/ui/gtk4/fire.ui | 270 +++++++++++++ resources/ui/gtk4/matrix.ui | 188 +++++++++ resources/ui/gtk4/prefs.ui | 747 +----------------------------------- resources/ui/gtk4/trex.ui | 200 ++++++++++ resources/ui/gtk4/tv.ui | 63 +++ 7 files changed, 735 insertions(+), 749 deletions(-) create mode 100644 resources/ui/gtk4/fire.ui create mode 100644 resources/ui/gtk4/matrix.ui create mode 100644 resources/ui/gtk4/trex.ui create mode 100644 resources/ui/gtk4/tv.ui diff --git a/prefs.js b/prefs.js index d39d906..4073dba 100644 --- a/prefs.js +++ b/prefs.js @@ -32,15 +32,25 @@ var PreferencesDialog = class PreferencesDialog { this._resources = Gio.Resource.load(Me.path + '/resources/burn-my-windows.gresource'); Gio.resources_register(this._resources); + // Store a reference to the settings object. + this._settings = ExtensionUtils.getSettings(); + // Load the user interface file. this._builder = new Gtk.Builder(); this._builder.add_from_resource(`/ui/${utils.isGTK4() ? 'gtk4' : 'gtk3'}/prefs.ui`); + this._builder.add_from_resource(`/ui/${utils.isGTK4() ? 'gtk4' : 'gtk3'}/fire.ui`); + this._builder.add_from_resource(`/ui/${utils.isGTK4() ? 'gtk4' : 'gtk3'}/matrix.ui`); + this._builder.add_from_resource(`/ui/${utils.isGTK4() ? 'gtk4' : 'gtk3'}/tv.ui`); + this._builder.add_from_resource(`/ui/${utils.isGTK4() ? 'gtk4' : 'gtk3'}/trex.ui`); // This is our top-level widget which we will return later. this._widget = this._builder.get_object('settings-widget'); - // Store a reference to the settings object. - this._settings = ExtensionUtils.getSettings(); + const stack = this._builder.get_object('main-stack'); + stack.add_titled(this._builder.get_object('fire-prefs'), 'fire', 'Fire'); + stack.add_titled(this._builder.get_object('matrix-prefs'), 'matrix', 'Matrix'); + stack.add_titled(this._builder.get_object('trex-prefs'), 'trex', 'T-Rex Attack'); + stack.add_titled(this._builder.get_object('tv-prefs'), 'tv', 'TV Effect'); // Bind all properties. this._bindCombobox('close-animation'); diff --git a/resources/ui/gtk3/prefs.ui b/resources/ui/gtk3/prefs.ui index e02b59d..f531341 100644 --- a/resources/ui/gtk3/prefs.ui +++ b/resources/ui/gtk3/prefs.ui @@ -1,5 +1,5 @@ - + diff --git a/resources/ui/gtk4/fire.ui b/resources/ui/gtk4/fire.ui new file mode 100644 index 0000000..6e28e38 --- /dev/null +++ b/resources/ui/gtk4/fire.ui @@ -0,0 +1,270 @@ + + + + + vertical + 60 + 60 + 60 + 60 + + + + 20 + + + none + 1 + + + + + 0 + + + + + Presets + 0 + start + center + 1 + + + + + Choose a Preset + 0 + + + + + + + + + + + + + + + + none + 1 + + + + + 0 + + + + + Scale + 0 + start + center + 1 + + + + + end + center + 1 + 2 + left + 300 + + + 3 + 0.1 + 0.01 + 0.1 + + + + + + + edit-clear-symbolic + Reset to Default Value + + + + + + + + + + + 0 + + + + + Speed + 0 + start + center + 1 + + + + + end + center + 1 + 2 + left + 300 + + + 2.0 + -2.0 + 0.01 + 0.1 + + + + + + + edit-clear-symbolic + Reset to Default Value + + + + + + + + + + + 0 + + + + + vertical + 3 + + + 3D Noise + 0 + start + center + 1 + + + + + Creates a more dynamic fire but requires more GPU power. + 0 + start + center + 1 + + + + + + + + end + center + + + + + edit-clear-symbolic + Reset to Default Value + + + + + + + + + + + 0 + + + + + Gradient + 0 + start + center + 1 + + + + + 1 + 1 + + + + + 1 + 1 + + + + + 1 + 1 + + + + + 1 + 1 + + + + + 1 + 1 + + + + + edit-clear-symbolic + Reset to Default Value + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/resources/ui/gtk4/matrix.ui b/resources/ui/gtk4/matrix.ui new file mode 100644 index 0000000..d7eed91 --- /dev/null +++ b/resources/ui/gtk4/matrix.ui @@ -0,0 +1,188 @@ + + + + + vertical + 60 + 60 + 60 + 60 + + + + + + none + 1 + + + + + 0 + + + + + Scale + 0 + start + center + 1 + + + + + end + center + 1 + 0 + left + 300 + + + 50 + 5 + 1 + 5 + + + + + + + edit-clear-symbolic + Reset to Default Value + + + + + + + + + + + 0 + + + + + Randomness + 0 + start + center + 1 + + + + + end + center + 1 + 2 + left + 300 + + + 1.0 + 0.0 + 0.01 + 0.1 + + + + + + + edit-clear-symbolic + Reset to Default Value + + + + + + + + + + + 0 + + + + + Trail Color + 0 + start + center + 1 + + + + + 0 + 1 + + + + + edit-clear-symbolic + Reset to Default Value + + + + + + + + + + + 0 + + + + + Tip Color + 0 + start + center + 1 + + + + + 0 + 1 + + + + + edit-clear-symbolic + Reset to Default Value + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/resources/ui/gtk4/prefs.ui b/resources/ui/gtk4/prefs.ui index 857d2f8..19a77a6 100644 --- a/resources/ui/gtk4/prefs.ui +++ b/resources/ui/gtk4/prefs.ui @@ -1,5 +1,5 @@ - + @@ -229,751 +229,6 @@ - - - Fire - - - - vertical - 60 - 60 - 60 - 60 - - - - 20 - - - none - 1 - - - - - 0 - - - - - Presets - 0 - start - center - 1 - - - - - Choose a Preset - 0 - - - - - - - - - - - - - - - - - none - 1 - - - - - 0 - - - - - Scale - 0 - start - center - 1 - - - - - end - center - 1 - 2 - left - 300 - - - 3 - 0.1 - 0.01 - 0.1 - - - - - - - edit-clear-symbolic - Reset to Default Value - - - - - - - - - - - 0 - - - - - Speed - 0 - start - center - 1 - - - - - end - center - 1 - 2 - left - 300 - - - 2.0 - -2.0 - 0.01 - 0.1 - - - - - - - edit-clear-symbolic - Reset to Default Value - - - - - - - - - - - 0 - - - - - vertical - 3 - - - 3D Noise - 0 - start - center - 1 - - - - - Creates a more dynamic fire but requires more GPU power. - 0 - start - center - 1 - - - - - - - - end - center - - - - - edit-clear-symbolic - Reset to Default Value - - - - - - - - - - - 0 - - - - - Gradient - 0 - start - center - 1 - - - - - 1 - 1 - - - - - 1 - 1 - - - - - 1 - 1 - - - - - 1 - 1 - - - - - 1 - 1 - - - - - edit-clear-symbolic - Reset to Default Value - - - - - - - - - - - - - - - - - - - - - - - Matrix - - - - vertical - 60 - 60 - 60 - 60 - - - - - - none - 1 - - - - - 0 - - - - - Scale - 0 - start - center - 1 - - - - - end - center - 1 - 0 - left - 300 - - - 50 - 5 - 1 - 5 - - - - - - - edit-clear-symbolic - Reset to Default Value - - - - - - - - - - - 0 - - - - - Randomness - 0 - start - center - 1 - - - - - end - center - 1 - 2 - left - 300 - - - 1.0 - 0.0 - 0.01 - 0.1 - - - - - - - edit-clear-symbolic - Reset to Default Value - - - - - - - - - - - 0 - - - - - Trail Color - 0 - start - center - 1 - - - - - 0 - 1 - - - - - edit-clear-symbolic - Reset to Default Value - - - - - - - - - - - 0 - - - - - Tip Color - 0 - start - center - 1 - - - - - 0 - 1 - - - - - edit-clear-symbolic - Reset to Default Value - - - - - - - - - - - - - - - - - - - - - - - TV Effect - - - - vertical - 60 - 60 - 60 - 60 - - - - - - none - 1 - - - - - 0 - - - - - Color - 0 - start - center - 1 - - - - - 0 - 1 - - - - - edit-clear-symbolic - Reset to Default Value - - - - - - - - - - - - - - - - - - - - - - - T-Rex Attack - - - - vertical - 60 - 60 - 60 - 60 - - - - - - none - 1 - - - - - 0 - - - - - Claw Scratch Scale - 0 - start - center - 1 - - - - - end - center - 1 - 1 - left - 300 - - - 10 - 0.1 - 0.1 - 1 - - - - - - - edit-clear-symbolic - Reset to Default Value - - - - - - - - - - - 0 - - - - - Claw Scratch Count - 0 - start - center - 1 - - - - - end - center - 1 - 0 - left - 300 - - - 50 - 1 - 1 - 10 - - - - - - - edit-clear-symbolic - Reset to Default Value - - - - - - - - - - - 0 - - - - - Warp Effect - 0 - start - center - 1 - - - - - end - center - 1 - 2 - left - 300 - - - 1 - 0 - 0.01 - 0.1 - - - - - - - edit-clear-symbolic - Reset to Default Value - - - - - - - - - - - 0 - - - - - Flash Color - 0 - start - center - 1 - - - - - 1 - 1 - - - - - edit-clear-symbolic - Reset to Default Value - - - - - - - - - - - - - - - - - - - diff --git a/resources/ui/gtk4/trex.ui b/resources/ui/gtk4/trex.ui new file mode 100644 index 0000000..14d20d3 --- /dev/null +++ b/resources/ui/gtk4/trex.ui @@ -0,0 +1,200 @@ + + + + + vertical + 60 + 60 + 60 + 60 + + + + + + none + 1 + + + + + 0 + + + + + Claw Scratch Scale + 0 + start + center + 1 + + + + + end + center + 1 + 1 + left + 300 + + + 10 + 0.1 + 0.1 + 1 + + + + + + + edit-clear-symbolic + Reset to Default Value + + + + + + + + + + + 0 + + + + + Claw Scratch Count + 0 + start + center + 1 + + + + + end + center + 1 + 0 + left + 300 + + + 50 + 1 + 1 + 10 + + + + + + + edit-clear-symbolic + Reset to Default Value + + + + + + + + + + + 0 + + + + + Warp Effect + 0 + start + center + 1 + + + + + end + center + 1 + 2 + left + 300 + + + 1 + 0 + 0.01 + 0.1 + + + + + + + edit-clear-symbolic + Reset to Default Value + + + + + + + + + + + 0 + + + + + Flash Color + 0 + start + center + 1 + + + + + 1 + 1 + + + + + edit-clear-symbolic + Reset to Default Value + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/resources/ui/gtk4/tv.ui b/resources/ui/gtk4/tv.ui new file mode 100644 index 0000000..150712e --- /dev/null +++ b/resources/ui/gtk4/tv.ui @@ -0,0 +1,63 @@ + + + + + vertical + 60 + 60 + 60 + 60 + + + + + + none + 1 + + + + + 0 + + + + + Color + 0 + start + center + 1 + + + + + 0 + 1 + + + + + edit-clear-symbolic + Reset to Default Value + + + + + + + + + + + + + + + + + \ No newline at end of file From c154115192fa3e52fd91d6ada7069e283fa72ce1 Mon Sep 17 00:00:00 2001 From: Simon Schneegans Date: Sat, 8 Jan 2022 13:34:28 +0100 Subject: [PATCH 03/30] :recycle: Move main menu to separate file --- prefs.js | 1 + resources/ui/common/main-menu.ui | 32 ++++++++++++++++++++++++++++++++ resources/ui/gtk3/prefs.ui | 30 ------------------------------ resources/ui/gtk4/prefs.ui | 30 ------------------------------ 4 files changed, 33 insertions(+), 60 deletions(-) create mode 100644 resources/ui/common/main-menu.ui diff --git a/prefs.js b/prefs.js index 4073dba..d74b6ce 100644 --- a/prefs.js +++ b/prefs.js @@ -37,6 +37,7 @@ var PreferencesDialog = class PreferencesDialog { // Load the user interface file. this._builder = new Gtk.Builder(); + this._builder.add_from_resource(`/ui/common/main-menu.ui`); this._builder.add_from_resource(`/ui/${utils.isGTK4() ? 'gtk4' : 'gtk3'}/prefs.ui`); this._builder.add_from_resource(`/ui/${utils.isGTK4() ? 'gtk4' : 'gtk3'}/fire.ui`); this._builder.add_from_resource(`/ui/${utils.isGTK4() ? 'gtk4' : 'gtk3'}/matrix.ui`); diff --git a/resources/ui/common/main-menu.ui b/resources/ui/common/main-menu.ui new file mode 100644 index 0000000..4ba062b --- /dev/null +++ b/resources/ui/common/main-menu.ui @@ -0,0 +1,32 @@ + + + +
+ + Visit Homepage + prefs.homepage + + + View Changelog + prefs.changelog + + + Report a Bug + prefs.bugs + +
+
+ + Donate + + Via PayPal + prefs.donate-paypal + + + Via GitHub + prefs.donate-github + + +
+
+
\ No newline at end of file diff --git a/resources/ui/gtk3/prefs.ui b/resources/ui/gtk3/prefs.ui index f531341..809c4f1 100644 --- a/resources/ui/gtk3/prefs.ui +++ b/resources/ui/gtk3/prefs.ui @@ -19,36 +19,6 @@
- -
- - Visit Homepage - prefs.homepage - - - View Changelog - prefs.changelog - - - Report a Bug - prefs.bugs - -
-
- - Donate - - Via PayPal - prefs.donate-paypal - - - Via GitHub - prefs.donate-github - - -
-
- main-menu 1 diff --git a/resources/ui/gtk4/prefs.ui b/resources/ui/gtk4/prefs.ui index 19a77a6..d51f05f 100644 --- a/resources/ui/gtk4/prefs.ui +++ b/resources/ui/gtk4/prefs.ui @@ -27,36 +27,6 @@ - -
- - Visit Homepage - prefs.homepage - - - View Changelog - prefs.changelog - - - Report a Bug - prefs.bugs - -
-
- - Donate - - Via PayPal - prefs.donate-paypal - - - Via GitHub - prefs.donate-github - - -
-
- main-menu open-menu-symbolic From 5396e1f18d1562200f8658a257925f438d741430 Mon Sep 17 00:00:00 2001 From: Simon Schneegans Date: Sat, 8 Jan 2022 13:38:57 +0100 Subject: [PATCH 04/30] :wrench: Port to Gtk3 --- resources/ui/gtk3/fire.ui | 312 ++++++++++++++++++++++++++++ resources/ui/gtk3/prefs.ui | 402 ------------------------------------- resources/ui/gtk3/tv.ui | 72 +++++++ 3 files changed, 384 insertions(+), 402 deletions(-) create mode 100644 resources/ui/gtk3/fire.ui create mode 100644 resources/ui/gtk3/tv.ui diff --git a/resources/ui/gtk3/fire.ui b/resources/ui/gtk3/fire.ui new file mode 100644 index 0000000..cf2388d --- /dev/null +++ b/resources/ui/gtk3/fire.ui @@ -0,0 +1,312 @@ + + + + + 3 + 0.1 + 0.01 + 0.1 + + + + 2.0 + -2.0 + 0.01 + 0.1 + + + + vertical + 60 + 60 + 60 + 60 + + + + 20 + + + none + 1 + + + + + 10 + 10 + 10 + 10 + 0 + + + + + Presets + 0 + start + center + 1 + + + + + Choose a Preset + 0 + + + + + + + + + + + + + + + + none + 1 + + + + + 10 + 10 + 10 + 10 + 0 + + + + + Scale + 0 + start + center + 1 + + + + + end + center + 1 + 2 + left + 300 + + + 3 + 0.1 + 0.01 + 0.1 + + + + + + + + + edit-clear-symbolic + 1 + + + Reset to Default Value + + + + + + + + + + + 0 + + + + + Speed + 0 + start + center + 1 + + + + + end + center + 1 + 2 + left + 300 + + + 2.0 + -2.0 + 0.01 + 0.1 + + + + + + + + + edit-clear-symbolic + 1 + + + Reset to Default Value + + + + + + + + + + + 0 + + + + + vertical + 3 + + + 3D Noise + 0 + start + center + 1 + + + + + Creates a more dynamic fire but requires more GPU power. + 0 + start + center + 1 + + + + + + + + end + center + + + + + + + edit-clear-symbolic + 1 + + + Reset to Default Value + + + + + + + + + + + 0 + + + + + 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/gtk3/prefs.ui b/resources/ui/gtk3/prefs.ui index 809c4f1..a68c755 100644 --- a/resources/ui/gtk3/prefs.ui +++ b/resources/ui/gtk3/prefs.ui @@ -38,34 +38,6 @@ 100 - - 3 - 0.1 - 0.01 - 0.1 - - - - 2.0 - -2.0 - 0.01 - 0.1 - - - - 50 - 5 - 1 - 5 - - - - 1 - 0 - 0.01 - 0.1 - - @@ -77,19 +49,6 @@ 30 30 - - - 30 - 10 - General Options - 0 - - - - - @@ -246,367 +205,6 @@ - - - - 30 - 10 - - - Fire Animation Options - 0 - 1 - - - - - - none - - - 8 - - - Choose a Preset - - - - - pan-down-symbolic - 1 - - - - - - - - - - - - - - none - - - - - 10 - 10 - 10 - 10 - 0 - - - 8 - - - 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 - - - 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 - 0 - - - 8 - - - vertical - 3 - - - 3D Noise - 0 - start - center - 1 - - - - - Creates a more dynamic fire but requires more GPU power. - 0 - start - center - 1 - - - - - - - - end - center - - - - - - - edit-clear-symbolic - 1 - - - Reset to Default Value - - - - - - - - - - - 10 - 10 - 10 - 10 - 0 - - - - 8 - - - Gradient - 0 - start - center - 1 - - - - - 1 - 1 - - - - - 1 - 1 - - - - - 1 - 1 - - - - - 1 - 1 - - - - - 1 - 1 - - - - - - - edit-clear-symbolic - 1 - - - Reset to Default Value - - - - - - - - - - - - - - - - - - 30 - 10 - - - TV Effect Options - 0 - 1 - - - - - - - - - - - none - - - - - 10 - 10 - 10 - 10 - 0 - - - 8 - - - Color - 0 - start - center - 1 - - - - - 1 - 1 - - - - - - - edit-clear-symbolic - 1 - - - Reset to Default Value - - - - - - - - - - - - - diff --git a/resources/ui/gtk3/tv.ui b/resources/ui/gtk3/tv.ui new file mode 100644 index 0000000..27e6cb7 --- /dev/null +++ b/resources/ui/gtk3/tv.ui @@ -0,0 +1,72 @@ + + + + + vertical + 60 + 60 + 60 + 60 + + + + + + none + 1 + + + + + 10 + 10 + 10 + 10 + 0 + + + + + Color + 0 + start + center + 1 + + + + + 0 + 1 + + + + + + + edit-clear-symbolic + 1 + + + Reset to Default Value + + + + + + + + + + + + + + + + + \ No newline at end of file From 8c1157f8082f418f25f59839b6917e48581abac2 Mon Sep 17 00:00:00 2001 From: Simon Schneegans Date: Sat, 8 Jan 2022 13:41:26 +0100 Subject: [PATCH 05/30] :wrench: Gtk3 fixes --- resources/ui/gtk3/fire.ui | 2 -- resources/ui/gtk3/tv.ui | 1 - 2 files changed, 3 deletions(-) diff --git a/resources/ui/gtk3/fire.ui b/resources/ui/gtk3/fire.ui index cf2388d..fadabeb 100644 --- a/resources/ui/gtk3/fire.ui +++ b/resources/ui/gtk3/fire.ui @@ -28,7 +28,6 @@ none - 1 @@ -71,7 +70,6 @@ none - 1 diff --git a/resources/ui/gtk3/tv.ui b/resources/ui/gtk3/tv.ui index 27e6cb7..22d864c 100644 --- a/resources/ui/gtk3/tv.ui +++ b/resources/ui/gtk3/tv.ui @@ -13,7 +13,6 @@ none - 1 From db80b34fad112ae4dd493633d6a33573f0455106 Mon Sep 17 00:00:00 2001 From: Simon Schneegans Date: Sat, 8 Jan 2022 13:42:53 +0100 Subject: [PATCH 06/30] :wrench: Gtk3 fixes --- resources/ui/gtk3/fire.ui | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/ui/gtk3/fire.ui b/resources/ui/gtk3/fire.ui index fadabeb..99ba7a5 100644 --- a/resources/ui/gtk3/fire.ui +++ b/resources/ui/gtk3/fire.ui @@ -52,8 +52,8 @@ + none Choose a Preset - 0 From 088290f8ba93a131230f30e9caff1e4a554472fc Mon Sep 17 00:00:00 2001 From: Simon Schneegans Date: Sat, 8 Jan 2022 13:44:58 +0100 Subject: [PATCH 07/30] :wrench: Gtk3 fixes --- resources/ui/gtk3/fire.ui | 18 ++---------------- 1 file changed, 2 insertions(+), 16 deletions(-) diff --git a/resources/ui/gtk3/fire.ui b/resources/ui/gtk3/fire.ui index 99ba7a5..d8d9aa5 100644 --- a/resources/ui/gtk3/fire.ui +++ b/resources/ui/gtk3/fire.ui @@ -100,14 +100,7 @@ 2 left 300 - - - 3 - 0.1 - 0.01 - 0.1 - - + flame-scale @@ -151,14 +144,7 @@ 2 left 300 - - - 2.0 - -2.0 - 0.01 - 0.1 - - + flame-movement-speed From 93bdd8c1a1cf46831a59713b3e46c92c853ca116 Mon Sep 17 00:00:00 2001 From: Simon Schneegans Date: Sat, 8 Jan 2022 13:48:10 +0100 Subject: [PATCH 08/30] :wrench: Gtk3 fixes --- resources/ui/gtk3/prefs.ui | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/resources/ui/gtk3/prefs.ui b/resources/ui/gtk3/prefs.ui index a68c755..93815a3 100644 --- a/resources/ui/gtk3/prefs.ui +++ b/resources/ui/gtk3/prefs.ui @@ -39,6 +39,11 @@
+ + + main-stack + + From 1af87cd5e37a8e0a4e665fe0862045dfd1615b5f Mon Sep 17 00:00:00 2001 From: Simon Schneegans Date: Sat, 8 Jan 2022 13:51:59 +0100 Subject: [PATCH 09/30] :wrench: Gtk3 fixes --- resources/ui/gtk3/fire.ui | 30 ++++- resources/ui/gtk3/prefs.ui | 263 +++++++++++++++++++------------------ 2 files changed, 166 insertions(+), 127 deletions(-) diff --git a/resources/ui/gtk3/fire.ui b/resources/ui/gtk3/fire.ui index d8d9aa5..93a3e61 100644 --- a/resources/ui/gtk3/fire.ui +++ b/resources/ui/gtk3/fire.ui @@ -53,7 +53,22 @@ none - Choose a Preset + + + 8 + + + Choose a Preset + + + + + pan-down-symbolic + 1 + + + + @@ -124,6 +139,10 @@ + 10 + 10 + 10 + 10 0 @@ -168,6 +187,10 @@ + 10 + 10 + 10 + 10 0 @@ -226,9 +249,14 @@ + 10 + 10 + 10 + 10 0 + 8 Gradient diff --git a/resources/ui/gtk3/prefs.ui b/resources/ui/gtk3/prefs.ui index 93815a3..9703f23 100644 --- a/resources/ui/gtk3/prefs.ui +++ b/resources/ui/gtk3/prefs.ui @@ -46,170 +46,181 @@ + slide-up-down + 1 + - - vertical - 60 - 60 - 30 - 30 - - + + General Options + + + + vertical + 60 + 60 + 30 + 30 + - - none - + - - 10 - 10 - 10 - 10 - 0 + + none + - - 8 + + 10 + 10 + 10 + 10 + 0 - - Close Window Animation - 0 - start - center - 1 - - - - - center - animation-mode-list - 1 - fire + + 8 - - - 0 - - - - - - - - - edit-clear-symbolic - 1 + + Close Window Animation + 0 + start + center + 1 + + + + + center + animation-mode-list + 1 + fire + + + + 0 + + + + + + + + + edit-clear-symbolic + 1 + + + Reset to Default Value + - Reset to Default Value - - - - - - 10 - 10 - 10 - 10 - 0 - - 8 + + 10 + 10 + 10 + 10 + 0 - - Animation Time [ms] - 0 - start - center - 1 - - - - - end - center - 1 - 0 - left - 300 - destroy-animation-time - - - - + + 8 - - edit-clear-symbolic - 1 + + Animation Time [ms] + 0 + start + center + 1 + + + + + end + center + 1 + 0 + left + 300 + destroy-animation-time + + + + + + + edit-clear-symbolic + 1 + + + Reset to Default Value + - Reset to Default Value - - - - - - 10 - 10 - 10 - 10 - 0 - - 8 + + 10 + 10 + 10 + 10 + 0 - - Also Burn Dialogs - 0 - start - center - 1 - - - - - end - center - - - - + + 8 - - edit-clear-symbolic - 1 + + Also Burn Dialogs + 0 + start + center + 1 + + + + + end + center + + + + + + + edit-clear-symbolic + 1 + + + Reset to Default Value + - Reset to Default Value - + - - - + + + From 875ef391a73d14817c5f119c2c2b346c30b7ed8b Mon Sep 17 00:00:00 2001 From: Simon Schneegans Date: Sat, 8 Jan 2022 13:54:16 +0100 Subject: [PATCH 10/30] :wrench: Gtk3 fixes --- resources/ui/gtk3/prefs.ui | 298 ++++++++++++++++++------------------- 1 file changed, 148 insertions(+), 150 deletions(-) diff --git a/resources/ui/gtk3/prefs.ui b/resources/ui/gtk3/prefs.ui index 9703f23..3f15c83 100644 --- a/resources/ui/gtk3/prefs.ui +++ b/resources/ui/gtk3/prefs.ui @@ -51,177 +51,175 @@ - + General Options - + - - vertical - 60 - 60 - 30 - 30 + + vertical + 60 + 60 + 30 + 30 + + - + + none + - - none - + + 10 + 10 + 10 + 10 + 0 - - 10 - 10 - 10 - 10 - 0 + + 8 - - 8 + + Close Window Animation + 0 + start + center + 1 + + + + + center + animation-mode-list + 1 + fire - - Close Window Animation - 0 - start - center - 1 - - - - - center - animation-mode-list - 1 - fire - - - - 0 - - - - - - - - - edit-clear-symbolic - 1 - - - Reset to Default Value - + + + 0 + + + + + + + + + edit-clear-symbolic + 1 + Reset to Default Value + - - - - 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 - - - - - - - - - - - 10 - 10 - 10 - 10 - 0 - - - 8 - - - Also Burn Dialogs - 0 - start - center - 1 - - - - - end - center - - - - - - - edit-clear-symbolic - 1 - - - Reset to Default Value - - - - - - - - + + + + 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 + + + + + + + + + + + 10 + 10 + 10 + 10 + 0 + + + 8 + + + Also Burn Dialogs + 0 + start + center + 1 + + + + + end + center + + + + + + + edit-clear-symbolic + 1 + + + Reset to Default Value + + + + + + + + - + - + From d6fed235c2dd272139214cd8c0eb7fbb9dae3668 Mon Sep 17 00:00:00 2001 From: Simon Schneegans Date: Sat, 8 Jan 2022 13:56:38 +0100 Subject: [PATCH 11/30] :wrench: Gtk3 fixes --- resources/ui/gtk3/prefs.ui | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/resources/ui/gtk3/prefs.ui b/resources/ui/gtk3/prefs.ui index 3f15c83..6196c5c 100644 --- a/resources/ui/gtk3/prefs.ui +++ b/resources/ui/gtk3/prefs.ui @@ -51,10 +51,6 @@ - - General Options - - vertical 60 @@ -219,6 +215,9 @@ + + General Options + From c81316bfe988b4e599c6c7f43c313cb26d208d0c Mon Sep 17 00:00:00 2001 From: Simon Schneegans Date: Sat, 8 Jan 2022 21:30:12 +0100 Subject: [PATCH 12/30] :hammer: Split prefs in separate classes --- prefs.js | 231 ++---------------- resources/ui/gtk3/{fire.ui => firePage.ui} | 72 +++++- resources/ui/gtk3/generalPage.ui | 129 ++++++++++ resources/ui/gtk3/prefs.ui | 195 +-------------- resources/ui/gtk3/{tv.ui => tvPage.ui} | 56 +++++ resources/ui/gtk4/{fire.ui => firePage.ui} | 58 ++++- resources/ui/gtk4/generalPage.ui | 115 +++++++++ .../ui/gtk4/{matrix.ui => matrixPage.ui} | 46 ++++ resources/ui/gtk4/prefs.ui | 181 +------------- resources/ui/gtk4/{trex.ui => trexPage.ui} | 46 ++++ resources/ui/gtk4/tv.ui | 63 ----- resources/ui/gtk4/tvPage.ui | 109 +++++++++ ...ell.extensions.burn-my-windows.gschema.xml | 102 +++++--- src/prefs/FirePage.js | 165 +++++++++++++ src/prefs/GeneralPage.js | 43 ++++ src/prefs/MatrixPage.js | 56 +++++ src/prefs/PrefsPage.js | 102 ++++++++ src/prefs/TRexPage.js | 56 +++++ src/prefs/TVEffectPage.js | 54 ++++ 19 files changed, 1187 insertions(+), 692 deletions(-) rename resources/ui/gtk3/{fire.ui => firePage.ui} (81%) create mode 100644 resources/ui/gtk3/generalPage.ui rename resources/ui/gtk3/{tv.ui => tvPage.ui} (50%) rename resources/ui/gtk4/{fire.ui => firePage.ui} (80%) create mode 100644 resources/ui/gtk4/generalPage.ui rename resources/ui/gtk4/{matrix.ui => matrixPage.ui} (78%) rename resources/ui/gtk4/{trex.ui => trexPage.ui} (79%) delete mode 100644 resources/ui/gtk4/tv.ui create mode 100644 resources/ui/gtk4/tvPage.ui create mode 100644 src/prefs/FirePage.js create mode 100644 src/prefs/GeneralPage.js create mode 100644 src/prefs/MatrixPage.js create mode 100644 src/prefs/PrefsPage.js create mode 100644 src/prefs/TRexPage.js create mode 100644 src/prefs/TVEffectPage.js diff --git a/prefs.js b/prefs.js index d74b6ce..87273f3 100644 --- a/prefs.js +++ b/prefs.js @@ -19,12 +19,19 @@ const ExtensionUtils = imports.misc.extensionUtils; const Me = imports.misc.extensionUtils.getCurrentExtension(); const utils = Me.imports.src.common.utils; +const FirePage = Me.imports.src.prefs.FirePage.FirePage; +const MatrixPage = Me.imports.src.prefs.MatrixPage.MatrixPage; +const TVEffectPage = Me.imports.src.prefs.TVEffectPage.TVEffectPage; +const TRexPage = Me.imports.src.prefs.TRexPage.TRexPage; +const GeneralPage = Me.imports.src.prefs.GeneralPage.GeneralPage; + ////////////////////////////////////////////////////////////////////////////////////////// // For now, the preferences dialog of this extension is very simple. In the future, if // // we might consider to improve its layout... // ////////////////////////////////////////////////////////////////////////////////////////// var PreferencesDialog = class PreferencesDialog { + // ------------------------------------------------------------ constructor / destructor constructor() { @@ -39,54 +46,16 @@ var PreferencesDialog = class PreferencesDialog { this._builder = new Gtk.Builder(); this._builder.add_from_resource(`/ui/common/main-menu.ui`); this._builder.add_from_resource(`/ui/${utils.isGTK4() ? 'gtk4' : 'gtk3'}/prefs.ui`); - this._builder.add_from_resource(`/ui/${utils.isGTK4() ? 'gtk4' : 'gtk3'}/fire.ui`); - this._builder.add_from_resource(`/ui/${utils.isGTK4() ? 'gtk4' : 'gtk3'}/matrix.ui`); - this._builder.add_from_resource(`/ui/${utils.isGTK4() ? 'gtk4' : 'gtk3'}/tv.ui`); - this._builder.add_from_resource(`/ui/${utils.isGTK4() ? 'gtk4' : 'gtk3'}/trex.ui`); + + this._generalPage = new GeneralPage(this._settings, this._builder); + this._firePage = new FirePage(this._settings, this._builder); + this._matrixPage = new MatrixPage(this._settings, this._builder); + this._tvEffectPage = new TVEffectPage(this._settings, this._builder); + this._trexPage = new TRexPage(this._settings, this._builder); // This is our top-level widget which we will return later. this._widget = this._builder.get_object('settings-widget'); - const stack = this._builder.get_object('main-stack'); - stack.add_titled(this._builder.get_object('fire-prefs'), 'fire', 'Fire'); - stack.add_titled(this._builder.get_object('matrix-prefs'), 'matrix', 'Matrix'); - stack.add_titled(this._builder.get_object('trex-prefs'), 'trex', 'T-Rex Attack'); - stack.add_titled(this._builder.get_object('tv-prefs'), 'tv', 'TV Effect'); - - // Bind all properties. - this._bindCombobox('close-animation'); - this._bindAdjustment('destroy-animation-time'); - this._bindSwitch('destroy-dialogs'); - this._bindAdjustment('flame-movement-speed'); - this._bindAdjustment('flame-scale'); - this._bindSwitch('flame-3d-noise'); - this._bindColorButton('fire-color-1'); - this._bindColorButton('fire-color-2'); - this._bindColorButton('fire-color-3'); - this._bindColorButton('fire-color-4'); - this._bindColorButton('fire-color-5'); - this._bindAdjustment('matrix-scale'); - this._bindAdjustment('matrix-randomness'); - this._bindColorButton('matrix-trail-color'); - this._bindColorButton('matrix-tip-color'); - this._bindColorButton('tv-effect-color'); - this._bindColorButton('claw-scratch-color'); - this._bindAdjustment('claw-scratch-scale'); - this._bindAdjustment('claw-scratch-count'); - this._bindAdjustment('claw-scratch-warp'); - - // The fire-gradient-reset button needs to be bound explicitly. - this._builder.get_object('reset-fire-colors').connect('clicked', () => { - this._settings.reset('fire-color-1'); - this._settings.reset('fire-color-2'); - this._settings.reset('fire-color-3'); - this._settings.reset('fire-color-4'); - this._settings.reset('fire-color-5'); - }); - - // Initialize the fire-preset dropdown. - this._createFirePresets(); - // Add a menu to the title bar of the preferences dialog. this._widget.connect('realize', (widget) => { const window = utils.isGTK4() ? widget.get_root() : widget.get_toplevel(); @@ -107,15 +76,13 @@ var PreferencesDialog = class PreferencesDialog { group.add_action(action); }; - addAction('homepage', 'https://github.com/Schneegans/Burn-My-Windows'); - addAction( - 'changelog', - 'https://github.com/Schneegans/Burn-My-Windows/blob/main/docs/changelog.md'); - addAction('bugs', 'https://github.com/Schneegans/Burn-My-Windows/issues'); - addAction( - 'donate-paypal', - 'https://www.paypal.com/donate/?hosted_button_id=3F7UFL8KLVPXE'); + // clang-format off + addAction('homepage', 'https://github.com/Schneegans/Burn-My-Windows'); + addAction('changelog', 'https://github.com/Schneegans/Burn-My-Windows/blob/main/docs/changelog.md'); + addAction('bugs', 'https://github.com/Schneegans/Burn-My-Windows/issues'); + addAction('donate-paypal', 'https://www.paypal.com/donate/?hosted_button_id=3F7UFL8KLVPXE'); addAction('donate-github', 'https://github.com/sponsors/Schneegans'); + // clang-format on window.insert_action_group('prefs', group); }); @@ -139,166 +106,6 @@ var PreferencesDialog = class PreferencesDialog { getWidget() { return this._widget; } - - // ----------------------------------------------------------------------- private stuff - - // Connects a Gtk.ComboBox (or anything else which has an 'active-id' property) to a - // settings key. It also binds the corresponding reset button. - _bindCombobox(settingsKey) { - this._bind(settingsKey, 'active-id'); - } - - // Connects a Gtk.Adjustment (or anything else which has a 'value' property) to a - // settings key. It also binds the corresponding reset button. - _bindAdjustment(settingsKey) { - this._bind(settingsKey, 'value'); - } - - // Connects a Gtk.Switch (or anything else which has an 'active' property) to a settings - // key. It also binds the corresponding reset button. - _bindSwitch(settingsKey) { - this._bind(settingsKey, 'active'); - } - - // Colors are stored as strings like 'rgb(1, 0.5, 0)'. As Gio.Settings.bind_with_mapping - // is not available yet, we need to do the color conversion manually. It also binds the - // corresponding reset button. - _bindColorButton(settingsKey) { - - const button = this._builder.get_object(settingsKey); - - if (button) { - - // Update the settings when the color is modified. - button.connect('color-set', () => { - this._settings.set_string(settingsKey, button.get_rgba().to_string()); - }); - - // Update the button state when the settings change. - const settingSignalHandler = () => { - const rgba = new Gdk.RGBA(); - rgba.parse(this._settings.get_string(settingsKey)); - button.rgba = rgba; - }; - - this._settings.connect('changed::' + settingsKey, settingSignalHandler); - - // Initialize the button with the state in the settings. - settingSignalHandler(); - } - - this._bindResetButton(settingsKey); - } - - // Connects any widget's property to a settings key. The widget must have the same ID as - // the settings key. It also binds the corresponding reset button. - _bind(settingsKey, property) { - const object = this._builder.get_object(settingsKey); - - if (object) { - this._settings.bind(settingsKey, object, property, Gio.SettingsBindFlags.DEFAULT); - } - - this._bindResetButton(settingsKey); - } - - // Searches for a reset button for the given settings key and make it reset the settings - // key when clicked. - _bindResetButton(settingsKey) { - const resetButton = this._builder.get_object('reset-' + settingsKey); - if (resetButton) { - resetButton.connect('clicked', () => { - this._settings.reset(settingsKey); - }); - } - } - - // This populates the preset dropdown menu for the fire options. - _createFirePresets() { - this._widget.connect('realize', (widget) => { - const presets = [ - { - name: 'Default Fire', - scale: 1.0, - speed: 0.5, - color1: 'rgba(76, 51, 25, 0.0)', - color2: 'rgba(180, 55, 30, 0.7)', - color3: 'rgba(255, 76, 38, 0.9)', - color4: 'rgba(255, 166, 25, 1)', - color5: 'rgba(255, 255, 255, 1)' - }, - { - name: 'Hell Fire', - scale: 1.5, - speed: 0.2, - color1: 'rgba(0,0,0,0)', - color2: 'rgba(103,7,80,0.5)', - color3: 'rgba(150,0,24,0.9)', - color4: 'rgb(255,200,0)', - color5: 'rgba(255, 255, 255, 1)' - }, - { - name: 'Dark and Smutty', - scale: 1.0, - speed: 0.5, - color1: 'rgba(0,0,0,0)', - color2: 'rgba(36,3,0,0.5)', - color3: 'rgba(150,0,24,0.9)', - color4: 'rgb(255,177,21)', - color5: 'rgb(255,238,166)' - }, - { - name: 'Cold Breeze', - scale: 1.5, - speed: -0.1, - color1: 'rgba(0,110,255,0)', - color2: 'rgba(30,111,180,0.24)', - color3: 'rgba(38,181,255,0.54)', - color4: 'rgba(34,162,255,0.84)', - color5: 'rgb(97,189,255)' - }, - { - name: 'Santa is Coming', - scale: 0.4, - speed: -0.5, - color1: 'rgba(0,110,255,0)', - color2: 'rgba(208,233,255,0.24)', - color3: 'rgba(207,235,255,0.84)', - color4: 'rgb(208,243,255)', - color5: 'rgb(255,255,255)' - } - ]; - - const menu = Gio.Menu.new(); - const group = Gio.SimpleActionGroup.new(); - const groupName = 'presets'; - - // Add all presets. - presets.forEach((preset, i) => { - const actionName = 'fire' + i; - menu.append(preset.name, groupName + '.' + actionName); - let action = Gio.SimpleAction.new(actionName, null); - - // Load the preset on activation. - action.connect('activate', () => { - this._settings.set_double('flame-movement-speed', preset.speed); - this._settings.set_double('flame-scale', preset.scale); - this._settings.set_string('fire-color-1', preset.color1); - this._settings.set_string('fire-color-2', preset.color2); - this._settings.set_string('fire-color-3', preset.color3); - this._settings.set_string('fire-color-4', preset.color4); - this._settings.set_string('fire-color-5', preset.color5); - }); - - group.add_action(action); - }); - - this._builder.get_object('fire-preset-button').set_menu_model(menu); - - const root = utils.isGTK4() ? widget.get_root() : widget.get_toplevel(); - root.insert_action_group(groupName, group); - }); - } } // Nothing to do for now... diff --git a/resources/ui/gtk3/fire.ui b/resources/ui/gtk3/firePage.ui similarity index 81% rename from resources/ui/gtk3/fire.ui rename to resources/ui/gtk3/firePage.ui index 93a3e61..3455fd8 100644 --- a/resources/ui/gtk3/fire.ui +++ b/resources/ui/gtk3/firePage.ui @@ -1,14 +1,21 @@ - + + 10000 + 500 + 10 + 100 + + + 3 0.1 0.01 0.1 - + 2.0 -2.0 0.01 @@ -89,6 +96,55 @@ + + + 10 + 10 + 10 + 10 + 0 + + + 8 + + + Animation Time [ms] + 0 + start + center + 1 + + + + + end + center + 1 + 0 + left + 300 + fire-animation-time + + + + + + + edit-clear-symbolic + 1 + + + Reset to Default Value + + + + + + + + 10 @@ -115,11 +171,11 @@ 2 left 300 - flame-scale + fire-scale - + edit-clear-symbolic @@ -163,11 +219,11 @@ 2 left 300 - flame-movement-speed + fire-movement-speed - + edit-clear-symbolic @@ -223,13 +279,13 @@ - + end center - + edit-clear-symbolic diff --git a/resources/ui/gtk3/generalPage.ui b/resources/ui/gtk3/generalPage.ui new file mode 100644 index 0000000..ddecbf9 --- /dev/null +++ b/resources/ui/gtk3/generalPage.ui @@ -0,0 +1,129 @@ + + + + + vertical + 60 + 60 + 30 + 30 + + + + + + none + + + + 10 + 10 + 10 + 10 + 0 + + + 8 + + + vertical + 3 + + + Close Window Animation + 0 + start + center + 1 + + + + + If multiple are selected, one is chosen randomly. + 0 + start + center + 1 + + + + + + + + Effects + + + + + + + edit-clear-symbolic + 1 + + + Reset to Default Value + + + + + + + + + + + 10 + 10 + 10 + 10 + 0 + + + 8 + + + Also Burn Dialogs + 0 + start + center + 1 + + + + + end + center + + + + + + + edit-clear-symbolic + 1 + + + Reset to Default Value + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/resources/ui/gtk3/prefs.ui b/resources/ui/gtk3/prefs.ui index 6196c5c..5b79db1 100644 --- a/resources/ui/gtk3/prefs.ui +++ b/resources/ui/gtk3/prefs.ui @@ -2,23 +2,6 @@ - - - - - - - - Fire - fire - - - TV Effect - tv - - - - main-menu 1 @@ -31,13 +14,6 @@ - - 10000 - 500 - 10 - 100 - - @@ -49,177 +25,8 @@ slide-up-down 1 - + - - vertical - 60 - 60 - 30 - 30 - - - - - - none - - - - 10 - 10 - 10 - 10 - 0 - - - 8 - - - Close Window Animation - 0 - start - center - 1 - - - - - center - animation-mode-list - 1 - fire - - - - 0 - - - - - - - - - edit-clear-symbolic - 1 - - - Reset to Default Value - - - - - - - - - - - 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 - - - - - - - - - - - 10 - 10 - 10 - 10 - 0 - - - 8 - - - Also Burn Dialogs - 0 - start - center - 1 - - - - - end - center - - - - - - - edit-clear-symbolic - 1 - - - Reset to Default Value - - - - - - - - - - - - - - - - General Options - - - diff --git a/resources/ui/gtk3/tv.ui b/resources/ui/gtk3/tvPage.ui similarity index 50% rename from resources/ui/gtk3/tv.ui rename to resources/ui/gtk3/tvPage.ui index 22d864c..b992120 100644 --- a/resources/ui/gtk3/tv.ui +++ b/resources/ui/gtk3/tvPage.ui @@ -1,6 +1,13 @@ + + 5000 + 100 + 10 + 100 + + vertical 60 @@ -17,6 +24,55 @@ + + + 10 + 10 + 10 + 10 + 0 + + + 8 + + + Animation Time [ms] + 0 + start + center + 1 + + + + + end + center + 1 + 0 + left + 300 + tv-animation-time + + + + + + + edit-clear-symbolic + 1 + + + Reset to Default Value + + + + + + + + 10 diff --git a/resources/ui/gtk4/fire.ui b/resources/ui/gtk4/firePage.ui similarity index 80% rename from resources/ui/gtk4/fire.ui rename to resources/ui/gtk4/firePage.ui index 6e28e38..9d8247c 100644 --- a/resources/ui/gtk4/fire.ui +++ b/resources/ui/gtk4/firePage.ui @@ -58,6 +58,52 @@ + + + 0 + + + + + Animation Time [ms] + 0 + start + center + 1 + + + + + end + center + 1 + 0 + left + 300 + + + 10000 + 500 + 10 + 100 + + + + + + + edit-clear-symbolic + Reset to Default Value + + + + + + + + 0 @@ -81,7 +127,7 @@ left 300 - + 3 0.1 0.01 @@ -91,7 +137,7 @@ - + edit-clear-symbolic Reset to Default Value + + + + + 0 + + + + + vertical + 3 + + + Close Window Animation + 0 + start + center + 1 + + + + + If multiple are selected, one is chosen randomly. + 0 + start + center + 1 + + + + + + + + Effects + + + + + edit-clear-symbolic + Reset to Default Value + + + + + + + + + + + 0 + + + + + Also Burn Dialogs + 0 + start + center + 1 + + + + + end + center + + + + + edit-clear-symbolic + Reset to Default Value + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/resources/ui/gtk4/matrix.ui b/resources/ui/gtk4/matrixPage.ui similarity index 78% rename from resources/ui/gtk4/matrix.ui rename to resources/ui/gtk4/matrixPage.ui index d7eed91..7f5a570 100644 --- a/resources/ui/gtk4/matrix.ui +++ b/resources/ui/gtk4/matrixPage.ui @@ -18,6 +18,52 @@ + + + 0 + + + + + Animation Time [ms] + 0 + start + center + 1 + + + + + end + center + 1 + 0 + left + 300 + + + 10000 + 500 + 10 + 100 + + + + + + + edit-clear-symbolic + Reset to Default Value + + + + + + + + 0 diff --git a/resources/ui/gtk4/prefs.ui b/resources/ui/gtk4/prefs.ui index d51f05f..92a5f39 100644 --- a/resources/ui/gtk4/prefs.ui +++ b/resources/ui/gtk4/prefs.ui @@ -2,31 +2,6 @@ - - - - - - - - Fire - fire - - - Matrix - matrix - - - TV Effect - tv - - - T-Rex Attack - trex - - - - main-menu open-menu-symbolic @@ -43,161 +18,7 @@ slide-up-down 1 - - - General Options - - - - vertical - 60 - 60 - 60 - 60 - - - - - - none - 1 - - - - - - 0 - - - - - Close Window Animation - 0 - start - center - 1 - - - - - center - animation-mode-list - 1 - fire - - - - 0 - - - - - - - edit-clear-symbolic - Reset to Default Value - - - - - - - - - - - 0 - - - - - Animation Time [ms] - 0 - start - center - 1 - - - - - end - center - 1 - 0 - left - 300 - - - 10000 - 500 - 10 - 100 - - - - - - - edit-clear-symbolic - Reset to Default Value - - - - - - - - - - - 0 - - - - - Also Burn Dialogs - 0 - start - center - 1 - - - - - end - center - - - - - edit-clear-symbolic - Reset to Default Value - - - - - - - - - - - - - - - - - - + diff --git a/resources/ui/gtk4/trex.ui b/resources/ui/gtk4/trexPage.ui similarity index 79% rename from resources/ui/gtk4/trex.ui rename to resources/ui/gtk4/trexPage.ui index 14d20d3..2bfe567 100644 --- a/resources/ui/gtk4/trex.ui +++ b/resources/ui/gtk4/trexPage.ui @@ -18,6 +18,52 @@ + + + 0 + + + + + Animation Time [ms] + 0 + start + center + 1 + + + + + end + center + 1 + 0 + left + 300 + + + 10000 + 500 + 10 + 100 + + + + + + + edit-clear-symbolic + Reset to Default Value + + + + + + + + 0 diff --git a/resources/ui/gtk4/tv.ui b/resources/ui/gtk4/tv.ui deleted file mode 100644 index 150712e..0000000 --- a/resources/ui/gtk4/tv.ui +++ /dev/null @@ -1,63 +0,0 @@ - - - - - vertical - 60 - 60 - 60 - 60 - - - - - - none - 1 - - - - - 0 - - - - - Color - 0 - start - center - 1 - - - - - 0 - 1 - - - - - edit-clear-symbolic - Reset to Default Value - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/resources/ui/gtk4/tvPage.ui b/resources/ui/gtk4/tvPage.ui new file mode 100644 index 0000000..c64ecef --- /dev/null +++ b/resources/ui/gtk4/tvPage.ui @@ -0,0 +1,109 @@ + + + + + vertical + 60 + 60 + 60 + 60 + + + + + + none + 1 + + + + + 0 + + + + + Animation Time [ms] + 0 + start + center + 1 + + + + + end + center + 1 + 0 + left + 300 + + + 5000 + 100 + 10 + 100 + + + + + + + edit-clear-symbolic + Reset to Default Value + + + + + + + + + + + 0 + + + + + Color + 0 + start + center + 1 + + + + + 0 + 1 + + + + + edit-clear-symbolic + Reset to Default Value + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/schemas/org.gnome.shell.extensions.burn-my-windows.gschema.xml b/schemas/org.gnome.shell.extensions.burn-my-windows.gschema.xml index d19bbf3..b049a78 100644 --- a/schemas/org.gnome.shell.extensions.burn-my-windows.gschema.xml +++ b/schemas/org.gnome.shell.extensions.burn-my-windows.gschema.xml @@ -1,27 +1,11 @@ - - - - - - - - - "fire" - Close Animation - The animation used for window closing. - - - - - 1500 - Destroy Animation Time - The time it takes to burn the windows. - + + + false @@ -29,22 +13,38 @@ Set to true to burn dialogs as well. - + + + + + + true + Fire Close Effect + Use the fire effect for window closing. + + + + 1500 + Fire Animation Time + The time the fire effect takes. + + + 0.5 - Flame Movement Speed - The speed at which the flames move. + Fire Movement Speed + The speed at which the fire moves. - + 1.0 - Flame Scale - The size of the flames. + Fire Scale + The size of the fire. - + false - Flame 3D Noise - Use a 3D noise for the flames. + Fire 3D Noise + Use a 3D noise for the fire. @@ -77,6 +77,21 @@ The fifth color of the fire gradient. + + + + + + false + Matrix Close Effect + Use the matrix effect for window closing. + + + + 2000 + Matrix Animation Time + The time the matrix effect takes. + 20 @@ -102,6 +117,21 @@ The color matrix trails. + + + + + + false + TV Close Effect + Use the tv effect for window closing. + + + + 250 + TV Animation Time + The time the tv effect takes. + "rgb(255, 255, 255)" @@ -109,6 +139,21 @@ The color of the TV effect. + + + + + + false + T-Rex Close Effect + Use the trex effect for window closing. + + + + 1500 + T-Rex Animation Time + The time the trex effect takes. + "rgb(170, 0, 0)" @@ -134,7 +179,6 @@ Number of claw scratches drawn on top of each other. - \ No newline at end of file diff --git a/src/prefs/FirePage.js b/src/prefs/FirePage.js new file mode 100644 index 0000000..a4afbe6 --- /dev/null +++ b/src/prefs/FirePage.js @@ -0,0 +1,165 @@ +////////////////////////////////////////////////////////////////////////////////////////// +// ) ( // +// ( /( ( ( ) ( ( ( ( )\ ) ( ( // +// )\()) ))\ )( ( ( )\ ) )\))( )\ ( (()/( ( )\))( ( // +// ((_)\ /((_|()\ )\ ) )\ '(()/( ((_)()((_) )\ ) ((_)))\((_)()\ )\ // +// | |(_|_))( ((_)_(_/( _((_)) )(_)) _(()((_|_)_(_/( _| |((_)(()((_|(_) // +// | '_ \ || | '_| ' \)) | ' \()| || | \ V V / | ' \)) _` / _ \ V V (_-< // +// |_.__/\_,_|_| |_||_| |_|_|_| \_, | \_/\_/|_|_||_|\__,_\___/\_/\_//__/ // +// |__/ // +// Copyright (c) 2021 Simon Schneegans // +// Released under the GPLv3 or later. See LICENSE file for details. // +////////////////////////////////////////////////////////////////////////////////////////// + +'use strict'; + +const {Gio} = imports.gi; + +const ExtensionUtils = imports.misc.extensionUtils; +const Me = imports.misc.extensionUtils.getCurrentExtension(); +const utils = Me.imports.src.common.utils; +const PrefsPage = Me.imports.src.prefs.PrefsPage.PrefsPage; + +////////////////////////////////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////////////////////// + +var FirePage = class FirePage extends PrefsPage { + + // ------------------------------------------------------------ constructor / destructor + + constructor(settings, builder) { + super(settings, builder); + + this._builder.add_from_resource( + `/ui/${utils.isGTK4() ? 'gtk4' : 'gtk3'}/firePage.ui`); + + // Bind all properties. + this._bindAdjustment('fire-animation-time'); + this._bindAdjustment('fire-movement-speed'); + this._bindAdjustment('fire-scale'); + this._bindSwitch('fire-3d-noise'); + this._bindColorButton('fire-color-1'); + this._bindColorButton('fire-color-2'); + this._bindColorButton('fire-color-3'); + this._bindColorButton('fire-color-4'); + this._bindColorButton('fire-color-5'); + + // The fire-gradient-reset button needs to be bound explicitly. + this._builder.get_object('reset-fire-colors').connect('clicked', () => { + this._settings.reset('fire-color-1'); + this._settings.reset('fire-color-2'); + this._settings.reset('fire-color-3'); + this._settings.reset('fire-color-4'); + this._settings.reset('fire-color-5'); + }); + + // Initialize the fire-preset dropdown. + this._createFirePresets(); + + const stack = this._builder.get_object('main-stack'); + stack.add_titled(this._builder.get_object('fire-prefs'), 'fire', 'Fire'); + } + + // ---------------------------------------------------------------------- public methods + + getMinVersion() { + return [3, 36]; + } + + getEnabledKey() { + return 'fire-close-effect'; + } + + getAnimationTime() { + return this._settings.get_int('fire-animation-time'); + } + + // ----------------------------------------------------------------------- private stuff + + // This populates the preset dropdown menu for the fire options. + _createFirePresets() { + this._builder.get_object('settings-widget').connect('realize', (widget) => { + const presets = [ + { + name: 'Default Fire', + scale: 1.0, + speed: 0.5, + color1: 'rgba(76, 51, 25, 0.0)', + color2: 'rgba(180, 55, 30, 0.7)', + color3: 'rgba(255, 76, 38, 0.9)', + color4: 'rgba(255, 166, 25, 1)', + color5: 'rgba(255, 255, 255, 1)' + }, + { + name: 'Hell Fire', + scale: 1.5, + speed: 0.2, + color1: 'rgba(0,0,0,0)', + color2: 'rgba(103,7,80,0.5)', + color3: 'rgba(150,0,24,0.9)', + color4: 'rgb(255,200,0)', + color5: 'rgba(255, 255, 255, 1)' + }, + { + name: 'Dark and Smutty', + scale: 1.0, + speed: 0.5, + color1: 'rgba(0,0,0,0)', + color2: 'rgba(36,3,0,0.5)', + color3: 'rgba(150,0,24,0.9)', + color4: 'rgb(255,177,21)', + color5: 'rgb(255,238,166)' + }, + { + name: 'Cold Breeze', + scale: 1.5, + speed: -0.1, + color1: 'rgba(0,110,255,0)', + color2: 'rgba(30,111,180,0.24)', + color3: 'rgba(38,181,255,0.54)', + color4: 'rgba(34,162,255,0.84)', + color5: 'rgb(97,189,255)' + }, + { + name: 'Santa is Coming', + scale: 0.4, + speed: -0.5, + color1: 'rgba(0,110,255,0)', + color2: 'rgba(208,233,255,0.24)', + color3: 'rgba(207,235,255,0.84)', + color4: 'rgb(208,243,255)', + color5: 'rgb(255,255,255)' + } + ]; + + const menu = Gio.Menu.new(); + const group = Gio.SimpleActionGroup.new(); + const groupName = 'presets'; + + // Add all presets. + presets.forEach((preset, i) => { + const actionName = 'fire' + i; + menu.append(preset.name, groupName + '.' + actionName); + let action = Gio.SimpleAction.new(actionName, null); + + // Load the preset on activation. + action.connect('activate', () => { + this._settings.set_double('fire-movement-speed', preset.speed); + this._settings.set_double('fire-scale', preset.scale); + this._settings.set_string('fire-color-1', preset.color1); + this._settings.set_string('fire-color-2', preset.color2); + this._settings.set_string('fire-color-3', preset.color3); + this._settings.set_string('fire-color-4', preset.color4); + this._settings.set_string('fire-color-5', preset.color5); + }); + + group.add_action(action); + }); + + this._builder.get_object('fire-preset-button').set_menu_model(menu); + + const root = utils.isGTK4() ? widget.get_root() : widget.get_toplevel(); + root.insert_action_group(groupName, group); + }); + } +} \ No newline at end of file diff --git a/src/prefs/GeneralPage.js b/src/prefs/GeneralPage.js new file mode 100644 index 0000000..a58408d --- /dev/null +++ b/src/prefs/GeneralPage.js @@ -0,0 +1,43 @@ +////////////////////////////////////////////////////////////////////////////////////////// +// ) ( // +// ( /( ( ( ) ( ( ( ( )\ ) ( ( // +// )\()) ))\ )( ( ( )\ ) )\))( )\ ( (()/( ( )\))( ( // +// ((_)\ /((_|()\ )\ ) )\ '(()/( ((_)()((_) )\ ) ((_)))\((_)()\ )\ // +// | |(_|_))( ((_)_(_/( _((_)) )(_)) _(()((_|_)_(_/( _| |((_)(()((_|(_) // +// | '_ \ || | '_| ' \)) | ' \()| || | \ V V / | ' \)) _` / _ \ V V (_-< // +// |_.__/\_,_|_| |_||_| |_|_|_| \_, | \_/\_/|_|_||_|\__,_\___/\_/\_//__/ // +// |__/ // +// Copyright (c) 2021 Simon Schneegans // +// Released under the GPLv3 or later. See LICENSE file for details. // +////////////////////////////////////////////////////////////////////////////////////////// + +'use strict'; + +const ExtensionUtils = imports.misc.extensionUtils; +const Me = imports.misc.extensionUtils.getCurrentExtension(); +const utils = Me.imports.src.common.utils; +const PrefsPage = Me.imports.src.prefs.PrefsPage.PrefsPage; + +////////////////////////////////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////////////////////// + +var GeneralPage = class GeneralPage extends PrefsPage { + + // ------------------------------------------------------------ constructor / destructor + + constructor(settings, builder) { + super(settings, builder); + + this._builder.add_from_resource( + `/ui/${utils.isGTK4() ? 'gtk4' : 'gtk3'}/generalPage.ui`); + + // Bind all properties. + this._bindSwitch('destroy-dialogs'); + + const stack = this._builder.get_object('main-stack'); + stack.add_titled( + this._builder.get_object('general-prefs'), 'general', 'General Options'); + } + + // ---------------------------------------------------------------------- public methods +} \ No newline at end of file diff --git a/src/prefs/MatrixPage.js b/src/prefs/MatrixPage.js new file mode 100644 index 0000000..a8404a9 --- /dev/null +++ b/src/prefs/MatrixPage.js @@ -0,0 +1,56 @@ +////////////////////////////////////////////////////////////////////////////////////////// +// ) ( // +// ( /( ( ( ) ( ( ( ( )\ ) ( ( // +// )\()) ))\ )( ( ( )\ ) )\))( )\ ( (()/( ( )\))( ( // +// ((_)\ /((_|()\ )\ ) )\ '(()/( ((_)()((_) )\ ) ((_)))\((_)()\ )\ // +// | |(_|_))( ((_)_(_/( _((_)) )(_)) _(()((_|_)_(_/( _| |((_)(()((_|(_) // +// | '_ \ || | '_| ' \)) | ' \()| || | \ V V / | ' \)) _` / _ \ V V (_-< // +// |_.__/\_,_|_| |_||_| |_|_|_| \_, | \_/\_/|_|_||_|\__,_\___/\_/\_//__/ // +// |__/ // +// Copyright (c) 2021 Simon Schneegans // +// Released under the GPLv3 or later. See LICENSE file for details. // +////////////////////////////////////////////////////////////////////////////////////////// + +'use strict'; + +const ExtensionUtils = imports.misc.extensionUtils; +const Me = imports.misc.extensionUtils.getCurrentExtension(); +const PrefsPage = Me.imports.src.prefs.PrefsPage.PrefsPage; + +////////////////////////////////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////////////////////// + +var MatrixPage = class MatrixPage extends PrefsPage { + + // ------------------------------------------------------------ constructor / destructor + + constructor(settings, builder) { + super(settings, builder); + + this._builder.add_from_resource('/ui/gtk4/matrixPage.ui'); + + // Bind all properties. + this._bindAdjustment('matrix-animation-time'); + this._bindAdjustment('matrix-scale'); + this._bindAdjustment('matrix-randomness'); + this._bindColorButton('matrix-trail-color'); + this._bindColorButton('matrix-tip-color'); + + const stack = this._builder.get_object('main-stack'); + stack.add_titled(this._builder.get_object('matrix-prefs'), 'matrix', 'Matrix'); + } + + // ---------------------------------------------------------------------- public methods + + getMinVersion() { + return [40, 0]; + } + + getEnabledKey() { + return 'matrix-close-effect'; + } + + getAnimationTime() { + return this._settings.get_int('matrix-animation-time'); + } +} \ No newline at end of file diff --git a/src/prefs/PrefsPage.js b/src/prefs/PrefsPage.js new file mode 100644 index 0000000..156607b --- /dev/null +++ b/src/prefs/PrefsPage.js @@ -0,0 +1,102 @@ +////////////////////////////////////////////////////////////////////////////////////////// +// ) ( // +// ( /( ( ( ) ( ( ( ( )\ ) ( ( // +// )\()) ))\ )( ( ( )\ ) )\))( )\ ( (()/( ( )\))( ( // +// ((_)\ /((_|()\ )\ ) )\ '(()/( ((_)()((_) )\ ) ((_)))\((_)()\ )\ // +// | |(_|_))( ((_)_(_/( _((_)) )(_)) _(()((_|_)_(_/( _| |((_)(()((_|(_) // +// | '_ \ || | '_| ' \)) | ' \()| || | \ V V / | ' \)) _` / _ \ V V (_-< // +// |_.__/\_,_|_| |_||_| |_|_|_| \_, | \_/\_/|_|_||_|\__,_\___/\_/\_//__/ // +// |__/ // +// Copyright (c) 2021 Simon Schneegans // +// Released under the GPLv3 or later. See LICENSE file for details. // +////////////////////////////////////////////////////////////////////////////////////////// + +'use strict'; + +const {Gdk, Gio} = imports.gi; + +////////////////////////////////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////////////////////// + +var PrefsPage = class PrefsPage { + + // ------------------------------------------------------------ constructor / destructor + + constructor(settings, builder) { + this._settings = settings; + this._builder = builder; + } + + // ---------------------------------------------------------------------- public methods + + // Connects a Gtk.ComboBox (or anything else which has an 'active-id' property) to a + // settings key. It also binds the corresponding reset button. + _bindCombobox(settingsKey) { + this._bind(settingsKey, 'active-id'); + } + + // Connects a Gtk.Adjustment (or anything else which has a 'value' property) to a + // settings key. It also binds the corresponding reset button. + _bindAdjustment(settingsKey) { + this._bind(settingsKey, 'value'); + } + + // Connects a Gtk.Switch (or anything else which has an 'active' property) to a settings + // key. It also binds the corresponding reset button. + _bindSwitch(settingsKey) { + this._bind(settingsKey, 'active'); + } + + // Colors are stored as strings like 'rgb(1, 0.5, 0)'. As Gio.Settings.bind_with_mapping + // is not available yet, we need to do the color conversion manually. It also binds the + // corresponding reset button. + _bindColorButton(settingsKey) { + + const button = this._builder.get_object(settingsKey); + + if (button) { + + // Update the settings when the color is modified. + button.connect('color-set', () => { + this._settings.set_string(settingsKey, button.get_rgba().to_string()); + }); + + // Update the button state when the settings change. + const settingSignalHandler = () => { + const rgba = new Gdk.RGBA(); + rgba.parse(this._settings.get_string(settingsKey)); + button.rgba = rgba; + }; + + this._settings.connect('changed::' + settingsKey, settingSignalHandler); + + // Initialize the button with the state in the settings. + settingSignalHandler(); + } + + this._bindResetButton(settingsKey); + } + + // Connects any widget's property to a settings key. The widget must have the same ID as + // the settings key. It also binds the corresponding reset button. + _bind(settingsKey, property) { + const object = this._builder.get_object(settingsKey); + + if (object) { + this._settings.bind(settingsKey, object, property, Gio.SettingsBindFlags.DEFAULT); + } + + this._bindResetButton(settingsKey); + } + + // Searches for a reset button for the given settings key and make it reset the settings + // key when clicked. + _bindResetButton(settingsKey) { + const resetButton = this._builder.get_object('reset-' + settingsKey); + if (resetButton) { + resetButton.connect('clicked', () => { + this._settings.reset(settingsKey); + }); + } + } +} \ No newline at end of file diff --git a/src/prefs/TRexPage.js b/src/prefs/TRexPage.js new file mode 100644 index 0000000..7248b4e --- /dev/null +++ b/src/prefs/TRexPage.js @@ -0,0 +1,56 @@ +////////////////////////////////////////////////////////////////////////////////////////// +// ) ( // +// ( /( ( ( ) ( ( ( ( )\ ) ( ( // +// )\()) ))\ )( ( ( )\ ) )\))( )\ ( (()/( ( )\))( ( // +// ((_)\ /((_|()\ )\ ) )\ '(()/( ((_)()((_) )\ ) ((_)))\((_)()\ )\ // +// | |(_|_))( ((_)_(_/( _((_)) )(_)) _(()((_|_)_(_/( _| |((_)(()((_|(_) // +// | '_ \ || | '_| ' \)) | ' \()| || | \ V V / | ' \)) _` / _ \ V V (_-< // +// |_.__/\_,_|_| |_||_| |_|_|_| \_, | \_/\_/|_|_||_|\__,_\___/\_/\_//__/ // +// |__/ // +// Copyright (c) 2021 Simon Schneegans // +// Released under the GPLv3 or later. See LICENSE file for details. // +////////////////////////////////////////////////////////////////////////////////////////// + +'use strict'; + +const ExtensionUtils = imports.misc.extensionUtils; +const Me = imports.misc.extensionUtils.getCurrentExtension(); +const PrefsPage = Me.imports.src.prefs.PrefsPage.PrefsPage; + +////////////////////////////////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////////////////////// + +var TRexPage = class TRexPage extends PrefsPage { + + // ------------------------------------------------------------ constructor / destructor + + constructor(settings, builder) { + super(settings, builder); + + this._builder.add_from_resource('/ui/gtk4/trexPage.ui'); + + // Bind all properties. + this._bindAdjustment('trex-animation-time'); + this._bindColorButton('claw-scratch-color'); + this._bindAdjustment('claw-scratch-scale'); + this._bindAdjustment('claw-scratch-count'); + this._bindAdjustment('claw-scratch-warp'); + + const stack = this._builder.get_object('main-stack'); + stack.add_titled(this._builder.get_object('trex-prefs'), 'trex', 'T-Rex Attack'); + } + + // ---------------------------------------------------------------------- public methods + + getMinVersion() { + return [40, 0]; + } + + getEnabledKey() { + return 'trex-close-effect'; + } + + getAnimationTime() { + return this._settings.get_int('trex-animation-time'); + } +} \ No newline at end of file diff --git a/src/prefs/TVEffectPage.js b/src/prefs/TVEffectPage.js new file mode 100644 index 0000000..17b371a --- /dev/null +++ b/src/prefs/TVEffectPage.js @@ -0,0 +1,54 @@ +////////////////////////////////////////////////////////////////////////////////////////// +// ) ( // +// ( /( ( ( ) ( ( ( ( )\ ) ( ( // +// )\()) ))\ )( ( ( )\ ) )\))( )\ ( (()/( ( )\))( ( // +// ((_)\ /((_|()\ )\ ) )\ '(()/( ((_)()((_) )\ ) ((_)))\((_)()\ )\ // +// | |(_|_))( ((_)_(_/( _((_)) )(_)) _(()((_|_)_(_/( _| |((_)(()((_|(_) // +// | '_ \ || | '_| ' \)) | ' \()| || | \ V V / | ' \)) _` / _ \ V V (_-< // +// |_.__/\_,_|_| |_||_| |_|_|_| \_, | \_/\_/|_|_||_|\__,_\___/\_/\_//__/ // +// |__/ // +// Copyright (c) 2021 Simon Schneegans // +// Released under the GPLv3 or later. See LICENSE file for details. // +////////////////////////////////////////////////////////////////////////////////////////// + +'use strict'; + +const ExtensionUtils = imports.misc.extensionUtils; +const Me = imports.misc.extensionUtils.getCurrentExtension(); +const utils = Me.imports.src.common.utils; +const PrefsPage = Me.imports.src.prefs.PrefsPage.PrefsPage; + +////////////////////////////////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////////////////////// + +var TVEffectPage = class TVEffectPage extends PrefsPage { + + // ------------------------------------------------------------ constructor / destructor + + constructor(settings, builder) { + super(settings, builder); + + this._builder.add_from_resource(`/ui/${utils.isGTK4() ? 'gtk4' : 'gtk3'}/tvPage.ui`); + + // Bind all properties. + this._bindAdjustment('tv-animation-time'); + this._bindColorButton('tv-effect-color'); + + const stack = this._builder.get_object('main-stack'); + stack.add_titled(this._builder.get_object('tv-prefs'), 'tv', 'TV Effect'); + } + + // ---------------------------------------------------------------------- public methods + + getMinVersion() { + return [3, 36]; + } + + getEnabledKey() { + return 'tv-close-effect'; + } + + getAnimationTime() { + return this._settings.get_int('tv-animation-time'); + } +} \ No newline at end of file From e3f0288eaf7026f307574aa396e3f6ee5d92d212 Mon Sep 17 00:00:00 2001 From: Simon Schneegans Date: Sat, 8 Jan 2022 21:41:10 +0100 Subject: [PATCH 13/30] :wrench: Add shell version check --- extension.js | 5 +---- src/common/utils.js | 19 +++++++++++++++++++ src/prefs/FirePage.js | 4 ---- src/prefs/MatrixPage.js | 9 +++++---- src/prefs/TRexPage.js | 9 +++++---- src/prefs/TVEffectPage.js | 4 ---- 6 files changed, 30 insertions(+), 20 deletions(-) diff --git a/extension.js b/extension.js index c920725..689e926 100644 --- a/extension.js +++ b/extension.js @@ -15,9 +15,6 @@ const {Clutter, Gio, Meta} = imports.gi; -const Config = imports.misc.config; -const [GS_MAJOR, GS_MINOR] = Config.PACKAGE_VERSION.split('.'); - const Workspace = imports.ui.workspace.Workspace; const WindowManager = imports.ui.windowManager.WindowManager; const WINDOW_REPOSITIONING_DELAY = imports.ui.workspace.WINDOW_REPOSITIONING_DELAY; @@ -89,7 +86,7 @@ class Extension { // overview window layout. Therefore we call this method in addition. // https://gitlab.gnome.org/GNOME/gnome-shell/-/blob/gnome-3-36/js/ui/workspace.js#L1877 // https://gitlab.gnome.org/GNOME/gnome-shell/-/blob/main/js/ui/workspace.js#L1415 - if (GS_MAJOR == 3 && GS_MINOR == 36) { + if (utils.shellVersionIs(3, 36)) { Workspace.prototype._addWindowClone = function(...params) { const [clone, overlay] = extensionThis._origAddWindowClone.apply(this, params); clone.connect('destroy', () => this._doRemoveWindow(clone.metaWindow)); diff --git a/src/common/utils.js b/src/common/utils.js index 1dead0a..61827a8 100644 --- a/src/common/utils.js +++ b/src/common/utils.js @@ -15,6 +15,9 @@ const {Gtk} = imports.gi; +const Config = imports.misc.config; +const [GS_MAJOR, GS_MINOR] = Config.PACKAGE_VERSION.split('.'); + const ExtensionUtils = imports.misc.extensionUtils; const Me = imports.misc.extensionUtils.getCurrentExtension(); @@ -42,3 +45,19 @@ function debug(message) { function isGTK4() { return Gtk.get_major_version() == 4; } + +function shellVersionIs(major, minor) { + return GS_MAJOR == major && GS_MINOR == minor; +} + +function shellVersionIsAtLeast(major, minor) { + if (GS_MAJOR > major) { + return true; + } + + if (GS_MAJOR == major) { + return GS_MINOR >= minor; + } + + return false; +} \ No newline at end of file diff --git a/src/prefs/FirePage.js b/src/prefs/FirePage.js index a4afbe6..66a700b 100644 --- a/src/prefs/FirePage.js +++ b/src/prefs/FirePage.js @@ -62,10 +62,6 @@ var FirePage = class FirePage extends PrefsPage { // ---------------------------------------------------------------------- public methods - getMinVersion() { - return [3, 36]; - } - getEnabledKey() { return 'fire-close-effect'; } diff --git a/src/prefs/MatrixPage.js b/src/prefs/MatrixPage.js index a8404a9..e6dbf47 100644 --- a/src/prefs/MatrixPage.js +++ b/src/prefs/MatrixPage.js @@ -15,6 +15,7 @@ const ExtensionUtils = imports.misc.extensionUtils; const Me = imports.misc.extensionUtils.getCurrentExtension(); +const utils = Me.imports.src.common.utils; const PrefsPage = Me.imports.src.prefs.PrefsPage.PrefsPage; ////////////////////////////////////////////////////////////////////////////////////////// @@ -27,6 +28,10 @@ var MatrixPage = class MatrixPage extends PrefsPage { constructor(settings, builder) { super(settings, builder); + if (!utils.shellVersionIsAtLeast(40, 0)) { + return; + } + this._builder.add_from_resource('/ui/gtk4/matrixPage.ui'); // Bind all properties. @@ -42,10 +47,6 @@ var MatrixPage = class MatrixPage extends PrefsPage { // ---------------------------------------------------------------------- public methods - getMinVersion() { - return [40, 0]; - } - getEnabledKey() { return 'matrix-close-effect'; } diff --git a/src/prefs/TRexPage.js b/src/prefs/TRexPage.js index 7248b4e..633cfff 100644 --- a/src/prefs/TRexPage.js +++ b/src/prefs/TRexPage.js @@ -15,6 +15,7 @@ const ExtensionUtils = imports.misc.extensionUtils; const Me = imports.misc.extensionUtils.getCurrentExtension(); +const utils = Me.imports.src.common.utils; const PrefsPage = Me.imports.src.prefs.PrefsPage.PrefsPage; ////////////////////////////////////////////////////////////////////////////////////////// @@ -27,6 +28,10 @@ var TRexPage = class TRexPage extends PrefsPage { constructor(settings, builder) { super(settings, builder); + if (!utils.shellVersionIsAtLeast(40, 0)) { + return; + } + this._builder.add_from_resource('/ui/gtk4/trexPage.ui'); // Bind all properties. @@ -42,10 +47,6 @@ var TRexPage = class TRexPage extends PrefsPage { // ---------------------------------------------------------------------- public methods - getMinVersion() { - return [40, 0]; - } - getEnabledKey() { return 'trex-close-effect'; } diff --git a/src/prefs/TVEffectPage.js b/src/prefs/TVEffectPage.js index 17b371a..284bd1b 100644 --- a/src/prefs/TVEffectPage.js +++ b/src/prefs/TVEffectPage.js @@ -40,10 +40,6 @@ var TVEffectPage = class TVEffectPage extends PrefsPage { // ---------------------------------------------------------------------- public methods - getMinVersion() { - return [3, 36]; - } - getEnabledKey() { return 'tv-close-effect'; } From 7ec9609d7a6ae06d48998b6bec4f71cc97a39568 Mon Sep 17 00:00:00 2001 From: Simon Schneegans Date: Sun, 9 Jan 2022 13:05:34 +0100 Subject: [PATCH 14/30] :wrench: Add close-effects menu --- prefs.js | 76 ++++++++++++++++++++++---------- resources/ui/gtk3/generalPage.ui | 19 ++------ resources/ui/gtk4/generalPage.ui | 14 ++---- src/prefs/FirePage.js | 24 +++++----- src/prefs/MatrixPage.js | 28 ++++++------ src/prefs/TRexPage.js | 28 ++++++------ src/prefs/TVEffectPage.js | 24 +++++----- 7 files changed, 116 insertions(+), 97 deletions(-) diff --git a/prefs.js b/prefs.js index 87273f3..e002708 100644 --- a/prefs.js +++ b/prefs.js @@ -30,6 +30,8 @@ const GeneralPage = Me.imports.src.prefs.GeneralPage.GeneralPage; // we might consider to improve its layout... // ////////////////////////////////////////////////////////////////////////////////////////// +const EFFECT_TYPES = [FirePage, MatrixPage, TVEffectPage, TRexPage]; + var PreferencesDialog = class PreferencesDialog { // ------------------------------------------------------------ constructor / destructor @@ -47,44 +49,70 @@ var PreferencesDialog = class PreferencesDialog { this._builder.add_from_resource(`/ui/common/main-menu.ui`); this._builder.add_from_resource(`/ui/${utils.isGTK4() ? 'gtk4' : 'gtk3'}/prefs.ui`); - this._generalPage = new GeneralPage(this._settings, this._builder); - this._firePage = new FirePage(this._settings, this._builder); - this._matrixPage = new MatrixPage(this._settings, this._builder); - this._tvEffectPage = new TVEffectPage(this._settings, this._builder); - this._trexPage = new TRexPage(this._settings, this._builder); + this._generalPAge = new GeneralPage(this._settings, this._builder); + + this._effects = []; + EFFECT_TYPES.forEach(Type => { + const [minMajor, minMinor] = Type.getMinShellVersion(); + if (utils.shellVersionIsAtLeast(minMajor, minMinor)) { + this._effects.push(new Type(this._settings, this._builder)); + } + }); // This is our top-level widget which we will return later. this._widget = this._builder.get_object('settings-widget'); - // Add a menu to the title bar of the preferences dialog. + // Some things can only be done once the widget is shown as we do not have access to + // the toplevel widget before. this._widget.connect('realize', (widget) => { const window = utils.isGTK4() ? widget.get_root() : widget.get_toplevel(); // Show the version number in the title bar. window.set_title(`Burn-My-Windows ${Me.metadata.version}`); - // Add the menu. - const menu = this._builder.get_object('menu-button'); - window.get_titlebar().pack_end(menu); + // Add the main menu to the title bar. + { + // Add the menu button to the title bar. + const menu = this._builder.get_object('menu-button'); + window.get_titlebar().pack_end(menu); - // Populate the actions. - const group = Gio.SimpleActionGroup.new(); + // Populate the menu with actions. + const group = Gio.SimpleActionGroup.new(); + window.insert_action_group('prefs', group); - const addAction = (name, uri) => { - const action = Gio.SimpleAction.new(name, null); - action.connect('activate', () => Gtk.show_uri(null, uri, Gdk.CURRENT_TIME)); - group.add_action(action); - }; + const addAction = (name, uri) => { + const action = Gio.SimpleAction.new(name, null); + action.connect('activate', () => Gtk.show_uri(null, uri, Gdk.CURRENT_TIME)); + group.add_action(action); + }; - // clang-format off - addAction('homepage', 'https://github.com/Schneegans/Burn-My-Windows'); - addAction('changelog', 'https://github.com/Schneegans/Burn-My-Windows/blob/main/docs/changelog.md'); - addAction('bugs', 'https://github.com/Schneegans/Burn-My-Windows/issues'); - addAction('donate-paypal', 'https://www.paypal.com/donate/?hosted_button_id=3F7UFL8KLVPXE'); - addAction('donate-github', 'https://github.com/sponsors/Schneegans'); - // clang-format on + // clang-format off + addAction('homepage', 'https://github.com/Schneegans/Burn-My-Windows'); + addAction('changelog', 'https://github.com/Schneegans/Burn-My-Windows/blob/main/docs/changelog.md'); + addAction('bugs', 'https://github.com/Schneegans/Burn-My-Windows/issues'); + addAction('donate-paypal', 'https://www.paypal.com/donate/?hosted_button_id=3F7UFL8KLVPXE'); + addAction('donate-github', 'https://github.com/sponsors/Schneegans'); + // clang-format on + } - window.insert_action_group('prefs', group); + // Populate the close-effects drop-down menu. + { + const group = Gio.SimpleActionGroup.new(); + window.insert_action_group('close-effects', group); + + const menu = this._builder.get_object('close-effect-menu'); + + this._effects.forEach(effect => { + const prefix = effect.constructor.getSettingsPrefix(); + const label = effect.constructor.getLabel(); + + const action = this._settings.create_action(`${prefix}-close-effect`); + group.add_action(action); + + menu.append_item( + Gio.MenuItem.new(label, `close-effects.${prefix}-close-effect`)); + }); + } }); // As we do not have something like a destructor, we just listen for the destroy diff --git a/resources/ui/gtk3/generalPage.ui b/resources/ui/gtk3/generalPage.ui index ddecbf9..9c952b8 100644 --- a/resources/ui/gtk3/generalPage.ui +++ b/resources/ui/gtk3/generalPage.ui @@ -1,6 +1,8 @@ + + vertical 60 @@ -54,21 +56,8 @@ - Effects - - - - - - - edit-clear-symbolic - 1 - - - Reset to Default Value - + Choose Effects + close-effect-menu diff --git a/resources/ui/gtk4/generalPage.ui b/resources/ui/gtk4/generalPage.ui index 6146516..193c826 100644 --- a/resources/ui/gtk4/generalPage.ui +++ b/resources/ui/gtk4/generalPage.ui @@ -1,6 +1,8 @@ + + vertical 60 @@ -54,16 +56,8 @@ - Effects - - - - - edit-clear-symbolic - Reset to Default Value - + Choose Effects + close-effect-menu diff --git a/src/prefs/FirePage.js b/src/prefs/FirePage.js index 66a700b..dbeadea 100644 --- a/src/prefs/FirePage.js +++ b/src/prefs/FirePage.js @@ -25,6 +25,20 @@ const PrefsPage = Me.imports.src.prefs.PrefsPage.PrefsPage; var FirePage = class FirePage extends PrefsPage { + // ---------------------------------------------------------------------- static methods + + static getMinShellVersion() { + return [3, 36]; + } + + static getSettingsPrefix() { + return 'fire'; + } + + static getLabel() { + return 'Fire'; + } + // ------------------------------------------------------------ constructor / destructor constructor(settings, builder) { @@ -60,16 +74,6 @@ var FirePage = class FirePage extends PrefsPage { stack.add_titled(this._builder.get_object('fire-prefs'), 'fire', 'Fire'); } - // ---------------------------------------------------------------------- public methods - - getEnabledKey() { - return 'fire-close-effect'; - } - - getAnimationTime() { - return this._settings.get_int('fire-animation-time'); - } - // ----------------------------------------------------------------------- private stuff // This populates the preset dropdown menu for the fire options. diff --git a/src/prefs/MatrixPage.js b/src/prefs/MatrixPage.js index e6dbf47..4ab405f 100644 --- a/src/prefs/MatrixPage.js +++ b/src/prefs/MatrixPage.js @@ -23,15 +23,25 @@ const PrefsPage = Me.imports.src.prefs.PrefsPage.PrefsPage; var MatrixPage = class MatrixPage extends PrefsPage { + // ---------------------------------------------------------------------- static methods + + static getMinShellVersion() { + return [40, 0]; + } + + static getSettingsPrefix() { + return 'matrix'; + } + + static getLabel() { + return 'Matrix'; + } + // ------------------------------------------------------------ constructor / destructor constructor(settings, builder) { super(settings, builder); - if (!utils.shellVersionIsAtLeast(40, 0)) { - return; - } - this._builder.add_from_resource('/ui/gtk4/matrixPage.ui'); // Bind all properties. @@ -44,14 +54,4 @@ var MatrixPage = class MatrixPage extends PrefsPage { const stack = this._builder.get_object('main-stack'); stack.add_titled(this._builder.get_object('matrix-prefs'), 'matrix', 'Matrix'); } - - // ---------------------------------------------------------------------- public methods - - getEnabledKey() { - return 'matrix-close-effect'; - } - - getAnimationTime() { - return this._settings.get_int('matrix-animation-time'); - } } \ No newline at end of file diff --git a/src/prefs/TRexPage.js b/src/prefs/TRexPage.js index 633cfff..113b02c 100644 --- a/src/prefs/TRexPage.js +++ b/src/prefs/TRexPage.js @@ -23,15 +23,25 @@ const PrefsPage = Me.imports.src.prefs.PrefsPage.PrefsPage; var TRexPage = class TRexPage extends PrefsPage { + // ---------------------------------------------------------------------- static methods + + static getMinShellVersion() { + return [40, 0]; + } + + static getSettingsPrefix() { + return 'trex'; + } + + static getLabel() { + return 'T-Rex Attack'; + } + // ------------------------------------------------------------ constructor / destructor constructor(settings, builder) { super(settings, builder); - if (!utils.shellVersionIsAtLeast(40, 0)) { - return; - } - this._builder.add_from_resource('/ui/gtk4/trexPage.ui'); // Bind all properties. @@ -44,14 +54,4 @@ var TRexPage = class TRexPage extends PrefsPage { const stack = this._builder.get_object('main-stack'); stack.add_titled(this._builder.get_object('trex-prefs'), 'trex', 'T-Rex Attack'); } - - // ---------------------------------------------------------------------- public methods - - getEnabledKey() { - return 'trex-close-effect'; - } - - getAnimationTime() { - return this._settings.get_int('trex-animation-time'); - } } \ No newline at end of file diff --git a/src/prefs/TVEffectPage.js b/src/prefs/TVEffectPage.js index 284bd1b..b919597 100644 --- a/src/prefs/TVEffectPage.js +++ b/src/prefs/TVEffectPage.js @@ -23,6 +23,20 @@ const PrefsPage = Me.imports.src.prefs.PrefsPage.PrefsPage; var TVEffectPage = class TVEffectPage extends PrefsPage { + // ---------------------------------------------------------------------- static methods + + static getMinShellVersion() { + return [3, 36]; + } + + static getSettingsPrefix() { + return 'tv'; + } + + static getLabel() { + return 'TV Effect'; + } + // ------------------------------------------------------------ constructor / destructor constructor(settings, builder) { @@ -37,14 +51,4 @@ var TVEffectPage = class TVEffectPage extends PrefsPage { const stack = this._builder.get_object('main-stack'); stack.add_titled(this._builder.get_object('tv-prefs'), 'tv', 'TV Effect'); } - - // ---------------------------------------------------------------------- public methods - - getEnabledKey() { - return 'tv-close-effect'; - } - - getAnimationTime() { - return this._settings.get_int('tv-animation-time'); - } } \ No newline at end of file From a99b682bf92c52aa7ed5c90026a943d779c13144 Mon Sep 17 00:00:00 2001 From: Simon Schneegans Date: Sun, 9 Jan 2022 13:13:34 +0100 Subject: [PATCH 15/30] :wrench: Revert fire settings names --- resources/ui/gtk3/firePage.ui | 16 ++++++++-------- resources/ui/gtk4/firePage.ui | 12 ++++++------ ....shell.extensions.burn-my-windows.gschema.xml | 6 +++--- src/prefs/FirePage.js | 10 +++++----- 4 files changed, 22 insertions(+), 22 deletions(-) diff --git a/resources/ui/gtk3/firePage.ui b/resources/ui/gtk3/firePage.ui index 3455fd8..5f1776c 100644 --- a/resources/ui/gtk3/firePage.ui +++ b/resources/ui/gtk3/firePage.ui @@ -8,14 +8,14 @@ 100 - + 3 0.1 0.01 0.1 - + 2.0 -2.0 0.01 @@ -171,11 +171,11 @@ 2 left 300 - fire-scale + flame-scale - + edit-clear-symbolic @@ -219,11 +219,11 @@ 2 left 300 - fire-movement-speed + flame-movement-speed - + edit-clear-symbolic @@ -279,13 +279,13 @@ - + end center - + edit-clear-symbolic diff --git a/resources/ui/gtk4/firePage.ui b/resources/ui/gtk4/firePage.ui index 9d8247c..69c9f2f 100644 --- a/resources/ui/gtk4/firePage.ui +++ b/resources/ui/gtk4/firePage.ui @@ -127,7 +127,7 @@ left 300 - + 3 0.1 0.01 @@ -137,7 +137,7 @@ - + edit-clear-symbolic Reset to Default Value