Mpris: Implement the raise method

This commit is contained in:
Jordan Petridis 2018-10-04 10:32:13 +03:00
parent 6a52a2bc46
commit e0b3dd9795
No known key found for this signature in database
GPG Key ID: E8523968931763BE
3 changed files with 5 additions and 5 deletions

Binary file not shown.

View File

@ -65,6 +65,7 @@ pub(crate) enum Action {
InitShowMenu(Fragile<ShowMenu>), InitShowMenu(Fragile<ShowMenu>),
EmptyState, EmptyState,
PopulatedState, PopulatedState,
RaiseWindow,
} }
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
@ -370,6 +371,7 @@ impl App {
self.headerbar.switch.set_sensitive(true); self.headerbar.switch.set_sensitive(true);
self.content.switch_to_populated(); self.content.switch_to_populated();
} }
Action::RaiseWindow => self.window.present(),
} }
} }

View File

@ -293,7 +293,7 @@ impl PlayerWidget {
fn init(s: &Rc<Self>, sender: &Sender<Action>) { fn init(s: &Rc<Self>, sender: &Sender<Action>) {
Self::connect_control_buttons(s); Self::connect_control_buttons(s);
Self::connect_rate_buttons(s); Self::connect_rate_buttons(s);
Self::connect_mpris_buttons(s); Self::connect_mpris_buttons(s, sender);
Self::connect_gst_signals(s, sender); Self::connect_gst_signals(s, sender);
} }
@ -322,7 +322,7 @@ impl PlayerWidget {
})); }));
} }
fn connect_mpris_buttons(s: &Rc<Self>) { fn connect_mpris_buttons(s: &Rc<Self>, sender: &Sender<Action>) {
let weak = Rc::downgrade(s); let weak = Rc::downgrade(s);
let mpris = s.info.mpris.clone(); let mpris = s.info.mpris.clone();
@ -349,9 +349,7 @@ impl PlayerWidget {
weak.upgrade().map(|p| p.rewind()); weak.upgrade().map(|p| p.rewind());
})); }));
//s.info.mpris.connect_raise(clone!(weak => move || { s.info.mpris.connect_raise(clone!(sender => move || sender.send(Action::RaiseWindow)));
// TODO: Do something here
//}));
} }
#[cfg_attr(rustfmt, rustfmt_skip)] #[cfg_attr(rustfmt, rustfmt_skip)]