Enabled technical ability to add custom items.

This commit is contained in:
clhodapp 2009-08-01 23:13:51 -04:00
parent 2257fe4a05
commit 62e210c2a3

View File

@ -84,6 +84,22 @@ class pluginclass( object ):
self.execapp = self.gconf.get( "string", "execute_app", "nautilus" )
self.iconsize = self.gconf.get( "int","icon_size", 2 )
# Check default items
self.showcomputer = self.gconf.get( "bool", "show_computer", True )
self.showhomefolder = self.gconf.get( "bool", "show_home_folder", True )
self.shownetwork = self.gconf.get( "bool", "show_network", True )
self.showdesktop = self.gconf.get( "bool", "show_desktop", True )
self.showtrash = self.gconf.get( "bool", "show_trash", True )
# Get paths for custom items
self.custompaths = self.gconf.get( "list-string", "custom_paths", [ ] )
# Get names for custom items
self.customnames = self.gconf.get( "list-string", "custom-names", [ ] )
# Hide vertical dotted separator
self.hideseparator = self.gconf.get( "bool", "hide_separator", False )
# Plugin icon
@ -101,24 +117,28 @@ class pluginclass( object ):
#Add standard places
def do_standard_places( self ):
if ( self.showcomputer == True ):
Button1 = easyButton( "computer", self.iconsize, [_("Computer")], -1, -1 )
Button1.connect( "clicked", self.ButtonClicked, "nautilus --no-desktop computer:" )
Button1.show()
self.placesBtnHolder.pack_start( Button1, False, False )
self.mintMenuWin.setTooltip( Button1, _("Browse all local and remote disks and folders accessible from this computer") )
if ( self.showhomefolder == True ):
Button2 = easyButton( "user-home", self.iconsize, [_("Home Folder")], -1, -1 )
Button2.connect( "clicked", self.ButtonClicked, "nautilus --no-desktop" )
Button2.show()
self.placesBtnHolder.pack_start( Button2, False, False )
self.mintMenuWin.setTooltip( Button2, _("Open your personal folder") )
if ( self.shownetwork == True ):
Button3 = easyButton( "network-workgroup", self.iconsize, [_("Network")], -1, -1 )
Button3.connect( "clicked", self.ButtonClicked, "nautilus --no-desktop network:" )
Button3.show()
self.placesBtnHolder.pack_start( Button3, False, False )
self.mintMenuWin.setTooltip( Button3, _("Browse bookmarked and local network locations") )
if ( self.showdesktop == True ):
# Determine where the Desktop folder is (could be localized)
desktopDir = home + "/Desktop"
try:
@ -138,6 +158,7 @@ class pluginclass( object ):
self.placesBtnHolder.pack_start( Button4, False, False )
self.mintMenuWin.setTooltip( Button4, _("Browse items placed on the desktop") )
if ( self.showtrash == True ):
self.trashButton = easyButton( "user-trash", self.iconsize, [_("Trash")], -1, -1 )
self.trashButton.connect( "clicked", self.ButtonClicked, "nautilus --no-desktop trash:" )
self.trashButton.show()
@ -147,6 +168,13 @@ class pluginclass( object ):
self.placesBtnHolder.pack_start( self.trashButton, False, False )
self.mintMenuWin.setTooltip( self.trashButton, _("Browse deleted files") )
for index in range( len(self.custompaths) ):
command = ( "nautilus --no-desktop " + self.custompaths[index] )
currentbutton = easyButton( "folder", self.iconsize, [_(self.customnames[index])], -1, -1 )
currentbutton.connect( "clicked", self.ButtonClicked, command )
currentbutton.show()
self.placesBtnHolder.pack_start( currentbutton, False, False )
def trashPopup( self, widget, event ):
if event.button == 3:
trashMenu = gtk.Menu()