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

@ -2,32 +2,30 @@ use std::collections::HashSet;
use std::sync::LazyLock;
use cosmic::{
app,
Element, Task, app,
applet::{
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_theme::Spacing,
iced::{
Alignment, Length, Subscription,
platform_specific::shell::wayland::commands::popup::{destroy_popup, get_popup},
widget::{column, row},
Alignment, Length, Subscription,
},
iced_runtime::core::{layout::Limits, window},
iced_widget::Row,
iced_runtime::core::window,
surface, theme,
widget::{
button, container, divider,
Column, Row, button, container, divider,
icon::{self, from_name},
scrollable, text, text_input, Column,
scrollable, text, text_input,
},
Element, Task,
};
use cosmic_dbus_networkmanager::interface::enums::{
ActiveConnectionState, DeviceState, NmConnectivityState,
};
use cosmic_time::{anim, chain, id, Instant, Timeline};
use cosmic_time::{Instant, Timeline, anim, chain, id};
use futures::channel::mpsc::UnboundedSender;
use zbus::Connection;
@ -35,6 +33,7 @@ use zbus::Connection;
use crate::{
config, fl,
network_manager::{
NetworkManagerEvent, NetworkManagerRequest, NetworkManagerState,
active_conns::active_conns_subscription,
available_wifi::{AccessPoint, NetworkType},
current_networks::ActiveConnectionInfo,
@ -42,7 +41,6 @@ use crate::{
hw_address::HwAddress,
network_manager_subscription,
wireless_enabled::wireless_enabled_subscription,
NetworkManagerEvent, NetworkManagerRequest, NetworkManagerState,
},
};
@ -290,7 +288,7 @@ impl cosmic::Application for CosmicNetworkApplet {
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,
@ -759,12 +757,14 @@ impl cosmic::Application for CosmicNetworkApplet {
}
known_wifi.push(Element::from(
column![menu_button(
Row::with_children(btn_content)
.align_y(Alignment::Center)
.spacing(8)
)
.on_press(Message::Disconnect(name.clone(), *hw_address))]
column![
menu_button(
Row::with_children(btn_content)
.align_y(Alignment::Center)
.spacing(8)
)
.on_press(Message::Disconnect(name.clone(), *hw_address))
]
.align_x(Alignment::Center),
));
}
@ -871,12 +871,14 @@ impl cosmic::Application for CosmicNetworkApplet {
.active_conns
.iter()
.any(|conn| conn.hw_address() == hw_device);
let mut btn_content = vec![column![
text::body(display_name),
Column::with_children(vec![text("Adapter").size(10).into()])
]
.width(Length::Fill)
.into()];
let mut btn_content = vec![
column![
text::body(display_name),
Column::with_children(vec![text("Adapter").size(10).into()])
]
.width(Length::Fill)
.into(),
];
if is_connected {
btn_content.push(
text::body(fl!("connected"))

View file

@ -1,8 +1,8 @@
// SPDX-License-Identifier: MPL-2.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

@ -1,5 +1,5 @@
use super::{NetworkManagerEvent, NetworkManagerState};
use cosmic::iced::{self, stream, Subscription};
use cosmic::iced::{self, Subscription, stream};
use cosmic_dbus_networkmanager::nm::NetworkManager;
use futures::{SinkExt, StreamExt};
use std::{fmt::Debug, hash::Hash};

View file

@ -20,22 +20,22 @@ use cosmic_dbus_networkmanager::{
enums::{self, ActiveConnectionState, DeviceType, NmConnectivityState},
},
nm::NetworkManager,
settings::{connection::Settings, NetworkManagerSettings},
settings::{NetworkManagerSettings, connection::Settings},
};
use futures::{
channel::mpsc::{unbounded, UnboundedReceiver, UnboundedSender},
SinkExt, StreamExt,
channel::mpsc::{UnboundedReceiver, UnboundedSender, unbounded},
};
use hw_address::HwAddress;
use tokio::process::Command;
use zbus::{
zvariant::{self, Value},
Connection,
zvariant::{self, Value},
};
use self::{
available_wifi::{handle_wireless_device, AccessPoint},
current_networks::{active_connections, ActiveConnectionInfo},
available_wifi::{AccessPoint, handle_wireless_device},
current_networks::{ActiveConnectionInfo, active_connections},
};
// In some distros, rfkill is only in sbin, which isn't normally in PATH