📝 Add some more comments

This commit is contained in:
Simon Schneegans
2022-01-10 05:41:10 +01:00
parent 3e61368087
commit 871cb8489f
6 changed files with 67 additions and 16 deletions
+16 -2
View File
@@ -27,26 +27,31 @@ const utils = Me.imports.src.utils;
// there are a couple of moving gradients which fade-in or fade-out the fire effect. //
//////////////////////////////////////////////////////////////////////////////////////////
// The shader class for this effect is registered further down in this file.
let FireShader = null;
var FireEffect = class FireEffect {
// ---------------------------------------------------------------------- static methods
// The effect is available on all GNOME Shell versions supported by this extension.
static getMinShellVersion() {
return [3, 36];
}
static getSettingsPrefix() {
static getNick() {
return 'fire';
}
// This will be shown in the sidebar of the preferences dialog as well as in the
// drop-down menus where the user can choose the effect.
static getLabel() {
return 'Fire';
}
static initPreferences(dialog) {
// Add the settings page to the builder.
dialog.getBuilder().add_from_resource(
`/ui/${utils.isGTK4() ? 'gtk4' : 'gtk3'}/firePage.ui`);
@@ -73,8 +78,11 @@ var FireEffect = class FireEffect {
// Initialize the fire-preset dropdown.
FireEffect._createFirePresets(dialog);
// Finally, append the settings page to the main stack.
const stack = dialog.getBuilder().get_object('main-stack');
stack.add_titled(dialog.getBuilder().get_object('fire-prefs'), 'fire', 'Fire');
stack.add_titled(
dialog.getBuilder().get_object('fire-prefs'), FireEffect.getNick(),
FireEffect.getLabel());
}
static createShader(settings) {
@@ -190,6 +198,12 @@ var FireEffect = class FireEffect {
}
//////////////////////////////////////////////////////////////////////////////////////////
// The shader class for this effect will only be registered in GNOME Shell's process //
// (not in the preferences process). It's done this way as Clutter may not be installed //
// on the system and therefore the preferences would crash. //
//////////////////////////////////////////////////////////////////////////////////////////
if (utils.isInShellProcess()) {
const Clutter = imports.gi.Clutter;