From 7ac16fb414aef6da9dc8d7654c5137fbdd574d94 Mon Sep 17 00:00:00 2001 From: Ashley Wulber Date: Fri, 14 Jan 2022 11:17:36 -0500 Subject: [PATCH] improve styling --- examples/launcher/style.css | 3 ++- examples/launcher/window/mod.rs | 9 +++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/examples/launcher/style.css b/examples/launcher/style.css index 1380fed3..d1c017b3 100644 --- a/examples/launcher/style.css +++ b/examples/launcher/style.css @@ -1,10 +1,11 @@ -listview row:hover { +listview row:selected { transition: 100ms; background: #888888; border-radius: 8px; } listview row { + transition: 100ms; background: #333333; border-radius: 8px; } diff --git a/examples/launcher/window/mod.rs b/examples/launcher/window/mod.rs index 08e3f1a5..40af3dff 100644 --- a/examples/launcher/window/mod.rs +++ b/examples/launcher/window/mod.rs @@ -89,7 +89,12 @@ impl Window { let model = gio::ListStore::new(SearchResultObject::static_type()); let slice_model = gtk4::SliceListModel::new(Some(&model), 0, NUM_LAUNCHER_ITEMS.into()); - let selection_model = gtk4::NoSelection::new(Some(&slice_model)); + let selection_model = gtk4::SingleSelection::builder() + .model(&slice_model) + .autoselect(false) + .can_unselect(true) + .selected(gtk4::INVALID_LIST_POSITION) + .build(); imp.model.set(model).expect("Could not set model"); // Wrap model with selection and pass it to the list view @@ -135,7 +140,7 @@ impl Window { dbg!(i); let model = list_view.model() .expect("List view missing selection model") - .downcast::() + .downcast::() .expect("could not downcast listview model to no selection model"); if i >= model.n_items() {