Separate CosmicAppletWindow and CosmicAppletButton
This commit is contained in:
parent
74f6c2eca6
commit
aac43de65d
16 changed files with 421 additions and 343 deletions
|
|
@ -24,34 +24,37 @@ fn main() {
|
|||
|
||||
fn build_ui(application: >k4::Application) {
|
||||
view! {
|
||||
window = libcosmic_applet::Applet {
|
||||
window = libcosmic_applet::AppletWindow {
|
||||
set_title: Some("COSMIC Power Applet"),
|
||||
set_application: Some(application),
|
||||
// TODO adjust battery icon based on charge
|
||||
set_button_icon_name: "system-shutdown-symbolic",
|
||||
#[wrap(Some)]
|
||||
set_popover_child: main_box = >k4::Box {
|
||||
set_orientation: Orientation::Vertical,
|
||||
set_spacing: 10,
|
||||
set_margin_top: 20,
|
||||
set_margin_bottom: 20,
|
||||
set_margin_start: 24,
|
||||
set_margin_end: 24,
|
||||
append: settings_button = &Button {
|
||||
#[wrap(Some)]
|
||||
set_child = &Label {
|
||||
set_label: "Settings...",
|
||||
set_halign: Align::Start,
|
||||
set_hexpand: true
|
||||
set_child = &libcosmic_applet::AppletButton {
|
||||
set_button_icon_name: "system-shutdown-symbolic",
|
||||
#[wrap(Some)]
|
||||
set_popover_child: main_box = >k4::Box {
|
||||
set_orientation: Orientation::Vertical,
|
||||
set_spacing: 10,
|
||||
set_margin_top: 20,
|
||||
set_margin_bottom: 20,
|
||||
set_margin_start: 24,
|
||||
set_margin_end: 24,
|
||||
append: settings_button = &Button {
|
||||
#[wrap(Some)]
|
||||
set_child = &Label {
|
||||
set_label: "Settings...",
|
||||
set_halign: Align::Start,
|
||||
set_hexpand: true
|
||||
},
|
||||
connect_clicked => move |_| {
|
||||
let _ = Command::new("cosmic-settings").spawn();
|
||||
}
|
||||
},
|
||||
connect_clicked => move |_| {
|
||||
let _ = Command::new("cosmic-settings").spawn();
|
||||
}
|
||||
},
|
||||
append = &Separator {},
|
||||
append: &ui::session::build(),
|
||||
append: second_separator = &Separator {},
|
||||
append: &ui::system::build(),
|
||||
append = &Separator {},
|
||||
append: &ui::session::build(),
|
||||
append: second_separator = &Separator {},
|
||||
append: &ui::system::build(),
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue