message dialog for move operation failure

git-svn-id: svn://svn.berlios.de/gpodder/trunk@299 b0d088ad-0a06-0410-aad2-9ed5178a7e87
This commit is contained in:
Thomas Perl 2007-04-02 12:14:38 +00:00
parent e7c943238a
commit 78d201aab9
3 changed files with 21 additions and 2 deletions

View file

@ -1,3 +1,10 @@
Mon, 2 Apr 2007 14:11:29 +0200 <thp@perli.net>
* src/gpodder/libgpodder.py: Added some sanity checks to get_size()
* src/gpodder/gpodder.py: Implemented a message dialog informing the
user about a failed download directory move operation; thanks to
Andy (apblist speakeasy.net) for suggesting this usability
improvement (in case of write errors, etc..)
Mon, 2 Apr 2007 13:42:21 +0200 <thp@perli.net>
* src/gpodder/libplayers.py: Added /usr/share/applications/kde/ to
list of directories to search for ".desktop" files so that gPodder

View file

@ -641,7 +641,7 @@ class Gpodder(SimpleGladeApp):
#-- Gpodder.on_itemPreferences_activate {
def on_itemPreferences_activate(self, widget, *args):
prop = Gpodderproperties( gpodderwindow = self.gPodder)
prop = Gpodderproperties( gpodderwindow = self.gPodder, showmessage = self.show_message)
prop.set_uar( self.user_apps_reader)
prop.set_callback_finished( self.updateTreeView)
#-- Gpodder.on_itemPreferences_activate }
@ -1089,6 +1089,10 @@ class Gpodderproperties(SimpleGladeApp):
self.gPodderProperties.set_transient_for( kwargs['gpodderwindow'])
self.gPodderProperties.set_position( gtk.WIN_POS_CENTER_ON_PARENT)
self.message_callback = None
if 'showmessage' in kwargs:
self.message_callback = kwargs['showmessage']
#-- Gpodderproperties.new {
def new(self):
self.callback_finished = None
@ -1182,6 +1186,9 @@ class Gpodderproperties(SimpleGladeApp):
def set_download_dir( self, new_download_dir, event = None):
gl = gPodderLib()
gl.downloaddir = self.chooserDownloadTo.get_filename()
if self.message_callback and gl.downloaddir != self.chooserDownloadTo.get_filename():
gobject.idle_add( self.message_callback, _('There has been an error moving your downloads to the specified location. The old download directory will be used instead.'), _('Error moving downloads'))
self.message_callback = None
if event:
event.set()

View file

@ -392,12 +392,17 @@ class gPodderLibClass( object):
return exists( symlink_path)
def get_size( self, filename):
if dirname( filename) == '/':
return 0L
if isfile( filename):
return getsize( filename)
elif isdir( filename):
sum = getsize( filename)
for item in listdir( filename):
sum = sum + self.get_size( join( filename, item))
try:
sum = sum + self.get_size( join( filename, item))
except:
return 0L
return sum
else:
log( 'Cannot get size for %s' % ( filename, ))