Merge branch 'alatiera/checkmark' into 'master'

episode: add a checkmark symbol to further indicate played state

Closes #106 and #69

See merge request World/podcasts!106
This commit is contained in:
Jordan Petridis 2019-05-14 09:11:16 +00:00
commit ff047c5823
4 changed files with 46 additions and 8 deletions

View File

@ -50,6 +50,11 @@ Tobias Bernard
<property name="halign">start</property>
<property name="orientation">vertical</property>
<property name="spacing">6</property>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="spacing">6</property>
<child>
<object class="GtkLabel" id="title_label">
<property name="visible">True</property>
@ -61,6 +66,29 @@ Tobias Bernard
<property name="lines">1</property>
<property name="xalign">0</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkImage" id="played_checkmark">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="tooltip_text" translatable="yes">You've already listened to this episode.</property>
<property name="icon_name">object-select-symbolic</property>
<style>
<class name="dim-label"/>
</style>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>

View File

@ -41,6 +41,7 @@ podcasts_sources = files(
'widgets/appnotif.rs',
'widgets/base_view.rs',
'widgets/empty.rs',
'widgets/episode.rs',
'widgets/home_view.rs',
'widgets/mod.rs',
'widgets/player.rs',

View File

@ -80,6 +80,7 @@ struct InfoLabels {
local_size: gtk::Label,
size_separator: gtk::Label,
total_size: gtk::Label,
played_checkmark: gtk::Image,
}
#[derive(Clone, Debug)]
@ -110,8 +111,10 @@ impl InfoLabels {
if episode.played().is_some() {
self.title.get_style_context().add_class("dim-label");
self.played_checkmark.show();
} else {
self.title.get_style_context().remove_class("dim-label");
self.played_checkmark.hide();
}
}
@ -195,6 +198,7 @@ impl Default for EpisodeWidget {
let duration = builder.get_object("duration_label").unwrap();
let local_size = builder.get_object("local_size").unwrap();
let total_size = builder.get_object("total_size").unwrap();
let played_checkmark = builder.get_object("played_checkmark").unwrap();
let separator1 = builder.get_object("separator1").unwrap();
let separator2 = builder.get_object("separator2").unwrap();
@ -212,6 +216,7 @@ impl Default for EpisodeWidget {
local_size,
total_size,
size_separator,
played_checkmark,
},
buttons: Buttons {
container: buttons_container,

View File

@ -137,9 +137,13 @@ fn dim_titles(episodes: &gtk::ListBox) -> Option<()> {
.downcast::<gtk::Box>()
.ok()?;
let bar = foo.get_children().remove(0).downcast::<gtk::Box>().ok()?;
let title = bar.get_children().remove(0).downcast::<gtk::Label>().ok()?;
let baz = bar.get_children().remove(0).downcast::<gtk::Box>().ok()?;
let title = baz.get_children().remove(0).downcast::<gtk::Label>().ok()?;
title.get_style_context().add_class("dim-label");
let checkmark = baz.get_children().remove(1).downcast::<gtk::Image>().ok()?;
checkmark.show();
}
Some(())
}