diff --git a/usr/lib/linuxmint/mintMenu/mintMenuConfig.glade b/usr/lib/linuxmint/mintMenu/mintMenuConfig.glade index d3e4e13..74b824b 100644 --- a/usr/lib/linuxmint/mintMenu/mintMenuConfig.glade +++ b/usr/lib/linuxmint/mintMenu/mintMenuConfig.glade @@ -824,10 +824,308 @@ tab + + + True + 0 + none + + + True + 12 + + + True + vertical + + + True + 0 + none + + + True + 2 + 10 + 14 + + + True + vertical + + + Computer + True + True + False + True + + + False + False + 0 + + + + + Home Folder + True + True + False + True + + + 1 + + + + + Network + True + True + False + True + + + 2 + + + + + Desktop + True + True + False + True + + + 3 + + + + + Trash + True + True + False + True + + + 4 + + + + + + + + + True + Toggle Default Places: + True + + + label_item + + + + + 0 + + + + + True + 0 + none + + + True + 9 + + + True + + + True + True + automatic + automatic + + + True + True + + + + + 0 + + + + + True + vertical + + + True + 5 + + + gtk-new + True + True + True + True + + + False + False + 0 + + + + + gtk-edit + True + True + True + True + + + False + False + 1 + + + + + False + False + 6 + 0 + + + + + True + + + gtk-go-up + True + True + True + True + + + False + False + 0 + + + + + gtk-go-down + True + True + True + True + + + False + False + 1 + + + + + 5 + 1 + + + + + True + + + gtk-remove + True + True + True + True + + + False + False + 0 + + + + + 5 + 2 + + + + + False + False + 6 + 1 + + + + + + + + + True + Custom Places: + True + + + label_item + + + + + 1 + + + + + + + + + True + 1 + True + + + label_item + + + + + 5 + + + + + True + Places + + + 5 + False + tab + + False - 2 0 @@ -860,4 +1158,106 @@ + + 5 + normal + False + + + True + vertical + 2 + + + True + 2 + 2 + + + True + True + + + + 1 + 2 + + + + + True + True + + + + 1 + 2 + 1 + 2 + + + + + True + Path: + + + 1 + 2 + + + + + True + Name: + + + + + 1 + + + + + True + end + + + gtk-ok + 1 + True + True + True + True + + + False + False + 0 + + + + + gtk-cancel + True + True + True + True + + + False + False + 1 + + + + + False + end + 0 + + + + + diff --git a/usr/lib/linuxmint/mintMenu/mintMenuConfig.py b/usr/lib/linuxmint/mintMenu/mintMenuConfig.py index 366f4c3..88b50e0 100755 --- a/usr/lib/linuxmint/mintMenu/mintMenuConfig.py +++ b/usr/lib/linuxmint/mintMenu/mintMenuConfig.py @@ -36,6 +36,7 @@ class mintMenuConfig( object ): # Load glade file and extract widgets gladefile = os.path.join( self.path, "mintMenuConfig.glade" ) wTree = gtk.glade.XML( gladefile, "mainWindow" ) + editTree = gtk.glade.XML( gladefile, "editPlaceDialog" ) #i18n @@ -102,12 +103,22 @@ class mintMenuConfig( object ): self.hotkeyText = wTree.get_widget( "hotkeyText" ) self.buttonIcon = wTree.get_widget( "buttonIcon" ) self.buttonIconImage = wTree.get_widget( "image_button_icon" ) - self.searchCommand = wTree.get_widget( "search_command" ) + self.searchCommand = wTree.get_widget( "search_command" ) + self.computertoggle = wTree.get_widget( "computercheckbutton" ) + self.homefoldertoggle = wTree.get_widget( "homecheckbutton" ) + self.networktoggle = wTree.get_widget( "networkcheckbutton" ) + self.desktoptoggle = wTree.get_widget( "desktopcheckbutton" ) + self.trashtoggle = wTree.get_widget( "trashcheckbutton" ) + self.customplacestree = wTree.get_widget( "customplacestree" ) + self.editPlaceDialog = editTree.get_widget( "editPlaceDialog" ) + self.editPlaceName = editTree.get_widget( "nameEntryBox" ) + self.editPlacePath = editTree.get_widget( "pathEntryBox" ) wTree.get_widget( "closeButton" ).connect("clicked", gtk.main_quit ) self.gconf = EasyGConf( "/apps/mintMenu/" ) self.gconfApplications = EasyGConf( "/apps/mintMenu/plugins/applications/" ) + self.gconfPlaces = EasyGConf( "/apps/mintMenu/plugins/places/" ) self.useCustomColors.connect( "toggled", self.toggleUseCustomColors ) @@ -137,6 +148,31 @@ class mintMenuConfig( object ): self.showRecentPlugin.connect("toggled", self.toggleRecent ) self.showRecentPlugin.set_active( self.getRecentToggle() ) + self.bindGconfValueToWidget( self.gconfPlaces, "bool", "show_computer", self.computertoggle, "toggled", self.computertoggle.set_active, self.computertoggle.get_active ) + self.bindGconfValueToWidget( self.gconfPlaces, "bool", "show_home_folder", self.homefoldertoggle, "toggled", self.homefoldertoggle.set_active, self.homefoldertoggle.get_active ) + self.bindGconfValueToWidget( self.gconfPlaces, "bool", "show_network", self.networktoggle, "toggled", self.networktoggle.set_active, self.networktoggle.get_active ) + self.bindGconfValueToWidget( self.gconfPlaces, "bool", "show_desktop", self.desktoptoggle, "toggled", self.desktoptoggle.set_active, self.desktoptoggle.get_active ) + self.bindGconfValueToWidget( self.gconfPlaces, "bool", "show_trash", self.trashtoggle, "toggled", self.trashtoggle.set_active, self.trashtoggle.get_active ) + + self.customplacenames = self.gconfPlaces.get( "list-string", "custom_names", [ ] ) + self.customplacepaths = self.gconfPlaces.get( "list-string", "custom_paths", [ ] ) + + self.customplacestreemodel = gtk.ListStore( str, str) + self.cell = gtk.CellRendererText() + + for count in range( len(self.customplacepaths) ): + self.customplacestreemodel.append( [ self.customplacenames[count], self.customplacepaths[count] ] ) + self.customplacestree.set_model( self.customplacestreemodel ) + self.namescolumn = gtk.TreeViewColumn( 'Name', self.cell, text = 0 ) + self.placescolumn = gtk.TreeViewColumn( 'Path', self.cell, text = 1 ) + self.customplacestree.append_column( self.namescolumn ) + self.customplacestree.append_column( self.placescolumn ) + wTree.get_widget("newButton").connect("clicked", self.newPlace) + wTree.get_widget("editButton").connect("clicked", self.editPlace) + wTree.get_widget("upButton").connect("clicked", self.moveUp) + wTree.get_widget("downButton").connect("clicked", self.moveDown) + wTree.get_widget("removeButton").connect("clicked", self.removePlace) + wTree.get_widget( "mainWindow" ).present() self.getBackgroundColor() @@ -205,6 +241,94 @@ class mintMenuConfig( object ): def gdkColorToString( self, gdkColor ): return "#%.2X%.2X%.2X" % ( gdkColor.red / 256, gdkColor.green / 256, gdkColor.blue / 256 ) + def moveUp( self, upButton ): + + treeselection = self.customplacestree.get_selection() + currentiter = (treeselection.get_selected())[1] + + if ( treeselection != None ): + + lagiter = self.customplacestreemodel.get_iter_first() + nextiter = self.customplacestreemodel.get_iter_first() + + while ( (self.customplacestreemodel.get_path(nextiter) != self.customplacestreemodel.get_path(currentiter)) & (nextiter != None)): + lagiter = nextiter + nextiter = self.customplacestreemodel.iter_next(nextiter) + + if (nextiter != None): + self.customplacestreemodel.swap(currentiter, lagiter) + self.updatePlacesGconf() + + return + + def newPlace(self, newButton): + self.editPlaceName.set_text("") + self.editPlacePath.set_text("") + response = self.editPlaceDialog.run() + self.editPlaceDialog.hide() + if (response == 1 ): + name = self.editPlaceName.get_text() + path = self.editPlacePath.get_text() + self.customplacestreemodel.append( (name, path) ) + self.updatePlacesGconf() + + def editPlace(self, editButton): + treeselection = self.customplacestree.get_selection() + currentiter = (treeselection.get_selected())[1] + + if (currentiter != None): + + initName = self.customplacestreemodel.get_value(currentiter, 0) + initPath = self.customplacestreemodel.get_value(currentiter, 1) + + self.editPlaceName.set_text(initName) + self.editPlacePath.set_text(initPath) + response = self.editPlaceDialog.run() + self.editPlaceDialog.hide() + if (response == 1 ): + name = self.editPlaceName.get_text() + path = self.editPlacePath.get_text() + self.customplacestreemodel.set_value(currentiter, 0, name) + self.customplacestreemodel.set_value(currentiter, 1, path) + self.updatePlacesGconf() + + def moveDown(self, downButton): + + treeselection = self.customplacestree.get_selection() + currentiter = (treeselection.get_selected())[1] + + nextiter = self.customplacestreemodel.iter_next(currentiter) + + if (nextiter != None): + self.customplacestreemodel.swap(currentiter, nextiter) + self.updatePlacesGconf() + + return + + + def removePlace(self, removeButton): + + treeselection = self.customplacestree.get_selection() + currentiter = (treeselection.get_selected())[1] + + if (currentiter != None): + self.customplacestreemodel.remove(currentiter) + self.updatePlacesGconf() + + return + + def updatePlacesGconf(self): + treeiter = self.customplacestreemodel.get_iter_first() + customplacenames = [ ] + customplacepaths = [ ] + while( treeiter != None ): + customplacenames = customplacenames + [ self.customplacestreemodel.get_value(treeiter, 0 ) ] + customplacepaths = customplacepaths + [ self.customplacestreemodel.get_value(treeiter, 1 ) ] + treeiter = self.customplacestreemodel.iter_next(treeiter) + self.gconfPlaces.set( "list-string", "custom_names", customplacenames) + self.gconfPlaces.set( "list-string", "custom_paths", customplacepaths) + return + window = mintMenuConfig() gtk.main() diff --git a/usr/lib/linuxmint/mintMenu/plugins/easygconf.pyc b/usr/lib/linuxmint/mintMenu/plugins/easygconf.pyc old mode 100644 new mode 100755 index 1b867fb..72be2ad Binary files a/usr/lib/linuxmint/mintMenu/plugins/easygconf.pyc and b/usr/lib/linuxmint/mintMenu/plugins/easygconf.pyc differ diff --git a/usr/lib/linuxmint/mintMenu/plugins/places.py b/usr/lib/linuxmint/mintMenu/plugins/places.py index acc38ad..54ea28d 100755 --- a/usr/lib/linuxmint/mintMenu/plugins/places.py +++ b/usr/lib/linuxmint/mintMenu/plugins/places.py @@ -58,7 +58,8 @@ class pluginclass( object ): self.content_holder.set_size_request( self.width, self.height ) def wake (self) : - self.refreshTrash() + if ( self.showtrash == True ): + self.refreshTrash() def destroy( self ): self.gconf.notifyRemoveAll() @@ -98,7 +99,7 @@ class pluginclass( object ): # Get names for custom items - self.customnames = self.gconf.get( "list-string", "custom-names", [ ] ) + self.customnames = self.gconf.get( "list-string", "custom_names", [ ] ) # Hide vertical dotted separator self.hideseparator = self.gconf.get( "bool", "hide_separator", False ) @@ -163,8 +164,7 @@ class pluginclass( object ): self.trashButton.connect( "clicked", self.ButtonClicked, "nautilus --no-desktop trash:" ) self.trashButton.show() self.trashButton.connect( "button-release-event", self.trashPopup ) - #self.refreshTrash() - + self.refreshTrash() self.placesBtnHolder.pack_start( self.trashButton, False, False ) self.mintMenuWin.setTooltip( self.trashButton, _("Browse deleted files") ) @@ -198,10 +198,10 @@ class pluginclass( object ): self.do_standard_places() def refreshTrash (self): - iconName = "user-trash" - if (os.path.exists(home + "/.local/share/Trash/info")): - infoFiles = commands.getoutput("ls " + home + "/.local/share/Trash/info/ | wc -l") - if (int(infoFiles) > 0): - iconName = "user-trash-full" - self.trashButton.setIcon(iconName) + iconName = "user-trash" + if (os.path.exists(home + "/.local/share/Trash/info")): + infoFiles = commands.getoutput("ls " + home + "/.local/share/Trash/info/ | wc -l") + if (int(infoFiles) > 0): + iconName = "user-trash-full" + self.trashButton.setIcon(iconName)