feat: wayland feature

This commit is contained in:
Nova
2022-11-09 11:13:07 -05:00
parent 6b578fe044
commit 41e76c9d0a
5 changed files with 22 additions and 8 deletions

View File

@@ -45,6 +45,7 @@ impl EnvironmentItem {
}
fn get_path_flex(node: &Node, _calling_client: Arc<Client>, _data: &[u8]) -> Result<Vec<u8>> {
#[allow(unreachable_patterns)]
let path: Result<String> = match &node.item.get().unwrap().specialization {
ItemType::Environment(env) => Ok(env.path.clone()),
_ => Err(anyhow!("")),

View File

@@ -9,6 +9,7 @@ use crate::core::node_collections::LifeLinkedNodeList;
use crate::core::registry::Registry;
use crate::nodes::alias::AliasInfo;
use crate::nodes::fields::find_field;
#[cfg(feature = "wayland")]
use crate::wayland::panel_item::{PanelItem, ITEM_TYPE_INFO_PANEL};
use anyhow::{anyhow, ensure, Result};
use lazy_static::lazy_static;
@@ -152,6 +153,7 @@ pub trait ItemSpecialization {
pub enum ItemType {
Environment(EnvironmentItem),
#[cfg(feature = "wayland")]
Panel(PanelItem),
}
impl Deref for ItemType {
@@ -160,6 +162,7 @@ impl Deref for ItemType {
fn deref(&self) -> &Self::Target {
match self {
ItemType::Environment(item) => item,
#[cfg(feature = "wayland")]
ItemType::Panel(item) => item,
}
}
@@ -325,6 +328,7 @@ pub fn create_interface(client: &Arc<Client>) {
fn type_info(name: &str) -> Result<&'static TypeInfo> {
match name {
"environment" => Ok(&ITEM_TYPE_INFO_ENVIRONMENT),
#[cfg(feature = "wayland")]
"panel" => Ok(&ITEM_TYPE_INFO_PANEL),
_ => Err(anyhow!("Invalid item type")),
}