Allowed drag-and-drop reordering of custom places.
This commit is contained in:
parent
79ff1b93c9
commit
b43d5ffe9f
@ -1011,6 +1011,7 @@
|
|||||||
<widget class="GtkTreeView" id="customplacestree">
|
<widget class="GtkTreeView" id="customplacestree">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">True</property>
|
<property name="can_focus">True</property>
|
||||||
|
<property name="reorderable">True</property>
|
||||||
</widget>
|
</widget>
|
||||||
</child>
|
</child>
|
||||||
</widget>
|
</widget>
|
||||||
|
@ -178,6 +178,10 @@ class mintMenuConfig( object ):
|
|||||||
|
|
||||||
for count in range( len(self.customplacepaths) ):
|
for count in range( len(self.customplacepaths) ):
|
||||||
self.customplacestreemodel.append( [ self.customplacenames[count], self.customplacepaths[count] ] )
|
self.customplacestreemodel.append( [ self.customplacenames[count], self.customplacepaths[count] ] )
|
||||||
|
|
||||||
|
self.customplacestreemodel.connect("row-changed", self.updatePlacesGconf)
|
||||||
|
self.customplacestreemodel.connect("row-deleted", self.updatePlacesGconf)
|
||||||
|
self.customplacestreemodel.connect("rows-reordered", self.updatePlacesGconf)
|
||||||
self.customplacestree.set_model( self.customplacestreemodel )
|
self.customplacestree.set_model( self.customplacestreemodel )
|
||||||
self.namescolumn = gtk.TreeViewColumn( 'Name', self.cell, text = 0 )
|
self.namescolumn = gtk.TreeViewColumn( 'Name', self.cell, text = 0 )
|
||||||
self.placescolumn = gtk.TreeViewColumn( 'Path', self.cell, text = 1 )
|
self.placescolumn = gtk.TreeViewColumn( 'Path', self.cell, text = 1 )
|
||||||
@ -273,7 +277,6 @@ class mintMenuConfig( object ):
|
|||||||
|
|
||||||
if (nextiter != None):
|
if (nextiter != None):
|
||||||
self.customplacestreemodel.swap(currentiter, lagiter)
|
self.customplacestreemodel.swap(currentiter, lagiter)
|
||||||
self.updatePlacesGconf()
|
|
||||||
|
|
||||||
return
|
return
|
||||||
|
|
||||||
@ -307,7 +310,6 @@ class mintMenuConfig( object ):
|
|||||||
path = newPlacePath.get_text()
|
path = newPlacePath.get_text()
|
||||||
if (name != "" and path !=""):
|
if (name != "" and path !=""):
|
||||||
self.customplacestreemodel.append( (name, path) )
|
self.customplacestreemodel.append( (name, path) )
|
||||||
self.updatePlacesGconf()
|
|
||||||
|
|
||||||
def editPlace(self, editButton):
|
def editPlace(self, editButton):
|
||||||
gladefile = os.path.join( self.path, "mintMenuConfig.glade" )
|
gladefile = os.path.join( self.path, "mintMenuConfig.glade" )
|
||||||
@ -349,7 +351,6 @@ class mintMenuConfig( object ):
|
|||||||
if (name != "" and path != ""):
|
if (name != "" and path != ""):
|
||||||
self.customplacestreemodel.set_value(currentiter, 0, name)
|
self.customplacestreemodel.set_value(currentiter, 0, name)
|
||||||
self.customplacestreemodel.set_value(currentiter, 1, path)
|
self.customplacestreemodel.set_value(currentiter, 1, path)
|
||||||
self.updatePlacesGconf()
|
|
||||||
|
|
||||||
def moveDown(self, downButton):
|
def moveDown(self, downButton):
|
||||||
|
|
||||||
@ -360,7 +361,6 @@ class mintMenuConfig( object ):
|
|||||||
|
|
||||||
if (nextiter != None):
|
if (nextiter != None):
|
||||||
self.customplacestreemodel.swap(currentiter, nextiter)
|
self.customplacestreemodel.swap(currentiter, nextiter)
|
||||||
self.updatePlacesGconf()
|
|
||||||
|
|
||||||
return
|
return
|
||||||
|
|
||||||
@ -372,7 +372,6 @@ class mintMenuConfig( object ):
|
|||||||
|
|
||||||
if (currentiter != None):
|
if (currentiter != None):
|
||||||
self.customplacestreemodel.remove(currentiter)
|
self.customplacestreemodel.remove(currentiter)
|
||||||
self.updatePlacesGconf()
|
|
||||||
|
|
||||||
return
|
return
|
||||||
|
|
||||||
@ -382,7 +381,9 @@ class mintMenuConfig( object ):
|
|||||||
else:
|
else:
|
||||||
self.placesHeightButton.set_sensitive(False)
|
self.placesHeightButton.set_sensitive(False)
|
||||||
|
|
||||||
def updatePlacesGconf(self):
|
def updatePlacesGconf(self, treemodel, path, iter = None, new_order = None):
|
||||||
|
# Do only if not partway though an append operation; Append = insert+change+change and each creates a signal
|
||||||
|
if ((iter == None) or (self.customplacestreemodel.get_value(iter, 1) != None)):
|
||||||
treeiter = self.customplacestreemodel.get_iter_first()
|
treeiter = self.customplacestreemodel.get_iter_first()
|
||||||
customplacenames = [ ]
|
customplacenames = [ ]
|
||||||
customplacepaths = [ ]
|
customplacepaths = [ ]
|
||||||
@ -392,7 +393,6 @@ class mintMenuConfig( object ):
|
|||||||
treeiter = self.customplacestreemodel.iter_next(treeiter)
|
treeiter = self.customplacestreemodel.iter_next(treeiter)
|
||||||
self.gconfPlaces.set( "list-string", "custom_names", customplacenames)
|
self.gconfPlaces.set( "list-string", "custom_names", customplacenames)
|
||||||
self.gconfPlaces.set( "list-string", "custom_paths", customplacepaths)
|
self.gconfPlaces.set( "list-string", "custom_paths", customplacepaths)
|
||||||
return
|
|
||||||
|
|
||||||
|
|
||||||
window = mintMenuConfig()
|
window = mintMenuConfig()
|
||||||
|
Loading…
Reference in New Issue
Block a user