Compare commits

...

1 Commits

Author SHA1 Message Date
Zander Brown
5e50ba6cb3 Add 1.72 & 2x speeds 2019-07-27 20:05:24 +00:00
2 changed files with 57 additions and 3 deletions

View File

@ -339,6 +339,42 @@ Tobias Bernard
<property name="margin_bottom">6</property>
<property name="orientation">vertical</property>
<property name="spacing">3</property>
<child>
<object class="GtkRadioButton" id="rate_2_00">
<property name="label" translatable="yes">2.00×</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="tooltip_text" translatable="yes">2 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>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkRadioButton" id="rate_1_75">
<property name="label" translatable="yes">1.75×</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.75 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>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkRadioButton" id="rate_1_50">
<property name="label" translatable="yes">1.50×</property>
@ -354,7 +390,7 @@ Tobias Bernard
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">0</property>
<property name="position">2</property>
</packing>
</child>
<child>
@ -372,7 +408,7 @@ Tobias Bernard
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
<property name="position">3</property>
</packing>
</child>
<child>
@ -390,7 +426,7 @@ Tobias Bernard
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">2</property>
<property name="position">4</property>
</packing>
</child>
</object>

View File

@ -175,6 +175,8 @@ fn format_duration(seconds: u32) -> String {
#[derive(Debug, Clone)]
struct PlayerRate {
radio200: gtk::RadioButton,
radio175: gtk::RadioButton,
radio150: gtk::RadioButton,
radio125: gtk::RadioButton,
radio_normal: gtk::RadioButton,
@ -275,6 +277,8 @@ impl Default for PlayerWidget {
episode_id: RefCell::new(None),
};
let radio200 = builder.get_object("rate_2_00").unwrap();
let radio175 = builder.get_object("rate_1_75").unwrap();
let radio150 = builder.get_object("rate_1_50").unwrap();
let radio125 = builder.get_object("rate_1_25").unwrap();
let radio_normal = builder.get_object("normal_rate").unwrap();
@ -282,6 +286,8 @@ impl Default for PlayerWidget {
let btn = builder.get_object("rate_button").unwrap();
let label = builder.get_object("rate_label").unwrap();
let rate = PlayerRate {
radio200,
radio175,
radio150,
radio125,
radio_normal,
@ -581,6 +587,18 @@ impl PlayerWrapper {
.connect_toggled(clone!(weak => move |_| {
weak.upgrade().map(|p| p.on_rate_changed(1.50));
}));
self.rate
.radio175
.connect_toggled(clone!(weak => move |_| {
weak.upgrade().map(|p| p.on_rate_changed(1.75));
}));
self.rate
.radio200
.connect_toggled(clone!(weak => move |_| {
weak.upgrade().map(|p| p.on_rate_changed(2.00));
}));
}
fn connect_mpris_buttons(&self, sender: &Sender<Action>) {