Verified Commit d281c189 authored by Jordan Petridis's avatar Jordan Petridis 🌱

EpisodeWidget: Pass EpisodeWidgetQuery by refference.

parent 04e7f4f8
......@@ -206,10 +206,10 @@ impl Default for EpisodeWidget {
}
impl EpisodeWidget {
pub fn new(episode: EpisodeWidgetQuery, sender: &Sender<Action>) -> Rc<Self> {
pub fn new(episode: &EpisodeWidgetQuery, sender: &Sender<Action>) -> Rc<Self> {
let widget = Rc::new(Self::default());
widget.info.init(&episode);
Self::determine_buttons_state(&widget, &episode, sender)
widget.info.init(episode);
Self::determine_buttons_state(&widget, episode, sender)
.map_err(|err| error!("Error: {}", err))
.ok();
widget
......
......@@ -95,7 +95,7 @@ impl HomeView {
let view_ = view.clone();
let func = move |ep: EpisodeWidgetQuery| {
let epoch = ep.epoch();
let widget = HomeEpisode::new(ep, &sender);
let widget = HomeEpisode::new(&ep, &sender);
match split(&now_utc, i64::from(epoch)) {
Today => add_to_box(&widget, &view_.today_list, &view_.today_box),
......@@ -197,7 +197,7 @@ impl Default for HomeEpisode {
}
impl HomeEpisode {
fn new(episode: EpisodeWidgetQuery, sender: &Sender<Action>) -> HomeEpisode {
fn new(episode: &EpisodeWidgetQuery, sender: &Sender<Action>) -> HomeEpisode {
let builder =
gtk::Builder::new_from_resource("/org/gnome/Hammond/gtk/episodes_view_widget.ui");
let container: gtk::Box = builder.get_object("container").unwrap();
......
......@@ -207,7 +207,7 @@ fn populate_listbox(
let list = show_.episodes.clone();
let constructor = clone!(sender => move |ep| {
EpisodeWidget::new(ep, &sender).container.clone()
EpisodeWidget::new(&ep, &sender).container.clone()
});
let callback = clone!(pd, show_ => move || {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment