🔧 Bind profile combo rows to settings
This commit is contained in:
@@ -98,7 +98,7 @@ var PreferencesDialog = class PreferencesDialog {
|
|||||||
|
|
||||||
// Load the general user interface files.
|
// Load the general user interface files.
|
||||||
this._builder = new Gtk.Builder();
|
this._builder = new Gtk.Builder();
|
||||||
this._builder.add_from_resource(`/ui/common/main-menu.ui`);
|
this._builder.add_from_resource(`/ui/common/menus.ui`);
|
||||||
this._builder.add_from_resource(`/ui/${utils.getUIDir()}/prefs.ui`);
|
this._builder.add_from_resource(`/ui/${utils.getUIDir()}/prefs.ui`);
|
||||||
|
|
||||||
// Check whether the power profiles daemon is available - if not, we hide the
|
// Check whether the power profiles daemon is available - if not, we hide the
|
||||||
@@ -169,7 +169,7 @@ var PreferencesDialog = class PreferencesDialog {
|
|||||||
|
|
||||||
// Now add the two toggle buttons for enabling and disabling the effect.
|
// Now add the two toggle buttons for enabling and disabling the effect.
|
||||||
const button = Gtk.Switch.new();
|
const button = Gtk.Switch.new();
|
||||||
button.set_action_name(`enabled-effects.${effect.getNick()}-enable-effect`);
|
button.set_action_name(`prefs.${effect.getNick()}-enable-effect`);
|
||||||
button.set_tooltip_text(_('Use this effect'));
|
button.set_tooltip_text(_('Use this effect'));
|
||||||
button.set_valign(Gtk.Align.CENTER);
|
button.set_valign(Gtk.Align.CENTER);
|
||||||
|
|
||||||
@@ -232,6 +232,10 @@ var PreferencesDialog = class PreferencesDialog {
|
|||||||
// Show the version number in the title bar.
|
// Show the version number in the title bar.
|
||||||
window.set_title(`Burn-My-Windows ${Me.metadata.version}`);
|
window.set_title(`Burn-My-Windows ${Me.metadata.version}`);
|
||||||
|
|
||||||
|
// Populate the menu with actions.
|
||||||
|
const group = Gio.SimpleActionGroup.new();
|
||||||
|
window.insert_action_group('prefs', group);
|
||||||
|
|
||||||
// Add the main menu to the title bar.
|
// Add the main menu to the title bar.
|
||||||
{
|
{
|
||||||
// Add the menu button to the title bar.
|
// Add the menu button to the title bar.
|
||||||
@@ -262,10 +266,6 @@ var PreferencesDialog = class PreferencesDialog {
|
|||||||
window.get_titlebar().pack_start(menu);
|
window.get_titlebar().pack_start(menu);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Populate the menu with actions.
|
|
||||||
const group = Gio.SimpleActionGroup.new();
|
|
||||||
window.insert_action_group('prefs', group);
|
|
||||||
|
|
||||||
const addURIAction = (name, uri) => {
|
const addURIAction = (name, uri) => {
|
||||||
const action = Gio.SimpleAction.new(name, null);
|
const action = Gio.SimpleAction.new(name, null);
|
||||||
action.connect('activate', () => Gtk.show_uri(null, uri, Gdk.CURRENT_TIME));
|
action.connect('activate', () => Gtk.show_uri(null, uri, Gdk.CURRENT_TIME));
|
||||||
@@ -379,11 +379,17 @@ var PreferencesDialog = class PreferencesDialog {
|
|||||||
group.add_action(aboutAction);
|
group.add_action(aboutAction);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Bind all the profile-related actions.
|
||||||
|
{
|
||||||
|
this.bindComboRow('profile-animation-type');
|
||||||
|
this.bindComboRow('profile-window-type');
|
||||||
|
this.bindComboRow('profile-desktop-style');
|
||||||
|
this.bindComboRow('profile-power-mode');
|
||||||
|
this.bindComboRow('profile-power-profile');
|
||||||
|
}
|
||||||
|
|
||||||
// Populate the enabled-effects drop-down menu.
|
// Populate the enabled-effects drop-down menu.
|
||||||
{
|
{
|
||||||
const group = Gio.SimpleActionGroup.new();
|
|
||||||
window.insert_action_group('enabled-effects', group);
|
|
||||||
|
|
||||||
this._ALL_EFFECTS.forEach(effect => {
|
this._ALL_EFFECTS.forEach(effect => {
|
||||||
const [minMajor, minMinor] = effect.getMinShellVersion();
|
const [minMajor, minMinor] = effect.getMinShellVersion();
|
||||||
if (utils.shellVersionIsAtLeast(minMajor, minMinor)) {
|
if (utils.shellVersionIsAtLeast(minMajor, minMinor)) {
|
||||||
@@ -396,7 +402,7 @@ var PreferencesDialog = class PreferencesDialog {
|
|||||||
if (!utils.isADW()) {
|
if (!utils.isADW()) {
|
||||||
const menu = this._builder.get_object('enabled-effects-menu');
|
const menu = this._builder.get_object('enabled-effects-menu');
|
||||||
const label = effect.getLabel();
|
const label = effect.getLabel();
|
||||||
menu.append_item(Gio.MenuItem.new(label, 'enabled-effects.' + actionName));
|
menu.append_item(Gio.MenuItem.new(label, 'prefs.' + actionName));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -434,10 +440,10 @@ var PreferencesDialog = class PreferencesDialog {
|
|||||||
return this._widget;
|
return this._widget;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Connects a Gtk.ComboBox (or anything else which has an 'active-id' property) to a
|
// Connects a Gtk.ComboBox (or anything else which has an 'selected' property) to a
|
||||||
// settings key. It also binds the corresponding reset button.
|
// settings key. It also binds the corresponding reset button.
|
||||||
bindCombobox(settingsKey) {
|
bindComboRow(settingsKey) {
|
||||||
this._bind(settingsKey, 'active-id');
|
this._bind(settingsKey, 'selected');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Connects a Gtk.Adjustment (or anything else which has a 'value' property) to a
|
// Connects a Gtk.Adjustment (or anything else which has a 'value' property) to a
|
||||||
|
|||||||
+26
-26
@@ -13,7 +13,7 @@ SPDX-License-Identifier: GPL-3.0-or-later
|
|||||||
<child>
|
<child>
|
||||||
<object class="GtkMenuButton">
|
<object class="GtkMenuButton">
|
||||||
<property name="label">Default Profile</property>
|
<property name="label">Default Profile</property>
|
||||||
<property name="menu-model">effect-profile-menu</property>
|
<property name="menu-model">profile-menu</property>
|
||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
@@ -66,10 +66,10 @@ SPDX-License-Identifier: GPL-3.0-or-later
|
|||||||
<property name="description" translatable="yes">Here you can specify under which circumstances the current effect settings should be applied.</property>
|
<property name="description" translatable="yes">Here you can specify under which circumstances the current effect settings should be applied.</property>
|
||||||
|
|
||||||
<child>
|
<child>
|
||||||
<object class="AdwEntryRow">
|
<object class="AdwEntryRow" id="profile-app">
|
||||||
<property name="title" translatable="yes">Choose an Application</property>
|
<property name="title" translatable="yes">Choose an Application</property>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkButton" id="reset-doom-animation-time">
|
<object class="GtkButton" id="profile-choose-app-button">
|
||||||
<property name="icon-name">bmw-select-app-symbolic</property>
|
<property name="icon-name">bmw-select-app-symbolic</property>
|
||||||
<property name="valign">center</property>
|
<property name="valign">center</property>
|
||||||
</object>
|
</object>
|
||||||
@@ -78,14 +78,14 @@ SPDX-License-Identifier: GPL-3.0-or-later
|
|||||||
</child>
|
</child>
|
||||||
|
|
||||||
<child>
|
<child>
|
||||||
<object class="AdwComboRow">
|
<object class="AdwComboRow" id="profile-animation-type">
|
||||||
<property name="title" translatable="yes">Animation Type</property>
|
<property name="title" translatable="yes">Animation Type</property>
|
||||||
<property name="model">
|
<property name="model">
|
||||||
<object class="GtkStringList">
|
<object class="GtkStringList">
|
||||||
<items>
|
<items>
|
||||||
<item>Any</item>
|
<item translatable="yes">Any</item>
|
||||||
<item>Open Windows</item>
|
<item translatable="yes">Open Windows</item>
|
||||||
<item>Close Windows</item>
|
<item translatable="yes">Close Windows</item>
|
||||||
</items>
|
</items>
|
||||||
</object>
|
</object>
|
||||||
</property>
|
</property>
|
||||||
@@ -93,14 +93,14 @@ SPDX-License-Identifier: GPL-3.0-or-later
|
|||||||
</child>
|
</child>
|
||||||
|
|
||||||
<child>
|
<child>
|
||||||
<object class="AdwComboRow">
|
<object class="AdwComboRow" id="profile-window-type">
|
||||||
<property name="title" translatable="yes">Window Type</property>
|
<property name="title" translatable="yes">Window Type</property>
|
||||||
<property name="model">
|
<property name="model">
|
||||||
<object class="GtkStringList">
|
<object class="GtkStringList">
|
||||||
<items>
|
<items>
|
||||||
<item>Any</item>
|
<item translatable="yes">Any</item>
|
||||||
<item>Normal Windows</item>
|
<item translatable="yes">Normal Windows</item>
|
||||||
<item>Dialogs</item>
|
<item translatable="yes">Dialogs</item>
|
||||||
</items>
|
</items>
|
||||||
</object>
|
</object>
|
||||||
</property>
|
</property>
|
||||||
@@ -108,14 +108,14 @@ SPDX-License-Identifier: GPL-3.0-or-later
|
|||||||
</child>
|
</child>
|
||||||
|
|
||||||
<child>
|
<child>
|
||||||
<object class="AdwComboRow">
|
<object class="AdwComboRow" id="profile-desktop-style">
|
||||||
<property name="title" translatable="yes">Desktop Style</property>
|
<property name="title" translatable="yes">Desktop Style</property>
|
||||||
<property name="model">
|
<property name="model">
|
||||||
<object class="GtkStringList">
|
<object class="GtkStringList">
|
||||||
<items>
|
<items>
|
||||||
<item>Any</item>
|
<item translatable="yes">Any</item>
|
||||||
<item>Default Mode</item>
|
<item translatable="yes">Default Mode</item>
|
||||||
<item>Dark Mode</item>
|
<item translatable="yes">Dark Mode</item>
|
||||||
</items>
|
</items>
|
||||||
</object>
|
</object>
|
||||||
</property>
|
</property>
|
||||||
@@ -123,14 +123,14 @@ SPDX-License-Identifier: GPL-3.0-or-later
|
|||||||
</child>
|
</child>
|
||||||
|
|
||||||
<child>
|
<child>
|
||||||
<object class="AdwComboRow">
|
<object class="AdwComboRow" id="profile-power-mode">
|
||||||
<property name="title" translatable="yes">Power Mode</property>
|
<property name="title" translatable="yes">Power Mode</property>
|
||||||
<property name="model">
|
<property name="model">
|
||||||
<object class="GtkStringList">
|
<object class="GtkStringList">
|
||||||
<items>
|
<items>
|
||||||
<item>Any</item>
|
<item translatable="yes">Any</item>
|
||||||
<item>On Battery</item>
|
<item translatable="yes">On Battery</item>
|
||||||
<item>Plugged In</item>
|
<item translatable="yes">Plugged In</item>
|
||||||
</items>
|
</items>
|
||||||
</object>
|
</object>
|
||||||
</property>
|
</property>
|
||||||
@@ -138,17 +138,17 @@ SPDX-License-Identifier: GPL-3.0-or-later
|
|||||||
</child>
|
</child>
|
||||||
|
|
||||||
<child>
|
<child>
|
||||||
<object class="AdwComboRow">
|
<object class="AdwComboRow" id="profile-power-profile">
|
||||||
<property name="title" translatable="yes">Power Profile</property>
|
<property name="title" translatable="yes">Power Profile</property>
|
||||||
<property name="model">
|
<property name="model">
|
||||||
<object class="GtkStringList">
|
<object class="GtkStringList">
|
||||||
<items>
|
<items>
|
||||||
<item>Any</item>
|
<item translatable="yes">Any</item>
|
||||||
<item>Power-Saver Mode</item>
|
<item translatable="yes">Power-Saver Mode</item>
|
||||||
<item>Balanced Mode</item>
|
<item translatable="yes">Balanced Mode</item>
|
||||||
<item>Performance Mode</item>
|
<item translatable="yes">Performance Mode</item>
|
||||||
<item>Power Saver or Balanced</item>
|
<item translatable="yes">Power Saver or Balanced</item>
|
||||||
<item>Balanced or Performance</item>
|
<item translatable="yes">Balanced or Performance</item>
|
||||||
</items>
|
</items>
|
||||||
</object>
|
</object>
|
||||||
</property>
|
</property>
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ SPDX-License-Identifier: GPL-3.0-or-later
|
|||||||
-->
|
-->
|
||||||
|
|
||||||
<interface domain="burn-my-windows">
|
<interface domain="burn-my-windows">
|
||||||
|
|
||||||
<menu id="main-menu">
|
<menu id="main-menu">
|
||||||
<section>
|
<section>
|
||||||
<item>
|
<item>
|
||||||
@@ -50,18 +51,19 @@ SPDX-License-Identifier: GPL-3.0-or-later
|
|||||||
</section>
|
</section>
|
||||||
</menu>
|
</menu>
|
||||||
|
|
||||||
<menu id="effect-profile-menu">
|
<menu id="profile-menu">
|
||||||
<section>
|
<section>
|
||||||
<item>
|
<item>
|
||||||
<attribute name="label" translatable="yes">Default Profile</attribute>
|
<attribute name="label" translatable="yes">Default Profile</attribute>
|
||||||
<attribute name="action">profile.default</attribute>
|
<attribute name="action">prefs.profile-default</attribute>
|
||||||
</item>
|
</item>
|
||||||
</section>
|
</section>
|
||||||
<section>
|
<section>
|
||||||
<item>
|
<item>
|
||||||
<attribute name="label" translatable="yes">Add New...</attribute>
|
<attribute name="label" translatable="yes">Add New...</attribute>
|
||||||
<attribute name="action">profile.new</attribute>
|
<attribute name="action">prefs.profile-new</attribute>
|
||||||
</item>
|
</item>
|
||||||
</section>
|
</section>
|
||||||
</menu>
|
</menu>
|
||||||
|
|
||||||
</interface>
|
</interface>
|
||||||
@@ -13,24 +13,6 @@ SPDX-License-Identifier: CC0-1.0
|
|||||||
<!-- General Options -->
|
<!-- General Options -->
|
||||||
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
|
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
|
||||||
|
|
||||||
<key name="destroy-dialogs" type="b">
|
|
||||||
<default>false</default>
|
|
||||||
<summary>Destroy Dialogs</summary>
|
|
||||||
<description>Set to true to burn dialogs as well.</description>
|
|
||||||
</key>
|
|
||||||
|
|
||||||
<key name="disable-on-battery" type="b">
|
|
||||||
<default>false</default>
|
|
||||||
<summary>Disable on Battery</summary>
|
|
||||||
<description>Enable effects only if plugged in.</description>
|
|
||||||
</key>
|
|
||||||
|
|
||||||
<key name="disable-on-power-save" type="b">
|
|
||||||
<default>false</default>
|
|
||||||
<summary>Disable on Power Save</summary>
|
|
||||||
<description>Enable effects only if power saver is disabled.</description>
|
|
||||||
</key>
|
|
||||||
|
|
||||||
<key name="preview-effect" type="s">
|
<key name="preview-effect" type="s">
|
||||||
<default>""</default>
|
<default>""</default>
|
||||||
<summary>Preview Effect</summary>
|
<summary>Preview Effect</summary>
|
||||||
@@ -43,6 +25,45 @@ SPDX-License-Identifier: CC0-1.0
|
|||||||
<description>If set to true, all animations will show only one still frame to allow for continuous integration tests.</description>
|
<description>If set to true, all animations will show only one still frame to allow for continuous integration tests.</description>
|
||||||
</key>
|
</key>
|
||||||
|
|
||||||
|
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
|
||||||
|
<!-- Profile Options -->
|
||||||
|
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
|
||||||
|
|
||||||
|
<key name="profile-animation-type" type="i">
|
||||||
|
<default>0</default>
|
||||||
|
<range min="0" max="2" />
|
||||||
|
<summary>Profile Animation Type</summary>
|
||||||
|
<description>The animation types for which the current effect settings should be used.</description>
|
||||||
|
</key>
|
||||||
|
|
||||||
|
<key name="profile-window-type" type="i">
|
||||||
|
<default>0</default>
|
||||||
|
<range min="0" max="2" />
|
||||||
|
<summary>Profile Window Type</summary>
|
||||||
|
<description>The window types for which the current effect settings should be used.</description>
|
||||||
|
</key>
|
||||||
|
|
||||||
|
<key name="profile-desktop-style" type="i">
|
||||||
|
<default>0</default>
|
||||||
|
<range min="0" max="2" />
|
||||||
|
<summary>Profile Desktop Style</summary>
|
||||||
|
<description>The desktop styles for which the current effect settings should be used.</description>
|
||||||
|
</key>
|
||||||
|
|
||||||
|
<key name="profile-power-mode" type="i">
|
||||||
|
<default>0</default>
|
||||||
|
<range min="0" max="2" />
|
||||||
|
<summary>Profile Power Mode</summary>
|
||||||
|
<description>The power mode for which the current effect settings should be used.</description>
|
||||||
|
</key>
|
||||||
|
|
||||||
|
<key name="profile-power-profile" type="i">
|
||||||
|
<default>0</default>
|
||||||
|
<range min="0" max="5" />
|
||||||
|
<summary>Profile Power Profile</summary>
|
||||||
|
<description>The power profiles in which the current effect settings should be used.</description>
|
||||||
|
</key>
|
||||||
|
|
||||||
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
|
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
|
||||||
<!-- Apparition Effect Options -->
|
<!-- Apparition Effect Options -->
|
||||||
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
|
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
|
||||||
|
|||||||
Reference in New Issue
Block a user