chore(cargo): update all crate dependencies

This commit is contained in:
Michael Aaron Murphy 2026-01-14 18:46:53 +01:00
parent b0cbb54bf2
commit 03c440b97a
No known key found for this signature in database
GPG key ID: B2732D4240C9212C
17 changed files with 136 additions and 46 deletions

View file

@ -0,0 +1,10 @@
[package]
name = "subscriptions"
version = "0.1.0"
edition = "2024"
[dependencies]
[dependencies.libcosmic]
path = "../../"
features = ["debug", "winit", "wgpu", "tokio", "xdg-portal"]

View file

@ -0,0 +1,80 @@
// Copyright 2025 System76 <info@system76.com>
// SPDX-License-Identifier: MPL-2.0
//! Application API example
use cosmic::app::{Core, Settings, Task};
use cosmic::iced::Subscription;
use cosmic::{executor, prelude::*, widget};
/// Runs application with these settings
fn main() -> Result<(), Box<dyn std::error::Error>> {
cosmic::app::run::<App>(Settings::default(), ())?;
Ok(())
}
/// Messages that are used specifically by our [`App`].
#[derive(Clone, Debug)]
pub enum Message {}
/// The [`App`] stores application-specific state.
pub struct App {
core: Core,
}
/// Implement [`cosmic::Application`] to integrate with COSMIC.
impl cosmic::Application for App {
/// Default async executor to use with the app.
type Executor = executor::Default;
/// Argument received [`cosmic::Application::new`].
type Flags = ();
/// Message type specific to our [`App`].
type Message = Message;
/// The unique application ID to supply to the window manager.
const APP_ID: &'static str = "org.cosmic.TextInputsDemo";
fn core(&self) -> &Core {
&self.core
}
fn core_mut(&mut self) -> &mut Core {
&mut self.core
}
/// Creates the application, and optionally emits task on initialize.
fn init(core: Core, _input: Self::Flags) -> (Self, Task<Self::Message>) {
let mut app = App { core };
let commands = Task::batch(vec![app.update_title()]);
(app, commands)
}
fn subscription(&self) -> Subscription<Self::Message> {
Subscription::none()
}
/// Handle application events here.
fn update(&mut self, message: Self::Message) -> Task<Self::Message> {
Task::none()
}
/// Creates a view after each update.
fn view(&self) -> Element<'_, Self::Message> {
widget::row().into()
}
}
impl App
where
Self: cosmic::Application,
{
fn update_title(&mut self) -> Task<Message> {
let window_title = format!("COSMIC Subscriptions Demo");
self.set_header_title(window_title.clone());
self.set_window_title(window_title, self.core.main_window_id().unwrap())
}
}