Minor style changes.
This commit is contained in:
parent
abe7215bc0
commit
7de118adeb
@ -114,9 +114,8 @@ impl App {
|
|||||||
|
|
||||||
pub fn run(self) {
|
pub fn run(self) {
|
||||||
let window = self.window.clone();
|
let window = self.window.clone();
|
||||||
let app = self.app_instance.clone();
|
self.app_instance.connect_startup(move |app| {
|
||||||
self.app_instance.connect_startup(move |_| {
|
build_ui(&window, app);
|
||||||
build_ui(&window, &app);
|
|
||||||
});
|
});
|
||||||
self.setup_timed_callbacks();
|
self.setup_timed_callbacks();
|
||||||
|
|
||||||
|
|||||||
@ -193,19 +193,13 @@ fn on_played_button_clicked(
|
|||||||
notif.set_reveal_child(true);
|
notif.set_reveal_child(true);
|
||||||
|
|
||||||
// Set up the callback
|
// Set up the callback
|
||||||
let id = timeout_add_seconds(
|
let callback = clone!(sender => move || {
|
||||||
10,
|
|
||||||
clone!(sender => move || {
|
|
||||||
if let Err(err) = wrap(&pd, sender.clone()) {
|
if let Err(err) = wrap(&pd, sender.clone()) {
|
||||||
error!(
|
error!("Something went horribly wrong with the notif callback: {}", err);
|
||||||
"Something went horribly wrong with the notif callback: {}",
|
|
||||||
err
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
glib::Continue(false)
|
glib::Continue(false)
|
||||||
}),
|
});
|
||||||
);
|
let id = timeout_add_seconds(10, callback);
|
||||||
|
|
||||||
let id = Rc::new(RefCell::new(Some(id)));
|
let id = Rc::new(RefCell::new(Some(id)));
|
||||||
|
|
||||||
// Cancel the callback
|
// Cancel the callback
|
||||||
@ -213,10 +207,13 @@ fn on_played_button_clicked(
|
|||||||
let foo = id.borrow_mut().take();
|
let foo = id.borrow_mut().take();
|
||||||
if let Some(id) = foo {
|
if let Some(id) = foo {
|
||||||
glib::source::source_remove(id);
|
glib::source::source_remove(id);
|
||||||
notif.set_reveal_child(false);
|
}
|
||||||
if let Err(err) = sender.send(Action::RefreshWidgetIfVis) {
|
|
||||||
error!("Something went horribly wrong with the Action channel: {}", err)
|
// Hide the notification
|
||||||
}
|
notif.set_reveal_child(false);
|
||||||
|
// Refresh the widget if visible
|
||||||
|
if let Err(err) = sender.send(Action::RefreshWidgetIfVis) {
|
||||||
|
error!("Something went horribly wrong with the Action channel: {}", err)
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user