// Copyright 2023 System76 // SPDX-License-Identifier: MPL-2.0 #[cfg(feature = "winit")] use crate::app; #[cfg(feature = "single-instance")] use crate::dbus_activation; pub const fn app(message: M) -> Action { Action::App(message) } #[cfg(feature = "winit")] pub const fn cosmic(message: app::Action) -> Action { Action::Cosmic(message) } pub const fn none() -> Action { Action::None } #[derive(Clone, Debug)] #[must_use] pub enum Action { /// Messages from the application, for the application. App(M), #[cfg(feature = "winit")] /// Internal messages to be handled by libcosmic. Cosmic(app::Action), #[cfg(feature = "single-instance")] /// Dbus activation messages DbusActivation(dbus_activation::Message), /// Do nothing None, } impl From for Action { fn from(value: M) -> Self { Self::App(value) } }