Fix compilation without desktop feature
This commit is contained in:
parent
e4a37273fd
commit
63126810b1
3 changed files with 13 additions and 2 deletions
|
|
@ -97,6 +97,7 @@ pub enum Action {
|
||||||
EditHistory,
|
EditHistory,
|
||||||
EditLocation,
|
EditLocation,
|
||||||
EmptyTrash,
|
EmptyTrash,
|
||||||
|
#[cfg(feature = "desktop")]
|
||||||
ExecEntryAction(usize),
|
ExecEntryAction(usize),
|
||||||
ExtractHere,
|
ExtractHere,
|
||||||
Gallery,
|
Gallery,
|
||||||
|
|
@ -159,6 +160,7 @@ impl Action {
|
||||||
}
|
}
|
||||||
Action::EmptyTrash => Message::TabMessage(None, tab::Message::EmptyTrash),
|
Action::EmptyTrash => Message::TabMessage(None, tab::Message::EmptyTrash),
|
||||||
Action::ExtractHere => Message::ExtractHere(entity_opt),
|
Action::ExtractHere => Message::ExtractHere(entity_opt),
|
||||||
|
#[cfg(feature = "desktop")]
|
||||||
Action::ExecEntryAction(action) => {
|
Action::ExecEntryAction(action) => {
|
||||||
Message::TabMessage(entity_opt, tab::Message::ExecEntryAction(None, *action))
|
Message::TabMessage(entity_opt, tab::Message::ExecEntryAction(None, *action))
|
||||||
}
|
}
|
||||||
|
|
@ -618,6 +620,7 @@ impl App {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(feature = "desktop")]
|
||||||
fn exec_entry_action(entry: cosmic::desktop::DesktopEntryData, action: usize) {
|
fn exec_entry_action(entry: cosmic::desktop::DesktopEntryData, action: usize) {
|
||||||
if let Some(action) = entry.desktop_actions.get(action) {
|
if let Some(action) = entry.desktop_actions.get(action) {
|
||||||
// Largely copied from COSMIC app library
|
// Largely copied from COSMIC app library
|
||||||
|
|
@ -2667,6 +2670,7 @@ impl Application for App {
|
||||||
tab::Command::EmptyTrash => {
|
tab::Command::EmptyTrash => {
|
||||||
self.dialog_pages.push_back(DialogPage::EmptyTrash);
|
self.dialog_pages.push_back(DialogPage::EmptyTrash);
|
||||||
}
|
}
|
||||||
|
#[cfg(feature = "desktop")]
|
||||||
tab::Command::ExecEntryAction(entry, action) => {
|
tab::Command::ExecEntryAction(entry, action) => {
|
||||||
App::exec_entry_action(entry, action);
|
App::exec_entry_action(entry, action);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -115,6 +115,7 @@ pub fn context_menu<'a>(
|
||||||
selected_types.dedup();
|
selected_types.dedup();
|
||||||
selected_trash_only = selected_trash_only && selected == 1;
|
selected_trash_only = selected_trash_only && selected == 1;
|
||||||
// Parse the desktop entry if it is the only selection
|
// Parse the desktop entry if it is the only selection
|
||||||
|
#[cfg(feature = "desktop")]
|
||||||
let selected_desktop_entry = selected_desktop_entry.and_then(|path| {
|
let selected_desktop_entry = selected_desktop_entry.and_then(|path| {
|
||||||
if selected == 1 {
|
if selected == 1 {
|
||||||
let lang_id = crate::localize::LANGUAGE_LOADER.current_language();
|
let lang_id = crate::localize::LANGUAGE_LOADER.current_language();
|
||||||
|
|
@ -139,8 +140,11 @@ pub fn context_menu<'a>(
|
||||||
}
|
}
|
||||||
} else if let Some(entry) = selected_desktop_entry {
|
} else if let Some(entry) = selected_desktop_entry {
|
||||||
children.push(menu_item(fl!("open"), Action::Open).into());
|
children.push(menu_item(fl!("open"), Action::Open).into());
|
||||||
for (i, action) in entry.desktop_actions.into_iter().enumerate() {
|
#[cfg(feature = "desktop")]
|
||||||
children.push(menu_item(action.name, Action::ExecEntryAction(i)).into())
|
{
|
||||||
|
for (i, action) in entry.desktop_actions.into_iter().enumerate() {
|
||||||
|
children.push(menu_item(action.name, Action::ExecEntryAction(i)).into())
|
||||||
|
}
|
||||||
}
|
}
|
||||||
children.push(divider::horizontal::light().into());
|
children.push(divider::horizontal::light().into());
|
||||||
children.push(menu_item(fl!("rename"), Action::Rename).into());
|
children.push(menu_item(fl!("rename"), Action::Rename).into());
|
||||||
|
|
|
||||||
|
|
@ -1006,6 +1006,7 @@ pub enum Command {
|
||||||
ChangeLocation(String, Location, Option<PathBuf>),
|
ChangeLocation(String, Location, Option<PathBuf>),
|
||||||
DropFiles(PathBuf, ClipboardPaste),
|
DropFiles(PathBuf, ClipboardPaste),
|
||||||
EmptyTrash,
|
EmptyTrash,
|
||||||
|
#[cfg(feature = "desktop")]
|
||||||
ExecEntryAction(cosmic::desktop::DesktopEntryData, usize),
|
ExecEntryAction(cosmic::desktop::DesktopEntryData, usize),
|
||||||
Iced(TaskWrapper),
|
Iced(TaskWrapper),
|
||||||
MoveToTrash(Vec<PathBuf>),
|
MoveToTrash(Vec<PathBuf>),
|
||||||
|
|
@ -1036,6 +1037,7 @@ pub enum Message {
|
||||||
EditLocationEnable,
|
EditLocationEnable,
|
||||||
OpenInNewTab(PathBuf),
|
OpenInNewTab(PathBuf),
|
||||||
EmptyTrash,
|
EmptyTrash,
|
||||||
|
#[cfg(feature = "desktop")]
|
||||||
ExecEntryAction(Option<PathBuf>, usize),
|
ExecEntryAction(Option<PathBuf>, usize),
|
||||||
Gallery(bool),
|
Gallery(bool),
|
||||||
GalleryPrevious,
|
GalleryPrevious,
|
||||||
|
|
@ -2322,6 +2324,7 @@ impl Tab {
|
||||||
Message::EmptyTrash => {
|
Message::EmptyTrash => {
|
||||||
commands.push(Command::EmptyTrash);
|
commands.push(Command::EmptyTrash);
|
||||||
}
|
}
|
||||||
|
#[cfg(feature = "desktop")]
|
||||||
Message::ExecEntryAction(path, action) => {
|
Message::ExecEntryAction(path, action) => {
|
||||||
let lang_id = crate::localize::LANGUAGE_LOADER.current_language();
|
let lang_id = crate::localize::LANGUAGE_LOADER.current_language();
|
||||||
let language = lang_id.language.as_str();
|
let language = lang_id.language.as_str();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue