(trunk gtk) fix minor regression in #2292 that limited the gtk client's speed display to not count fractions-of-a-KiB/s
This commit is contained in:
parent
8a7c68194e
commit
be3f3a617e
|
@ -288,10 +288,10 @@ struct TorrentCellRendererPrivate
|
|||
control when the speed displays get updated. this is done to keep
|
||||
the individual torrents' speeds and the status bar's overall speed
|
||||
in sync even if they refresh at slightly different times */
|
||||
int upload_speed;
|
||||
double upload_speed;
|
||||
|
||||
/* @see upload_speed */
|
||||
int download_speed;
|
||||
double download_speed;
|
||||
|
||||
gboolean minimal;
|
||||
};
|
||||
|
@ -720,8 +720,8 @@ torrent_cell_renderer_set_property( GObject * object,
|
|||
switch( property_id )
|
||||
{
|
||||
case P_TORRENT: p->tor = g_value_get_pointer( v ); break;
|
||||
case P_UPLOAD_SPEED: p->upload_speed = g_value_get_int( v ); break;
|
||||
case P_DOWNLOAD_SPEED: p->download_speed = g_value_get_int( v ); break;
|
||||
case P_UPLOAD_SPEED: p->upload_speed = g_value_get_double( v ); break;
|
||||
case P_DOWNLOAD_SPEED: p->download_speed = g_value_get_double( v ); break;
|
||||
case P_BAR_HEIGHT: p->bar_height = g_value_get_int( v ); break;
|
||||
case P_MINIMAL: p->minimal = g_value_get_boolean( v ); break;
|
||||
default: G_OBJECT_WARN_INVALID_PROPERTY_ID( object, property_id, pspec ); break;
|
||||
|
@ -740,8 +740,8 @@ torrent_cell_renderer_get_property( GObject * object,
|
|||
switch( property_id )
|
||||
{
|
||||
case P_TORRENT: g_value_set_pointer( v, p->tor ); break;
|
||||
case P_UPLOAD_SPEED: g_value_set_int( v, p->upload_speed ); break;
|
||||
case P_DOWNLOAD_SPEED: g_value_set_int( v, p->download_speed ); break;
|
||||
case P_UPLOAD_SPEED: g_value_set_double( v, p->upload_speed ); break;
|
||||
case P_DOWNLOAD_SPEED: g_value_set_double( v, p->download_speed ); break;
|
||||
case P_BAR_HEIGHT: g_value_set_int( v, p->bar_height ); break;
|
||||
case P_MINIMAL: g_value_set_boolean( v, p->minimal ); break;
|
||||
default: G_OBJECT_WARN_INVALID_PROPERTY_ID( object, property_id, pspec ); break;
|
||||
|
@ -790,16 +790,16 @@ torrent_cell_renderer_class_init( TorrentCellRendererClass * klass )
|
|||
G_PARAM_READWRITE ) );
|
||||
|
||||
g_object_class_install_property( gobject_class, P_UPLOAD_SPEED,
|
||||
g_param_spec_int( "piece-upload-speed", NULL,
|
||||
"tr_stat.pieceUploadSpeed",
|
||||
0, INT_MAX, 0,
|
||||
G_PARAM_READWRITE ) );
|
||||
g_param_spec_double( "piece-upload-speed", NULL,
|
||||
"tr_stat.pieceUploadSpeed",
|
||||
0, INT_MAX, 0,
|
||||
G_PARAM_READWRITE ) );
|
||||
|
||||
g_object_class_install_property( gobject_class, P_DOWNLOAD_SPEED,
|
||||
g_param_spec_int( "piece-download-speed", NULL,
|
||||
"tr_stat.pieceDownloadSpeed",
|
||||
0, INT_MAX, 0,
|
||||
G_PARAM_READWRITE ) );
|
||||
g_param_spec_double( "piece-download-speed", NULL,
|
||||
"tr_stat.pieceDownloadSpeed",
|
||||
0, INT_MAX, 0,
|
||||
G_PARAM_READWRITE ) );
|
||||
|
||||
g_object_class_install_property( gobject_class, P_BAR_HEIGHT,
|
||||
g_param_spec_int( "bar-height", NULL,
|
||||
|
|
|
@ -256,9 +256,10 @@ compareByActivity( GtkTreeModel * model,
|
|||
GtkTreeIter * b,
|
||||
gpointer user_data UNUSED )
|
||||
{
|
||||
int i, aUp, aDown, bUp, bDown;
|
||||
int i;
|
||||
tr_torrent *ta, *tb;
|
||||
const tr_stat *sa, *sb;
|
||||
double aUp, aDown, bUp, bDown;
|
||||
|
||||
gtk_tree_model_get( model, a, MC_SPEED_UP, &aUp,
|
||||
MC_SPEED_DOWN, &aDown,
|
||||
|
@ -269,7 +270,7 @@ compareByActivity( GtkTreeModel * model,
|
|||
MC_TORRENT_RAW, &tb,
|
||||
-1 );
|
||||
|
||||
if(( i = ((aUp+aDown)-(bUp+bDown)) ))
|
||||
if(( i = compareDouble( sa->percentDone, sb->percentDone )))
|
||||
return i;
|
||||
|
||||
sa = tr_torrentStatCached( ta );
|
||||
|
@ -622,8 +623,8 @@ tr_core_init( GTypeInstance * instance,
|
|||
G_TYPE_STRING, /* collated name */
|
||||
TR_TORRENT_TYPE, /* TrTorrent object */
|
||||
G_TYPE_POINTER, /* tr_torrent* */
|
||||
G_TYPE_INT, /* tr_stat.pieceUploadSpeed */
|
||||
G_TYPE_INT, /* tr_stat.pieceDownloadSpeed */
|
||||
G_TYPE_DOUBLE, /* tr_stat.pieceUploadSpeed */
|
||||
G_TYPE_DOUBLE, /* tr_stat.pieceDownloadSpeed */
|
||||
G_TYPE_INT }; /* tr_stat.status */
|
||||
|
||||
p = self->priv = G_TYPE_INSTANCE_GET_PRIVATE( self,
|
||||
|
@ -766,8 +767,8 @@ tr_core_add_torrent( TrCore * self,
|
|||
MC_NAME_COLLATED, collated,
|
||||
MC_TORRENT, gtor,
|
||||
MC_TORRENT_RAW, tor,
|
||||
MC_SPEED_UP, (int)st->pieceUploadSpeed,
|
||||
MC_SPEED_DOWN, (int)st->pieceDownloadSpeed,
|
||||
MC_SPEED_UP, st->pieceUploadSpeed,
|
||||
MC_SPEED_DOWN, st->pieceDownloadSpeed,
|
||||
MC_ACTIVITY, st->activity,
|
||||
-1 );
|
||||
|
||||
|
@ -1035,8 +1036,8 @@ update_foreach( GtkTreeModel * model,
|
|||
gpointer data UNUSED )
|
||||
{
|
||||
int oldActivity, newActivity;
|
||||
int oldUpSpeed, newUpSpeed;
|
||||
int oldDownSpeed, newDownSpeed;
|
||||
double oldUpSpeed, newUpSpeed;
|
||||
double oldDownSpeed, newDownSpeed;
|
||||
const tr_stat * st;
|
||||
TrTorrent * gtor;
|
||||
|
||||
|
@ -1057,8 +1058,8 @@ update_foreach( GtkTreeModel * model,
|
|||
/* updating the model triggers off resort/refresh,
|
||||
so don't do it unless something's actually changed... */
|
||||
if( ( newActivity != oldActivity ) ||
|
||||
( newUpSpeed != oldUpSpeed ) ||
|
||||
( newDownSpeed != oldDownSpeed ) )
|
||||
( (int)(newUpSpeed*10.0) != (int)(oldUpSpeed*10.0) ) ||
|
||||
( (int)(newDownSpeed*10.0) != (int)(oldDownSpeed*10.0) ) )
|
||||
{
|
||||
gtk_list_store_set( GTK_LIST_STORE( model ), iter,
|
||||
MC_ACTIVITY, newActivity,
|
||||
|
|
|
@ -337,8 +337,8 @@ syncAltSpeedButton( PrivateData * p )
|
|||
const gboolean b = pref_flag_get( TR_PREFS_KEY_ALT_SPEED_ENABLED );
|
||||
GtkWidget * w = p->alt_speed_button;
|
||||
|
||||
tr_strlspeed( u, pref_int_get( TR_PREFS_KEY_ALT_SPEED_UP ), sizeof( u ) );
|
||||
tr_strlspeed( d, pref_int_get( TR_PREFS_KEY_ALT_SPEED_DOWN ), sizeof( d ) );
|
||||
tr_strlspeed( u, pref_double_get( TR_PREFS_KEY_ALT_SPEED_UP ), sizeof( u ) );
|
||||
tr_strlspeed( d, pref_double_get( TR_PREFS_KEY_ALT_SPEED_DOWN ), sizeof( d ) );
|
||||
fmt = b ? _( "Click to disable Temporary Speed Limits\n(%1$s down, %2$s up)" )
|
||||
: _( "Click to enable Temporary Speed Limits\n(%1$s down, %2$s up)" );
|
||||
g_snprintf( buf, sizeof( buf ), fmt, d, u );
|
||||
|
@ -1154,13 +1154,13 @@ updateSpeeds( PrivateData * p )
|
|||
if( session != NULL )
|
||||
{
|
||||
char buf[128];
|
||||
int up=0, down=0;
|
||||
double up=0, down=0;
|
||||
GtkTreeIter iter;
|
||||
GtkTreeModel * model = tr_core_model( p->core );
|
||||
|
||||
if( gtk_tree_model_get_iter_first( model, &iter ) ) do
|
||||
{
|
||||
int u, d;
|
||||
double u, d;
|
||||
gtk_tree_model_get( model, &iter, MC_SPEED_UP, &u,
|
||||
MC_SPEED_DOWN, &d,
|
||||
-1 );
|
||||
|
|
Loading…
Reference in New Issue