refactor: rename single-instance feature
This commit is contained in:
parent
ef5b6fb44a
commit
c38dc6da94
3 changed files with 14 additions and 14 deletions
|
|
@ -43,7 +43,7 @@ xdg-portal = ["ashpd"]
|
|||
# XXX Use "a11y"; which is causing a panic currently
|
||||
applet = ["wayland", "tokio", "cosmic-panel-config", "ron"]
|
||||
applet-token = []
|
||||
zbus = ["dep:zbus", "serde", "ron"]
|
||||
single-instance = ["dep:zbus", "serde", "ron"]
|
||||
|
||||
[dependencies]
|
||||
apply = "0.3.0"
|
||||
|
|
|
|||
|
|
@ -179,7 +179,7 @@ where
|
|||
})
|
||||
.map(super::Message::Cosmic),
|
||||
window_events.map(super::Message::Cosmic),
|
||||
#[cfg(feature = "zbus")]
|
||||
#[cfg(feature = "single-instance")]
|
||||
self.app
|
||||
.core()
|
||||
.single_instance
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ use iced::Subscription;
|
|||
use iced::{window, Application as IcedApplication};
|
||||
pub use message::Message;
|
||||
use url::Url;
|
||||
#[cfg(feature = "zbus")]
|
||||
#[cfg(feature = "single-instance")]
|
||||
use {
|
||||
iced_futures::futures::channel::mpsc::{Receiver, Sender},
|
||||
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)
|
||||
}
|
||||
#[cfg(feature = "zbus")]
|
||||
#[cfg(feature = "single-instance")]
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct DbusActivationMessage<Action = String, Args = Vec<String>> {
|
||||
pub activation_token: Option<String>,
|
||||
|
|
@ -142,10 +142,10 @@ pub enum DbusActivationDetails<Action = String, Args = Vec<String>> {
|
|||
args: Args,
|
||||
},
|
||||
}
|
||||
#[cfg(feature = "zbus")]
|
||||
#[cfg(feature = "single-instance")]
|
||||
#[derive(Debug, Default)]
|
||||
pub struct DbusActivation(Option<Sender<DbusActivationMessage>>);
|
||||
#[cfg(feature = "zbus")]
|
||||
#[cfg(feature = "single-instance")]
|
||||
impl DbusActivation {
|
||||
#[must_use]
|
||||
pub fn new() -> Self {
|
||||
|
|
@ -159,7 +159,7 @@ impl DbusActivation {
|
|||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "zbus")]
|
||||
#[cfg(feature = "single-instance")]
|
||||
#[dbus_proxy(interface = "org.freedesktop.DbusActivation")]
|
||||
pub trait DbusActivationInterface {
|
||||
/// Activate the application.
|
||||
|
|
@ -181,7 +181,7 @@ pub trait DbusActivationInterface {
|
|||
) -> zbus::Result<()>;
|
||||
}
|
||||
|
||||
#[cfg(feature = "zbus")]
|
||||
#[cfg(feature = "single-instance")]
|
||||
#[dbus_interface(interface = "org.freedesktop.DbusActivation")]
|
||||
impl DbusActivation {
|
||||
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`].
|
||||
/// 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.
|
||||
type Executor: iced_futures::Executor;
|
||||
|
||||
#[cfg(feature = "zbus")]
|
||||
#[cfg(feature = "single-instance")]
|
||||
/// Argument received [`Application::new`].
|
||||
type Flags: Clone + CosmicFlags;
|
||||
|
||||
#[cfg(not(feature = "zbus"))]
|
||||
#[cfg(not(feature = "single-instance"))]
|
||||
/// Argument received [`Application::new`].
|
||||
type Flags: Clone;
|
||||
|
||||
#[cfg(feature = "zbus")]
|
||||
#[cfg(feature = "single-instance")]
|
||||
/// Message type specific to our app.
|
||||
type Message: Clone
|
||||
+ From<
|
||||
|
|
@ -369,7 +369,7 @@ where
|
|||
+ Send
|
||||
+ 'static;
|
||||
|
||||
#[cfg(not(feature = "zbus"))]
|
||||
#[cfg(not(feature = "single-instance"))]
|
||||
/// Message type specific to our app.
|
||||
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>> {
|
||||
use iced_futures::futures::StreamExt;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue