I have a ColumnView which for each row has a DropDown widget to select one of x options, where x is small, typically less than 6 and is static for the life of the ColumnView.
I cannot find a way to share a copy of the ListModel that provides the data for the DropDown. Currently I am doing as follows when building my SignalListItemFactory.
let factory = SignalListItemFactory::new();
factory.connect_setup(move |_, list_item| {
let drop = DropDown::new(model.borrow().clone(), None::<Expression>);
list_item
.downcast_ref::<ListItem>()
.expect("Needs to be ListItem")
.set_child(Some(&drop));
});
where model is defined as model: RefCell<Option<StringList>>
This is obviously cloning the model, which has many downsides for me, but as the gtk-rs binding take ownership of the model, I can see no way to share the model.
From reading the code for the DropDown rust bindings, it seems only a pointer is eventually passed to GTK with .into_glib_ptr()
.