Remove forgotten unwrap().
This commit is contained in:
parent
c6f5a4200d
commit
b172aa7aa3
@ -35,6 +35,8 @@ lazy_static! {
|
|||||||
allow_negative: false,
|
allow_negative: false,
|
||||||
})
|
})
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static ref NOW: DateTime<Utc> = Utc::now();
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone)]
|
#[derive(Debug, Clone)]
|
||||||
@ -93,10 +95,6 @@ impl Default for EpisodeWidget {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
lazy_static! {
|
|
||||||
static ref NOW: DateTime<Utc> = Utc::now();
|
|
||||||
}
|
|
||||||
|
|
||||||
impl EpisodeWidget {
|
impl EpisodeWidget {
|
||||||
pub fn new(episode: EpisodeWidgetQuery, sender: Sender<Action>) -> EpisodeWidget {
|
pub fn new(episode: EpisodeWidgetQuery, sender: Sender<Action>) -> EpisodeWidget {
|
||||||
let widget = EpisodeWidget::default();
|
let widget = EpisodeWidget::default();
|
||||||
@ -110,9 +108,6 @@ impl EpisodeWidget {
|
|||||||
// Set the title label state.
|
// Set the title label state.
|
||||||
self.set_title(&episode);
|
self.set_title(&episode);
|
||||||
|
|
||||||
// Set the size label.
|
|
||||||
self.set_total_size(episode.length());
|
|
||||||
|
|
||||||
// Set the duaration label.
|
// Set the duaration label.
|
||||||
self.set_duration(episode.duration());
|
self.set_duration(episode.duration());
|
||||||
|
|
||||||
@ -122,6 +117,12 @@ impl EpisodeWidget {
|
|||||||
// Show or hide the play/delete/download buttons upon widget initialization.
|
// Show or hide the play/delete/download buttons upon widget initialization.
|
||||||
self.show_buttons(episode.local_uri());
|
self.show_buttons(episode.local_uri());
|
||||||
|
|
||||||
|
// Set the size label.
|
||||||
|
if let Err(err) = self.set_total_size(episode.length()) {
|
||||||
|
error!("Failed to set the Size label.");
|
||||||
|
error!("Error: {}", err);
|
||||||
|
}
|
||||||
|
|
||||||
// Determine what the state of the progress bar should be.
|
// Determine what the state of the progress bar should be.
|
||||||
if let Err(err) = self.determine_progess_bar() {
|
if let Err(err) = self.determine_progess_bar() {
|
||||||
error!("Something went wrong determining the ProgressBar State.");
|
error!("Something went wrong determining the ProgressBar State.");
|
||||||
@ -200,16 +201,17 @@ impl EpisodeWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Set the Episode label dependings on its size
|
/// Set the Episode label dependings on its size
|
||||||
fn set_total_size(&self, bytes: Option<i32>) {
|
fn set_total_size(&self, bytes: Option<i32>) -> Result<(), Error> {
|
||||||
if let Some(size) = bytes {
|
if let Some(size) = bytes {
|
||||||
if size != 0 {
|
if size != 0 {
|
||||||
size.file_size(SIZE_OPTS.clone()).ok().map(|s| {
|
let s = size.file_size(SIZE_OPTS.clone())
|
||||||
self.total_size.set_text(&s);
|
.map_err(|err| format_err!("{}", err))?;
|
||||||
self.total_size.show();
|
self.total_size.set_text(&s);
|
||||||
self.separator2.show();
|
self.total_size.show();
|
||||||
});
|
self.separator2.show();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
// FIXME: REFACTOR ME
|
// FIXME: REFACTOR ME
|
||||||
@ -284,7 +286,7 @@ fn on_play_bttn_clicked(
|
|||||||
|
|
||||||
if episode.set_played_now().is_ok() {
|
if episode.set_played_now().is_ok() {
|
||||||
title.get_style_context().map(|c| c.add_class("dim-label"));
|
title.get_style_context().map(|c| c.add_class("dim-label"));
|
||||||
sender.send(Action::RefreshEpisodesViewBGR).unwrap();
|
sender.send(Action::RefreshEpisodesViewBGR)?;
|
||||||
};
|
};
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user