🔀 Merge pull request #67 from Schneegans/feature/preview

This commit is contained in:
Simon Schneegans
2022-01-23 13:49:56 +01:00
committed by GitHub
30 changed files with 316 additions and 158 deletions
+5
View File
@@ -7,6 +7,11 @@
#### New Features #### New Features
* **New Effect: Broken Glass.** Shatter your windows into a shower sharp shards! This effect can be configured so that the shards fly away from your mouse pointer position! * **New Effect: Broken Glass.** Shatter your windows into a shower sharp shards! This effect can be configured so that the shards fly away from your mouse pointer position!
* The effect-configuration pages of the preferences dialog now have **Preview Buttons** which con be used to, well, preview the current settings (without having to enable the effect first).
#### Other Enhancements
* Added a menu entry with a link to the guide for creating new effect types.
## [Burn My Window 9](https://github.com/schneegans/Burn-My-Windows/releases/tag/v9) ## [Burn My Window 9](https://github.com/schneegans/Burn-My-Windows/releases/tag/v9)
+8 -18
View File
@@ -138,8 +138,9 @@ var SimpleFade = class SimpleFade {
// This is called by the preferences dialog. It loads the settings page for this effect, // This is called by the preferences dialog. It loads the settings page for this effect,
// binds all properties to the settings and appends the page to the main stack of the // binds all properties to the settings and appends the page to the main stack of the
// preferences dialog. // preferences dialog.
static initPreferences(dialog) { static getPreferences(dialog) {
// Empty for now... Code is added here later in the tutorial! // Empty for now... Code is added here later in the tutorial!
return null;
} }
// ---------------------------------------------------------------- API for extension.js // ---------------------------------------------------------------- API for extension.js
@@ -248,7 +249,7 @@ There should be two sliders in this example: The animation duration and the widt
If your effect supports GNOME Shell 3.3x _and_ GNOME Shell 40+, you will have to provide two `*.ui` files for this. If your effect supports GNOME Shell 3.3x _and_ GNOME Shell 40+, you will have to provide two `*.ui` files for this.
This is because starting with GNOME Shell 40, the preference dialog uses GTK4, before it used to use GTK3. This is because starting with GNOME Shell 40, the preference dialog uses GTK4, before it used to use GTK3.
Usually, there are only a few minor differences between the two files. Usually, there are only a few minor differences between the two files.
We will load the respective file in the `initPreferences()` method of your new effect class. We will load the respective file in the `getPreferences()` method of your new effect class.
Just save the code below to `resources/ui/gtk3/SimpleFade.ui` and `resources/ui/gtk4/SimpleFade.ui` respectively. Just save the code below to `resources/ui/gtk3/SimpleFade.ui` and `resources/ui/gtk4/SimpleFade.ui` respectively.
Remember to replace any occurrence of `simple-fade` with your effect's nick-name! Remember to replace any occurrence of `simple-fade` with your effect's nick-name!
@@ -276,10 +277,6 @@ Remember to replace any occurrence of `simple-fade` with your effect's nick-name
<object class="GtkBox" id="simple-fade-prefs"> <object class="GtkBox" id="simple-fade-prefs">
<property name="orientation">vertical</property> <property name="orientation">vertical</property>
<property name="margin-start">60</property>
<property name="margin-end">60</property>
<property name="margin-top">60</property>
<property name="margin-bottom">60</property>
<child> <child>
<object class="GtkFrame"> <object class="GtkFrame">
@@ -421,10 +418,6 @@ Remember to replace any occurrence of `simple-fade` with your effect's nick-name
<object class="GtkBox" id="simple-fade-prefs"> <object class="GtkBox" id="simple-fade-prefs">
<property name="orientation">vertical</property> <property name="orientation">vertical</property>
<property name="margin-start">60</property>
<property name="margin-end">60</property>
<property name="margin-top">60</property>
<property name="margin-bottom">60</property>
<child> <child>
<object class="GtkFrame"> <object class="GtkFrame">
@@ -528,10 +521,10 @@ Remember to replace any occurrence of `simple-fade` with your effect's nick-name
### Loading the Preferences Page ### Loading the Preferences Page
In order to load the above `*.ui` files, add the following code to your effect's `initPreferences()` method. In order to load the above `*.ui` files, add the following code to your effect's `getPreferences()` method.
```javascript ```javascript
static initPreferences(dialog) { static getPreferences(dialog) {
// Add the settings page to the builder. // Add the settings page to the builder.
dialog.getBuilder().add_from_resource(`/ui/${utils.getGTKString()}/SimpleFade.ui`); dialog.getBuilder().add_from_resource(`/ui/${utils.getGTKString()}/SimpleFade.ui`);
@@ -541,12 +534,9 @@ static initPreferences(dialog) {
dialog.bindAdjustment('simple-fade-animation-time'); dialog.bindAdjustment('simple-fade-animation-time');
dialog.bindAdjustment('simple-fade-width'); dialog.bindAdjustment('simple-fade-width');
// Finally, append the settings page to the main stack. // Finally, return the new settings page.
const stack = dialog.getBuilder().get_object('main-stack'); return dialog.getBuilder().get_object('simple-fade-prefs');
stack.add_titled( }
dialog.getBuilder().get_object(SimpleFade.getNick() + '-prefs'),
SimpleFade.getNick(), SimpleFade.getLabel());
}
``` ```
Once this is in place, you can kill the extension-preferences process and re-open the settings. Once this is in place, you can kill the extension-preferences process and re-open the settings.
+42 -11
View File
@@ -81,6 +81,14 @@ class Extension {
this._origWindowTime = imports.ui.windowManager.DESTROY_WINDOW_ANIMATION_TIME; this._origWindowTime = imports.ui.windowManager.DESTROY_WINDOW_ANIMATION_TIME;
this._origDialogTime = imports.ui.windowManager.DIALOG_DESTROY_WINDOW_ANIMATION_TIME; this._origDialogTime = imports.ui.windowManager.DIALOG_DESTROY_WINDOW_ANIMATION_TIME;
// Reset the dialog destroy time if the corresponding setting gets disabled.
this._settings.connect('changed::destroy-dialogs', () => {
if (!this._settings.get_boolean('destroy-dialogs')) {
imports.ui.windowManager.DIALOG_DESTROY_WINDOW_ANIMATION_TIME =
this._origDialogTime;
}
});
// We will use extensionThis to refer to the extension inside the patched methods of // We will use extensionThis to refer to the extension inside the patched methods of
// the WorkspacesView. // the WorkspacesView.
const extensionThis = this; const extensionThis = this;
@@ -207,26 +215,49 @@ class Extension {
} }
// We do nothing if a dialog got closed and we should not burn them. // We do nothing if a dialog got closed and we should not burn them.
const shouldDestroyDialogs = this._settings.get_boolean('destroy-dialogs');
const isDialogWindow = const isDialogWindow =
actor.meta_window.window_type == Meta.WindowType.MODAL_DIALOG || actor.meta_window.window_type == Meta.WindowType.MODAL_DIALOG ||
actor.meta_window.window_type == Meta.WindowType.DIALOG; actor.meta_window.window_type == Meta.WindowType.DIALOG;
if (!this._settings.get_boolean('destroy-dialogs') && isDialogWindow) { // If an effect is to be previewed, we have to affect dialogs es well. This is
// because the preview window is a dialog window...
const previewNick = this._settings.get_string('close-preview-effect');
if (isDialogWindow && !shouldDestroyDialogs && previewNick == '') {
return; return;
} }
// Create a list of all currently enabled effects. // Now we have to choose an effect.
const enabledEffects = ALL_EFFECTS.filter(Effect => { this._effect = null;
return this._settings.get_boolean(`${Effect.getNick()}-close-effect`);
});
// Nothing is enabled... // First we check if an effect is to be previewed.
if (enabledEffects.length == 0) { if (previewNick != '') {
return; this._effect = ALL_EFFECTS.find(Effect => {
return Effect.getNick() == previewNick;
});
// Only preview the effect once.
this._settings.set_string('close-preview-effect', '');
} else {
// Else we choose a random effect from all enabled effects. Therefore, we first
// create a list of all currently enabled effects.
const enabled = ALL_EFFECTS.filter(Effect => {
return this._settings.get_boolean(`${Effect.getNick()}-close-effect`);
});
// And then choose a random effect.
if (enabled.length > 0) {
this._effect = enabled[Math.floor(Math.random() * enabled.length)];
}
} }
// Choose a random effect. // If nothing was enabled, we have to do nothing :)
this._effect = enabledEffects[Math.floor(Math.random() * enabledEffects.length)]; if (this._effect == null) {
return;
}
// The effect usually will choose to override the present transitions on the actor. // The effect usually will choose to override the present transitions on the actor.
const transitionConfig = this._effect.getCloseTransition(actor, this._settings); const transitionConfig = this._effect.getCloseTransition(actor, this._settings);
@@ -255,7 +286,7 @@ class Extension {
// We set the currently used time here, so that others can get an idea how long this // We set the currently used time here, so that others can get an idea how long this
// will take... // will take...
const duration = transition.get_duration(); const duration = transition.get_duration();
if (isDialogWindow) { if (isDialogWindow && shouldDestroyDialogs) {
imports.ui.windowManager.DIALOG_DESTROY_WINDOW_ANIMATION_TIME = duration; imports.ui.windowManager.DIALOG_DESTROY_WINDOW_ANIMATION_TIME = duration;
} else { } else {
imports.ui.windowManager.DESTROY_WINDOW_ANIMATION_TIME = duration; imports.ui.windowManager.DESTROY_WINDOW_ANIMATION_TIME = duration;
+108 -2
View File
@@ -13,7 +13,7 @@
'use strict'; 'use strict';
const {Gio, Gtk, Gdk} = imports.gi; const {Gio, Gtk, Gdk, GLib, GObject} = imports.gi;
const ExtensionUtils = imports.misc.extensionUtils; const ExtensionUtils = imports.misc.extensionUtils;
const Me = imports.misc.extensionUtils.getCurrentExtension(); const Me = imports.misc.extensionUtils.getCurrentExtension();
@@ -31,6 +31,9 @@ const ALL_EFFECTS = [
Me.imports.src.Wisps.Wisps, Me.imports.src.Wisps.Wisps,
]; ];
// This template widget class is defined at the bottom of this file.
var BurnMyWindowsEffectPage = null;
////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////
// The preferences dialog is organized in pages, each of which is loaded from a // // The preferences dialog is organized in pages, each of which is loaded from a //
// separate ui file. There's one page with general options, all other paged are loaded // // separate ui file. There's one page with general options, all other paged are loaded //
@@ -46,6 +49,19 @@ var PreferencesDialog = class PreferencesDialog {
this._resources = Gio.Resource.load(Me.path + '/resources/burn-my-windows.gresource'); this._resources = Gio.Resource.load(Me.path + '/resources/burn-my-windows.gresource');
Gio.resources_register(this._resources); Gio.resources_register(this._resources);
// Load the CSS file for the settings dialog.
const styleProvider = Gtk.CssProvider.new();
styleProvider.load_from_resource('/css/gtk.css');
if (utils.isGTK4()) {
Gtk.StyleContext.add_provider_for_display(
Gdk.Display.get_default(), styleProvider,
Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION);
} else {
Gtk.StyleContext.add_provider_for_screen(
Gdk.Screen.get_default(), styleProvider,
Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION);
}
// Make sure custom icons are found. // Make sure custom icons are found.
if (utils.isGTK4()) { if (utils.isGTK4()) {
Gtk.IconTheme.get_for_display(Gdk.Display.get_default()).add_resource_path('/img'); Gtk.IconTheme.get_for_display(Gdk.Display.get_default()).add_resource_path('/img');
@@ -53,6 +69,9 @@ var PreferencesDialog = class PreferencesDialog {
Gtk.IconTheme.get_default().add_resource_path('/img'); Gtk.IconTheme.get_default().add_resource_path('/img');
} }
// Register the template widgets used in the settings dialog.
this._registerCustomClasses();
// Store a reference to the settings object. // Store a reference to the settings object.
this._settings = ExtensionUtils.getSettings(); this._settings = ExtensionUtils.getSettings();
@@ -65,10 +84,20 @@ var PreferencesDialog = class PreferencesDialog {
this.bindSwitch('destroy-dialogs'); this.bindSwitch('destroy-dialogs');
// Add all other effect pages. // Add all other effect pages.
const stack = this._builder.get_object('main-stack');
ALL_EFFECTS.forEach(Effect => { ALL_EFFECTS.forEach(Effect => {
const [minMajor, minMinor] = Effect.getMinShellVersion(); const [minMajor, minMinor] = Effect.getMinShellVersion();
if (utils.shellVersionIsAtLeast(minMajor, minMinor)) { if (utils.shellVersionIsAtLeast(minMajor, minMinor)) {
Effect.initPreferences(this);
const page = new BurnMyWindowsEffectPage(Effect, this);
// Add the Effect's preferences (if any).
const preferences = Effect.getPreferences(this);
if (preferences) {
this.gtkBoxAppend(page, preferences);
}
stack.add_titled(page, Effect.getNick(), Effect.getLabel());
} }
}); });
@@ -103,6 +132,7 @@ var PreferencesDialog = class PreferencesDialog {
addAction('homepage', 'https://github.com/Schneegans/Burn-My-Windows'); addAction('homepage', 'https://github.com/Schneegans/Burn-My-Windows');
addAction('changelog', 'https://github.com/Schneegans/Burn-My-Windows/blob/main/docs/changelog.md'); 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('bugs', 'https://github.com/Schneegans/Burn-My-Windows/issues');
addAction('new-effect', 'https://github.com/Schneegans/Burn-My-Windows/blob/main/docs/how-to-create-new-effects.md');
addAction('donate-paypal', 'https://www.paypal.com/donate/?hosted_button_id=3F7UFL8KLVPXE'); addAction('donate-paypal', 'https://www.paypal.com/donate/?hosted_button_id=3F7UFL8KLVPXE');
addAction('donate-github', 'https://github.com/sponsors/Schneegans'); addAction('donate-github', 'https://github.com/sponsors/Schneegans');
// clang-format on // clang-format on
@@ -210,6 +240,17 @@ var PreferencesDialog = class PreferencesDialog {
this._bindResetButton(settingsKey); this._bindResetButton(settingsKey);
} }
// ----------------------------------------------------------------- GTK3 / GTK4 helpers
// Appends the given child widget to the given Gtk.Box.
gtkBoxAppend(box, child) {
if (utils.isGTK4()) {
box.append(child);
} else {
box.pack_start(child, false, false, 0);
}
}
// ----------------------------------------------------------------------- private stuff // ----------------------------------------------------------------------- private stuff
// Searches for a reset button for the given settings key and make it reset the settings // Searches for a reset button for the given settings key and make it reset the settings
@@ -234,6 +275,71 @@ var PreferencesDialog = class PreferencesDialog {
this._bindResetButton(settingsKey); this._bindResetButton(settingsKey);
} }
// Initializes template widgets used by the preferences dialog.
_registerCustomClasses() {
// Each effect page is based on a template widget. This template contains the title
// and the preview button.
// clang-format off
BurnMyWindowsEffectPage =
GObject.registerClass({
GTypeName: 'BurnMyWindowsEffectPage',
Template: `resource:///ui/${utils.getGTKString()}/effectPage.ui`,
InternalChildren: ['label', 'button'],
},
class BurnMyWindowsEffectPage extends Gtk.Box {
_init(Effect, dialog) {
super._init();
// Set the effect's name as label.
this._label.label = Effect.getLabel();
// Open the preview window once the preview button is clicked.
this._button.connect('clicked', () => {
// Set the to-be-previewed effect.
dialog.getSettings().set_string('close-preview-effect', Effect.getNick());
// Create the preview-window.
const window = new Gtk.Window({
title: `Preview for ${Effect.getLabel()}`,
default_width: 800,
default_height: 450,
modal: true,
transient_for: utils.isGTK4() ? this._button.get_root() :
this._button.get_toplevel()
});
const box = new Gtk.Box({
orientation: Gtk.Orientation.VERTICAL,
valign: Gtk.Align.CENTER,
spacing: 10,
});
const label = Gtk.Label.new('Close this Window to Preview the Effect!');
label.get_style_context().add_class('large-title');
const image = new Gtk.Image({
icon_name: 'burn-my-windows-symbolic',
pixel_size: 128,
});
dialog.gtkBoxAppend(box, image);
dialog.gtkBoxAppend(box, label);
if (utils.isGTK4()) {
window.set_child(box);
} else {
window.add(box);
}
window.show();
});
}
});
// clang-format on
}
} }
// Nothing to do for now... // Nothing to do for now...
+3
View File
@@ -0,0 +1,3 @@
.pill-button {
border-radius: 9999px;
}
+6 -2
View File
@@ -10,12 +10,16 @@
<attribute name="label" translatable="yes">View Changelog</attribute> <attribute name="label" translatable="yes">View Changelog</attribute>
<attribute name="action">prefs.changelog</attribute> <attribute name="action">prefs.changelog</attribute>
</item> </item>
</section>
<section>
<item> <item>
<attribute name="label" translatable="yes">Report a Bug</attribute> <attribute name="label" translatable="yes">Report a Bug</attribute>
<attribute name="action">prefs.bugs</attribute> <attribute name="action">prefs.bugs</attribute>
</item> </item>
</section> <item>
<section> <attribute name="label" translatable="yes">Create a Custom Effect</attribute>
<attribute name="action">prefs.new-effect</attribute>
</item>
<submenu> <submenu>
<attribute name="label" translatable="yes">Donate</attribute> <attribute name="label" translatable="yes">Donate</attribute>
<item> <item>
-4
View File
@@ -17,10 +17,6 @@
<object class="GtkBox" id="energize-a-prefs"> <object class="GtkBox" id="energize-a-prefs">
<property name="orientation">vertical</property> <property name="orientation">vertical</property>
<property name="margin-start">60</property>
<property name="margin-end">60</property>
<property name="margin-top">60</property>
<property name="margin-bottom">60</property>
<child> <child>
<object class="GtkFrame"> <object class="GtkFrame">
-4
View File
@@ -17,10 +17,6 @@
<object class="GtkBox" id="energize-b-prefs"> <object class="GtkBox" id="energize-b-prefs">
<property name="orientation">vertical</property> <property name="orientation">vertical</property>
<property name="margin-start">60</property>
<property name="margin-end">60</property>
<property name="margin-top">60</property>
<property name="margin-bottom">60</property>
<child> <child>
<object class="GtkFrame"> <object class="GtkFrame">
-17
View File
@@ -24,10 +24,6 @@
<object class="GtkBox" id="fire-prefs"> <object class="GtkBox" id="fire-prefs">
<property name="orientation">vertical</property> <property name="orientation">vertical</property>
<property name="margin-start">60</property>
<property name="margin-end">60</property>
<property name="margin-top">60</property>
<property name="margin-bottom">60</property>
<child> <child>
<object class="GtkFrame"> <object class="GtkFrame">
@@ -81,19 +77,6 @@
</child> </child>
</object> </object>
</child> </child>
</object>
</child>
</object>
</child>
<child>
<object class="GtkFrame">
<child>
<object class="GtkListBox">
<property name="selection-mode">none</property>
<style>
<class name="rich-list" />
</style>
<child> <child>
<object class="GtkListBoxRow"> <object class="GtkListBoxRow">
-4
View File
@@ -10,10 +10,6 @@
<object class="GtkBox" id="tv-prefs"> <object class="GtkBox" id="tv-prefs">
<property name="orientation">vertical</property> <property name="orientation">vertical</property>
<property name="margin-start">60</property>
<property name="margin-end">60</property>
<property name="margin-top">60</property>
<property name="margin-bottom">60</property>
<child> <child>
<object class="GtkFrame"> <object class="GtkFrame">
-4
View File
@@ -17,10 +17,6 @@
<object class="GtkBox" id="wisps-prefs"> <object class="GtkBox" id="wisps-prefs">
<property name="orientation">vertical</property> <property name="orientation">vertical</property>
<property name="margin-start">60</property>
<property name="margin-end">60</property>
<property name="margin-top">60</property>
<property name="margin-bottom">60</property>
<child> <child>
<object class="GtkFrame"> <object class="GtkFrame">
+57
View File
@@ -0,0 +1,57 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<requires lib="gtk" version="3.0" />
<template class="BurnMyWindowsEffectPage" parent="GtkBox">
<property name="orientation">vertical</property>
<property name="margin-top">60</property>
<property name="margin-bottom">60</property>
<property name="margin-start">60</property>
<property name="margin-end">60</property>
<property name="hexpand">1</property>
<property name="spacing">10</property>
<child>
<object class="GtkBox">
<child>
<object class="GtkLabel" id="label">
<property name="xalign">0</property>
<property name="hexpand">1</property>
<style>
<class name="large-title" />
</style>
</object>
</child>
<child>
<object class="GtkButton" id="button">
<property name="valign">center</property>
<child>
<object class="GtkBox">
<property name="margin_start">8</property>
<property name="margin_end">8</property>
<property name="spacing">6</property>
<child>
<object class="GtkImage">
<property name="icon_name">media-playback-start-symbolic</property>
</object>
</child>
<child>
<object class="GtkLabel">
<property name="halign">start</property>
<property name="label" translatable="yes">Preview this Effect</property>
</object>
</child>
</object>
</child>
<style>
<class name="suggested-action" />
<class name="pill-button" />
</style>
</object>
</child>
</object>
</child>
</template>
</interface>
-4
View File
@@ -3,10 +3,6 @@
<object class="GtkBox" id="broken-glass-prefs"> <object class="GtkBox" id="broken-glass-prefs">
<property name="orientation">vertical</property> <property name="orientation">vertical</property>
<property name="margin-start">60</property>
<property name="margin-end">60</property>
<property name="margin-top">60</property>
<property name="margin-bottom">60</property>
<child> <child>
<object class="GtkFrame"> <object class="GtkFrame">
-4
View File
@@ -3,10 +3,6 @@
<object class="GtkBox" id="energize-a-prefs"> <object class="GtkBox" id="energize-a-prefs">
<property name="orientation">vertical</property> <property name="orientation">vertical</property>
<property name="margin-start">60</property>
<property name="margin-end">60</property>
<property name="margin-top">60</property>
<property name="margin-bottom">60</property>
<child> <child>
<object class="GtkFrame"> <object class="GtkFrame">
-4
View File
@@ -3,10 +3,6 @@
<object class="GtkBox" id="energize-b-prefs"> <object class="GtkBox" id="energize-b-prefs">
<property name="orientation">vertical</property> <property name="orientation">vertical</property>
<property name="margin-start">60</property>
<property name="margin-end">60</property>
<property name="margin-top">60</property>
<property name="margin-bottom">60</property>
<child> <child>
<object class="GtkFrame"> <object class="GtkFrame">
-18
View File
@@ -3,10 +3,6 @@
<object class="GtkBox" id="fire-prefs"> <object class="GtkBox" id="fire-prefs">
<property name="orientation">vertical</property> <property name="orientation">vertical</property>
<property name="margin-start">60</property>
<property name="margin-end">60</property>
<property name="margin-top">60</property>
<property name="margin-bottom">60</property>
<child> <child>
<object class="GtkFrame"> <object class="GtkFrame">
@@ -42,20 +38,6 @@
</child> </child>
</object> </object>
</child> </child>
</object>
</child>
</object>
</child>
<child>
<object class="GtkFrame">
<child>
<object class="GtkListBox">
<property name="selection-mode">none</property>
<property name="show-separators">1</property>
<style>
<class name="rich-list" />
</style>
<child> <child>
<object class="GtkListBoxRow"> <object class="GtkListBoxRow">
-4
View File
@@ -3,10 +3,6 @@
<object class="GtkBox" id="matrix-prefs"> <object class="GtkBox" id="matrix-prefs">
<property name="orientation">vertical</property> <property name="orientation">vertical</property>
<property name="margin-start">60</property>
<property name="margin-end">60</property>
<property name="margin-top">60</property>
<property name="margin-bottom">60</property>
<child> <child>
<object class="GtkFrame"> <object class="GtkFrame">
-4
View File
@@ -3,10 +3,6 @@
<object class="GtkBox" id="trex-prefs"> <object class="GtkBox" id="trex-prefs">
<property name="orientation">vertical</property> <property name="orientation">vertical</property>
<property name="margin-start">60</property>
<property name="margin-end">60</property>
<property name="margin-top">60</property>
<property name="margin-bottom">60</property>
<child> <child>
<object class="GtkFrame"> <object class="GtkFrame">
-4
View File
@@ -3,10 +3,6 @@
<object class="GtkBox" id="tv-prefs"> <object class="GtkBox" id="tv-prefs">
<property name="orientation">vertical</property> <property name="orientation">vertical</property>
<property name="margin-start">60</property>
<property name="margin-end">60</property>
<property name="margin-top">60</property>
<property name="margin-bottom">60</property>
<child> <child>
<object class="GtkFrame"> <object class="GtkFrame">
-4
View File
@@ -3,10 +3,6 @@
<object class="GtkBox" id="wisps-prefs"> <object class="GtkBox" id="wisps-prefs">
<property name="orientation">vertical</property> <property name="orientation">vertical</property>
<property name="margin-start">60</property>
<property name="margin-end">60</property>
<property name="margin-top">60</property>
<property name="margin-bottom">60</property>
<child> <child>
<object class="GtkFrame"> <object class="GtkFrame">
+57
View File
@@ -0,0 +1,57 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<requires lib="gtk" version="4.0" />
<template class="BurnMyWindowsEffectPage" parent="GtkBox">
<property name="orientation">vertical</property>
<property name="margin-top">60</property>
<property name="margin-bottom">60</property>
<property name="margin-start">60</property>
<property name="margin-end">60</property>
<property name="hexpand">1</property>
<property name="spacing">10</property>
<child>
<object class="GtkBox">
<child>
<object class="GtkLabel" id="label">
<property name="xalign">0</property>
<property name="hexpand">1</property>
<style>
<class name="large-title" />
</style>
</object>
</child>
<child>
<object class="GtkButton" id="button">
<property name="valign">center</property>
<property name="child">
<object class="GtkBox">
<property name="margin_start">8</property>
<property name="margin_end">8</property>
<property name="spacing">6</property>
<child>
<object class="GtkImage">
<property name="icon_name">media-playback-start-symbolic</property>
</object>
</child>
<child>
<object class="GtkLabel">
<property name="halign">start</property>
<property name="label" translatable="yes">Preview this Effect</property>
</object>
</child>
</object>
</property>
<style>
<class name="suggested-action" />
<class name="pill-button" />
</style>
</object>
</child>
</object>
</child>
</template>
</interface>
@@ -13,6 +13,12 @@
<description>Set to true to burn dialogs as well.</description> <description>Set to true to burn dialogs as well.</description>
</key> </key>
<key name="close-preview-effect" type="s">
<default>""</default>
<summary>Close Preview Effect</summary>
<description>The effect with this nick will be used for the next window-close animation.</description>
</key>
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - --> <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<!-- Fire Options --> <!-- Fire Options -->
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - --> <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
+3 -6
View File
@@ -60,7 +60,7 @@ var BrokenGlass = class BrokenGlass {
// This is called by the preferences dialog. It loads the settings page for this effect, // This is called by the preferences dialog. It loads the settings page for this effect,
// binds all properties to the settings and appends the page to the main stack of the // binds all properties to the settings and appends the page to the main stack of the
// preferences dialog. // preferences dialog.
static initPreferences(dialog) { static getPreferences(dialog) {
// Add the settings page to the builder. // Add the settings page to the builder.
dialog.getBuilder().add_from_resource('/ui/gtk4/BrokenGlass.ui'); dialog.getBuilder().add_from_resource('/ui/gtk4/BrokenGlass.ui');
@@ -72,11 +72,8 @@ var BrokenGlass = class BrokenGlass {
dialog.bindAdjustment('broken-glass-blow-force'); dialog.bindAdjustment('broken-glass-blow-force');
dialog.bindSwitch('broken-glass-use-pointer'); dialog.bindSwitch('broken-glass-use-pointer');
// Finally, append the settings page to the main stack. // Finally, return the new settings page.
const stack = dialog.getBuilder().get_object('main-stack'); return dialog.getBuilder().get_object('broken-glass-prefs');
stack.add_titled(
dialog.getBuilder().get_object('broken-glass-prefs'), BrokenGlass.getNick(),
BrokenGlass.getLabel());
} }
// ---------------------------------------------------------------- API for extension.js // ---------------------------------------------------------------- API for extension.js
+3 -6
View File
@@ -57,7 +57,7 @@ var EnergizeA = class EnergizeA {
// This is called by the preferences dialog. It loads the settings page for this effect, // This is called by the preferences dialog. It loads the settings page for this effect,
// binds all properties to the settings and appends the page to the main stack of the // binds all properties to the settings and appends the page to the main stack of the
// preferences dialog. // preferences dialog.
static initPreferences(dialog) { static getPreferences(dialog) {
// Add the settings page to the builder. // Add the settings page to the builder.
dialog.getBuilder().add_from_resource(`/ui/${utils.getGTKString()}/EnergizeA.ui`); dialog.getBuilder().add_from_resource(`/ui/${utils.getGTKString()}/EnergizeA.ui`);
@@ -67,11 +67,8 @@ var EnergizeA = class EnergizeA {
dialog.bindAdjustment('energize-a-scale'); dialog.bindAdjustment('energize-a-scale');
dialog.bindColorButton('energize-a-color'); dialog.bindColorButton('energize-a-color');
// Finally, append the settings page to the main stack. // Finally, return the new settings page.
const stack = dialog.getBuilder().get_object('main-stack'); return dialog.getBuilder().get_object('energize-a-prefs');
stack.add_titled(
dialog.getBuilder().get_object('energize-a-prefs'), EnergizeA.getNick(),
EnergizeA.getLabel());
} }
// ---------------------------------------------------------------- API for extension.js // ---------------------------------------------------------------- API for extension.js
+3 -6
View File
@@ -57,7 +57,7 @@ var EnergizeB = class EnergizeB {
// This is called by the preferences dialog. It loads the settings page for this effect, // This is called by the preferences dialog. It loads the settings page for this effect,
// binds all properties to the settings and appends the page to the main stack of the // binds all properties to the settings and appends the page to the main stack of the
// preferences dialog. // preferences dialog.
static initPreferences(dialog) { static getPreferences(dialog) {
// Add the settings page to the builder. // Add the settings page to the builder.
dialog.getBuilder().add_from_resource(`/ui/${utils.getGTKString()}/EnergizeB.ui`); dialog.getBuilder().add_from_resource(`/ui/${utils.getGTKString()}/EnergizeB.ui`);
@@ -67,11 +67,8 @@ var EnergizeB = class EnergizeB {
dialog.bindAdjustment('energize-b-scale'); dialog.bindAdjustment('energize-b-scale');
dialog.bindColorButton('energize-b-color'); dialog.bindColorButton('energize-b-color');
// Finally, append the settings page to the main stack. // Finally, return the new settings page.
const stack = dialog.getBuilder().get_object('main-stack'); return dialog.getBuilder().get_object('energize-b-prefs');
stack.add_titled(
dialog.getBuilder().get_object('energize-b-prefs'), EnergizeB.getNick(),
EnergizeB.getLabel());
} }
// ---------------------------------------------------------------- API for extension.js // ---------------------------------------------------------------- API for extension.js
+3 -5
View File
@@ -61,7 +61,7 @@ var Fire = class Fire {
// This is called by the preferences dialog. It loads the settings page for this effect, // This is called by the preferences dialog. It loads the settings page for this effect,
// binds all properties to the settings and appends the page to the main stack of the // binds all properties to the settings and appends the page to the main stack of the
// preferences dialog. // preferences dialog.
static initPreferences(dialog) { static getPreferences(dialog) {
// Add the settings page to the builder. // Add the settings page to the builder.
dialog.getBuilder().add_from_resource(`/ui/${utils.getGTKString()}/Fire.ui`); dialog.getBuilder().add_from_resource(`/ui/${utils.getGTKString()}/Fire.ui`);
@@ -89,10 +89,8 @@ var Fire = class Fire {
// Initialize the fire-preset dropdown. // Initialize the fire-preset dropdown.
Fire._createFirePresets(dialog); Fire._createFirePresets(dialog);
// Finally, append the settings page to the main stack. // Finally, return the new settings page.
const stack = dialog.getBuilder().get_object('main-stack'); return dialog.getBuilder().get_object('fire-prefs');
stack.add_titled(
dialog.getBuilder().get_object('fire-prefs'), Fire.getNick(), Fire.getLabel());
} }
// ---------------------------------------------------------------- API for extension.js // ---------------------------------------------------------------- API for extension.js
+3 -6
View File
@@ -61,7 +61,7 @@ var Matrix = class Matrix {
// This is called by the preferences dialog. It loads the settings page for this effect, // This is called by the preferences dialog. It loads the settings page for this effect,
// binds all properties to the settings and appends the page to the main stack of the // binds all properties to the settings and appends the page to the main stack of the
// preferences dialog. // preferences dialog.
static initPreferences(dialog) { static getPreferences(dialog) {
// Add the settings page to the builder. // Add the settings page to the builder.
dialog.getBuilder().add_from_resource('/ui/gtk4/Matrix.ui'); dialog.getBuilder().add_from_resource('/ui/gtk4/Matrix.ui');
@@ -73,11 +73,8 @@ var Matrix = class Matrix {
dialog.bindColorButton('matrix-trail-color'); dialog.bindColorButton('matrix-trail-color');
dialog.bindColorButton('matrix-tip-color'); dialog.bindColorButton('matrix-tip-color');
// Finally, append the settings page to the main stack. // Finally, return the new settings page.
const stack = dialog.getBuilder().get_object('main-stack'); return dialog.getBuilder().get_object('matrix-prefs');
stack.add_titled(
dialog.getBuilder().get_object('matrix-prefs'), Matrix.getNick(),
Matrix.getLabel());
} }
// ---------------------------------------------------------------- API for extension.js // ---------------------------------------------------------------- API for extension.js
+3 -6
View File
@@ -59,7 +59,7 @@ var TRexAttack = class TRexAttack {
// This is called by the preferences dialog. It loads the settings page for this effect, // This is called by the preferences dialog. It loads the settings page for this effect,
// binds all properties to the settings and appends the page to the main stack of the // binds all properties to the settings and appends the page to the main stack of the
// preferences dialog. // preferences dialog.
static initPreferences(dialog) { static getPreferences(dialog) {
// Add the settings page to the builder. // Add the settings page to the builder.
dialog.getBuilder().add_from_resource('/ui/gtk4/TRexAttack.ui'); dialog.getBuilder().add_from_resource('/ui/gtk4/TRexAttack.ui');
@@ -71,11 +71,8 @@ var TRexAttack = class TRexAttack {
dialog.bindAdjustment('claw-scratch-count'); dialog.bindAdjustment('claw-scratch-count');
dialog.bindAdjustment('claw-scratch-warp'); dialog.bindAdjustment('claw-scratch-warp');
// Finally, append the settings page to the main stack. // Finally, return the new settings page.
const stack = dialog.getBuilder().get_object('main-stack'); return dialog.getBuilder().get_object('trex-prefs');
stack.add_titled(
dialog.getBuilder().get_object('trex-prefs'), TRexAttack.getNick(),
TRexAttack.getLabel());
} }
// ---------------------------------------------------------------- API for extension.js // ---------------------------------------------------------------- API for extension.js
+3 -6
View File
@@ -59,7 +59,7 @@ var TVEffect = class TVEffect {
// This is called by the preferences dialog. It loads the settings page for this effect, // This is called by the preferences dialog. It loads the settings page for this effect,
// binds all properties to the settings and appends the page to the main stack of the // binds all properties to the settings and appends the page to the main stack of the
// preferences dialog. // preferences dialog.
static initPreferences(dialog) { static getPreferences(dialog) {
// Add the settings page to the builder. // Add the settings page to the builder.
dialog.getBuilder().add_from_resource(`/ui/${utils.getGTKString()}/TVEffect.ui`); dialog.getBuilder().add_from_resource(`/ui/${utils.getGTKString()}/TVEffect.ui`);
@@ -68,11 +68,8 @@ var TVEffect = class TVEffect {
dialog.bindAdjustment('tv-animation-time'); dialog.bindAdjustment('tv-animation-time');
dialog.bindColorButton('tv-effect-color'); dialog.bindColorButton('tv-effect-color');
// Finally, append the settings page to the main stack. // Finally, return the new settings page.
const stack = dialog.getBuilder().get_object('main-stack'); return dialog.getBuilder().get_object('tv-prefs');
stack.add_titled(
dialog.getBuilder().get_object('tv-prefs'), TVEffect.getNick(),
TVEffect.getLabel());
} }
// ---------------------------------------------------------------- API for extension.js // ---------------------------------------------------------------- API for extension.js
+3 -5
View File
@@ -58,7 +58,7 @@ var Wisps = class Wisps {
// This is called by the preferences dialog. It loads the settings page for this effect, // This is called by the preferences dialog. It loads the settings page for this effect,
// binds all properties to the settings and appends the page to the main stack of the // binds all properties to the settings and appends the page to the main stack of the
// preferences dialog. // preferences dialog.
static initPreferences(dialog) { static getPreferences(dialog) {
// Add the settings page to the builder. // Add the settings page to the builder.
dialog.getBuilder().add_from_resource(`/ui/${utils.getGTKString()}/Wisps.ui`); dialog.getBuilder().add_from_resource(`/ui/${utils.getGTKString()}/Wisps.ui`);
@@ -68,10 +68,8 @@ var Wisps = class Wisps {
dialog.bindAdjustment('wisps-scale'); dialog.bindAdjustment('wisps-scale');
dialog.bindColorButton('wisps-color'); dialog.bindColorButton('wisps-color');
// Finally, append the settings page to the main stack. // Finally, return the new settings page.
const stack = dialog.getBuilder().get_object('main-stack'); return dialog.getBuilder().get_object('wisps-prefs');
stack.add_titled(
dialog.getBuilder().get_object('wisps-prefs'), Wisps.getNick(), Wisps.getLabel());
} }
// ---------------------------------------------------------------- API for extension.js // ---------------------------------------------------------------- API for extension.js