prefs: Mark experimental options

Options not fully reliable with possibility to break playback. Better mark them as experimental then listen to users complaining on daily basis.
This commit is contained in:
Rafał Dzięgiel
2021-09-03 20:08:07 +02:00
parent ad0c6151a9
commit 70942ba419
2 changed files with 53 additions and 7 deletions

View File

@@ -55,8 +55,10 @@ class ClapperPrefsActionRow extends Adw.ActionRow
this._schemaName = null;
this._bindProp = null;
this.add_suffix(widget);
this.set_activatable_widget(widget);
if(widget) {
this.add_suffix(widget);
this.set_activatable_widget(widget);
}
}
set schema_name(value)
@@ -117,13 +119,53 @@ class ClapperPrefsSubpageRow extends Adw.ActionRow
GObject.registerClass({
GTypeName: 'ClapperPrefsSwitch',
Properties: {
'custom-icon-name': GObject.ParamSpec.string(
'custom-icon-name',
'Icon name',
'Name of the icon',
GObject.ParamFlags.WRITABLE | GObject.ParamFlags.CONSTRUCT_ONLY,
null
),
'custom-icon-subtitle': GObject.ParamSpec.string(
'custom-icon-subtitle',
'Icon subtitle',
'Text below the icon',
GObject.ParamFlags.WRITABLE | GObject.ParamFlags.CONSTRUCT_ONLY,
null
),
}
},
class ClapperPrefsSwitch extends PrefsActionRow
{
_init()
_init(opts)
{
super._init(new Gtk.Switch(widgetOpts));
super._init(null);
this._bindProp = 'active';
if(opts.custom_icon_name || opts.custom_icon_subtitle) {
const box = new Gtk.Box({
margin_top: 2,
orientation: Gtk.Orientation.VERTICAL,
valign: Gtk.Align.CENTER,
});
const customIcon = new Gtk.Image({
icon_name: opts.custom_icon_name || null,
});
box.append(customIcon);
const customLabel = new Gtk.Label({
label: opts.custom_icon_subtitle || '',
});
customLabel.add_css_class('subtitle');
box.append(customLabel);
this.add_suffix(box);
}
const sw = new Gtk.Switch(widgetOpts);
this.add_suffix(sw);
this.set_activatable_widget(sw);
}
});

View File

@@ -257,14 +257,18 @@
<child>
<object class="ClapperPrefsSwitch">
<property name="title" translatable="yes">Use playbin3</property>
<property name="subtitle" translatable="yes">Use experimental playbin3 element (requires player restart)</property>
<property name="subtitle" translatable="yes">Requires player restart</property>
<property name="custom-icon-name">dialog-warning-symbolic</property>
<property name="custom-icon-subtitle" translatable="yes">Experimental</property>
<property name="schema-name">use-playbin3</property>
</object>
</child>
<child>
<object class="ClapperPrefsSwitch">
<property name="title" translatable="yes">Use PipeWire</property>
<property name="subtitle" translatable="yes">Use PipeWire for audio output (requires player restart)</property>
<property name="title" translatable="yes">Use PipeWire for audio</property>
<property name="subtitle" translatable="yes">Requires player restart</property>
<property name="custom-icon-name">dialog-warning-symbolic</property>
<property name="custom-icon-subtitle" translatable="yes">Experimental</property>
<property name="schema-name">use-pipewire</property>
</object>
</child>