[kupfer] plugin.volumes: Implement Volume.is_valid
- From: Ulrik Sverdrup <usverdrup src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [kupfer] plugin.volumes: Implement Volume.is_valid
- Date: Wed, 9 Sep 2009 19:15:29 +0000 (UTC)
commit 7f5021995d358dd8d4f49cc833e192798e531405
Author: Ulrik Sverdrup <ulrik sverdrup gmail com>
Date: Wed Sep 9 00:25:10 2009 +0200
plugin.volumes: Implement Volume.is_valid
So that Volumes disappear from selection when unmounted by going
invalid.
kupfer/plugin/volumes.py | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
---
diff --git a/kupfer/plugin/volumes.py b/kupfer/plugin/volumes.py
index cee8328..f629c25 100644
--- a/kupfer/plugin/volumes.py
+++ b/kupfer/plugin/volumes.py
@@ -28,6 +28,10 @@ class Volume (Leaf):
def content_source(self, alternate=False):
return objects.DirectorySource(self.object, show_hidden=alternate)
+ def is_valid(self):
+ vm = gio.volume_monitor_get()
+ return any(self.volume == v for v in vm.get_mounts())
+
def get_description(self):
return _("Volume mounted at %s") % self.object
def get_gicon(self):
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]