chore: use std::sync::LazyLock
Removes `once_cell` as a direct dependency.
This commit is contained in:
parent
467716c167
commit
c3fafd3910
42 changed files with 77 additions and 106 deletions
|
|
@ -4,6 +4,7 @@
|
|||
mod localize;
|
||||
mod mouse_area;
|
||||
|
||||
use std::sync::LazyLock;
|
||||
use std::time::Duration;
|
||||
|
||||
use crate::{localize::localize, pulse::DeviceInfo};
|
||||
|
|
@ -28,7 +29,7 @@ use cosmic::{
|
|||
Element, Renderer, Task, Theme,
|
||||
};
|
||||
use cosmic_settings_subscriptions::pulse as sub_pulse;
|
||||
use cosmic_time::{anim, chain, id, once_cell::sync::Lazy, Instant, Timeline};
|
||||
use cosmic_time::{anim, chain, id, Instant, Timeline};
|
||||
use iced::{
|
||||
platform_specific::shell::wayland::commands::popup::{destroy_popup, get_popup},
|
||||
widget::container,
|
||||
|
|
@ -47,7 +48,7 @@ static FULL_VOLUME: f64 = Volume::NORMAL.0 as f64;
|
|||
// Max volume is 150% volume.
|
||||
static MAX_VOLUME: f64 = FULL_VOLUME + (FULL_VOLUME * 0.5);
|
||||
|
||||
static SHOW_MEDIA_CONTROLS: Lazy<id::Toggler> = Lazy::new(id::Toggler::unique);
|
||||
static SHOW_MEDIA_CONTROLS: LazyLock<id::Toggler> = LazyLock::new(id::Toggler::unique);
|
||||
|
||||
const GO_BACK: &str = "media-skip-backward-symbolic";
|
||||
const GO_NEXT: &str = "media-skip-forward-symbolic";
|
||||
|
|
|
|||
|
|
@ -1,18 +1,18 @@
|
|||
// Copyright 2023 System76 <info@system76.com>
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
|
||||
use cosmic_time::once_cell::sync::Lazy;
|
||||
use i18n_embed::{
|
||||
fluent::{fluent_language_loader, FluentLanguageLoader},
|
||||
DefaultLocalizer, LanguageLoader, Localizer,
|
||||
};
|
||||
use rust_embed::RustEmbed;
|
||||
use std::sync::LazyLock;
|
||||
|
||||
#[derive(RustEmbed)]
|
||||
#[folder = "i18n/"]
|
||||
struct Localizations;
|
||||
|
||||
pub static LANGUAGE_LOADER: Lazy<FluentLanguageLoader> = Lazy::new(|| {
|
||||
pub static LANGUAGE_LOADER: LazyLock<FluentLanguageLoader> = LazyLock::new(|| {
|
||||
let loader: FluentLanguageLoader = fluent_language_loader!();
|
||||
|
||||
loader
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
// Copyright 2023 System76 <info@system76.com>
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
|
||||
use std::{cell::RefCell, mem, rc::Rc, thread, time::Duration};
|
||||
use std::{cell::RefCell, mem, rc::Rc, sync::LazyLock, thread, time::Duration};
|
||||
|
||||
extern crate libpulse_binding as pulse;
|
||||
|
||||
|
|
@ -9,7 +9,6 @@ use cosmic::{
|
|||
iced::{self, stream, Subscription},
|
||||
iced_futures::futures::{self, SinkExt},
|
||||
};
|
||||
use cosmic_time::once_cell::sync::Lazy;
|
||||
|
||||
use libpulse_binding::{
|
||||
callbacks::ListResult,
|
||||
|
|
@ -25,8 +24,8 @@ use libpulse_binding::{
|
|||
|
||||
use tokio::sync::{mpsc, Mutex};
|
||||
|
||||
pub static FROM_PULSE: Lazy<Mutex<Option<(mpsc::Receiver<Message>, mpsc::Sender<Message>)>>> =
|
||||
Lazy::new(|| Mutex::new(None));
|
||||
pub static FROM_PULSE: LazyLock<Mutex<Option<(mpsc::Receiver<Message>, mpsc::Sender<Message>)>>> =
|
||||
LazyLock::new(|| Mutex::new(None));
|
||||
|
||||
pub fn connect() -> iced::Subscription<Event> {
|
||||
struct SomeWorker;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue