chore: update lock

This commit is contained in:
Ashley Wulber 2023-12-11 14:46:22 -05:00 committed by Michael Murphy
parent 13cc6b9f7c
commit d31359e8c6
7 changed files with 154 additions and 173 deletions

View file

@ -130,15 +130,15 @@ impl cosmic::Application for SettingsApp {
}
fn on_close_requested(&self, id: window::Id) -> Option<Self::Message> {
let message = if id == applets_inner::ADD_PANEL_APPLET_DIALOGUE_ID {
let message = if id == *applets_inner::ADD_PANEL_APPLET_DIALOGUE_ID {
Message::PageMessage(crate::pages::Message::PanelApplet(
applets_inner::Message::ClosedAppletDialogue,
))
} else if id == ADD_DOCK_APPLET_DIALOGUE_ID {
} else if id == *ADD_DOCK_APPLET_DIALOGUE_ID {
Message::PageMessage(crate::pages::Message::DockApplet(dock::applets::Message(
applets_inner::Message::ClosedAppletDialogue,
)))
} else if id == COLOR_PICKER_DIALOG_ID {
} else if id == *COLOR_PICKER_DIALOG_ID {
Message::PageMessage(crate::pages::Message::Appearance(
appearance::Message::CloseRequested,
))
@ -264,7 +264,7 @@ impl cosmic::Application for SettingsApp {
crate::pages::Message::PanelApplet(message) => {
if let Some(page) = self.pages.page_mut::<applets_inner::Page>() {
return page
.update(message, applets_inner::ADD_PANEL_APPLET_DIALOGUE_ID)
.update(message, *applets_inner::ADD_PANEL_APPLET_DIALOGUE_ID)
.map(cosmic::app::Message::App);
}
}
@ -295,7 +295,7 @@ impl cosmic::Application for SettingsApp {
return page
.update(
applets_inner::Message::PanelConfig(config),
applets_inner::ADD_PANEL_APPLET_DIALOGUE_ID,
*applets_inner::ADD_PANEL_APPLET_DIALOGUE_ID,
)
.map(cosmic::app::Message::App);
}
@ -330,7 +330,7 @@ impl cosmic::Application for SettingsApp {
return page
.update(
applets_inner::Message::Applets(info_list),
applets_inner::ADD_PANEL_APPLET_DIALOGUE_ID,
*applets_inner::ADD_PANEL_APPLET_DIALOGUE_ID,
)
.map(cosmic::app::Message::App);
}
@ -390,33 +390,33 @@ impl cosmic::Application for SettingsApp {
#[allow(clippy::too_many_lines)]
fn view_window(&self, id: window::Id) -> Element<Message> {
if let Some(Some(page)) =
(id == APPLET_DND_ICON_ID).then(|| self.pages.page::<applets_inner::Page>())
(id == *APPLET_DND_ICON_ID).then(|| self.pages.page::<applets_inner::Page>())
{
return page.dnd_icon();
}
if let Some(Some(page)) = (id == applets_inner::ADD_PANEL_APPLET_DIALOGUE_ID)
if let Some(Some(page)) = (id == *applets_inner::ADD_PANEL_APPLET_DIALOGUE_ID)
.then(|| self.pages.page::<applets_inner::Page>())
{
return page.add_applet_view(crate::pages::Message::PanelApplet);
}
if let Some(Some(page)) = (id == appearance::COLOR_PICKER_DIALOG_ID)
if let Some(Some(page)) = (id == *appearance::COLOR_PICKER_DIALOG_ID)
.then(|| self.pages.page::<appearance::Page>())
{
return page.color_picker_view();
}
if let Some(Some(page)) =
(id == ADD_DOCK_APPLET_DIALOGUE_ID).then(|| self.pages.page::<dock::applets::Page>())
(id == *ADD_DOCK_APPLET_DIALOGUE_ID).then(|| self.pages.page::<dock::applets::Page>())
{
return page.inner().add_applet_view(|msg| {
crate::pages::Message::DockApplet(dock::applets::Message(msg))
});
}
if let Some(Some(page)) =
(id == keyboard::ADD_INPUT_SOURCE_DIALOGUE_ID).then(|| self.pages.page::<input::Page>())
if let Some(Some(page)) = (id == *keyboard::ADD_INPUT_SOURCE_DIALOGUE_ID)
.then(|| self.pages.page::<input::Page>())
{
return page.add_input_source_view();
}
if let Some(Some(page)) = (id == keyboard::SPECIAL_CHARACTER_DIALOGUE_ID)
if let Some(Some(page)) = (id == *keyboard::SPECIAL_CHARACTER_DIALOGUE_ID)
.then(|| self.pages.page::<input::Page>())
{
return page.special_character_key_view();
@ -478,10 +478,13 @@ impl SettingsApp {
}
fn set_title(&mut self) -> Command<crate::Message> {
self.set_window_title(format!(
"{} - COSMIC Settings",
self.pages.info[self.active_page].title
))
self.set_window_title(
format!(
"{} - COSMIC Settings",
self.pages.info[self.active_page].title
),
window::Id::MAIN,
)
}
/// Activates the navbar item associated with a page.

View file

@ -23,6 +23,7 @@ use cosmic::{Command, Element};
use cosmic_settings_desktop::wallpaper;
use cosmic_settings_page::Section;
use cosmic_settings_page::{self as page, section};
use once_cell::sync::Lazy;
use ron::ser::PrettyConfig;
use slotmap::SlotMap;
use tracing::warn;
@ -30,7 +31,8 @@ use tracing::warn;
use crate::app;
use super::wallpaper::widgets::color_image;
pub const COLOR_PICKER_DIALOG_ID: window::Id = window::Id(1003);
pub static COLOR_PICKER_DIALOG_ID: Lazy<window::Id> = Lazy::new(|| window::Id::unique());
enum NamedColorPicker {
CustomAccent,
@ -316,7 +318,7 @@ impl Page {
// apply changes
theme_builder_needs_update = true;
self.active_dialog = None;
close_window::<app::Message>(COLOR_PICKER_DIALOG_ID)
close_window::<app::Message>(*COLOR_PICKER_DIALOG_ID)
}
// TODO apply changes
ColorPickerUpdate::ActionFinished => {
@ -329,7 +331,7 @@ impl Page {
ColorPickerUpdate::Cancel => {
// close the color picker dialog
self.active_dialog = None;
close_window(COLOR_PICKER_DIALOG_ID)
close_window(*COLOR_PICKER_DIALOG_ID)
}
ColorPickerUpdate::ToggleColorPicker => {
let prev = self
@ -377,7 +379,7 @@ impl Page {
// apply changes
theme_builder_needs_update = true;
self.active_dialog = None;
close_window::<app::Message>(COLOR_PICKER_DIALOG_ID)
close_window::<app::Message>(*COLOR_PICKER_DIALOG_ID)
}
// TODO apply changes
ColorPickerUpdate::ActionFinished => {
@ -390,7 +392,7 @@ impl Page {
ColorPickerUpdate::Cancel => {
// close the color picker dialog
self.active_dialog = None;
close_window(COLOR_PICKER_DIALOG_ID)
close_window(*COLOR_PICKER_DIALOG_ID)
}
ColorPickerUpdate::ToggleColorPicker => {
let prev = self
@ -442,7 +444,7 @@ impl Page {
// apply changes
theme_builder_needs_update = true;
self.active_dialog = None;
close_window::<app::Message>(COLOR_PICKER_DIALOG_ID)
close_window::<app::Message>(*COLOR_PICKER_DIALOG_ID)
}
// TODO apply changes
ColorPickerUpdate::ActionFinished => {
@ -455,7 +457,7 @@ impl Page {
ColorPickerUpdate::Cancel => {
// close the color picker dialog
self.active_dialog = None;
close_window(COLOR_PICKER_DIALOG_ID)
close_window(*COLOR_PICKER_DIALOG_ID)
}
ColorPickerUpdate::ToggleColorPicker => {
let prev = self.active_dialog.replace(NamedColorPicker::CustomAccent);
@ -479,7 +481,7 @@ impl Page {
// apply changes
theme_builder_needs_update = true;
self.active_dialog = None;
close_window::<app::Message>(COLOR_PICKER_DIALOG_ID)
close_window::<app::Message>(*COLOR_PICKER_DIALOG_ID)
}
// TODO apply changes
ColorPickerUpdate::ActionFinished => {
@ -492,7 +494,7 @@ impl Page {
ColorPickerUpdate::Cancel => {
// close the color picker dialog
self.active_dialog = None;
close_window(COLOR_PICKER_DIALOG_ID)
close_window(*COLOR_PICKER_DIALOG_ID)
}
ColorPickerUpdate::ToggleColorPicker => {
let prev = self.active_dialog.replace(NamedColorPicker::InterfaceText);
@ -513,7 +515,7 @@ impl Page {
// apply changes
theme_builder_needs_update = true;
self.active_dialog = None;
close_window::<app::Message>(COLOR_PICKER_DIALOG_ID)
close_window::<app::Message>(*COLOR_PICKER_DIALOG_ID)
}
// TODO apply changes
ColorPickerUpdate::ActionFinished => {
@ -526,7 +528,7 @@ impl Page {
ColorPickerUpdate::Cancel => {
// close the color picker dialog
self.active_dialog = None;
close_window(COLOR_PICKER_DIALOG_ID)
close_window(*COLOR_PICKER_DIALOG_ID)
}
ColorPickerUpdate::ToggleColorPicker => {
let prev = self
@ -806,7 +808,7 @@ impl Page {
Command::none()
}
Message::DragColorPicker => {
cosmic::iced_sctk::commands::window::start_drag_window(COLOR_PICKER_DIALOG_ID)
cosmic::iced_sctk::commands::window::start_drag_window(*COLOR_PICKER_DIALOG_ID)
}
};
@ -1397,10 +1399,10 @@ impl page::AutoBind<crate::pages::Message> for Page {}
fn color_picker_window_settings() -> SctkWindowSettings {
SctkWindowSettings {
window_id: COLOR_PICKER_DIALOG_ID,
window_id: *COLOR_PICKER_DIALOG_ID,
app_id: Some("com.system76.CosmicSettings".to_string()),
title: Some(fl!("color-picker")),
parent: Some(window::Id(0)),
parent: Some(window::Id::MAIN),
autosize: false,
size_limits: layout::Limits::NONE
.min_width(300.0)

View file

@ -1,6 +1,7 @@
use cosmic::{cosmic_config::CosmicConfigEntry, iced::window, iced_runtime::Command};
use cosmic_panel_config::CosmicPanelConfig;
use cosmic_settings_page::{self as page, section, Section};
use once_cell::sync::Lazy;
use slotmap::SlotMap;
use std::borrow::Cow;
@ -12,7 +13,7 @@ use crate::{
},
};
pub const ADD_DOCK_APPLET_DIALOGUE_ID: window::Id = window::Id(1002);
pub static ADD_DOCK_APPLET_DIALOGUE_ID: Lazy<window::Id> = Lazy::new(|| window::Id::unique());
pub(crate) struct Page {
inner: applets_inner::Page,
@ -58,7 +59,7 @@ pub struct Message(pub applets_inner::Message);
impl Page {
pub fn update(&mut self, message: Message) -> Command<app::Message> {
self.inner.update(message.0, ADD_DOCK_APPLET_DIALOGUE_ID)
self.inner.update(message.0, *ADD_DOCK_APPLET_DIALOGUE_ID)
}
}

View file

@ -36,6 +36,7 @@ use cosmic::{
},
theme, Apply, Element,
};
use once_cell::sync::Lazy;
use std::{
borrow::{Borrow, Cow},
@ -67,8 +68,8 @@ const SPACING: f32 = 8.0;
// radius is 8.0
const DRAG_START_DISTANCE_SQUARED: f32 = 64.0;
pub const APPLET_DND_ICON_ID: window::Id = window::Id(1000);
pub const ADD_PANEL_APPLET_DIALOGUE_ID: window::Id = window::Id(1001);
pub static APPLET_DND_ICON_ID: Lazy<window::Id> = Lazy::new(|| window::Id::unique());
pub static ADD_PANEL_APPLET_DIALOGUE_ID: Lazy<window::Id> = Lazy::new(|| window::Id::unique());
pub struct Page {
pub(crate) available_entries: Vec<Applet<'static>>,
@ -463,7 +464,7 @@ impl Page {
window_id,
app_id: Some("com.system76.CosmicSettings".to_string()),
title: Some(fl!("add-applet")),
parent: Some(window::Id(0)),
parent: Some(window::Id::MAIN),
autosize: false,
size_limits: layout::Limits::NONE
.min_width(300.0)
@ -539,7 +540,7 @@ pub fn lists<
.collect()
})
.unwrap_or_default(),
Some((window::Id(0), APPLET_DND_ICON_ID)),
Some((window::Id::MAIN, *APPLET_DND_ICON_ID)),
Message::StartDnd,
|a| Message::DnDCommand(Arc::new(a)),
Message::RemoveStart,
@ -570,7 +571,7 @@ pub fn lists<
.collect()
})
.unwrap_or_default(),
Some((window::Id(0), APPLET_DND_ICON_ID)),
Some((window::Id::MAIN, *APPLET_DND_ICON_ID)),
Message::StartDnd,
|a| Message::DnDCommand(Arc::new(a)),
Message::RemoveCenter,
@ -602,7 +603,7 @@ pub fn lists<
.collect()
})
.unwrap_or_default(),
Some((window::Id(0), APPLET_DND_ICON_ID)),
Some((window::Id::MAIN, *APPLET_DND_ICON_ID)),
Message::StartDnd,
|a| Message::DnDCommand(Arc::new(a)),
Message::RemoveEnd,

View file

@ -9,12 +9,13 @@ use cosmic::{
widget::{button, container, icon, radio, settings},
};
use cosmic_settings_page::{self as page, section, Section};
use once_cell::sync::Lazy;
use slotmap::SlotMap;
use super::Message;
pub const ADD_INPUT_SOURCE_DIALOGUE_ID: window::Id = window::Id(2000);
pub const SPECIAL_CHARACTER_DIALOGUE_ID: window::Id = window::Id(2001);
pub static ADD_INPUT_SOURCE_DIALOGUE_ID: Lazy<window::Id> = Lazy::new(|| window::Id::unique());
pub static SPECIAL_CHARACTER_DIALOGUE_ID: Lazy<window::Id> = Lazy::new(|| window::Id::unique());
static COMPOSE_OPTIONS: &[(&str, &str)] = &[
// ("Left Alt", "compose:lalt"), XXX?

View file

@ -162,10 +162,10 @@ impl Page {
Message::OpenSpecialCharacterDialog(special_key) => {
self.special_character_dialog = Some(special_key);
let window_settings = SctkWindowSettings {
window_id: keyboard::SPECIAL_CHARACTER_DIALOGUE_ID,
window_id: *keyboard::SPECIAL_CHARACTER_DIALOGUE_ID,
app_id: Some("com.system76.CosmicSettings".to_string()),
title: Some(special_key.title()),
parent: Some(window::Id(0)),
parent: Some(window::Id::MAIN),
autosize: false,
size_limits: layout::Limits::NONE
.min_width(300.0)
@ -182,7 +182,7 @@ impl Page {
}
Message::CloseSpecialCharacterDialog => {
self.special_character_dialog = None;
return commands::window::close_window(keyboard::SPECIAL_CHARACTER_DIALOGUE_ID);
return commands::window::close_window(*keyboard::SPECIAL_CHARACTER_DIALOGUE_ID);
}
Message::SpecialCharacterSelect(id) => {
if let Some(special_key) = self.special_character_dialog {