chore: update to Rust 2024 edition

This commit is contained in:
Vukašin Vojinović 2025-08-12 21:38:51 +02:00 committed by Michael Murphy
parent c3fafd3910
commit 2b7b4cba56
71 changed files with 254 additions and 292 deletions

View file

@ -4,30 +4,29 @@
mod localize;
mod subscriptions;
use cosmic::{
app,
Element, Task, app,
applet::{
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::{Config, CosmicConfigEntry},
cosmic_theme::Spacing,
iced::{
Alignment, Length, Subscription,
platform_specific::shell::wayland::commands::popup::{destroy_popup, get_popup},
widget::{column, row},
window, Alignment, Length, Limits, Subscription,
window,
},
iced_widget::{scrollable, Column},
surface, theme,
widget::{button, container, divider, icon, text},
Element, Task,
widget::{Column, button, container, divider, icon, scrollable, text},
};
use cosmic::iced_futures::futures::executor::block_on;
use cosmic_notifications_config::NotificationsConfig;
use cosmic_notifications_util::{ActionId, Image, Notification};
use cosmic_time::{anim, chain, id, Instant, Timeline};
use cosmic_time::{Instant, Timeline, anim, chain, id};
use std::{borrow::Cow, collections::HashMap, path::PathBuf, sync::LazyLock};
use subscriptions::notifications::{self, NotificationsAppletProxy};
use tokio::sync::mpsc::Sender;
@ -185,7 +184,7 @@ impl cosmic::Application for Notifications {
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,
@ -411,26 +410,30 @@ impl cosmic::Application for Notifications {
space_xxs, space_s, ..
} = theme::active().cosmic().spacing;
let do_not_disturb = padded_control(row![anim!(
DO_NOT_DISTURB,
&self.timeline,
fl!("do-not-disturb"),
self.config.do_not_disturb,
Message::DoNotDisturb
)
.text_size(14)
.width(Length::Fill)]);
let do_not_disturb = padded_control(row![
anim!(
DO_NOT_DISTURB,
&self.timeline,
fl!("do-not-disturb"),
self.config.do_not_disturb,
Message::DoNotDisturb
)
.text_size(14)
.width(Length::Fill)
]);
let notifications = if self.cards.is_empty() {
let no_notifications = String::from(fl!("no-notifications"));
row![container(
column![
text_icon("cosmic-applet-notification-symbolic", 40),
text::body(no_notifications)
]
.align_x(Alignment::Center)
)
.center_x(Length::Fill)]
row![
container(
column![
text_icon("cosmic-applet-notification-symbolic", 40),
text::body(no_notifications)
]
.align_x(Alignment::Center)
)
.center_x(Length::Fill)
]
.padding([8, 0])
.spacing(12)
} else {
@ -581,12 +584,14 @@ impl cosmic::Application for Notifications {
notifs.push(card_list.into());
}
row!(scrollable(
Column::with_children(notifs)
.spacing(8)
.height(Length::Shrink),
row!(
scrollable(
Column::with_children(notifs)
.spacing(8)
.height(Length::Shrink),
)
.height(Length::Shrink)
)
.height(Length::Shrink))
.padding(menu_control_padding())
};

View file

@ -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;

View file

@ -4,10 +4,10 @@
use crate::subscriptions::freedesktop_proxy::NotificationsProxy;
use cosmic::{
iced::futures::{self, SinkExt},
iced_futures::{stream, Subscription},
iced_futures::{Subscription, stream},
};
use futures_util::StreamExt;
use tokio::sync::mpsc::{channel, Receiver, Sender};
use tokio::sync::mpsc::{Receiver, Sender, channel};
use tracing::{error, warn};
use zbus::Connection;

View file

@ -12,7 +12,6 @@ use cosmic_notifications_util::Notification;
use futures_util::{SinkExt, StreamExt};
use std::{
collections::HashMap,
future::pending,
os::unix::io::{FromRawFd, RawFd},
pin::pin,
};