chore: update to Rust 2024 edition
This commit is contained in:
parent
c3fafd3910
commit
2b7b4cba56
71 changed files with 254 additions and 292 deletions
|
|
@ -1,7 +1,7 @@
|
|||
// Copyright 2023 System76 <info@system76.com>
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
|
||||
use cosmic::cosmic_config::{self, cosmic_config_derive::CosmicConfigEntry, CosmicConfigEntry};
|
||||
use cosmic::cosmic_config::{self, CosmicConfigEntry, cosmic_config_derive::CosmicConfigEntry};
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Default, Debug, Clone, Serialize, Deserialize, CosmicConfigEntry, PartialEq, Eq)]
|
||||
|
|
|
|||
|
|
@ -10,33 +10,29 @@ use std::time::Duration;
|
|||
use crate::{localize::localize, pulse::DeviceInfo};
|
||||
use config::AudioAppletConfig;
|
||||
use cosmic::{
|
||||
app,
|
||||
Element, Renderer, Task, Theme, app,
|
||||
applet::{
|
||||
cosmic_panel_config::PanelAnchor,
|
||||
menu_button, menu_control_padding, padded_control,
|
||||
token::subscription::{activation_token_subscription, TokenRequest, TokenUpdate},
|
||||
token::subscription::{TokenRequest, TokenUpdate, activation_token_subscription},
|
||||
},
|
||||
cctk::sctk::reexports::calloop,
|
||||
cosmic_config::CosmicConfigEntry,
|
||||
cosmic_theme::Spacing,
|
||||
iced::{
|
||||
self,
|
||||
self, Alignment, Length, Subscription,
|
||||
widget::{self, column, row, slider},
|
||||
window, Alignment, Length, Limits, Subscription,
|
||||
window,
|
||||
},
|
||||
surface, theme,
|
||||
widget::{button, divider, horizontal_space, icon, text, Column, Row},
|
||||
Element, Renderer, Task, Theme,
|
||||
widget::{Column, Row, button, container, divider, horizontal_space, icon, text},
|
||||
};
|
||||
use cosmic_settings_subscriptions::pulse as sub_pulse;
|
||||
use cosmic_time::{anim, chain, id, Instant, Timeline};
|
||||
use iced::{
|
||||
platform_specific::shell::wayland::commands::popup::{destroy_popup, get_popup},
|
||||
widget::container,
|
||||
};
|
||||
use cosmic_time::{Instant, Timeline, anim, chain, id};
|
||||
use iced::platform_specific::shell::wayland::commands::popup::{destroy_popup, get_popup};
|
||||
use libpulse_binding::volume::Volume;
|
||||
use mpris2_zbus::player::PlaybackStatus;
|
||||
use mpris_subscription::{MprisRequest, MprisUpdate};
|
||||
use mpris2_zbus::player::PlaybackStatus;
|
||||
|
||||
mod config;
|
||||
mod mpris_subscription;
|
||||
|
|
@ -342,7 +338,7 @@ impl cosmic::Application for Audio {
|
|||
self.popup.replace(new_id);
|
||||
self.timeline = Timeline::new();
|
||||
|
||||
let mut popup_settings = self.core.applet.get_popup_settings(
|
||||
let popup_settings = self.core.applet.get_popup_settings(
|
||||
self.core.main_window_id().unwrap(),
|
||||
new_id,
|
||||
None,
|
||||
|
|
|
|||
|
|
@ -2,8 +2,8 @@
|
|||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
|
||||
use i18n_embed::{
|
||||
fluent::{fluent_language_loader, FluentLanguageLoader},
|
||||
DefaultLocalizer, LanguageLoader, Localizer,
|
||||
fluent::{FluentLanguageLoader, fluent_language_loader},
|
||||
};
|
||||
use rust_embed::RustEmbed;
|
||||
use std::sync::LazyLock;
|
||||
|
|
|
|||
|
|
@ -4,10 +4,10 @@ use cosmic::iced::Vector;
|
|||
use cosmic::iced_renderer::core::Point;
|
||||
|
||||
use cosmic::iced_core::{
|
||||
Clipboard, Element, Layout, Length, Rectangle, Shell, Size, Widget,
|
||||
event::{self, Event},
|
||||
layout, mouse, overlay, renderer, touch,
|
||||
widget::{tree, Operation, Tree},
|
||||
Clipboard, Element, Layout, Length, Rectangle, Shell, Size, Widget,
|
||||
widget::{Operation, Tree, tree},
|
||||
};
|
||||
|
||||
/// Emit messages on mouse events.
|
||||
|
|
|
|||
|
|
@ -4,8 +4,8 @@
|
|||
use std::{borrow::Cow, fmt::Debug, hash::Hash, path::PathBuf};
|
||||
|
||||
use cosmic::{
|
||||
iced::{self, stream, Subscription},
|
||||
iced_futures::futures::{self, future::OptionFuture, SinkExt, StreamExt},
|
||||
iced::{self, Subscription, stream},
|
||||
iced_futures::futures::{self, SinkExt, StreamExt, future::OptionFuture},
|
||||
};
|
||||
use mpris2_zbus::{
|
||||
enumerator,
|
||||
|
|
@ -15,8 +15,8 @@ use mpris2_zbus::{
|
|||
use tokio::join;
|
||||
use urlencoding::decode;
|
||||
use zbus::{
|
||||
names::{BusName, OwnedBusName},
|
||||
Connection,
|
||||
names::{BusName, OwnedBusName},
|
||||
};
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
|
|
|
|||
|
|
@ -6,15 +6,15 @@ use std::{cell::RefCell, mem, rc::Rc, sync::LazyLock, thread, time::Duration};
|
|||
extern crate libpulse_binding as pulse;
|
||||
|
||||
use cosmic::{
|
||||
iced::{self, stream, Subscription},
|
||||
iced::{self, Subscription, stream},
|
||||
iced_futures::futures::{self, SinkExt},
|
||||
};
|
||||
|
||||
use libpulse_binding::{
|
||||
callbacks::ListResult,
|
||||
context::{
|
||||
introspect::{Introspector, SinkInfo, SourceInfo},
|
||||
Context,
|
||||
introspect::{Introspector, SinkInfo, SourceInfo},
|
||||
},
|
||||
error::PAErr,
|
||||
mainloop::standard::{IterateResult, Mainloop},
|
||||
|
|
@ -22,7 +22,7 @@ use libpulse_binding::{
|
|||
volume::ChannelVolumes,
|
||||
};
|
||||
|
||||
use tokio::sync::{mpsc, Mutex};
|
||||
use tokio::sync::{Mutex, mpsc};
|
||||
|
||||
pub static FROM_PULSE: LazyLock<Mutex<Option<(mpsc::Receiver<Message>, mpsc::Sender<Message>)>>> =
|
||||
LazyLock::new(|| Mutex::new(None));
|
||||
|
|
@ -508,22 +508,22 @@ impl PulseServer {
|
|||
match self.mainloop.borrow_mut().iterate(false) {
|
||||
IterateResult::Success(_) => {}
|
||||
IterateResult::Err(e) => {
|
||||
return Err(PulseServerError::IterateErr(IterateResult::Err(e)))
|
||||
return Err(PulseServerError::IterateErr(IterateResult::Err(e)));
|
||||
}
|
||||
IterateResult::Quit(e) => {
|
||||
return Err(PulseServerError::IterateErr(IterateResult::Quit(e)))
|
||||
return Err(PulseServerError::IterateErr(IterateResult::Quit(e)));
|
||||
}
|
||||
}
|
||||
|
||||
match self.context.borrow().get_state() {
|
||||
pulse::context::State::Ready => break,
|
||||
pulse::context::State::Failed => {
|
||||
return Err(PulseServerError::ContextErr(pulse::context::State::Failed))
|
||||
return Err(PulseServerError::ContextErr(pulse::context::State::Failed));
|
||||
}
|
||||
pulse::context::State::Terminated => {
|
||||
return Err(PulseServerError::ContextErr(
|
||||
pulse::context::State::Terminated,
|
||||
))
|
||||
));
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
|
|
@ -757,10 +757,10 @@ impl PulseServer {
|
|||
loop {
|
||||
match self.mainloop.borrow_mut().iterate(false) {
|
||||
IterateResult::Err(e) => {
|
||||
return Err(PulseServerError::IterateErr(IterateResult::Err(e)))
|
||||
return Err(PulseServerError::IterateErr(IterateResult::Err(e)));
|
||||
}
|
||||
IterateResult::Quit(e) => {
|
||||
return Err(PulseServerError::IterateErr(IterateResult::Quit(e)))
|
||||
return Err(PulseServerError::IterateErr(IterateResult::Quit(e)));
|
||||
}
|
||||
IterateResult::Success(_) => {}
|
||||
}
|
||||
|
|
@ -770,7 +770,7 @@ impl PulseServer {
|
|||
pulse::operation::State::Cancelled => {
|
||||
return Err(PulseServerError::OperationErr(
|
||||
pulse::operation::State::Cancelled,
|
||||
))
|
||||
));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue