Ignore:
Timestamp:
Aug 4, 2010, 5:23:25 AM (12 years ago)
Author:
Longinus00
Message:

(2.0x) #3185: Number on drop-down menu "Activity" - "Active" seems does not follow a change in torrent status correctly

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2.0x/gtk/tr-core.c

    r10853 r11106  
    483483}
    484484
     485static char *
     486torrentTrackerString( tr_torrent * tor )
     487{
     488    int i;
     489    GString * str = g_string_new( NULL );
     490    const tr_info * inf = tr_torrentInfo( tor );
     491
     492    for( i = 0; i < inf->trackerCount; ++i )
     493    {
     494        const tr_tracker_info * t = &inf->trackers[i];
     495        g_string_append( str, t->announce );
     496    }
     497
     498    return g_string_free( str, FALSE );
     499}
     500
    485501#ifdef HAVE_GIO
    486502
     
    710726                      G_TYPE_DOUBLE,    /* tr_stat.pieceUploadSpeed */
    711727                      G_TYPE_DOUBLE,    /* tr_stat.pieceDownloadSpeed */
    712                       G_TYPE_INT };     /* tr_stat.status */
     728                      G_TYPE_INT,       /* tr_stat.activity */
     729                      G_TYPE_UCHAR,     /* tr_stat.finished */
     730                      G_TYPE_CHAR,      /* tr_priority_t */
     731                      G_TYPE_STRING };  /* concatenated trackers string */
    713732
    714733    p = self->priv = G_TYPE_INSTANCE_GET_PRIVATE( self,
     
    844863    tr_torrent *    tor = tr_torrent_handle( gtor );
    845864    char *          collated = doCollate( inf->name );
     865    char *          trackers = torrentTrackerString( tor );
    846866    GtkListStore *  store = GTK_LIST_STORE( tr_core_model( self ) );
    847867    GtkTreeIter     unused;
     
    855875                                       MC_SPEED_DOWN,    st->pieceDownloadSpeed,
    856876                                       MC_ACTIVITY,      st->activity,
     877                                       MC_FINISHED,      st->finished,
     878                                       MC_PRIORITY,      tr_torrentGetPriority( tor ),
     879                                       MC_TRACKERS,      trackers,
    857880                                       -1 );
    858881
     
    863886    g_object_unref( G_OBJECT( gtor ) );
    864887    g_free( collated );
     888    g_free( trackers );
    865889}
    866890
     
    12431267{
    12441268    int oldActivity, newActivity;
     1269    tr_bool oldFinished, newFinished;
     1270    tr_priority_t oldPriority, newPriority;
     1271    char * oldTrackers, * newTrackers;
    12451272    double oldUpSpeed, newUpSpeed;
    12461273    double oldDownSpeed, newDownSpeed;
    12471274    const tr_stat * st;
    12481275    TrTorrent * gtor;
     1276    tr_torrent * tor;
    12491277
    12501278    /* get the old states */
     
    12521280                        MC_TORRENT, &gtor,
    12531281                        MC_ACTIVITY, &oldActivity,
     1282                        MC_FINISHED, &oldFinished,
     1283                        MC_PRIORITY, &oldPriority,
     1284                        MC_TRACKERS, &oldTrackers,
    12541285                        MC_SPEED_UP, &oldUpSpeed,
    12551286                        MC_SPEED_DOWN, &oldDownSpeed,
     
    12571288
    12581289    /* get the new states */
    1259     st = tr_torrentStat( tr_torrent_handle( gtor ) );
     1290    tor = tr_torrent_handle( gtor );
     1291    st = tr_torrentStat( tor );
    12601292    newActivity = st->activity;
     1293    newFinished = st->finished;
     1294    newPriority = tr_torrentGetPriority( tor );
     1295    newTrackers = torrentTrackerString( tor );
    12611296    newUpSpeed = st->pieceUploadSpeed;
    12621297    newDownSpeed = st->pieceDownloadSpeed;
     
    12651300       so don't do it unless something's actually changed... */
    12661301    if( ( newActivity != oldActivity ) ||
     1302        || ( newFinished != oldFinished )
     1303        || ( newPriority != oldPriority )
     1304        || tr_strcmp( oldTrackers, newTrackers )
    12671305        ( (int)(newUpSpeed*10.0) != (int)(oldUpSpeed*10.0) ) ||
    12681306        ( (int)(newDownSpeed*10.0) != (int)(oldDownSpeed*10.0) ) )
     
    12701308        gtk_list_store_set( GTK_LIST_STORE( model ), iter,
    12711309                            MC_ACTIVITY, newActivity,
     1310                            MC_FINISHED, newFinished,
     1311                            MC_PRIORITY, newPriority,
     1312                            MC_TRACKERS, newTrackers,
    12721313                            MC_SPEED_UP, newUpSpeed,
    12731314                            MC_SPEED_DOWN, newDownSpeed,
     
    12771318    /* cleanup */
    12781319    g_object_unref( gtor );
     1320    g_free( newTrackers );
     1321    g_free( oldTrackers );
    12791322    return FALSE;
    12801323}
Note: See TracChangeset for help on using the changeset viewer.