chore: clippy
This commit is contained in:
parent
96ce377ebf
commit
eb55cd020f
12 changed files with 41 additions and 42 deletions
|
|
@ -5,7 +5,7 @@ use cosmic::{
|
||||||
iced::stream,
|
iced::stream,
|
||||||
surface,
|
surface,
|
||||||
theme::CosmicTheme,
|
theme::CosmicTheme,
|
||||||
widget::{dropdown, list, settings, text},
|
widget::{dropdown, settings, text},
|
||||||
};
|
};
|
||||||
pub use cosmic_comp_config::ZoomMovement;
|
pub use cosmic_comp_config::ZoomMovement;
|
||||||
use cosmic_config::CosmicConfigEntry;
|
use cosmic_config::CosmicConfigEntry;
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@ use std::{
|
||||||
use cosmic::{
|
use cosmic::{
|
||||||
Apply, Element, Task,
|
Apply, Element, Task,
|
||||||
cosmic_config::{self, ConfigGet, ConfigSet},
|
cosmic_config::{self, ConfigGet, ConfigSet},
|
||||||
iced::{Length, stream},
|
iced::stream,
|
||||||
surface,
|
surface,
|
||||||
widget::{self, dropdown, settings, text},
|
widget::{self, dropdown, settings, text},
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ use cosmic::cosmic_config::{Config, ConfigSet};
|
||||||
use cosmic::cosmic_theme::Spacing;
|
use cosmic::cosmic_theme::Spacing;
|
||||||
use cosmic::iced::core::{Color, Length};
|
use cosmic::iced::core::{Color, Length};
|
||||||
use cosmic::widget::{
|
use cosmic::widget::{
|
||||||
ColorPickerModel, color_picker::ColorPickerUpdate, container, flex_row, list, settings, text,
|
ColorPickerModel, color_picker::ColorPickerUpdate, container, flex_row, settings, text,
|
||||||
};
|
};
|
||||||
use cosmic::{Apply, Task};
|
use cosmic::{Apply, Task};
|
||||||
use cosmic::{Element, widget};
|
use cosmic::{Element, widget};
|
||||||
|
|
|
||||||
|
|
@ -6,8 +6,7 @@ use std::sync::Arc;
|
||||||
use cosmic::{
|
use cosmic::{
|
||||||
Apply, Element, Task,
|
Apply, Element, Task,
|
||||||
config::{CosmicTk, FontConfig},
|
config::{CosmicTk, FontConfig},
|
||||||
iced::core::text::Wrapping,
|
widget,
|
||||||
widget::{self, settings, svg},
|
|
||||||
};
|
};
|
||||||
use cosmic_config::ConfigSet;
|
use cosmic_config::ConfigSet;
|
||||||
|
|
||||||
|
|
@ -193,10 +192,11 @@ impl Model {
|
||||||
widget::list_column::with_capacity(families.len()),
|
widget::list_column::with_capacity(families.len()),
|
||||||
|list, family| {
|
|list, family| {
|
||||||
let selected = &**family == current_font;
|
let selected = &**family == current_font;
|
||||||
list.add(
|
list.add(selection_context_item(
|
||||||
widget::list::button(selection_context_item(&**family, selected))
|
family,
|
||||||
.on_press(callback(family.clone())),
|
selected,
|
||||||
)
|
callback(family.clone()),
|
||||||
|
))
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
list.into()
|
list.into()
|
||||||
|
|
|
||||||
|
|
@ -22,8 +22,7 @@ use cosmic::dialog::file_chooser::{self, FileFilter};
|
||||||
use cosmic::iced::Subscription;
|
use cosmic::iced::Subscription;
|
||||||
use cosmic::iced::core::{Alignment, Length};
|
use cosmic::iced::core::{Alignment, Length};
|
||||||
use cosmic::widget::{
|
use cosmic::widget::{
|
||||||
button, color_picker::ColorPickerUpdate, container, list, row, settings, space::horizontal,
|
button, color_picker::ColorPickerUpdate, container, row, settings, space::horizontal, text,
|
||||||
text,
|
|
||||||
};
|
};
|
||||||
use cosmic::{Apply, Element, Task, widget};
|
use cosmic::{Apply, Element, Task, widget};
|
||||||
#[cfg(feature = "wayland")]
|
#[cfg(feature = "wayland")]
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ use cosmic::{
|
||||||
cosmic_theme::Density,
|
cosmic_theme::Density,
|
||||||
iced::{Alignment, Length},
|
iced::{Alignment, Length},
|
||||||
surface,
|
surface,
|
||||||
widget::{button, container, dropdown, list, row, settings, slider, space, text},
|
widget::{button, container, dropdown, row, settings, slider, space, text},
|
||||||
};
|
};
|
||||||
|
|
||||||
use cosmic::Apply;
|
use cosmic::Apply;
|
||||||
|
|
@ -290,7 +290,7 @@ pub(crate) fn configuration<P: page::Page<crate::pages::Message> + PanelPage>(
|
||||||
.find(|(_, v)| v.id == page.applets_page_id())
|
.find(|(_, v)| v.id == page.applets_page_id())
|
||||||
{
|
{
|
||||||
settings.add(crate::widget::go_next_item(
|
settings.add(crate::widget::go_next_item(
|
||||||
&*descriptions[applets_label],
|
&descriptions[applets_label],
|
||||||
crate::pages::Message::Page(panel_applets_entity),
|
crate::pages::Message::Page(panel_applets_entity),
|
||||||
))
|
))
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@
|
||||||
use super::Message;
|
use super::Message;
|
||||||
use cosmic::iced::Radius;
|
use cosmic::iced::Radius;
|
||||||
use cosmic::iced::core::Border;
|
use cosmic::iced::core::Border;
|
||||||
use cosmic::iced::core::{self, Background, Color, Degrees, Length, gradient::Linear};
|
use cosmic::iced::core::{Background, Color, Degrees, Length, gradient::Linear};
|
||||||
use cosmic::iced::runtime::core::image::Handle as ImageHandle;
|
use cosmic::iced::runtime::core::image::Handle as ImageHandle;
|
||||||
use cosmic::prelude::*;
|
use cosmic::prelude::*;
|
||||||
use cosmic::widget::{Space, button, container};
|
use cosmic::widget::{Space, button, container};
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
|
|
||||||
use cosmic::{
|
use cosmic::{
|
||||||
Apply, Element,
|
Apply, Element,
|
||||||
iced::{Alignment, Length},
|
iced::Length,
|
||||||
surface,
|
surface,
|
||||||
widget::{self, settings},
|
widget::{self, settings},
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -6,9 +6,8 @@
|
||||||
use cosmic::{
|
use cosmic::{
|
||||||
Apply, Element,
|
Apply, Element,
|
||||||
cosmic_config::{self, ConfigGet, ConfigSet},
|
cosmic_config::{self, ConfigGet, ConfigSet},
|
||||||
iced::Length,
|
|
||||||
surface,
|
surface,
|
||||||
widget::{self, settings, text},
|
widget::{self, settings},
|
||||||
};
|
};
|
||||||
use cosmic_comp_config::workspace::{Action, WorkspaceConfig, WorkspaceLayout, WorkspaceMode};
|
use cosmic_comp_config::workspace::{Action, WorkspaceConfig, WorkspaceLayout, WorkspaceMode};
|
||||||
use cosmic_settings_page::Section;
|
use cosmic_settings_page::Section;
|
||||||
|
|
|
||||||
|
|
@ -335,10 +335,11 @@ impl Page {
|
||||||
|
|
||||||
for (id, timezone) in self.timezone_list.iter().enumerate() {
|
for (id, timezone) in self.timezone_list.iter().enumerate() {
|
||||||
if search_input.is_empty() || timezone.to_lowercase().contains(search_input) {
|
if search_input.is_empty() || timezone.to_lowercase().contains(search_input) {
|
||||||
list = list.add(
|
list = list.add(selection_context_item(
|
||||||
list::button(selection_context_item(timezone, Some(id) == self.timezone))
|
timezone,
|
||||||
.on_press(Message::Timezone(id)),
|
Some(id) == self.timezone,
|
||||||
);
|
Message::Timezone(id),
|
||||||
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -471,7 +472,7 @@ fn timezone() -> Section<crate::pages::Message> {
|
||||||
.title(§ion.title)
|
.title(§ion.title)
|
||||||
// Time zone select
|
// Time zone select
|
||||||
.add(crate::widget::go_next_with_item(
|
.add(crate::widget::go_next_with_item(
|
||||||
&*section.descriptions[time_zone],
|
§ion.descriptions[time_zone],
|
||||||
widget::text::body(
|
widget::text::body(
|
||||||
page.timezone
|
page.timezone
|
||||||
.map(|id| &*page.timezone_list[id])
|
.map(|id| &*page.timezone_list[id])
|
||||||
|
|
|
||||||
|
|
@ -375,17 +375,15 @@ impl Page {
|
||||||
.as_ref()
|
.as_ref()
|
||||||
.is_some_and(|(_, locales)| locales.contains(&available_language.lang_code));
|
.is_some_and(|(_, locales)| locales.contains(&available_language.lang_code));
|
||||||
|
|
||||||
list = list.add(
|
list = list.add(selection_context_item(
|
||||||
list::button(selection_context_item(
|
&available_language.display_name,
|
||||||
&available_language.display_name,
|
is_installed,
|
||||||
is_installed,
|
if is_installed {
|
||||||
))
|
|
||||||
.on_press(if is_installed {
|
|
||||||
Message::RemoveLanguage(id)
|
Message::RemoveLanguage(id)
|
||||||
} else {
|
} else {
|
||||||
Message::AddLanguage(id)
|
Message::AddLanguage(id)
|
||||||
}),
|
},
|
||||||
)
|
))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -478,14 +476,15 @@ impl Page {
|
||||||
.as_ref()
|
.as_ref()
|
||||||
.is_some_and(|l| l.lang_code == locale.lang_code);
|
.is_some_and(|l| l.lang_code == locale.lang_code);
|
||||||
|
|
||||||
list = list.add(
|
list = list.add(selection_context_item(
|
||||||
list::button(selection_context_item(&locale.region_name, is_selected))
|
&locale.region_name,
|
||||||
.on_press_maybe(if is_selected {
|
is_selected,
|
||||||
None
|
if is_selected {
|
||||||
} else {
|
None
|
||||||
Some(Message::SelectRegion(id))
|
} else {
|
||||||
}),
|
Some(Message::SelectRegion(id))
|
||||||
)
|
},
|
||||||
|
))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -204,7 +204,7 @@ pub fn go_next_with_item<'a, Msg: 'static>(
|
||||||
description: &'a str,
|
description: &'a str,
|
||||||
item: impl Into<cosmic::Element<'a, Msg>>,
|
item: impl Into<cosmic::Element<'a, Msg>>,
|
||||||
msg_opt: impl Into<Option<Msg>>,
|
msg_opt: impl Into<Option<Msg>>,
|
||||||
) -> list::ListButton<'_, Msg> {
|
) -> list::ListButton<'a, Msg> {
|
||||||
settings::item_row(vec![
|
settings::item_row(vec![
|
||||||
text::body(description).wrapping(Wrapping::Word).into(),
|
text::body(description).wrapping(Wrapping::Word).into(),
|
||||||
horizontal().into(),
|
horizontal().into(),
|
||||||
|
|
@ -217,13 +217,13 @@ pub fn go_next_with_item<'a, Msg: 'static>(
|
||||||
])
|
])
|
||||||
.apply(list::button)
|
.apply(list::button)
|
||||||
.on_press_maybe(msg_opt.into())
|
.on_press_maybe(msg_opt.into())
|
||||||
.into()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn selection_context_item<'a, Msg: 'static>(
|
pub fn selection_context_item<'a, Msg: 'static>(
|
||||||
name: &'a str,
|
name: &'a str,
|
||||||
selected: bool,
|
selected: bool,
|
||||||
) -> cosmic::Element<'a, Msg> {
|
msg_opt: impl Into<Option<Msg>>,
|
||||||
|
) -> list::ListButton<'a, Msg> {
|
||||||
let svg_accent = Rc::new(|theme: &cosmic::Theme| widget::svg::Style {
|
let svg_accent = Rc::new(|theme: &cosmic::Theme| widget::svg::Style {
|
||||||
color: Some(theme.cosmic().accent_text_color().into()),
|
color: Some(theme.cosmic().accent_text_color().into()),
|
||||||
});
|
});
|
||||||
|
|
@ -248,5 +248,6 @@ pub fn selection_context_item<'a, Msg: 'static>(
|
||||||
horizontal().width(16.).into()
|
horizontal().width(16.).into()
|
||||||
},
|
},
|
||||||
])
|
])
|
||||||
.into()
|
.apply(list::button)
|
||||||
|
.on_press_maybe(msg_opt.into())
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue