cargo fmt
This commit is contained in:
parent
9d68241c6d
commit
51f67e31be
17 changed files with 27 additions and 73 deletions
|
|
@ -7,7 +7,7 @@ use crate::widget::{
|
||||||
button, icon,
|
button, icon,
|
||||||
menu::{self},
|
menu::{self},
|
||||||
nav_bar, responsive_container,
|
nav_bar, responsive_container,
|
||||||
};
|
};
|
||||||
use cosmic_config::CosmicConfigEntry;
|
use cosmic_config::CosmicConfigEntry;
|
||||||
use cosmic_theme::ThemeMode;
|
use cosmic_theme::ThemeMode;
|
||||||
use iced::{window, Limits, Size};
|
use iced::{window, Limits, Size};
|
||||||
|
|
@ -17,7 +17,6 @@ use slotmap::Key;
|
||||||
|
|
||||||
use crate::Theme;
|
use crate::Theme;
|
||||||
|
|
||||||
|
|
||||||
/// Status of the nav bar and its panels.
|
/// Status of the nav bar and its panels.
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
pub struct NavBar {
|
pub struct NavBar {
|
||||||
|
|
@ -403,10 +402,6 @@ impl Core {
|
||||||
Vec<menu::Item<A, std::borrow::Cow<'static, str>>>,
|
Vec<menu::Item<A, std::borrow::Cow<'static, str>>>,
|
||||||
)>,
|
)>,
|
||||||
) -> crate::Element<'a, Message> {
|
) -> crate::Element<'a, Message> {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
use crate::widget::id_container;
|
use crate::widget::id_container;
|
||||||
|
|
||||||
let menu_bar_size = self.menu_bars.get(&id);
|
let menu_bar_size = self.menu_bars.get(&id);
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,6 @@
|
||||||
//! Check out our [application](https://github.com/pop-os/libcosmic/tree/master/examples/application)
|
//! Check out our [application](https://github.com/pop-os/libcosmic/tree/master/examples/application)
|
||||||
//! example in our repository.
|
//! example in our repository.
|
||||||
|
|
||||||
|
|
||||||
pub mod command;
|
pub mod command;
|
||||||
pub mod context_drawer;
|
pub mod context_drawer;
|
||||||
mod core;
|
mod core;
|
||||||
|
|
@ -18,8 +17,6 @@ pub mod settings;
|
||||||
pub mod message {
|
pub mod message {
|
||||||
use crate::surface_message::SurfaceMessage;
|
use crate::surface_message::SurfaceMessage;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Clone, Debug)]
|
||||||
#[must_use]
|
#[must_use]
|
||||||
pub enum Message<M> {
|
pub enum Message<M> {
|
||||||
|
|
@ -549,7 +546,8 @@ where
|
||||||
} else {
|
} else {
|
||||||
p.activate(platform_data)
|
p.activate(platform_data)
|
||||||
}
|
}
|
||||||
}; match res {
|
};
|
||||||
|
match res {
|
||||||
Ok(()) => {
|
Ok(()) => {
|
||||||
tracing::info!("Successfully activated another instance");
|
tracing::info!("Successfully activated another instance");
|
||||||
true
|
true
|
||||||
|
|
|
||||||
|
|
@ -25,12 +25,7 @@ use cosmic_panel_config::{CosmicPanelBackground, PanelAnchor, PanelSize};
|
||||||
use iced_core::{Layout, Padding, Shadow};
|
use iced_core::{Layout, Padding, Shadow};
|
||||||
use iced_widget::runtime::platform_specific::wayland::popup::{SctkPopupSettings, SctkPositioner};
|
use iced_widget::runtime::platform_specific::wayland::popup::{SctkPopupSettings, SctkPositioner};
|
||||||
use sctk::reexports::protocols::xdg::shell::client::xdg_positioner::{Anchor, Gravity};
|
use sctk::reexports::protocols::xdg::shell::client::xdg_positioner::{Anchor, Gravity};
|
||||||
use std::{
|
use std::{borrow::Cow, num::NonZeroU32, rc::Rc, sync::LazyLock};
|
||||||
borrow::Cow,
|
|
||||||
num::NonZeroU32,
|
|
||||||
rc::Rc,
|
|
||||||
sync::LazyLock,
|
|
||||||
};
|
|
||||||
use tracing::info;
|
use tracing::info;
|
||||||
|
|
||||||
use crate::app::cosmic;
|
use crate::app::cosmic;
|
||||||
|
|
@ -166,11 +161,7 @@ impl Context {
|
||||||
let height = f32::from(height) + applet_padding as f32 * 2.;
|
let height = f32::from(height) + applet_padding as f32 * 2.;
|
||||||
let mut settings = crate::app::Settings::default()
|
let mut settings = crate::app::Settings::default()
|
||||||
.size(iced_core::Size::new(width, height))
|
.size(iced_core::Size::new(width, height))
|
||||||
.size_limits(
|
.size_limits(Limits::NONE.min_height(height).min_width(width))
|
||||||
Limits::NONE
|
|
||||||
.min_height(height)
|
|
||||||
.min_width(width),
|
|
||||||
)
|
|
||||||
.resizable(None)
|
.resizable(None)
|
||||||
.default_text_size(14.0)
|
.default_text_size(14.0)
|
||||||
.default_font(crate::font::default())
|
.default_font(crate::font::default())
|
||||||
|
|
|
||||||
|
|
@ -152,7 +152,8 @@ impl From<FontConfig> for iced::Font {
|
||||||
let mut family_map = FAMILY_MAP.lock().unwrap();
|
let mut family_map = FAMILY_MAP.lock().unwrap();
|
||||||
|
|
||||||
let name: &'static str = family_map
|
let name: &'static str = family_map
|
||||||
.get(font.family.as_str()).copied()
|
.get(font.family.as_str())
|
||||||
|
.copied()
|
||||||
.unwrap_or_else(|| {
|
.unwrap_or_else(|| {
|
||||||
let value = font.family.clone().leak();
|
let value = font.family.clone().leak();
|
||||||
family_map.insert(value);
|
family_map.insert(value);
|
||||||
|
|
|
||||||
|
|
@ -725,9 +725,7 @@ impl slider::Catalog for Theme {
|
||||||
impl menu::Catalog for Theme {
|
impl menu::Catalog for Theme {
|
||||||
type Class<'a> = ();
|
type Class<'a> = ();
|
||||||
|
|
||||||
fn default<'a>() -> <Self as menu::Catalog>::Class<'a> {
|
fn default<'a>() -> <Self as menu::Catalog>::Class<'a> {}
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
fn style(&self, class: &<Self as menu::Catalog>::Class<'_>) -> menu::Style {
|
fn style(&self, class: &<Self as menu::Catalog>::Class<'_>) -> menu::Style {
|
||||||
let cosmic = self.cosmic();
|
let cosmic = self.cosmic();
|
||||||
|
|
@ -751,9 +749,7 @@ impl menu::Catalog for Theme {
|
||||||
impl pick_list::Catalog for Theme {
|
impl pick_list::Catalog for Theme {
|
||||||
type Class<'a> = ();
|
type Class<'a> = ();
|
||||||
|
|
||||||
fn default<'a>() -> <Self as pick_list::Catalog>::Class<'a> {
|
fn default<'a>() -> <Self as pick_list::Catalog>::Class<'a> {}
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
fn style(
|
fn style(
|
||||||
&self,
|
&self,
|
||||||
|
|
@ -790,9 +786,7 @@ impl pick_list::Catalog for Theme {
|
||||||
impl radio::Catalog for Theme {
|
impl radio::Catalog for Theme {
|
||||||
type Class<'a> = ();
|
type Class<'a> = ();
|
||||||
|
|
||||||
fn default<'a>() -> Self::Class<'a> {
|
fn default<'a>() -> Self::Class<'a> {}
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
fn style(&self, class: &Self::Class<'_>, status: radio::Status) -> radio::Style {
|
fn style(&self, class: &Self::Class<'_>, status: radio::Status) -> radio::Style {
|
||||||
let theme = self.cosmic();
|
let theme = self.cosmic();
|
||||||
|
|
@ -844,9 +838,7 @@ impl radio::Catalog for Theme {
|
||||||
impl toggler::Catalog for Theme {
|
impl toggler::Catalog for Theme {
|
||||||
type Class<'a> = ();
|
type Class<'a> = ();
|
||||||
|
|
||||||
fn default<'a>() -> Self::Class<'a> {
|
fn default<'a>() -> Self::Class<'a> {}
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
fn style(&self, class: &Self::Class<'_>, status: toggler::Status) -> toggler::Style {
|
fn style(&self, class: &Self::Class<'_>, status: toggler::Status) -> toggler::Style {
|
||||||
let cosmic = self.cosmic();
|
let cosmic = self.cosmic();
|
||||||
|
|
@ -901,9 +893,7 @@ impl toggler::Catalog for Theme {
|
||||||
impl pane_grid::Catalog for Theme {
|
impl pane_grid::Catalog for Theme {
|
||||||
type Class<'a> = ();
|
type Class<'a> = ();
|
||||||
|
|
||||||
fn default<'a>() -> <Self as pane_grid::Catalog>::Class<'a> {
|
fn default<'a>() -> <Self as pane_grid::Catalog>::Class<'a> {}
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
fn style(&self, class: &<Self as pane_grid::Catalog>::Class<'_>) -> pane_grid::Style {
|
fn style(&self, class: &<Self as pane_grid::Catalog>::Class<'_>) -> pane_grid::Style {
|
||||||
let theme = self.cosmic();
|
let theme = self.cosmic();
|
||||||
|
|
|
||||||
|
|
@ -593,12 +593,7 @@ impl<'a, Message: 'a + Clone> Widget<Message, crate::Theme, crate::Renderer>
|
||||||
}
|
}
|
||||||
match self.description.as_ref() {
|
match self.description.as_ref() {
|
||||||
Some(iced_accessibility::Description::Id(id)) => {
|
Some(iced_accessibility::Description::Id(id)) => {
|
||||||
node.set_described_by(
|
node.set_described_by(id.iter().cloned().map(NodeId::from).collect::<Vec<_>>());
|
||||||
id.iter()
|
|
||||||
.cloned()
|
|
||||||
.map(NodeId::from)
|
|
||||||
.collect::<Vec<_>>(),
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
Some(iced_accessibility::Description::Text(text)) => {
|
Some(iced_accessibility::Description::Text(text)) => {
|
||||||
node.set_description(text.clone());
|
node.set_description(text.clone());
|
||||||
|
|
|
||||||
|
|
@ -17,8 +17,7 @@ pub(super) struct Overlay<'a, 'b, Message> {
|
||||||
pub(super) width: f32,
|
pub(super) width: f32,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<Message> overlay::Overlay<Message, crate::Theme, crate::Renderer>
|
impl<Message> overlay::Overlay<Message, crate::Theme, crate::Renderer> for Overlay<'_, '_, Message>
|
||||||
for Overlay<'_, '_, Message>
|
|
||||||
where
|
where
|
||||||
Message: Clone,
|
Message: Clone,
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -46,9 +46,7 @@ pub struct ContextMenu<'a, Message> {
|
||||||
context_menu: Option<Vec<menu::Tree<'a, Message>>>,
|
context_menu: Option<Vec<menu::Tree<'a, Message>>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<Message: Clone> Widget<Message, crate::Theme, crate::Renderer>
|
impl<Message: Clone> Widget<Message, crate::Theme, crate::Renderer> for ContextMenu<'_, Message> {
|
||||||
for ContextMenu<'_, Message>
|
|
||||||
{
|
|
||||||
fn tag(&self) -> tree::Tag {
|
fn tag(&self) -> tree::Tag {
|
||||||
tree::Tag::of::<LocalState>()
|
tree::Tag::of::<LocalState>()
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -417,8 +417,7 @@ where
|
||||||
text_line_height: text::LineHeight,
|
text_line_height: text::LineHeight,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<S: AsRef<str>, Message> Widget<Message, crate::Theme, crate::Renderer>
|
impl<S: AsRef<str>, Message> Widget<Message, crate::Theme, crate::Renderer> for List<'_, S, Message>
|
||||||
for List<'_, S, Message>
|
|
||||||
where
|
where
|
||||||
[S]: std::borrow::ToOwned,
|
[S]: std::borrow::ToOwned,
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -180,9 +180,7 @@ impl<'a, Message: 'a> Overlay<'a, Message> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<Message> iced_core::Overlay<Message, crate::Theme, crate::Renderer>
|
impl<Message> iced_core::Overlay<Message, crate::Theme, crate::Renderer> for Overlay<'_, Message> {
|
||||||
for Overlay<'_, Message>
|
|
||||||
{
|
|
||||||
fn layout(&mut self, renderer: &crate::Renderer, bounds: Size) -> layout::Node {
|
fn layout(&mut self, renderer: &crate::Renderer, bounds: Size) -> layout::Node {
|
||||||
let position = self.position;
|
let position = self.position;
|
||||||
let space_below = bounds.height - (position.y + self.target_height);
|
let space_below = bounds.height - (position.y + self.target_height);
|
||||||
|
|
|
||||||
|
|
@ -85,9 +85,7 @@ impl<'a, Message> FlexRow<'a, Message> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<Message: 'static + Clone> Widget<Message, crate::Theme, Renderer>
|
impl<Message: 'static + Clone> Widget<Message, crate::Theme, Renderer> for FlexRow<'_, Message> {
|
||||||
for FlexRow<'_, Message>
|
|
||||||
{
|
|
||||||
fn children(&self) -> Vec<Tree> {
|
fn children(&self) -> Vec<Tree> {
|
||||||
self.children.iter().map(Tree::new).collect()
|
self.children.iter().map(Tree::new).collect()
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -138,8 +138,7 @@ where
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<Message, Renderer> Widget<Message, Theme, Renderer>
|
impl<Message, Renderer> Widget<Message, Theme, Renderer> for LayerContainer<'_, Message, Renderer>
|
||||||
for LayerContainer<'_, Message, Renderer>
|
|
||||||
where
|
where
|
||||||
Renderer: iced_core::Renderer,
|
Renderer: iced_core::Renderer,
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -280,8 +280,7 @@ where
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
impl<Message, Renderer> Widget<Message, crate::Theme, Renderer>
|
impl<Message, Renderer> Widget<Message, crate::Theme, Renderer> for MenuBar<'_, Message, Renderer>
|
||||||
for MenuBar<'_, Message, Renderer>
|
|
||||||
where
|
where
|
||||||
Renderer: renderer::Renderer,
|
Renderer: renderer::Renderer,
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -345,7 +345,6 @@ pub mod wayland;
|
||||||
pub mod tooltip {
|
pub mod tooltip {
|
||||||
use crate::Element;
|
use crate::Element;
|
||||||
|
|
||||||
|
|
||||||
pub use iced::widget::tooltip::Position;
|
pub use iced::widget::tooltip::Position;
|
||||||
|
|
||||||
pub type Tooltip<'a, Message> =
|
pub type Tooltip<'a, Message> =
|
||||||
|
|
|
||||||
|
|
@ -20,9 +20,7 @@ pub fn section<'a, Message: 'static>() -> Section<'a, Message> {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A section with a pre-defined list column.
|
/// A section with a pre-defined list column.
|
||||||
pub fn with_column<Message: 'static>(
|
pub fn with_column<Message: 'static>(children: ListColumn<'_, Message>) -> Section<'_, Message> {
|
||||||
children: ListColumn<'_, Message>,
|
|
||||||
) -> Section<'_, Message> {
|
|
||||||
Section {
|
Section {
|
||||||
title: Cow::Borrowed(""),
|
title: Cow::Borrowed(""),
|
||||||
children,
|
children,
|
||||||
|
|
|
||||||
|
|
@ -9,10 +9,10 @@ use crate::{
|
||||||
Element,
|
Element,
|
||||||
};
|
};
|
||||||
use apply::Apply;
|
use apply::Apply;
|
||||||
use iced::{Border, Shadow};
|
|
||||||
use iced::{Alignment, Length};
|
use iced::{Alignment, Length};
|
||||||
use std::ops::{Add, Sub};
|
use iced::{Border, Shadow};
|
||||||
use std::borrow::Cow;
|
use std::borrow::Cow;
|
||||||
|
use std::ops::{Add, Sub};
|
||||||
|
|
||||||
/// Horizontal spin button widget.
|
/// Horizontal spin button widget.
|
||||||
pub fn spin_button<'a, T, M>(
|
pub fn spin_button<'a, T, M>(
|
||||||
|
|
@ -151,9 +151,7 @@ where
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn horizontal_variant<T, Message>(
|
fn horizontal_variant<T, Message>(spin_button: SpinButton<'_, T, Message>) -> Element<'_, Message>
|
||||||
spin_button: SpinButton<'_, T, Message>,
|
|
||||||
) -> Element<'_, Message>
|
|
||||||
where
|
where
|
||||||
Message: Clone + 'static,
|
Message: Clone + 'static,
|
||||||
T: Copy + Sub<Output = T> + Add<Output = T> + PartialOrd,
|
T: Copy + Sub<Output = T> + Add<Output = T> + PartialOrd,
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,6 @@ use iced_core::{
|
||||||
Background, Clipboard, Color, Layout, Length, Padding, Point, Rectangle, Shell, Vector, Widget,
|
Background, Clipboard, Color, Layout, Length, Padding, Point, Rectangle, Shell, Vector, Widget,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
pub use super::{Catalog, Style};
|
pub use super::{Catalog, Style};
|
||||||
|
|
||||||
/// Internally defines different button widget variants.
|
/// Internally defines different button widget variants.
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue