Add button to clear recents
This commit is contained in:
parent
b3af8bf211
commit
accf5b2ba6
3 changed files with 34 additions and 0 deletions
|
|
@ -62,6 +62,9 @@ empty-trash = Empty trash
|
||||||
empty-trash-title = Empty trash?
|
empty-trash-title = Empty trash?
|
||||||
empty-trash-warning = Items in the Trash folder will be permanently deleted
|
empty-trash-warning = Items in the Trash folder will be permanently deleted
|
||||||
|
|
||||||
|
## Clear Recents
|
||||||
|
clear-recents = Clear Recents
|
||||||
|
|
||||||
## Mount Error Dialog
|
## Mount Error Dialog
|
||||||
mount-error = Unable to access drive
|
mount-error = Unable to access drive
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4588,6 +4588,14 @@ impl Application for App {
|
||||||
tab::Command::DropFiles(to, from) => {
|
tab::Command::DropFiles(to, from) => {
|
||||||
commands.push(self.update(Message::PasteContents(to, from)));
|
commands.push(self.update(Message::PasteContents(to, from)));
|
||||||
}
|
}
|
||||||
|
tab::Command::ClearRecents => {
|
||||||
|
match recently_used_xbel::clear_recently_used() {
|
||||||
|
Ok(()) => {}
|
||||||
|
Err(err) => {
|
||||||
|
log::warn!("failed to clear recents history: {}", err);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
tab::Command::EmptyTrash => {
|
tab::Command::EmptyTrash => {
|
||||||
return self.push_dialog(
|
return self.push_dialog(
|
||||||
DialogPage::EmptyTrash,
|
DialogPage::EmptyTrash,
|
||||||
|
|
|
||||||
23
src/tab.rs
23
src/tab.rs
|
|
@ -1683,6 +1683,7 @@ pub enum Command {
|
||||||
ContextMenu(Option<Point>, Option<window::Id>),
|
ContextMenu(Option<Point>, Option<window::Id>),
|
||||||
Delete(Vec<PathBuf>),
|
Delete(Vec<PathBuf>),
|
||||||
DropFiles(PathBuf, ClipboardPaste),
|
DropFiles(PathBuf, ClipboardPaste),
|
||||||
|
ClearRecents,
|
||||||
EmptyTrash,
|
EmptyTrash,
|
||||||
#[cfg(feature = "desktop")]
|
#[cfg(feature = "desktop")]
|
||||||
ExecEntryAction(cosmic::desktop::DesktopEntryData, usize),
|
ExecEntryAction(cosmic::desktop::DesktopEntryData, usize),
|
||||||
|
|
@ -1722,6 +1723,7 @@ pub enum Message {
|
||||||
EditLocationSubmit,
|
EditLocationSubmit,
|
||||||
EditLocationTab,
|
EditLocationTab,
|
||||||
OpenInNewTab(PathBuf),
|
OpenInNewTab(PathBuf),
|
||||||
|
ClearRecents,
|
||||||
EmptyTrash,
|
EmptyTrash,
|
||||||
#[cfg(feature = "desktop")]
|
#[cfg(feature = "desktop")]
|
||||||
ExecEntryAction(Option<PathBuf>, usize),
|
ExecEntryAction(Option<PathBuf>, usize),
|
||||||
|
|
@ -3697,6 +3699,9 @@ impl Tab {
|
||||||
Message::OpenInNewTab(path) => {
|
Message::OpenInNewTab(path) => {
|
||||||
commands.push(Command::OpenInNewTab(path));
|
commands.push(Command::OpenInNewTab(path));
|
||||||
}
|
}
|
||||||
|
Message::ClearRecents => {
|
||||||
|
commands.push(Command::ClearRecents);
|
||||||
|
}
|
||||||
Message::EmptyTrash => {
|
Message::EmptyTrash => {
|
||||||
commands.push(Command::EmptyTrash);
|
commands.push(Command::EmptyTrash);
|
||||||
}
|
}
|
||||||
|
|
@ -6216,6 +6221,24 @@ impl Tab {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Location::Recents | Location::Search(SearchLocation::Recents, ..) => {
|
||||||
|
if let Some(items) = self.items_opt()
|
||||||
|
&& !items.is_empty()
|
||||||
|
{
|
||||||
|
tab_column = tab_column.push(
|
||||||
|
widget::layer_container(widget::row::with_children([
|
||||||
|
widget::space::horizontal().into(),
|
||||||
|
widget::button::standard(fl!("clear-recents"))
|
||||||
|
.on_press(Message::ClearRecents)
|
||||||
|
.into(),
|
||||||
|
]))
|
||||||
|
.padding([space_xxs, space_xs])
|
||||||
|
.layer(cosmic_theme::Layer::Primary)
|
||||||
|
.apply(widget::container)
|
||||||
|
.padding([0, 0, 7, 0]),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
Location::Network(uri, _display_name, _path) if uri == "network:///" => {
|
Location::Network(uri, _display_name, _path) if uri == "network:///" => {
|
||||||
tab_column = tab_column.push(
|
tab_column = tab_column.push(
|
||||||
widget::layer_container(widget::row::with_children([
|
widget::layer_container(widget::row::with_children([
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue