fixed column width save and restore

This commit is contained in:
Martin Wagner 2020-03-04 18:55:43 +01:00
parent ae3ac76b3d
commit 0fb67698cd

View File

@ -840,10 +840,11 @@ class TrackView(Gtk.Box):
self.pack_end(status_bar, False, False, 0) self.pack_end(status_bar, False, False, 0)
def save_settings(self): #only saves the column sizes def save_settings(self): #only saves the column sizes
sizes=[]
columns=self.treeview.get_columns() columns=self.treeview.get_columns()
for column in columns: permutation=self.settings.get_value("column-permutation").unpack()
sizes.append(column.get_width()) sizes=[0] * len(permutation)
for i in range(len(permutation)):
sizes[permutation[i]]=columns[i].get_width()
self.settings.set_value("column-sizes", GLib.Variant("ai", sizes)) self.settings.set_value("column-sizes", GLib.Variant("ai", sizes))
def load_settings(self, *args): def load_settings(self, *args):
@ -852,13 +853,10 @@ class TrackView(Gtk.Box):
self.treeview.remove_column(column) self.treeview.remove_column(column)
sizes=self.settings.get_value("column-sizes").unpack() sizes=self.settings.get_value("column-sizes").unpack()
visibilities=self.settings.get_value("column-visibilities").unpack() visibilities=self.settings.get_value("column-visibilities").unpack()
index=0
for column in self.columns:
if sizes[index] > 0:
column.set_fixed_width(sizes[index])
column.set_visible(visibilities[index])
index=index+1
for i in self.settings.get_value("column-permutation"): for i in self.settings.get_value("column-permutation"):
if sizes[i] > 0:
self.columns[i].set_fixed_width(sizes[i])
self.columns[i].set_visible(visibilities[i])
self.treeview.append_column(self.columns[i]) self.treeview.append_column(self.columns[i])
def scroll_to_selected_title(self): def scroll_to_selected_title(self):