Merge branch 'wip/exalm/tnum' into 'master'
Tabular figures; model buttons for speed rate popover See merge request World/podcasts!134
This commit is contained in:
commit
abd263f127
@ -110,6 +110,9 @@ Tobias Bernard
|
||||
<style>
|
||||
<class name="dim-label"/>
|
||||
</style>
|
||||
<attributes>
|
||||
<attribute name="font-features" value="tnum=1"/>
|
||||
</attributes>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
@ -143,6 +146,9 @@ Tobias Bernard
|
||||
<style>
|
||||
<class name="dim-label"/>
|
||||
</style>
|
||||
<attributes>
|
||||
<attribute name="font-features" value="tnum=1"/>
|
||||
</attributes>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
@ -177,6 +183,9 @@ Tobias Bernard
|
||||
<style>
|
||||
<class name="dim-label"/>
|
||||
</style>
|
||||
<attributes>
|
||||
<attribute name="font-features" value="tnum=1"/>
|
||||
</attributes>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
@ -212,6 +221,9 @@ Tobias Bernard
|
||||
<style>
|
||||
<class name="dim-label"/>
|
||||
</style>
|
||||
<attributes>
|
||||
<attribute name="font-features" value="tnum=1"/>
|
||||
</attributes>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
|
||||
@ -132,6 +132,9 @@
|
||||
<property name="can_focus">False</property>
|
||||
<property name="width_chars">5</property>
|
||||
<property name="xalign">1</property>
|
||||
<attributes>
|
||||
<attribute name="font-features" value="tnum=1"/>
|
||||
</attributes>
|
||||
<style>
|
||||
<class name="dim-label"/>
|
||||
<class name="small-label"/>
|
||||
@ -154,6 +157,9 @@
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="width_chars">5</property>
|
||||
<attributes>
|
||||
<attribute name="font-features" value="tnum=1"/>
|
||||
</attributes>
|
||||
<style>
|
||||
<class name="dim-label"/>
|
||||
<class name="small-label"/>
|
||||
|
||||
@ -45,6 +45,9 @@ Tobias Bernard
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label" translatable="yes">1.00×</property>
|
||||
<attributes>
|
||||
<attribute name="font-features" value="tnum=1"/>
|
||||
</attributes>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
@ -75,23 +78,15 @@ Tobias Bernard
|
||||
<object class="GtkBox">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="margin_start">6</property>
|
||||
<property name="margin_end">6</property>
|
||||
<property name="margin_top">6</property>
|
||||
<property name="margin_bottom">6</property>
|
||||
<property name="margin">6</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<property name="spacing">3</property>
|
||||
<child>
|
||||
<object class="GtkRadioButton" id="rate_1_50">
|
||||
<property name="label" translatable="yes">1.50×</property>
|
||||
<object class="GtkModelButton" id="rate_1_50">
|
||||
<property name="text"><span font-features="tnum=1">1.50×</span></property>
|
||||
<property name="use-markup">True</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">False</property>
|
||||
<property name="tooltip_text" translatable="yes">1.5 speed rate</property>
|
||||
<property name="halign">center</property>
|
||||
<property name="valign">center</property>
|
||||
<property name="draw_indicator">True</property>
|
||||
<property name="group">normal_rate</property>
|
||||
<property name="role">radio</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">True</property>
|
||||
@ -100,16 +95,12 @@ Tobias Bernard
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkRadioButton" id="rate_1_25">
|
||||
<property name="label" translatable="yes">1.25×</property>
|
||||
<object class="GtkModelButton" id="rate_1_25">
|
||||
<property name="text"><span font-features="tnum=1">1.25×</span></property>
|
||||
<property name="use-markup">True</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">False</property>
|
||||
<property name="tooltip_text" translatable="yes">1.25 speed rate</property>
|
||||
<property name="halign">center</property>
|
||||
<property name="valign">center</property>
|
||||
<property name="draw_indicator">True</property>
|
||||
<property name="group">normal_rate</property>
|
||||
<property name="role">radio</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">True</property>
|
||||
@ -118,16 +109,13 @@ Tobias Bernard
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkRadioButton" id="normal_rate">
|
||||
<property name="label" translatable="yes">1.00×</property>
|
||||
<object class="GtkModelButton" id="normal_rate">
|
||||
<property name="text"><span font-features="tnum=1">1.00×</span></property>
|
||||
<property name="use-markup">True</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">False</property>
|
||||
<property name="tooltip_text" translatable="yes">Normal speed</property>
|
||||
<property name="halign">center</property>
|
||||
<property name="valign">center</property>
|
||||
<property name="active">True</property>
|
||||
<property name="draw_indicator">True</property>
|
||||
<property name="role">radio</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">True</property>
|
||||
|
||||
@ -263,6 +263,9 @@ Tobias Bernard
|
||||
<property name="halign">start</property>
|
||||
<property name="valign">center</property>
|
||||
<property name="label">0:00</property>
|
||||
<attributes>
|
||||
<attribute name="font-features" value="tnum=1"/>
|
||||
</attributes>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
@ -291,6 +294,9 @@ Tobias Bernard
|
||||
<property name="halign">start</property>
|
||||
<property name="valign">center</property>
|
||||
<property name="label">0:00</property>
|
||||
<attributes>
|
||||
<attribute name="font-features" value="tnum=1"/>
|
||||
</attributes>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
|
||||
@ -208,9 +208,9 @@ fn format_duration(seconds: u32) -> String {
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
struct PlayerRate {
|
||||
radio150: gtk::RadioButton,
|
||||
radio125: gtk::RadioButton,
|
||||
radio_normal: gtk::RadioButton,
|
||||
radio150: gtk::ModelButton,
|
||||
radio125: gtk::ModelButton,
|
||||
radio_normal: gtk::ModelButton,
|
||||
popover: gtk::Popover,
|
||||
btn: gtk::MenuButton,
|
||||
label: gtk::Label,
|
||||
@ -220,9 +220,9 @@ impl PlayerRate {
|
||||
fn new() -> Self {
|
||||
let builder = gtk::Builder::new_from_resource("/org/gnome/Podcasts/gtk/player_rate.ui");
|
||||
|
||||
let radio150: gtk::RadioButton = builder.get_object("rate_1_50").unwrap();
|
||||
let radio125: gtk::RadioButton = builder.get_object("rate_1_25").unwrap();
|
||||
let radio_normal: gtk::RadioButton = builder.get_object("normal_rate").unwrap();
|
||||
let radio150: gtk::ModelButton = builder.get_object("rate_1_50").unwrap();
|
||||
let radio125: gtk::ModelButton = builder.get_object("rate_1_25").unwrap();
|
||||
let radio_normal: gtk::ModelButton = builder.get_object("normal_rate").unwrap();
|
||||
let popover = builder.get_object("rate_popover").unwrap();
|
||||
let btn = builder.get_object("rate_button").unwrap();
|
||||
let label = builder.get_object("rate_label").unwrap();
|
||||
@ -239,19 +239,22 @@ impl PlayerRate {
|
||||
|
||||
fn set_rate(&self, rate: f64) {
|
||||
self.label.set_text(&format!("{:.2}×", rate));
|
||||
self.radio_normal.set_property_active(rate == 1.0);
|
||||
self.radio125.set_property_active(rate == 1.25);
|
||||
self.radio150.set_property_active(rate == 1.5);
|
||||
}
|
||||
|
||||
fn connect_signals(&self, widget: &Rc<PlayerWidget>) {
|
||||
self.radio_normal
|
||||
.connect_toggled(clone!(@weak widget => move |_| {
|
||||
.connect_clicked(clone!(@weak widget => move |_| {
|
||||
widget.on_rate_changed(1.00);
|
||||
}));
|
||||
self.radio125
|
||||
.connect_toggled(clone!(@weak widget => move |_| {
|
||||
.connect_clicked(clone!(@weak widget => move |_| {
|
||||
widget.on_rate_changed(1.25);
|
||||
}));
|
||||
self.radio150
|
||||
.connect_toggled(clone!(@weak widget => move |_| {
|
||||
.connect_clicked(clone!(@weak widget => move |_| {
|
||||
widget.on_rate_changed(1.50);
|
||||
}));
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user