Changeset 8900


Ignore:
Timestamp:
Aug 12, 2009, 1:42:49 PM (13 years ago)
Author:
charles
Message:

(trunk gtk) fix minor regression in #2292 that limited the gtk client's speed display to not count fractions-of-a-KiB/s

Location:
trunk/gtk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/gtk/torrent-cell-renderer.c

    r8889 r8900  
    289289       the individual torrents' speeds and the status bar's overall speed
    290290       in sync even if they refresh at slightly different times */
    291     int upload_speed;
     291    double upload_speed;
    292292
    293293    /* @see upload_speed */
    294     int download_speed;
     294    double download_speed;
    295295
    296296    gboolean minimal;
     
    721721    {
    722722        case P_TORRENT:        p->tor            = g_value_get_pointer( v ); break;
    723         case P_UPLOAD_SPEED:   p->upload_speed   = g_value_get_int( v ); break;
    724         case P_DOWNLOAD_SPEED: p->download_speed = g_value_get_int( v ); break;
     723        case P_UPLOAD_SPEED:   p->upload_speed   = g_value_get_double( v ); break;
     724        case P_DOWNLOAD_SPEED: p->download_speed = g_value_get_double( v ); break;
    725725        case P_BAR_HEIGHT:     p->bar_height     = g_value_get_int( v ); break;
    726726        case P_MINIMAL:        p->minimal        = g_value_get_boolean( v ); break;
     
    741741    {
    742742        case P_TORRENT:        g_value_set_pointer( v, p->tor ); break;
    743         case P_UPLOAD_SPEED:   g_value_set_int( v, p->upload_speed ); break;
    744         case P_DOWNLOAD_SPEED: g_value_set_int( v, p->download_speed ); break;
     743        case P_UPLOAD_SPEED:   g_value_set_double( v, p->upload_speed ); break;
     744        case P_DOWNLOAD_SPEED: g_value_set_double( v, p->download_speed ); break;
    745745        case P_BAR_HEIGHT:     g_value_set_int( v, p->bar_height ); break;
    746746        case P_MINIMAL:        g_value_set_boolean( v, p->minimal ); break;
     
    791791
    792792    g_object_class_install_property( gobject_class, P_UPLOAD_SPEED,
    793                                     g_param_spec_int( "piece-upload-speed", NULL,
    794                                                       "tr_stat.pieceUploadSpeed",
    795                                                       0, INT_MAX, 0,
    796                                                       G_PARAM_READWRITE ) );
     793                                    g_param_spec_double( "piece-upload-speed", NULL,
     794                                                         "tr_stat.pieceUploadSpeed",
     795                                                         0, INT_MAX, 0,
     796                                                         G_PARAM_READWRITE ) );
    797797
    798798    g_object_class_install_property( gobject_class, P_DOWNLOAD_SPEED,
    799                                     g_param_spec_int( "piece-download-speed", NULL,
    800                                                       "tr_stat.pieceDownloadSpeed",
    801                                                       0, INT_MAX, 0,
    802                                                       G_PARAM_READWRITE ) );
     799                                    g_param_spec_double( "piece-download-speed", NULL,
     800                                                         "tr_stat.pieceDownloadSpeed",
     801                                                         0, INT_MAX, 0,
     802                                                         G_PARAM_READWRITE ) );
    803803
    804804    g_object_class_install_property( gobject_class, P_BAR_HEIGHT,
  • trunk/gtk/tr-core.c

    r8882 r8900  
    257257                   gpointer       user_data UNUSED )
    258258{
    259     int i, aUp, aDown, bUp, bDown;
     259    int i;
    260260    tr_torrent *ta, *tb;
    261261    const tr_stat *sa, *sb;
     262    double aUp, aDown, bUp, bDown;
    262263
    263264    gtk_tree_model_get( model, a, MC_SPEED_UP, &aUp,
     
    270271                                  -1 );
    271272
    272     if(( i = ((aUp+aDown)-(bUp+bDown)) ))
     273    if(( i = compareDouble( sa->percentDone, sb->percentDone )))
    273274        return i;
    274275
     
    623624                      TR_TORRENT_TYPE,  /* TrTorrent object */
    624625                      G_TYPE_POINTER,   /* tr_torrent* */
    625                       G_TYPE_INT,       /* tr_stat.pieceUploadSpeed */
    626                       G_TYPE_INT,       /* tr_stat.pieceDownloadSpeed */
     626                      G_TYPE_DOUBLE,    /* tr_stat.pieceUploadSpeed */
     627                      G_TYPE_DOUBLE,    /* tr_stat.pieceDownloadSpeed */
    627628                      G_TYPE_INT };     /* tr_stat.status */
    628629
     
    767768                                       MC_TORRENT,       gtor,
    768769                                       MC_TORRENT_RAW,   tor,
    769                                        MC_SPEED_UP,      (int)st->pieceUploadSpeed,
    770                                        MC_SPEED_DOWN,    (int)st->pieceDownloadSpeed,
     770                                       MC_SPEED_UP,      st->pieceUploadSpeed,
     771                                       MC_SPEED_DOWN,    st->pieceDownloadSpeed,
    771772                                       MC_ACTIVITY,      st->activity,
    772773                                       -1 );
     
    10361037{
    10371038    int oldActivity, newActivity;
    1038     int oldUpSpeed, newUpSpeed;
    1039     int oldDownSpeed, newDownSpeed;
     1039    double oldUpSpeed, newUpSpeed;
     1040    double oldDownSpeed, newDownSpeed;
    10401041    const tr_stat * st;
    10411042    TrTorrent * gtor;
     
    10581059       so don't do it unless something's actually changed... */
    10591060    if( ( newActivity != oldActivity ) ||
    1060         ( newUpSpeed != oldUpSpeed ) ||
    1061         ( newDownSpeed != oldDownSpeed ) )
     1061        ( (int)(newUpSpeed*10.0) != (int)(oldUpSpeed*10.0) ) ||
     1062        ( (int)(newDownSpeed*10.0) != (int)(oldDownSpeed*10.0) ) )
    10621063    {
    10631064        gtk_list_store_set( GTK_LIST_STORE( model ), iter,
  • trunk/gtk/tr-window.c

    r8889 r8900  
    338338    GtkWidget * w = p->alt_speed_button;
    339339
    340     tr_strlspeed( u, pref_int_get( TR_PREFS_KEY_ALT_SPEED_UP ), sizeof( u ) );
    341     tr_strlspeed( d, pref_int_get( TR_PREFS_KEY_ALT_SPEED_DOWN ), sizeof( d ) );
     340    tr_strlspeed( u, pref_double_get( TR_PREFS_KEY_ALT_SPEED_UP ), sizeof( u ) );
     341    tr_strlspeed( d, pref_double_get( TR_PREFS_KEY_ALT_SPEED_DOWN ), sizeof( d ) );
    342342    fmt = b ? _( "Click to disable Temporary Speed Limits\n(%1$s down, %2$s up)" )
    343343            : _( "Click to enable Temporary Speed Limits\n(%1$s down, %2$s up)" );
     
    11551155    {
    11561156        char buf[128];
    1157         int up=0, down=0;
     1157        double up=0, down=0;
    11581158        GtkTreeIter iter;
    11591159        GtkTreeModel * model = tr_core_model( p->core );
     
    11611161        if( gtk_tree_model_get_iter_first( model, &iter ) ) do
    11621162        {
    1163             int u, d;
     1163            double u, d;
    11641164            gtk_tree_model_get( model, &iter, MC_SPEED_UP, &u,
    11651165                                              MC_SPEED_DOWN, &d,
Note: See TracChangeset for help on using the changeset viewer.