Changeset 2121


Ignore:
Timestamp:
Jun 17, 2007, 5:29:47 AM (15 years ago)
Author:
charles
Message:
  • gtk: fix another special case bug.
  • cli: sync to libT changes wrt tr_getFinished()
Location:
branches/file_selection
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/file_selection/cli/transmissioncli.c

    r2107 r2121  
    298298        }
    299299       
    300         if( tr_getFinished( tor ) )
     300        if( tr_getDone(tor) || tr_getComplete(tor) )
    301301        {
    302302            result = system(finishCall);
  • branches/file_selection/gtk/makemeta-ui.c

    r2115 r2121  
    191191    char * filename;
    192192    char buf[512];
     193    int fileCount = 0;
     194    uint64_t totalSize = 0;
    193195
    194196    if( ui->builder ) {
     
    198200
    199201    filename = gtk_file_chooser_get_filename( chooser );
    200     ui->builder = tr_metaInfoBuilderCreate( ui->handle, filename );
    201     g_free( filename );
    202 
    203     pch = readablesize( ui->builder->totalSize );
    204     g_snprintf( buf, sizeof(buf), "<i>%s; %lu %s</i>",
    205                 pch, ui->builder->fileCount,
    206                 ngettext("file", "files", (int)ui->builder->fileCount));
     202    if( filename ) {
     203        ui->builder = tr_metaInfoBuilderCreate( ui->handle, filename );
     204        g_free( filename );
     205        fileCount = (int) ui->builder->fileCount;
     206        totalSize = ui->builder->totalSize;
     207    }
     208
     209    pch = readablesize( totalSize );
     210    g_snprintf( buf, sizeof(buf), "<i>%s; %d %s</i>",
     211                pch, fileCount,
     212                ngettext("file", "files", fileCount));
    207213    gtk_label_set_markup ( GTK_LABEL(ui->size_lb), buf );
    208214    g_free( pch );
  • branches/file_selection/libtransmission/torrent.c

    r2085 r2121  
    378378}
    379379
    380 int tr_getIncomplete( tr_torrent_t * tor )
    381 {
    382     if( tor->hasChangedState == TR_CP_INCOMPLETE )
     380static int tr_didStateChangeTo ( tr_torrent_t * tor, int status )
     381{
     382    if( tor->hasChangedState == status )
    383383    {
    384384        tor->hasChangedState = -1;
     
    388388}
    389389
     390int tr_getIncomplete( tr_torrent_t * tor )
     391{
     392    return tr_didStateChangeTo( tor, TR_CP_INCOMPLETE );
     393}
    390394int tr_getDone( tr_torrent_t * tor )
    391395{
    392     if( tor->hasChangedState == TR_CP_DONE )
    393     {
    394         tor->hasChangedState = -1;
    395         return 1;
    396     }
    397     return 0;
    398 }
    399 
     396    return tr_didStateChangeTo( tor, TR_CP_DONE );
     397}
    400398int tr_getComplete( tr_torrent_t * tor )
    401399{
    402     if( tor->hasChangedState == TR_CP_COMPLETE )
    403     {
    404         tor->hasChangedState = -1;
    405         return 1;
    406     }
    407     return 0;
     400    return tr_didStateChangeTo( tor, TR_CP_COMPLETE );
    408401}
    409402
Note: See TracChangeset for help on using the changeset viewer.