Skip to content

Commit

Permalink
feat(filter_panel): add accent color when filter_list is not empty
Browse files Browse the repository at this point in the history
Signed-off-by: tsukinaha <sakuovds@gmail.com>
  • Loading branch information
tsukinaha committed Dec 22, 2024
1 parent 3d12eab commit c1490f6
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/ui/widgets/search.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,9 @@ mod imp {
#[template_child]
pub stack: TemplateChild<gtk::Stack>,

#[template_child]
pub filter: TemplateChild<gtk::Button>,

pub filter_panel: OnceCell<FilterPanelDialog>,
pub selection: gtk::SingleSelection,
}
Expand Down Expand Up @@ -274,6 +277,12 @@ impl SearchPage {
.map(|f| f.filters_list())
.unwrap_or_default();

if !filters_list.is_empty() {
imp.filter.add_css_class("accent");
} else {
imp.filter.remove_css_class("accent");
}

match spawn_tokio(async move {
EMBY_CLIENT
.search(
Expand Down
5 changes: 5 additions & 0 deletions src/ui/widgets/single_grid.rs
Original file line number Diff line number Diff line change
Expand Up @@ -508,6 +508,11 @@ impl SingleGrid {
.get()
.map(|f| f.filters_list())
.unwrap_or_default();
if !filters_list.is_empty() {
obj.imp().filter.add_css_class("accent");
} else {
obj.imp().filter.remove_css_class("accent");
}
let future = f(sort_by.clone(), sort_order.clone(), filters_list);
spawn(glib::clone!(
#[weak(rename_to = obj)]
Expand Down
1 change: 1 addition & 0 deletions src/ui/widgets/tuview_scrolled.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ pub(crate) mod imp {
pub list: TemplateChild<gtk::ListView>,
#[template_child]
pub spinner_revealer: TemplateChild<gtk::Revealer>,

pub selection: gtk::SingleSelection,
pub lock: Arc<AtomicBool>,
}
Expand Down

0 comments on commit c1490f6

Please sign in to comment.