(trunk gtk) #1735: .torrent files are not deleted even if you said so

This commit is contained in:
Charles Kerr 2009-02-09 20:08:33 +00:00
parent ec113c60e1
commit e3e2314418
3 changed files with 6 additions and 39 deletions

View File

@ -896,11 +896,11 @@ add_filename( TrCore * core,
if( doPrompt )
g_signal_emit( core, TR_CORE_GET_CLASS( core )->promptsig, 0, ctor );
else {
tr_torrent * tor = tr_torrentNew( session, ctor, &err );
TrTorrent * gtor = tr_torrent_new_ctor( session, ctor, &err );
if( err )
tr_core_errsig( core, err, filename );
else
tr_core_add_torrent( core, tr_torrent_new_preexisting( tor ) );
tr_core_add_torrent( core, gtor );
}
tr_metainfoFree( &inf );
break;

View File

@ -189,20 +189,16 @@ tr_torrent_new_preexisting( tr_torrent * tor )
TrTorrent *
tr_torrent_new_ctor( tr_session * session,
tr_ctor * ctor,
char ** err )
int * errcode )
{
tr_torrent * tor;
int errcode;
uint8_t doTrash = FALSE;
errcode = -1;
*err = NULL;
/* let the gtk client handle the removal, since libT
* doesn't have any concept of the glib trash API */
tr_ctorGetDeleteSource( ctor, &doTrash );
tr_ctorSetDeleteSource( ctor, FALSE );
tor = tr_torrentNew( session, ctor, &errcode );
tor = tr_torrentNew( session, ctor, errcode );
if( tor && doTrash )
{
@ -215,36 +211,7 @@ tr_torrent_new_ctor( tr_session * session,
tr_file_trash_or_remove( source );
}
if( !tor )
{
const char * filename = tr_ctorGetSourceFile( ctor );
if( !filename )
filename = "(null)";
switch( errcode )
{
case TR_EINVALID:
*err =
g_strdup_printf( _(
"File \"%s\" isn't a valid torrent" ),
filename );
break;
case TR_EDUPLICATE:
*err = g_strdup_printf( _(
"File \"%s\" is already open" ),
filename );
break;
default:
*err = g_strdup( filename );
break;
}
return NULL;
}
return maketorrent( tor );
return tor ? maketorrent( tor ) : NULL;
}
char *

View File

@ -75,7 +75,7 @@ TrTorrent * tr_torrent_new_preexisting( tr_torrent * tor );
TrTorrent * tr_torrent_new_ctor( tr_session * session,
tr_ctor * ctor,
char ** err );
int * errcode );
void tr_torrent_set_remove_flag( TrTorrent *,
gboolean );