Skip to content

Commit

Permalink
Add more special places
Browse files Browse the repository at this point in the history
  • Loading branch information
kra-mo committed Dec 23, 2023
1 parent d69a4f8 commit 42398ff
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 9 deletions.
2 changes: 1 addition & 1 deletion hyperplane/item.py
Original file line number Diff line number Diff line change
Expand Up @@ -434,7 +434,7 @@ def __right_click(self, *_args: Any) -> None:
if self.is_dir:
menu_items.add("open-new-tab")
menu_items.add("open-new-window")
if self.gfile.get_uri().startswith("trash:///"):
if self.gfile.get_uri().startswith("trash://"):
menu_items.remove("trash")
menu_items.remove("rename")
if self.gfile.get_uri().count("/") < 4:
Expand Down
22 changes: 14 additions & 8 deletions hyperplane/items_page.py
Original file line number Diff line number Diff line change
Expand Up @@ -418,18 +418,24 @@ def __popup_menu(self) -> None:
"open-with",
}

# Read-only special directories
if self.gfile:
if self.gfile.get_uri() == "trash:///":
if shared.trash_list.get_n_items():
items.add("empty-trash")
if (
(uri := self.gfile.get_uri()).startswith("trash://")
or uri.startswith("recent://")
or uri.startswith("burn://")
or uri.startswith("network://")
):
items.remove("paste")
items.remove("new-folder")

if self.gfile.get_uri() == "recent:///":
if bool(shared.recent_manager.get_items()):
items.add("clear-recents")
items.remove("paste")
items.remove("new-folder")
if self.gfile.get_uri() == "trash:///":
if shared.trash_list.get_n_items():
items.add("empty-trash")

if self.gfile.get_uri() == "recent:///":
if bool(shared.recent_manager.get_items()):
items.add("clear-recents")

self.get_root().set_menu_items(items)

Expand Down

0 comments on commit 42398ff

Please sign in to comment.