From fad5742f015797f4eb1d61ff848ec8bb45ef096a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Kol=C3=ADn?= Date: Tue, 6 Aug 2024 15:31:01 +0200 Subject: [PATCH] Apply suggestions from code review Co-authored-by: Hofer-Julian <30049909+Hofer-Julian@users.noreply.github.com> --- src/List View/code.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/List View/code.rs b/src/List View/code.rs index 10e2806b..c58e3659 100644 --- a/src/List View/code.rs +++ b/src/List View/code.rs @@ -20,10 +20,10 @@ pub fn main() { // Model let strings_model = gtk::StringList::new(&["Default Item 1", "Default Item 2", "Default Item 3"]); - let model = gtk::SingleSelection::new(Some(strings_model)); + let model = gtk::SingleSelection::new(Some(strings_model.clone())); - //View - model.connect_items_changed(move |_model, position, removed, added| { + // View + strings_model.connect_items_changed(move |_model, position, removed, added| { println!( "position: {}, Item removed? {}, Item added? {}", position, @@ -52,7 +52,7 @@ pub fn main() { // Get the item counter value let value = item.get(); // Access the underlying gtk::StringList - let strings_model: gtk::StringList = model + let strings_model = model .model() .unwrap() .downcast::() @@ -69,7 +69,7 @@ pub fn main() { let selected_item = model.selected(); // In order to delete values we need to access the // actual StringList model, we've created. - let strings_model: gtk::StringList = model + let strings_model = model .model() .unwrap() .downcast::()