Clean up by using set_model instead which allows a reference
This commit is contained in:
parent
350640a223
commit
bb9d9595eb
1 changed files with 4 additions and 7 deletions
|
@ -88,14 +88,10 @@ impl SimpleComponent for SampleListModel {
|
||||||
item.set_child(Some(&cell))
|
item.set_child(Some(&cell))
|
||||||
});
|
});
|
||||||
|
|
||||||
let list_store = gtk::gio::ListStore::new(gtk::glib::types::Type::OBJECT);
|
let mut list_store = gtk::gio::ListStore::new(gtk::glib::types::Type::OBJECT);
|
||||||
let samples = gtk::MultiSelection::new(Some(list_store));
|
let samples = gtk::MultiSelection::new(None::<gtk::gio::ListStore>);
|
||||||
|
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::<gtk::gio::ListStore>()
|
|
||||||
.unwrap();
|
|
||||||
list_store.extend(
|
list_store.extend(
|
||||||
list_samples(&mut pool.get().expect("Expected a connection"))
|
list_samples(&mut pool.get().expect("Expected a connection"))
|
||||||
.into_iter()
|
.into_iter()
|
||||||
|
@ -108,6 +104,7 @@ impl SimpleComponent for SampleListModel {
|
||||||
gtk::gdk::FileList::static_type(),
|
gtk::gdk::FileList::static_type(),
|
||||||
gtk::gdk::DragAction::COPY,
|
gtk::gdk::DragAction::COPY,
|
||||||
);
|
);
|
||||||
|
|
||||||
drop_target.connect_drop(move |_, value, _, _| {
|
drop_target.connect_drop(move |_, value, _, _| {
|
||||||
for f in value
|
for f in value
|
||||||
.get::<gtk::gdk::FileList>()
|
.get::<gtk::gdk::FileList>()
|
||||||
|
|
Loading…
Reference in a new issue