From 28ea14f2e91b6dfb8c0e692cbf5604a753497120 Mon Sep 17 00:00:00 2001 From: Jordan Petridis Date: Mon, 13 May 2019 23:19:24 +0200 Subject: [PATCH 1/2] 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 --- podcasts-gtk/resources/gtk/episode_widget.ui | 42 ++++++++++++++++---- podcasts-gtk/src/widgets/episode.rs | 5 +++ podcasts-gtk/src/widgets/show_menu.rs | 6 ++- 3 files changed, 45 insertions(+), 8 deletions(-) diff --git a/podcasts-gtk/resources/gtk/episode_widget.ui b/podcasts-gtk/resources/gtk/episode_widget.ui index d0ac37b..4518b72 100644 --- a/podcasts-gtk/resources/gtk/episode_widget.ui +++ b/podcasts-gtk/resources/gtk/episode_widget.ui @@ -51,15 +51,43 @@ Tobias Bernard vertical 6 - + True False - Episode Title - end - True - False - 1 - 0 + 6 + + + True + False + Episode Title + end + True + False + 1 + 0 + + + False + True + 0 + + + + + True + False + You've already listened to this episode. + object-select-symbolic + + + + False + True + 1 + + False diff --git a/podcasts-gtk/src/widgets/episode.rs b/podcasts-gtk/src/widgets/episode.rs index 8601db5..81b9013 100644 --- a/podcasts-gtk/src/widgets/episode.rs +++ b/podcasts-gtk/src/widgets/episode.rs @@ -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, diff --git a/podcasts-gtk/src/widgets/show_menu.rs b/podcasts-gtk/src/widgets/show_menu.rs index 3e5f27b..80e5753 100644 --- a/podcasts-gtk/src/widgets/show_menu.rs +++ b/podcasts-gtk/src/widgets/show_menu.rs @@ -137,9 +137,13 @@ fn dim_titles(episodes: >k::ListBox) -> Option<()> { .downcast::() .ok()?; let bar = foo.get_children().remove(0).downcast::().ok()?; - let title = bar.get_children().remove(0).downcast::().ok()?; + let baz = bar.get_children().remove(0).downcast::().ok()?; + let title = baz.get_children().remove(0).downcast::().ok()?; title.get_style_context().add_class("dim-label"); + + let checkmark = baz.get_children().remove(1).downcast::().ok()?; + checkmark.show(); } Some(()) } From 6c701e0c410e69547053c975ad4171de09660a63 Mon Sep 17 00:00:00 2001 From: Christopher Davis Date: Thu, 25 Apr 2019 22:28:16 -0400 Subject: [PATCH 2/2] build: Add missing source file In the transition to tightening our meson integration this file was left untracked by meson. --- podcasts-gtk/src/meson.build | 1 + 1 file changed, 1 insertion(+) diff --git a/podcasts-gtk/src/meson.build b/podcasts-gtk/src/meson.build index aa9386b..63d0739 100644 --- a/podcasts-gtk/src/meson.build +++ b/podcasts-gtk/src/meson.build @@ -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',