3
# Copyright (c) 2007 Timon ter Braak
5
# This library is free software; you can redistribute it and/or
6
# modify it under the terms of the GNU Lesser General Public
7
# License as published by the Free Software Foundation; either
8
# version 2 of the License, or (at your option) any later version.
10
# This library is distributed in the hope that it will be useful,
11
# but WITHOUT ANY WARRANTY; without even the implied warranty of
12
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13
# Lesser General Public License for more details.
15
# You should have received a copy of the GNU Lesser General Public
16
# License along with this library; if not, write to the
17
# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18
# Boston, MA 02111-1307, USA.
22
from awn.extras import _
23
from desktopagnostic.config import GROUP_DEFAULT
24
from stacks_backend_folder import *
25
from stacks_vfs import VfsUri, Monitor
27
class PluggerBackend(FolderBackend):
29
def _eject_cb(self, *args, **kargs):
32
def _unmount_cb(self, widget):
33
for volume in gnomevfs.VolumeMonitor().get_mounted_volumes():
34
hudi = volume.get_hal_udi()
36
hal,sep,vid = hudi.rpartition(os.sep)
37
if not cmp(vid, self.applet.uid):
38
volume.unmount(self._eject_cb)
40
def _hide_cb(self, widget):
41
#self.applet.gconf_client.set_bool(self.applet.gconf_path + "/hide_volume", True)
45
return BACKEND_TYPE_PLUGGER
48
title = self.applet.client.get_string(GROUP_DEFAULT, "title")
49
if title and len(title) > 0:
52
return _("Mounted Volume")
54
def get_menu_items(self):
55
items = FolderBackend.get_menu_items(self)
56
unmount_item = gtk.MenuItem(label=_("Unmount Volume"))
57
unmount_item.connect_object("activate", self._unmount_cb, self)
58
items.append(unmount_item)
59
hide_item = gtk.MenuItem(label=_("Hide Volume"))
60
hide_item.connect_object("activate", self._hide_cb, self)
61
items.append(hide_item)