fix(dock) add applet button
This commit is contained in:
parent
ff4cd49965
commit
bf6201d54a
2 changed files with 31 additions and 6 deletions
|
|
@ -1,4 +1,10 @@
|
|||
use cosmic::{cosmic_config::CosmicConfigEntry, iced_runtime::Command, Element};
|
||||
use cosmic::{
|
||||
cosmic_config::CosmicConfigEntry,
|
||||
iced::{alignment, Length},
|
||||
iced_runtime::Command,
|
||||
widget::{button, container, row, text},
|
||||
Apply, Element,
|
||||
};
|
||||
use cosmic_panel_config::CosmicPanelConfig;
|
||||
use cosmic_settings_page::{self as page, section, Section};
|
||||
use slotmap::SlotMap;
|
||||
|
|
@ -74,7 +80,26 @@ impl page::Page<crate::pages::Message> for Page {
|
|||
}
|
||||
|
||||
fn info(&self) -> page::Info {
|
||||
page::Info::new("dock_applets", "preferences-dock-symbolic")
|
||||
page::Info::new("dock_applets", "preferences-dock-symbolic").title(fl!("applets"))
|
||||
}
|
||||
|
||||
fn header_view(&self) -> Option<Element<'_, crate::pages::Message>> {
|
||||
let theme = cosmic::theme::active();
|
||||
let spacing = theme.cosmic().spacing;
|
||||
let content = row::with_capacity(2)
|
||||
.spacing(spacing.space_xxs)
|
||||
.push(
|
||||
button(text(fl!("add-applet")))
|
||||
.on_press(Message(applets_inner::Message::AddAppletDrawer))
|
||||
.padding([spacing.space_xxs, spacing.space_xs]),
|
||||
)
|
||||
.apply(container)
|
||||
.width(Length::Fill)
|
||||
.align_x(alignment::Horizontal::Right)
|
||||
.apply(Element::from)
|
||||
.map(crate::pages::Message::DockApplet);
|
||||
|
||||
Some(content)
|
||||
}
|
||||
|
||||
fn context_drawer(&self) -> Option<Element<crate::pages::Message>> {
|
||||
|
|
|
|||
|
|
@ -135,7 +135,7 @@ impl page::Page<crate::pages::Message> for Page {
|
|||
.spacing(spacing.space_xxs)
|
||||
.push(
|
||||
button(text(fl!("add-applet")))
|
||||
.on_press(Message::AddAppletDialog)
|
||||
.on_press(Message::AddAppletDrawer)
|
||||
.padding([spacing.space_xxs, spacing.space_xs]),
|
||||
)
|
||||
.apply(container)
|
||||
|
|
@ -177,7 +177,7 @@ pub enum Message {
|
|||
DnDCommand(Arc<Box<dyn Send + Sync + Fn() -> ActionInner>>),
|
||||
Search(String),
|
||||
AddApplet(Applet<'static>),
|
||||
AddAppletDialog,
|
||||
AddAppletDrawer,
|
||||
Save,
|
||||
Cancel,
|
||||
}
|
||||
|
|
@ -202,7 +202,7 @@ impl Debug for Message {
|
|||
Message::Cancel => write!(f, "Cancel"),
|
||||
Message::Search(_) => write!(f, "Search"),
|
||||
Message::AddApplet(_) => write!(f, "AddApplet"),
|
||||
Message::AddAppletDialog => write!(f, "AddAppletDialogue"),
|
||||
Message::AddAppletDrawer => write!(f, "AddAppletDialogue"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -454,7 +454,7 @@ impl Page {
|
|||
list.push(applet.id.to_string());
|
||||
self.save();
|
||||
}
|
||||
Message::AddAppletDialog => {
|
||||
Message::AddAppletDrawer => {
|
||||
self.context = Some(ContextDrawer::AddApplet);
|
||||
return cosmic::command::message(app::Message::OpenContextDrawer(Cow::Owned(fl!(
|
||||
"add-applet"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue