chore: update fixes

This commit is contained in:
Ashley Wulber 2024-02-05 19:24:19 -05:00 committed by Ashley Wulber
parent 0ab6f724fb
commit f00fd8bc1a
6 changed files with 37 additions and 18 deletions

View file

@ -25,7 +25,6 @@ use cosmic::iced::widget::vertical_space;
use cosmic::iced::widget::{column, dnd_source, mouse_area, row, Column, Row};
use cosmic::iced::Color;
use cosmic::iced::{window, Subscription};
use cosmic::iced_core::window::Icon;
use cosmic::iced_core::Border;
use cosmic::iced_core::Padding;
use cosmic::iced_core::Shadow;
@ -326,7 +325,7 @@ async fn try_get_gpus() -> Option<Vec<Gpu>> {
pub fn menu_button<'a, Message>(
content: impl Into<Element<'a, Message>>,
) -> cosmic::widget::Button<'a, Message, cosmic::Renderer> {
) -> cosmic::widget::Button<'a, Message, cosmic::Theme, cosmic::Renderer> {
cosmic::widget::Button::new(content)
.style(Button::AppletMenu)
.padding(menu_control_padding())
@ -916,7 +915,7 @@ impl cosmic::Application for CosmicAppList {
let (w, h, favorites, active, divider) = if is_horizontal {
(
Length::Fill,
Length::Shrink,
Length::Shrink,
dnd_listener(row(favorites)),
row(active).into(),
@ -927,7 +926,7 @@ impl cosmic::Application for CosmicAppList {
} else {
(
Length::Shrink,
Length::Fill,
Length::Shrink,
dnd_listener(column(favorites)),
column(active).into(),
container(divider::horizontal::default())
@ -983,7 +982,7 @@ impl cosmic::Application for CosmicAppList {
]
};
let content = match &self.core.applet.anchor {
let mut content = match &self.core.applet.anchor {
PanelAnchor::Left | PanelAnchor::Right => container(
Column::with_children(content_list)
.spacing(4)
@ -999,6 +998,10 @@ impl cosmic::Application for CosmicAppList {
.width(w),
),
};
if self.active_list.is_empty() && self.favorite_list.is_empty() {
let suggested_size = self.core.applet.suggested_size();
content = content.width(suggested_size.0).height(suggested_size.1);
}
if self.popup.is_some() {
mouse_area(content)
.on_right_release(Message::ClosePopup)
@ -1115,7 +1118,11 @@ impl cosmic::Application for CosmicAppList {
};
self.core.applet.popup_container(content).into()
} else {
iced::widget::text("").into()
let suggested = self.core.applet.suggested_size();
iced::widget::row!()
.width(Length::Fixed(suggested.0 as f32))
.height(Length::Fixed(suggested.1 as f32))
.into()
}
}

View file

@ -801,7 +801,7 @@ fn revealer_head(
title: String,
selected: String,
toggle: Message,
) -> cosmic::widget::Button<'static, Message, Renderer> {
) -> cosmic::widget::Button<'static, Message, cosmic::Theme, Renderer> {
menu_button(column![
text(title).width(Length::Fill).size(14),
text(selected).size(10),

View file

@ -24,7 +24,7 @@ use cosmic::iced::{
window, Alignment, Length, Subscription,
};
use cosmic::iced_core::alignment::Vertical;
use cosmic::iced_core::{Background, Color};
use cosmic::iced_core::{Background, Border, Color, Shadow};
use cosmic::iced_runtime::core::layout::Limits;
use cosmic::iced_style::application;
use cosmic::iced_widget::{Column, Row};
@ -379,9 +379,12 @@ impl cosmic::Application for CosmicBatteryApplet {
|theme| container::Appearance {
text_color: Some(Color::TRANSPARENT),
background: Some(Background::Color(theme.cosmic().accent_color().into())),
border_radius: 2.0.into(),
border_width: 0.0,
border_color: Color::TRANSPARENT,
border: Border {
radius: 2.0.into(),
width: 0.0,
color: Color::TRANSPARENT,
},
shadow: Shadow::default(),
icon_color: Some(Color::TRANSPARENT),
},
)))
@ -558,9 +561,12 @@ impl cosmic::Application for CosmicBatteryApplet {
background: Some(Background::Color(
theme.cosmic().accent_color().into(),
)),
border_radius: 4.0.into(),
border_width: 0.0,
border_color: Color::TRANSPARENT,
border: Border {
radius: 4.0.into(),
width: 0.0,
color: Color::TRANSPARENT,
},
shadow: Default::default(),
icon_color: Some(Color::TRANSPARENT),
},
))),

View file

@ -355,11 +355,15 @@ impl cosmic::Application for Power {
}
}
fn power_buttons(name: &str, msg: String) -> cosmic::widget::Button<Message, Renderer> {
fn power_buttons(
name: &str,
msg: String,
) -> cosmic::widget::Button<Message, cosmic::Theme, Renderer> {
cosmic::widget::button(
column![text_icon(name, 40), text(msg).size(14)]
.spacing(4)
.align_items(Alignment::Center),
.align_items(Alignment::Center)
.width(Length::Fill),
)
.width(Length::Fill)
.height(Length::Fixed(76.0))

View file

@ -152,7 +152,9 @@ fn layout_view(layout: &Layout, expanded: Option<i32>) -> cosmic::Element<Msg> {
.into()
}
fn row_button(content: Vec<cosmic::Element<Msg>>) -> cosmic::widget::Button<Msg, cosmic::Renderer> {
fn row_button(
content: Vec<cosmic::Element<Msg>>,
) -> cosmic::widget::Button<Msg, cosmic::Theme, cosmic::Renderer> {
menu_button(
iced::widget::Row::with_children(content)
.spacing(8)

View file

@ -330,7 +330,7 @@ fn date_button(
day: u32,
is_month: bool,
is_day: bool,
) -> Button<'static, Message, cosmic::Renderer> {
) -> Button<'static, Message, cosmic::Theme, cosmic::Renderer> {
let style = if is_day {
cosmic::widget::button::Style::Suggested
} else {