Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Hofer-Julian <[email protected]>
  • Loading branch information
ondrejkolin and Hofer-Julian authored Aug 6, 2024
1 parent 981a3c3 commit fad5742
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/List View/code.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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::<gtk::StringList>()
Expand All @@ -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::<gtk::StringList>()
Expand Down

0 comments on commit fad5742

Please sign in to comment.