🎉 Add presets
This commit is contained in:
@@ -61,6 +61,8 @@ var PreferencesDialog = class PreferencesDialog {
|
|||||||
this._settings.reset('fire-color-5');
|
this._settings.reset('fire-color-5');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
this._createFirePresets();
|
||||||
|
|
||||||
// As we do not have something like a destructor, we just listen for the destroy
|
// As we do not have something like a destructor, we just listen for the destroy
|
||||||
// signal of our main widget.
|
// signal of our main widget.
|
||||||
this._widget.connect('destroy', () => {
|
this._widget.connect('destroy', () => {
|
||||||
@@ -125,6 +127,75 @@ var PreferencesDialog = class PreferencesDialog {
|
|||||||
this._settings.reset(settingsKey);
|
this._settings.reset(settingsKey);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_createFirePresets() {
|
||||||
|
this._widget.connect('realize', (widget) => {
|
||||||
|
const presets = [
|
||||||
|
{
|
||||||
|
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();
|
||||||
|
|
||||||
|
presets.forEach((preset, i) => {
|
||||||
|
const actionName = 'fire' + i;
|
||||||
|
menu.append(preset.name, 'presets.' + actionName);
|
||||||
|
let action = Gio.SimpleAction.new(actionName, null);
|
||||||
|
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);
|
||||||
|
widget.get_root().insert_action_group('presets', group);
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Nothing to do for now...
|
// Nothing to do for now...
|
||||||
|
|||||||
@@ -22,13 +22,15 @@
|
|||||||
<object class="GtkLabel">
|
<object class="GtkLabel">
|
||||||
<property name="margin-top">30</property>
|
<property name="margin-top">30</property>
|
||||||
<property name="margin-bottom">10</property>
|
<property name="margin-bottom">10</property>
|
||||||
<property name="label">Fire Options</property>
|
<property name="label">General Options</property>
|
||||||
<property name="xalign">0</property>
|
<property name="xalign">0</property>
|
||||||
<style>
|
<style>
|
||||||
<class name="title-4" />
|
<class name="title-4" />
|
||||||
</style>
|
</style>
|
||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
|
|
||||||
|
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkFrame">
|
<object class="GtkFrame">
|
||||||
<child>
|
<child>
|
||||||
@@ -86,6 +88,45 @@
|
|||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
|
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
|
||||||
|
|
||||||
|
<child>
|
||||||
|
<object class="GtkBox">
|
||||||
|
<property name="margin-top">30</property>
|
||||||
|
<property name="margin-bottom">10</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkLabel">
|
||||||
|
<property name="label">Fire Options</property>
|
||||||
|
<property name="xalign">0</property>
|
||||||
|
<property name="hexpand">1</property>
|
||||||
|
<style>
|
||||||
|
<class name="title-4" />
|
||||||
|
</style>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkMenuButton" id="fire-preset-button">
|
||||||
|
<property name="label">Choose a Preset</property>
|
||||||
|
<property name="has-frame">0</property>
|
||||||
|
</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">
|
||||||
<property name="activatable">0</property>
|
<property name="activatable">0</property>
|
||||||
@@ -110,7 +151,7 @@
|
|||||||
<property name="width-request">300</property>
|
<property name="width-request">300</property>
|
||||||
<property name="adjustment">
|
<property name="adjustment">
|
||||||
<object class="GtkAdjustment" id="flame-scale">
|
<object class="GtkAdjustment" id="flame-scale">
|
||||||
<property name="upper">5</property>
|
<property name="upper">3</property>
|
||||||
<property name="lower">0.1</property>
|
<property name="lower">0.1</property>
|
||||||
<property name="step-increment">0.01</property>
|
<property name="step-increment">0.01</property>
|
||||||
<property name="page-increment">0.1</property>
|
<property name="page-increment">0.1</property>
|
||||||
|
|||||||
Reference in New Issue
Block a user