Skip to content

Commit

Permalink
prevent column widths from collapsing when we exit sonata while withd…
Browse files Browse the repository at this point in the history
…rawn - we can't simply save the current col.get_width()'s since they are unavailable in this situation, so we'll store them right before withdrawing the window
  • Loading branch information
Scott Horowitz committed Feb 7, 2008
1 parent f4247f3 commit 82a0844
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 11 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG
Expand Up @@ -3,9 +3,10 @@ v1.4.2 - Pending
+ Bug: Fix seeking in progress bar
+ Bug: Fix blank album info when there is an ampersand
+ Bug: Missing color in notification window
+ Bug: Notebook arrow clicks are ignored (because of gtk bug)
+ Bug: Notebook arrow clicks are ignored due to gtk bug
+ Bug: Potential ordering bug when sorting via column heading click
+ Bug: Make desktop file compliant
+ Bug: Column widths can collapse when exiting while minimized to the tray

v1.4.1 - February 2, 2008
+ Remove queue support (it was removed from mpd-svn, complain to them)
Expand Down
32 changes: 22 additions & 10 deletions sonata.py
Expand Up @@ -2067,17 +2067,11 @@ def settings_save(self):
conf.set('player', 'info_album_expanded', self.info_album_expanded)
conf.set('player', 'info_song_more', self.info_song_more)
conf.set('player', 'info_art_enlarged', self.info_art_enlarged)
self.update_column_widths()
tmp = ""
for i in range(len(self.columns) - 1):
tmp += str(self.columns[i].get_width()) + ","
if self.expanderwindow.get_hscrollbar().get_property('visible'):
tmp += str(self.columns[len(self.columns) - 1].get_width())
else:
# The last column may be larger than specified, since it expands to fill
# the treeview, so lets get the minimum of the current width and the
# fixed width. This will prevent a horizontal scrollbar from unnecessarily
# showing sometimes.
tmp += str(min(self.columns[len(self.columns) - 1].get_fixed_width(), self.columns[len(self.columns) - 1].get_width()))
for i in range(len(self.columns)-1):
tmp += str(self.columnwidths[i]) + ","
tmp += str(self.columnwidths[len(self.columns)-1])
conf.set('player', 'columnwidths', tmp)
conf.set('player', 'show_header', self.show_header)
conf.set('player', 'browser', self.url_browser)
Expand Down Expand Up @@ -5051,6 +5045,20 @@ def replace_cover(self, iconview, path, artist, album):
while self.downloading_image:
gtk.main_iteration()

def update_column_widths(self):
if not self.withdrawn:
self.columnwidths = []
for i in range(len(self.columns) - 1):
self.columnwidths.append(self.columns[i].get_width())
if self.expanderwindow.get_hscrollbar().get_property('visible'):
self.columnwidths.append(self.columns[len(self.columns) - 1].get_width())
else:
# The last column may be larger than specified, since it expands to fill
# the treeview, so lets get the minimum of the current width and the
# fixed width. This will prevent a horizontal scrollbar from unnecessarily
# showing sometimes.
self.columnwidths.append(min(self.columns[len(self.columns) - 1].get_fixed_width(), self.columns[len(self.columns) - 1].get_width()))

def trayaction_menu(self, status_icon, button, activate_time):
self.traymenu.popup(None, None, None, button, activate_time)

Expand Down Expand Up @@ -5137,6 +5145,10 @@ def withdraw_app_undo_present_and_focus(self):

def withdraw_app(self):
if HAVE_EGG or HAVE_STATUS_ICON:
# Save the playlist column widths before withdrawing the app.
# Otherwise we will not be able to correctly save the column
# widths if the user quits sonata while it is withdrawn.
self.update_column_widths()
self.window.hide()
self.withdrawn = True
self.UIManager.get_widget('/traymenu/showmenu').set_active(False)
Expand Down

0 comments on commit 82a0844

Please sign in to comment.