refactor: rename single-instance feature

This commit is contained in:
Ashley Wulber 2023-11-17 13:55:00 -05:00 committed by Ashley Wulber
parent ef5b6fb44a
commit c38dc6da94
3 changed files with 14 additions and 14 deletions

View file

@ -43,7 +43,7 @@ xdg-portal = ["ashpd"]
# XXX Use "a11y"; which is causing a panic currently # XXX Use "a11y"; which is causing a panic currently
applet = ["wayland", "tokio", "cosmic-panel-config", "ron"] applet = ["wayland", "tokio", "cosmic-panel-config", "ron"]
applet-token = [] applet-token = []
zbus = ["dep:zbus", "serde", "ron"] single-instance = ["dep:zbus", "serde", "ron"]
[dependencies] [dependencies]
apply = "0.3.0" apply = "0.3.0"

View file

@ -179,7 +179,7 @@ where
}) })
.map(super::Message::Cosmic), .map(super::Message::Cosmic),
window_events.map(super::Message::Cosmic), window_events.map(super::Message::Cosmic),
#[cfg(feature = "zbus")] #[cfg(feature = "single-instance")]
self.app self.app
.core() .core()
.single_instance .single_instance

View file

@ -49,7 +49,7 @@ use iced::Subscription;
use iced::{window, Application as IcedApplication}; use iced::{window, Application as IcedApplication};
pub use message::Message; pub use message::Message;
use url::Url; use url::Url;
#[cfg(feature = "zbus")] #[cfg(feature = "single-instance")]
use { use {
iced_futures::futures::channel::mpsc::{Receiver, Sender}, iced_futures::futures::channel::mpsc::{Receiver, Sender},
iced_futures::futures::SinkExt, iced_futures::futures::SinkExt,
@ -122,7 +122,7 @@ pub fn run<App: Application>(settings: Settings, flags: App::Flags) -> iced::Res
cosmic::Cosmic::<App>::run(iced) cosmic::Cosmic::<App>::run(iced)
} }
#[cfg(feature = "zbus")] #[cfg(feature = "single-instance")]
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
pub struct DbusActivationMessage<Action = String, Args = Vec<String>> { pub struct DbusActivationMessage<Action = String, Args = Vec<String>> {
pub activation_token: Option<String>, pub activation_token: Option<String>,
@ -142,10 +142,10 @@ pub enum DbusActivationDetails<Action = String, Args = Vec<String>> {
args: Args, args: Args,
}, },
} }
#[cfg(feature = "zbus")] #[cfg(feature = "single-instance")]
#[derive(Debug, Default)] #[derive(Debug, Default)]
pub struct DbusActivation(Option<Sender<DbusActivationMessage>>); pub struct DbusActivation(Option<Sender<DbusActivationMessage>>);
#[cfg(feature = "zbus")] #[cfg(feature = "single-instance")]
impl DbusActivation { impl DbusActivation {
#[must_use] #[must_use]
pub fn new() -> Self { pub fn new() -> Self {
@ -159,7 +159,7 @@ impl DbusActivation {
} }
} }
#[cfg(feature = "zbus")] #[cfg(feature = "single-instance")]
#[dbus_proxy(interface = "org.freedesktop.DbusActivation")] #[dbus_proxy(interface = "org.freedesktop.DbusActivation")]
pub trait DbusActivationInterface { pub trait DbusActivationInterface {
/// Activate the application. /// Activate the application.
@ -181,7 +181,7 @@ pub trait DbusActivationInterface {
) -> zbus::Result<()>; ) -> zbus::Result<()>;
} }
#[cfg(feature = "zbus")] #[cfg(feature = "single-instance")]
#[dbus_interface(interface = "org.freedesktop.DbusActivation")] #[dbus_interface(interface = "org.freedesktop.DbusActivation")]
impl DbusActivation { impl DbusActivation {
async fn activate(&mut self, platform_data: HashMap<&str, Value<'_>>) { async fn activate(&mut self, platform_data: HashMap<&str, Value<'_>>) {
@ -258,7 +258,7 @@ impl DbusActivation {
} }
} }
#[cfg(feature = "zbus")] #[cfg(feature = "single-instance")]
/// Launch a COSMIC application with the given [`Settings`]. /// Launch a COSMIC application with the given [`Settings`].
/// If the application is already running, the arguments will be passed to the /// If the application is already running, the arguments will be passed to the
@ -349,15 +349,15 @@ where
/// Default async executor to use with the app. /// Default async executor to use with the app.
type Executor: iced_futures::Executor; type Executor: iced_futures::Executor;
#[cfg(feature = "zbus")] #[cfg(feature = "single-instance")]
/// Argument received [`Application::new`]. /// Argument received [`Application::new`].
type Flags: Clone + CosmicFlags; type Flags: Clone + CosmicFlags;
#[cfg(not(feature = "zbus"))] #[cfg(not(feature = "single-instance"))]
/// Argument received [`Application::new`]. /// Argument received [`Application::new`].
type Flags: Clone; type Flags: Clone;
#[cfg(feature = "zbus")] #[cfg(feature = "single-instance")]
/// Message type specific to our app. /// Message type specific to our app.
type Message: Clone type Message: Clone
+ From< + From<
@ -369,7 +369,7 @@ where
+ Send + Send
+ 'static; + 'static;
#[cfg(not(feature = "zbus"))] #[cfg(not(feature = "single-instance"))]
/// Message type specific to our app. /// Message type specific to our app.
type Message: Clone + std::fmt::Debug + Send + 'static; type Message: Clone + std::fmt::Debug + Send + 'static;
@ -626,7 +626,7 @@ impl<App: Application> ApplicationExt for App {
} }
} }
#[cfg(feature = "zbus")] #[cfg(feature = "single-instance")]
fn single_instance_subscription<App: ApplicationExt>() -> Subscription<Message<App::Message>> { fn single_instance_subscription<App: ApplicationExt>() -> Subscription<Message<App::Message>> {
use iced_futures::futures::StreamExt; use iced_futures::futures::StreamExt;