[kupfer] plugin.trash: Hide toplevel trash source
- From: Ulrik Sverdrup <usverdrup src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [kupfer] plugin.trash: Hide toplevel trash source
- Date: Sun, 6 Dec 2009 20:47:40 +0000 (UTC)
commit 1de26c9e39fdcbd118b31d55cee0095d707e132a
Author: Ulrik Sverdrup <ulrik sverdrup gmail com>
Date: Sun Dec 6 17:29:49 2009 +0100
plugin.trash: Hide toplevel trash source
It is not completely optimal, but we reuse the InvisibleSourceLeaf
trick for the trash plugin. This makes the trash item behave just like
it did before (as an object in the catalog, not a catalog itself).
I personally see no use of having the *contents* of the trash in the
toplevel catalog, so no reason to make it possible.
kupfer/plugin/trash.py | 9 ++++++++-
1 files changed, 8 insertions(+), 1 deletions(-)
---
diff --git a/kupfer/plugin/trash.py b/kupfer/plugin/trash.py
index b54f98d..f63af4b 100644
--- a/kupfer/plugin/trash.py
+++ b/kupfer/plugin/trash.py
@@ -1,7 +1,7 @@
import gio
from kupfer.objects import Leaf, Action, Source
-from kupfer.objects import OpenDirectory
+from kupfer.objects import OpenDirectory, SourceLeaf
from kupfer import utils, icons, pretty
__kupfer_name__ = _("Trash")
@@ -129,8 +129,15 @@ class Trash (SpecialLocation):
return ngettext("Trash contains one file",
"Trash contains %(num)s files", item_count) % {"num": item_count}
+class InvisibleSourceLeaf (SourceLeaf):
+ """Hack to hide this source"""
+ def is_valid(self):
+ return False
+
class TrashSource (Source):
def __init__(self):
Source.__init__(self, _("Trash"))
def get_items(self):
yield Trash(TRASH_URI)
+ def get_leaf_repr(self):
+ return InvisibleSourceLeaf(self)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]