{
TrCore * core;
int id;
+ gboolean delete_files;
};
static gboolean
{
struct torrent_idle_data * data = gdata;
- tr_core_remove_torrent_from_id( data->core, data->id, FALSE );
+ tr_core_remove_torrent_from_id( data->core, data->id, data->delete_files );
g_free( data );
return FALSE; /* tell g_idle not to call this func twice */
break;
}
- case TR_RPC_TORRENT_REMOVING: {
+ case TR_RPC_TORRENT_REMOVING:
+ case TR_RPC_TORRENT_TRASHING: {
struct torrent_idle_data * data = g_new0( struct torrent_idle_data, 1 );
data->id = tr_torrentId( tor );
data->core = cbdata->core;
+ data->delete_files = type == TR_RPC_TORRENT_TRASHING;
gtr_idle_add( rpc_torrent_remove_idle, data );
status = TR_RPC_NOREMOVE;
break;
{
int i;
int torrentCount;
+ tr_rpc_callback_type type;
+ tr_bool deleteFlag = FALSE;
tr_torrent ** torrents = getTorrents( session, args_in, &torrentCount );
assert( idle_data == NULL );
+ tr_bencDictFindBool( args_in, "delete-local-data", &deleteFlag );
+ type = deleteFlag ? TR_RPC_TORRENT_TRASHING
+ : TR_RPC_TORRENT_REMOVING;
+
for( i=0; i<torrentCount; ++i )
{
tr_torrent * tor = torrents[i];
- const tr_rpc_callback_status status = notify( session, TR_RPC_TORRENT_REMOVING, tor );
+ const tr_rpc_callback_status status = notify( session, type, tor );
if( !( status & TR_RPC_NOREMOVE ) )
- {
- tr_bool deleteFlag = FALSE;
- tr_bencDictFindBool( args_in, "delete-local-data", &deleteFlag );
tr_torrentRemove( tor, deleteFlag, NULL );
- }
}
tr_free( torrents );