Skip to content

Commit 5350fc9

Browse files
committed
📝 Add some comments
1 parent a129441 commit 5350fc9

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

prefs.js

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ var PreferencesDialog = class PreferencesDialog {
6161
this._settings.reset('fire-color-5');
6262
});
6363

64+
// Initialize the fire-preset dropdown.
6465
this._createFirePresets();
6566

6667
// As we do not have something like a destructor, we just listen for the destroy
@@ -128,6 +129,7 @@ var PreferencesDialog = class PreferencesDialog {
128129
});
129130
}
130131

132+
// This populates the preset dropdown menu for the fire options.
131133
_createFirePresets() {
132134
this._widget.connect('realize', (widget) => {
133135
const presets = [
@@ -183,13 +185,17 @@ var PreferencesDialog = class PreferencesDialog {
183185
}
184186
];
185187

186-
const menu = Gio.Menu.new();
187-
const group = Gio.SimpleActionGroup.new();
188+
const menu = Gio.Menu.new();
189+
const group = Gio.SimpleActionGroup.new();
190+
const groupName = 'presets';
188191

192+
// Add all presets.
189193
presets.forEach((preset, i) => {
190194
const actionName = 'fire' + i;
191-
menu.append(preset.name, 'presets.' + actionName);
195+
menu.append(preset.name, groupName + '.' + actionName);
192196
let action = Gio.SimpleAction.new(actionName, null);
197+
198+
// Load the preset on activation.
193199
action.connect('activate', () => {
194200
this._settings.set_double('flame-movement-speed', preset.speed);
195201
this._settings.set_double('flame-scale', preset.scale);
@@ -199,11 +205,12 @@ var PreferencesDialog = class PreferencesDialog {
199205
this._settings.set_string('fire-color-4', preset.color4);
200206
this._settings.set_string('fire-color-5', preset.color5);
201207
});
208+
202209
group.add_action(action);
203210
});
204211

205212
this._builder.get_object('fire-preset-button').set_menu_model(menu);
206-
widget.get_root().insert_action_group('presets', group);
213+
widget.get_root().insert_action_group(groupName, group);
207214
});
208215
}
209216
}

0 commit comments

Comments
 (0)