fix deprecation warnings caused by old trait object syntax
This commit is contained in:
@@ -150,7 +150,7 @@ impl ListItem for Album {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn as_listitem(&self) -> Box<ListItem> {
|
fn as_listitem(&self) -> Box<dyn ListItem> {
|
||||||
Box::new(self.clone())
|
Box::new(self.clone())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -139,7 +139,7 @@ impl ListItem for Artist {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn as_listitem(&self) -> Box<ListItem> {
|
fn as_listitem(&self) -> Box<dyn ListItem> {
|
||||||
Box::new(self.clone())
|
Box::new(self.clone())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
20
src/mpris.rs
20
src/mpris.rs
@@ -12,7 +12,7 @@ use queue::{Queue, RepeatSetting};
|
|||||||
use spotify::{PlayerEvent, Spotify};
|
use spotify::{PlayerEvent, Spotify};
|
||||||
use track::Track;
|
use track::Track;
|
||||||
|
|
||||||
type Metadata = HashMap<String, Variant<Box<RefArg>>>;
|
type Metadata = HashMap<String, Variant<Box<dyn RefArg>>>;
|
||||||
struct MprisState(String, Option<Track>);
|
struct MprisState(String, Option<Track>);
|
||||||
|
|
||||||
fn get_playbackstatus(spotify: Arc<Spotify>) -> String {
|
fn get_playbackstatus(spotify: Arc<Spotify>) -> String {
|
||||||
@@ -192,7 +192,7 @@ fn run_dbus_server(spotify: Arc<Spotify>, queue: Arc<Queue>, rx: mpsc::Receiver<
|
|||||||
|
|
||||||
let property_metadata = {
|
let property_metadata = {
|
||||||
let queue = queue.clone();
|
let queue = queue.clone();
|
||||||
f.property::<HashMap<String, Variant<Box<RefArg>>>, _>("Metadata", ())
|
f.property::<HashMap<String, Variant<Box<dyn RefArg>>>, _>("Metadata", ())
|
||||||
.access(Access::Read)
|
.access(Access::Read)
|
||||||
.on_get(move |iter, _| {
|
.on_get(move |iter, _| {
|
||||||
let hm = get_metadata(queue.clone().get_current());
|
let hm = get_metadata(queue.clone().get_current());
|
||||||
@@ -401,7 +401,10 @@ fn run_dbus_server(spotify: Arc<Spotify>, queue: Arc<Queue>, rx: mpsc::Receiver<
|
|||||||
|
|
||||||
if let Ok(state) = rx.try_recv() {
|
if let Ok(state) = rx.try_recv() {
|
||||||
let mut changed: PropertiesPropertiesChanged = Default::default();
|
let mut changed: PropertiesPropertiesChanged = Default::default();
|
||||||
debug!("mpris PropertiesChanged: status {}, track: {:?}", state.0, state.1);
|
debug!(
|
||||||
|
"mpris PropertiesChanged: status {}, track: {:?}",
|
||||||
|
state.0, state.1
|
||||||
|
);
|
||||||
|
|
||||||
changed.interface_name = "org.mpris.MediaPlayer2.Player".to_string();
|
changed.interface_name = "org.mpris.MediaPlayer2.Player".to_string();
|
||||||
changed.changed_properties.insert(
|
changed.changed_properties.insert(
|
||||||
@@ -409,15 +412,14 @@ fn run_dbus_server(spotify: Arc<Spotify>, queue: Arc<Queue>, rx: mpsc::Receiver<
|
|||||||
Variant(Box::new(get_metadata(state.1))),
|
Variant(Box::new(get_metadata(state.1))),
|
||||||
);
|
);
|
||||||
|
|
||||||
changed.changed_properties.insert(
|
changed
|
||||||
"PlaybackStatus".to_string(),
|
.changed_properties
|
||||||
Variant(Box::new(state.0)),
|
.insert("PlaybackStatus".to_string(), Variant(Box::new(state.0)));
|
||||||
);
|
|
||||||
|
|
||||||
conn.send(
|
conn.send(
|
||||||
changed.to_emit_message(&Path::new("/org/mpris/MediaPlayer2".to_string()).unwrap()),
|
changed.to_emit_message(&Path::new("/org/mpris/MediaPlayer2".to_string()).unwrap()),
|
||||||
)
|
)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -426,7 +428,7 @@ fn run_dbus_server(spotify: Arc<Spotify>, queue: Arc<Queue>, rx: mpsc::Receiver<
|
|||||||
pub struct MprisManager {
|
pub struct MprisManager {
|
||||||
tx: mpsc::Sender<MprisState>,
|
tx: mpsc::Sender<MprisState>,
|
||||||
queue: Arc<Queue>,
|
queue: Arc<Queue>,
|
||||||
spotify: Arc<Spotify>
|
spotify: Arc<Spotify>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl MprisManager {
|
impl MprisManager {
|
||||||
|
|||||||
@@ -107,7 +107,7 @@ impl ListItem for Playlist {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn as_listitem(&self) -> Box<ListItem> {
|
fn as_listitem(&self) -> Box<dyn ListItem> {
|
||||||
Box::new(self.clone())
|
Box::new(self.clone())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -75,9 +75,9 @@ struct Worker {
|
|||||||
commands: mpsc::UnboundedReceiver<WorkerCommand>,
|
commands: mpsc::UnboundedReceiver<WorkerCommand>,
|
||||||
session: Session,
|
session: Session,
|
||||||
player: Player,
|
player: Player,
|
||||||
play_task: Box<futures::Future<Item = (), Error = oneshot::Canceled>>,
|
play_task: Box<dyn futures::Future<Item = (), Error = oneshot::Canceled>>,
|
||||||
refresh_task: Box<futures::Stream<Item = (), Error = tokio_timer::Error>>,
|
refresh_task: Box<dyn futures::Stream<Item = (), Error = tokio_timer::Error>>,
|
||||||
token_task: Box<futures::Future<Item = (), Error = MercuryError>>,
|
token_task: Box<dyn futures::Future<Item = (), Error = MercuryError>>,
|
||||||
active: bool,
|
active: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -102,7 +102,7 @@ impl Worker {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl Worker {
|
impl Worker {
|
||||||
fn create_refresh(&self) -> Box<futures::Stream<Item = (), Error = tokio_timer::Error>> {
|
fn create_refresh(&self) -> Box<dyn futures::Stream<Item = (), Error = tokio_timer::Error>> {
|
||||||
let ev = self.events.clone();
|
let ev = self.events.clone();
|
||||||
let future =
|
let future =
|
||||||
tokio_timer::Interval::new_interval(Duration::from_millis(400)).map(move |_| {
|
tokio_timer::Interval::new_interval(Duration::from_millis(400)).map(move |_| {
|
||||||
@@ -185,8 +185,8 @@ impl futures::Future for Worker {
|
|||||||
}
|
}
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
error!("could not generate token: {:?}", e);
|
error!("could not generate token: {:?}", e);
|
||||||
},
|
}
|
||||||
_ => ()
|
_ => (),
|
||||||
}
|
}
|
||||||
|
|
||||||
if !progress {
|
if !progress {
|
||||||
@@ -256,7 +256,7 @@ impl Spotify {
|
|||||||
fn get_token(
|
fn get_token(
|
||||||
session: &Session,
|
session: &Session,
|
||||||
sender: oneshot::Sender<Token>,
|
sender: oneshot::Sender<Token>,
|
||||||
) -> Box<Future<Item = (), Error = MercuryError>> {
|
) -> Box<dyn Future<Item = (), Error = MercuryError>> {
|
||||||
let client_id = config::CLIENT_ID;
|
let client_id = config::CLIENT_ID;
|
||||||
let scopes = "user-read-private,playlist-read-private,playlist-read-collaborative,playlist-modify-public,playlist-modify-private,user-follow-modify,user-follow-read,user-library-read,user-library-modify,user-top-read,user-read-recently-played";
|
let scopes = "user-read-private,playlist-read-private,playlist-read-collaborative,playlist-modify-public,playlist-modify-private,user-follow-modify,user-follow-read,user-library-read,user-library-modify,user-top-read,user-read-recently-played";
|
||||||
let url = format!(
|
let url = format!(
|
||||||
|
|||||||
@@ -151,7 +151,7 @@ impl ListItem for Track {
|
|||||||
current.map(|t| t.id == self.id).unwrap_or(false)
|
current.map(|t| t.id == self.id).unwrap_or(false)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn as_listitem(&self) -> Box<ListItem> {
|
fn as_listitem(&self) -> Box<dyn ListItem> {
|
||||||
Box::new(self.clone())
|
Box::new(self.clone())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ pub trait ListItem: Sync + Send + 'static {
|
|||||||
None
|
None
|
||||||
}
|
}
|
||||||
|
|
||||||
fn as_listitem(&self) -> Box<ListItem>;
|
fn as_listitem(&self) -> Box<dyn ListItem>;
|
||||||
}
|
}
|
||||||
|
|
||||||
pub trait ViewExt: View {
|
pub trait ViewExt: View {
|
||||||
|
|||||||
@@ -17,12 +17,12 @@ pub struct ContextMenu {
|
|||||||
}
|
}
|
||||||
|
|
||||||
enum ContextMenuAction {
|
enum ContextMenuAction {
|
||||||
ShowItem(Box<ListItem>),
|
ShowItem(Box<dyn ListItem>),
|
||||||
ShareUrl(String),
|
ShareUrl(String),
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ContextMenu {
|
impl ContextMenu {
|
||||||
pub fn new(item: &Box<ListItem>, queue: Arc<Queue>, library: Arc<Library>) -> Self {
|
pub fn new(item: &Box<dyn ListItem>, queue: Arc<Queue>, library: Arc<Library>) -> Self {
|
||||||
let mut content: SelectView<ContextMenuAction> = SelectView::new().autojump();
|
let mut content: SelectView<ContextMenuAction> = SelectView::new().autojump();
|
||||||
if let Some(a) = item.artist() {
|
if let Some(a) = item.artist() {
|
||||||
content.add_item("Show artist", ContextMenuAction::ShowItem(Box::new(a)));
|
content.add_item("Show artist", ContextMenuAction::ShowItem(Box::new(a)));
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ use ui::album::AlbumView;
|
|||||||
use ui::artist::ArtistView;
|
use ui::artist::ArtistView;
|
||||||
use ui::contextmenu::ContextMenu;
|
use ui::contextmenu::ContextMenu;
|
||||||
|
|
||||||
pub type Paginator<I> = Box<Fn(Arc<RwLock<Vec<I>>>) + Send + Sync>;
|
pub type Paginator<I> = Box<dyn Fn(Arc<RwLock<Vec<I>>>) + Send + Sync>;
|
||||||
pub struct Pagination<I: ListItem> {
|
pub struct Pagination<I: ListItem> {
|
||||||
max_content: Arc<RwLock<Option<usize>>>,
|
max_content: Arc<RwLock<Option<usize>>>,
|
||||||
callback: Arc<RwLock<Option<Paginator<I>>>>,
|
callback: Arc<RwLock<Option<Paginator<I>>>>,
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ pub struct SearchView {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type SearchHandler<I> =
|
type SearchHandler<I> =
|
||||||
Box<Fn(&Arc<Spotify>, &Arc<RwLock<Vec<I>>>, &str, usize, bool) -> u32 + Send + Sync>;
|
Box<dyn Fn(&Arc<Spotify>, &Arc<RwLock<Vec<I>>>, &str, usize, bool) -> u32 + Send + Sync>;
|
||||||
|
|
||||||
pub const LIST_ID: &str = "search_list";
|
pub const LIST_ID: &str = "search_list";
|
||||||
pub const EDIT_ID: &str = "search_edit";
|
pub const EDIT_ID: &str = "search_edit";
|
||||||
|
|||||||
Reference in New Issue
Block a user