chore: various fixes and some cleanup
This commit is contained in:
parent
e10459fb37
commit
e8d53b14ea
27 changed files with 1181 additions and 107 deletions
|
|
@ -13,6 +13,8 @@ env_logger = "0.10.2"
|
|||
log = "0.4.29"
|
||||
|
||||
[dependencies.libcosmic]
|
||||
# path = "../../"
|
||||
branch = "iced-rebase"
|
||||
git = "https://github.com/pop-os/libcosmic"
|
||||
default-features = false
|
||||
features = ["applet-token"]
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ pub struct Window {
|
|||
core: Core,
|
||||
popup: Option<Id>,
|
||||
example_row: bool,
|
||||
toggle: bool,
|
||||
selected: Option<usize>,
|
||||
}
|
||||
|
||||
|
|
@ -22,6 +23,7 @@ impl Default for Window {
|
|||
core: Core::default(),
|
||||
popup: None,
|
||||
example_row: false,
|
||||
toggle: false,
|
||||
selected: None,
|
||||
}
|
||||
}
|
||||
|
|
@ -33,6 +35,7 @@ pub enum Message {
|
|||
ToggleExampleRow(bool),
|
||||
Selected(usize),
|
||||
Surface(cosmic::surface::Action),
|
||||
Toggle(bool),
|
||||
}
|
||||
|
||||
impl cosmic::Application for Window {
|
||||
|
|
@ -71,7 +74,6 @@ impl cosmic::Application for Window {
|
|||
Message::ToggleExampleRow(toggled) => {
|
||||
self.example_row = toggled;
|
||||
}
|
||||
|
||||
Message::Surface(a) => {
|
||||
return cosmic::task::message(cosmic::Action::Cosmic(
|
||||
cosmic::app::Action::Surface(a),
|
||||
|
|
@ -80,6 +82,9 @@ impl cosmic::Application for Window {
|
|||
Message::Selected(i) => {
|
||||
self.selected = Some(i);
|
||||
}
|
||||
Message::Toggle(v) => {
|
||||
self.toggle = v;
|
||||
}
|
||||
};
|
||||
Task::none()
|
||||
}
|
||||
|
|
@ -123,9 +128,9 @@ impl cosmic::Application for Window {
|
|||
"Example row",
|
||||
cosmic::widget::container(
|
||||
toggler(state.example_row)
|
||||
.on_toggle(|value| Message::ToggleExampleRow(value)),
|
||||
)
|
||||
.height(Length::Fixed(50.)),
|
||||
.on_toggle(Message::ToggleExampleRow)
|
||||
.width(Length::Fill),
|
||||
),
|
||||
))
|
||||
.add(popup_dropdown(
|
||||
&["1", "asdf", "hello", "test"],
|
||||
|
|
@ -155,7 +160,7 @@ impl cosmic::Application for Window {
|
|||
"oops".into()
|
||||
}
|
||||
|
||||
fn style(&self) -> Option<cosmic::iced_runtime::Appearance> {
|
||||
fn style(&self) -> Option<cosmic::iced_core::theme::Style> {
|
||||
Some(cosmic::applet::style())
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,12 +8,11 @@ default = ["wayland"]
|
|||
wayland = ["libcosmic/wayland"]
|
||||
|
||||
[dependencies]
|
||||
tracing = "0.1.44"
|
||||
tracing-subscriber = "0.3.22"
|
||||
tracing-log = "0.2.0"
|
||||
env_logger = "0.11"
|
||||
|
||||
[dependencies.libcosmic]
|
||||
path = "../../"
|
||||
git = "https://github.com/pop-os/libcosmic"
|
||||
branch = "iced-rebase"
|
||||
features = [
|
||||
"debug",
|
||||
"winit",
|
||||
|
|
|
|||
|
|
@ -54,8 +54,9 @@ impl widget::menu::Action for Action {
|
|||
/// Runs application with these settings
|
||||
#[rustfmt::skip]
|
||||
fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
// tracing_subscriber::fmt::init();
|
||||
// let _ = tracing_log::LogTracer::init();
|
||||
|
||||
env_logger::Builder::from_env(env_logger::Env::default().default_filter_or("warn")).init();
|
||||
|
||||
|
||||
let input = vec![
|
||||
(Page::Page1, "🖖 Hello from libcosmic.".into()),
|
||||
|
|
@ -66,9 +67,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
|||
|
||||
let settings = Settings::default()
|
||||
.size(Size::new(1024., 768.));
|
||||
|
||||
cosmic::app::run::<App>(settings, input)?;
|
||||
|
||||
cosmic::app::run::<App>(settings, input).unwrap();
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue