episode: add a checkmark symbol to further indicate played state
Using only a dim styleclass on the widget is too light and does not work with the HighContrast theme. Close #69 #106
This commit is contained in:
parent
f00f9b104c
commit
28ea14f2e9
@ -51,15 +51,43 @@ Tobias Bernard
|
|||||||
<property name="orientation">vertical</property>
|
<property name="orientation">vertical</property>
|
||||||
<property name="spacing">6</property>
|
<property name="spacing">6</property>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkLabel" id="title_label">
|
<object class="GtkBox">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">False</property>
|
<property name="can_focus">False</property>
|
||||||
<property name="label">Episode Title</property>
|
<property name="spacing">6</property>
|
||||||
<property name="ellipsize">end</property>
|
<child>
|
||||||
<property name="single_line_mode">True</property>
|
<object class="GtkLabel" id="title_label">
|
||||||
<property name="track_visited_links">False</property>
|
<property name="visible">True</property>
|
||||||
<property name="lines">1</property>
|
<property name="can_focus">False</property>
|
||||||
<property name="xalign">0</property>
|
<property name="label">Episode Title</property>
|
||||||
|
<property name="ellipsize">end</property>
|
||||||
|
<property name="single_line_mode">True</property>
|
||||||
|
<property name="track_visited_links">False</property>
|
||||||
|
<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>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="expand">False</property>
|
<property name="expand">False</property>
|
||||||
|
|||||||
@ -80,6 +80,7 @@ struct InfoLabels {
|
|||||||
local_size: gtk::Label,
|
local_size: gtk::Label,
|
||||||
size_separator: gtk::Label,
|
size_separator: gtk::Label,
|
||||||
total_size: gtk::Label,
|
total_size: gtk::Label,
|
||||||
|
played_checkmark: gtk::Image,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Clone, Debug)]
|
||||||
@ -110,8 +111,10 @@ impl InfoLabels {
|
|||||||
|
|
||||||
if episode.played().is_some() {
|
if episode.played().is_some() {
|
||||||
self.title.get_style_context().add_class("dim-label");
|
self.title.get_style_context().add_class("dim-label");
|
||||||
|
self.played_checkmark.show();
|
||||||
} else {
|
} else {
|
||||||
self.title.get_style_context().remove_class("dim-label");
|
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 duration = builder.get_object("duration_label").unwrap();
|
||||||
let local_size = builder.get_object("local_size").unwrap();
|
let local_size = builder.get_object("local_size").unwrap();
|
||||||
let total_size = builder.get_object("total_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 separator1 = builder.get_object("separator1").unwrap();
|
||||||
let separator2 = builder.get_object("separator2").unwrap();
|
let separator2 = builder.get_object("separator2").unwrap();
|
||||||
@ -212,6 +216,7 @@ impl Default for EpisodeWidget {
|
|||||||
local_size,
|
local_size,
|
||||||
total_size,
|
total_size,
|
||||||
size_separator,
|
size_separator,
|
||||||
|
played_checkmark,
|
||||||
},
|
},
|
||||||
buttons: Buttons {
|
buttons: Buttons {
|
||||||
container: buttons_container,
|
container: buttons_container,
|
||||||
|
|||||||
@ -137,9 +137,13 @@ fn dim_titles(episodes: >k::ListBox) -> Option<()> {
|
|||||||
.downcast::<gtk::Box>()
|
.downcast::<gtk::Box>()
|
||||||
.ok()?;
|
.ok()?;
|
||||||
let bar = foo.get_children().remove(0).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");
|
title.get_style_context().add_class("dim-label");
|
||||||
|
|
||||||
|
let checkmark = baz.get_children().remove(1).downcast::<gtk::Image>().ok()?;
|
||||||
|
checkmark.show();
|
||||||
}
|
}
|
||||||
Some(())
|
Some(())
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user