🚚 Use simpler effect class names

This commit is contained in:
Simon Schneegans
2022-01-16 05:46:22 +01:00
parent 5287ac2614
commit ee37015d6d
7 changed files with 24 additions and 27 deletions
+5 -5
View File
@@ -71,7 +71,7 @@ Just remember to replace `simple-fade` with your custom name!
### 2. Creating the Effect Class
You will have to create a new file called `src/SimpleFadeEffect.js` and paste the following code to it.
You will have to create a new file called `src/SimpleFade.js` and paste the following code to it.
Please study this code carefully, all of it is explained with inline comments.
<details>
@@ -110,7 +110,7 @@ let Shader = null;
// The effect class is completely static. It can be used to get some metadata (like the
// effect's name or supported GNOME Shell versions), to initialize the respective page of
// the settings dialog, as well as to create the actual shader for the effect.
var SimpleFadeEffect = class SimpleFadeEffect {
var SimpleFade = class SimpleFade {
// ---------------------------------------------------------------------------- metadata
@@ -233,7 +233,7 @@ Like this:
```javascript
const ALL_EFFECTS = [
...
Me.imports.src.SimpleFadeEffect.SimpleFadeEffect,
Me.imports.src.SimpleFade.SimpleFade,
...
];
```
@@ -555,8 +555,8 @@ static initPreferences(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(SimpleFadeEffect.getNick() + '-prefs'),
SimpleFadeEffect.getNick(), SimpleFadeEffect.getLabel());
dialog.getBuilder().get_object(SimpleFade.getNick() + '-prefs'),
SimpleFade.getNick(), SimpleFade.getLabel());
}
```
+4 -5
View File
@@ -22,15 +22,14 @@ const WINDOW_REPOSITIONING_DELAY = imports.ui.workspace.WINDOW_REPOSITIONING_DEL
const ExtensionUtils = imports.misc.extensionUtils;
const Me = imports.misc.extensionUtils.getCurrentExtension();
const utils = Me.imports.src.utils;
const FireEffect = Me.imports.src.FireEffect.FireEffect;
// New effects must be registered here and in prefs.js.
const ALL_EFFECTS = [
Me.imports.src.FireEffect.FireEffect,
Me.imports.src.MatrixEffect.MatrixEffect,
Me.imports.src.TRexEffect.TRexEffect,
Me.imports.src.Fire.Fire,
Me.imports.src.Matrix.Matrix,
Me.imports.src.TRexAttack.TRexAttack,
Me.imports.src.TVEffect.TVEffect,
Me.imports.src.WispsEffect.WispsEffect,
Me.imports.src.Wisps.Wisps,
];
//////////////////////////////////////////////////////////////////////////////////////////
+4 -4
View File
@@ -21,11 +21,11 @@ const utils = Me.imports.src.utils;
// New effects must be registered here and in extension.js.
const ALL_EFFECTS = [
Me.imports.src.FireEffect.FireEffect,
Me.imports.src.MatrixEffect.MatrixEffect,
Me.imports.src.TRexEffect.TRexEffect,
Me.imports.src.Fire.Fire,
Me.imports.src.Matrix.Matrix,
Me.imports.src.TRexAttack.TRexAttack,
Me.imports.src.TVEffect.TVEffect,
Me.imports.src.WispsEffect.WispsEffect,
Me.imports.src.Wisps.Wisps,
];
//////////////////////////////////////////////////////////////////////////////////////////
+3 -4
View File
@@ -33,7 +33,7 @@ let Shader = null;
// The effect class is completely static. It can be used to get some metadata (like the
// effect's name or supported GNOME Shell versions), to initialize the respective page of
// the settings dialog, as well as to create the actual shader for the effect.
var FireEffect = class FireEffect {
var Fire = class Fire {
// ---------------------------------------------------------------------------- metadata
@@ -86,13 +86,12 @@ var FireEffect = class FireEffect {
});
// Initialize the fire-preset dropdown.
FireEffect._createFirePresets(dialog);
Fire._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'), FireEffect.getNick(),
FireEffect.getLabel());
dialog.getBuilder().get_object('fire-prefs'), Fire.getNick(), Fire.getLabel());
}
// ---------------------------------------------------------------- API for extension.js
+3 -3
View File
@@ -33,7 +33,7 @@ let Shader = null;
// The effect class is completely static. It can be used to get some metadata (like the
// effect's name or supported GNOME Shell versions), to initialize the respective page of
// the settings dialog, as well as to create the actual shader for the effect.
var MatrixEffect = class MatrixEffect {
var Matrix = class Matrix {
// ---------------------------------------------------------------------------- metadata
@@ -75,8 +75,8 @@ var MatrixEffect = class MatrixEffect {
// Finally, append the settings page to the main stack.
const stack = dialog.getBuilder().get_object('main-stack');
stack.add_titled(
dialog.getBuilder().get_object('matrix-prefs'), MatrixEffect.getNick(),
MatrixEffect.getLabel());
dialog.getBuilder().get_object('matrix-prefs'), Matrix.getNick(),
Matrix.getLabel());
}
// ---------------------------------------------------------------- API for extension.js
+3 -3
View File
@@ -31,7 +31,7 @@ let Shader = null;
// The effect class is completely static. It can be used to get some metadata (like the
// effect's name or supported GNOME Shell versions), to initialize the respective page of
// the settings dialog, as well as to create the actual shader for the effect.
var TRexEffect = class TRexEffect {
var TRexAttack = class TRexAttack {
// ---------------------------------------------------------------------------- metadata
@@ -73,8 +73,8 @@ var TRexEffect = class TRexEffect {
// Finally, append the settings page to the main stack.
const stack = dialog.getBuilder().get_object('main-stack');
stack.add_titled(
dialog.getBuilder().get_object('trex-prefs'), TRexEffect.getNick(),
TRexEffect.getLabel());
dialog.getBuilder().get_object('trex-prefs'), TRexAttack.getNick(),
TRexAttack.getLabel());
}
// ---------------------------------------------------------------- API for extension.js
+2 -3
View File
@@ -30,7 +30,7 @@ let Shader = null;
// The effect class is completely static. It can be used to get some metadata (like the
// effect's name or supported GNOME Shell versions), to initialize the respective page of
// the settings dialog, as well as to create the actual shader for the effect.
var WispsEffect = class WispsEffect {
var Wisps = class Wisps {
// ---------------------------------------------------------------------------- metadata
@@ -69,8 +69,7 @@ var WispsEffect = class WispsEffect {
// Finally, append the settings page to the main stack.
const stack = dialog.getBuilder().get_object('main-stack');
stack.add_titled(
dialog.getBuilder().get_object('wisps-prefs'), WispsEffect.getNick(),
WispsEffect.getLabel());
dialog.getBuilder().get_object('wisps-prefs'), Wisps.getNick(), Wisps.getLabel());
}
// ---------------------------------------------------------------- API for extension.js