From bb9d9595eb89bdb42dde9886909d6bb92fc0e5bb Mon Sep 17 00:00:00 2001 From: Vivianne Langdon Date: Mon, 26 Jun 2023 19:03:59 -0700 Subject: [PATCH] Clean up by using set_model instead which allows a reference --- src/sample_list.rs | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/sample_list.rs b/src/sample_list.rs index ba534b3..ccbdce1 100644 --- a/src/sample_list.rs +++ b/src/sample_list.rs @@ -88,14 +88,10 @@ impl SimpleComponent for SampleListModel { item.set_child(Some(&cell)) }); - let list_store = gtk::gio::ListStore::new(gtk::glib::types::Type::OBJECT); - let samples = gtk::MultiSelection::new(Some(list_store)); + let mut list_store = gtk::gio::ListStore::new(gtk::glib::types::Type::OBJECT); + let samples = gtk::MultiSelection::new(None::); + samples.set_model(Some(&list_store)); - // XXX: ideally I could use the above list_store, but it gets moved...? - let mut list_store = samples - .model() - .and_downcast::() - .unwrap(); list_store.extend( list_samples(&mut pool.get().expect("Expected a connection")) .into_iter() @@ -108,6 +104,7 @@ impl SimpleComponent for SampleListModel { gtk::gdk::FileList::static_type(), gtk::gdk::DragAction::COPY, ); + drop_target.connect_drop(move |_, value, _, _| { for f in value .get::()