mirror of
https://github.com/transmission/transmission
synced 2025-03-12 07:03:44 +00:00
(trunk gtk) #1690: Torrent is completed without ever starting (because there's nothing to download)
This commit is contained in:
parent
a13e0755f0
commit
df81c6546c
2 changed files with 16 additions and 5 deletions
|
@ -162,11 +162,11 @@ notifyInMainThread( gpointer user_data )
|
|||
}
|
||||
|
||||
static void
|
||||
completenessChangedCallback( tr_torrent * tor UNUSED,
|
||||
completenessChangedCallback( tr_torrent * tor,
|
||||
tr_completeness completeness,
|
||||
void * user_data )
|
||||
{
|
||||
if( completeness != TR_LEECH )
|
||||
if( ( completeness != TR_LEECH ) && ( tr_torrentStat( tor )->sizeWhenDone != 0 ) )
|
||||
g_idle_add( notifyInMainThread, user_data );
|
||||
}
|
||||
|
||||
|
|
17
gtk/util.c
17
gtk/util.c
|
@ -23,6 +23,7 @@
|
|||
*****************************************************************************/
|
||||
|
||||
#include <ctype.h> /* isxdigit() */
|
||||
#include <errno.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdlib.h> /* free() */
|
||||
#include <string.h> /* strcmp() */
|
||||
|
@ -521,12 +522,22 @@ tr_file_trash_or_unlink( const char * filename )
|
|||
{
|
||||
gboolean trashed = FALSE;
|
||||
#ifdef HAVE_GIO
|
||||
GError * err = NULL;
|
||||
GFile * file = g_file_new_for_path( filename );
|
||||
trashed = g_file_trash( file, NULL, NULL );
|
||||
trashed = g_file_trash( file, NULL, &err );
|
||||
if( err )
|
||||
g_message( "Unable to trash file \"%s\": %s", filename, err->message );
|
||||
g_clear_error( &err );
|
||||
g_object_unref( G_OBJECT( file ) );
|
||||
|
||||
|
||||
#endif
|
||||
if( !trashed )
|
||||
g_unlink( filename );
|
||||
if( !trashed ) {
|
||||
if( g_unlink( filename ) ) {
|
||||
const int err = errno;
|
||||
g_message( "Unable to unlink file \"%s\": %s", filename, g_strerror( err ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
|
Loading…
Add table
Reference in a new issue