Fix loading when no .state file exists.

This commit is contained in:
Andrew Resch 2007-12-08 21:39:19 +00:00
parent 26350c5099
commit 9e9eee5d2c

View File

@ -183,6 +183,7 @@ class ListView:
"""Load the listview state from filename.""" """Load the listview state from filename."""
# Get the config location for loading the state file # Get the config location for loading the state file
config_location = ConfigManager("gtkui.conf")["config_location"] config_location = ConfigManager("gtkui.conf")["config_location"]
state = None
try: try:
log.debug("Loading ListView state file: %s", filename) log.debug("Loading ListView state file: %s", filename)
@ -374,7 +375,6 @@ class ListView:
elif column_type == None: elif column_type == None:
return return
column.set_sizing(gtk.TREE_VIEW_COLUMN_FIXED)
column.set_sort_column_id(self.columns[header].column_indices[sortid]) column.set_sort_column_id(self.columns[header].column_indices[sortid])
column.set_clickable(True) column.set_clickable(True)
column.set_resizable(True) column.set_resizable(True)
@ -384,10 +384,12 @@ class ListView:
column.set_visible(not hidden) column.set_visible(not hidden)
# Check for loaded state and apply # Check for loaded state and apply
if self.state != None:
for column_state in self.state: for column_state in self.state:
if header == column_state.name: if header == column_state.name:
# We found a loaded state # We found a loaded state
if column_state.width > 0: if column_state.width > 0:
column.set_sizing(gtk.TREE_VIEW_COLUMN_FIXED)
column.set_fixed_width(column_state.width) column.set_fixed_width(column_state.width)
column.set_sort_indicator(column_state.sort) column.set_sort_indicator(column_state.sort)
column.set_sort_order(column_state.sort_order) column.set_sort_order(column_state.sort_order)