1
0
Fork 0
mirror of https://github.com/transmission/transmission synced 2025-03-04 10:38:13 +00:00

(gtk) fix trunk refresh bug reported by hussam in irc.

This commit is contained in:
Charles Kerr 2007-12-27 06:59:48 +00:00
parent 5f2d3b022e
commit 94d8cd9fa9
2 changed files with 19 additions and 20 deletions

View file

@ -185,14 +185,9 @@ compareByActivity( GtkTreeModel * model,
gpointer user_data UNUSED ) gpointer user_data UNUSED )
{ {
int i; int i;
tr_torrent *ta, *tb;
const tr_stat *sa, *sb; const tr_stat *sa, *sb;
gtk_tree_model_get( model, a, MC_STAT, &sa, -1 );
gtk_tree_model_get( model, a, MC_TORRENT_RAW, &ta, -1 ); gtk_tree_model_get( model, b, MC_STAT, &sb, -1 );
gtk_tree_model_get( model, b, MC_TORRENT_RAW, &tb, -1 );
sa = tr_torrentStatCached( ta );
sb = tr_torrentStatCached( tb );
if(( i = compareDouble( sa->rateUpload + sa->rateDownload, if(( i = compareDouble( sa->rateUpload + sa->rateDownload,
sb->rateUpload + sb->rateDownload ) )) sb->rateUpload + sb->rateDownload ) ))
@ -236,12 +231,9 @@ compareByProgress( GtkTreeModel * model,
gpointer user_data UNUSED ) gpointer user_data UNUSED )
{ {
int ret; int ret;
tr_torrent *ta, *tb;
const tr_stat *sa, *sb; const tr_stat *sa, *sb;
gtk_tree_model_get( model, a, MC_TORRENT_RAW, &ta, -1 ); gtk_tree_model_get( model, a, MC_STAT, &sa, -1 );
gtk_tree_model_get( model, b, MC_TORRENT_RAW, &tb, -1 ); gtk_tree_model_get( model, b, MC_STAT, &sb, -1 );
sa = tr_torrentStatCached( ta );
sb = tr_torrentStatCached( tb );
ret = compareDouble( sa->percentDone, sb->percentDone ); ret = compareDouble( sa->percentDone, sb->percentDone );
if( !ret ) if( !ret )
ret = compareDouble( sa->ratio, sa->ratio ); ret = compareDouble( sa->ratio, sa->ratio );
@ -254,10 +246,10 @@ compareByState( GtkTreeModel * model,
GtkTreeIter * b, GtkTreeIter * b,
gpointer user_data UNUSED ) gpointer user_data UNUSED )
{ {
tr_torrent *ta, *tb; const tr_stat *sa, *sb;
gtk_tree_model_get( model, a, MC_TORRENT_RAW, &ta, -1 ); gtk_tree_model_get( model, a, MC_STAT, &sa, -1 );
gtk_tree_model_get( model, b, MC_TORRENT_RAW, &tb, -1 ); gtk_tree_model_get( model, b, MC_STAT, &sb, -1 );
return tr_torrentStatCached(ta)->status - tr_torrentStatCached(tb)->status; return sa->status - sb->status;
} }
static int static int
@ -335,6 +327,7 @@ tr_core_init( GTypeInstance * instance, gpointer g_class SHUTUP )
G_TYPE_STRING, /* hash string */ G_TYPE_STRING, /* hash string */
TR_TORRENT_TYPE, /* TrTorrent object */ TR_TORRENT_TYPE, /* TrTorrent object */
G_TYPE_POINTER, /* tr_torrent* */ G_TYPE_POINTER, /* tr_torrent* */
G_TYPE_POINTER, /* tr_stat* */
G_TYPE_INT /* ID for IPC */ G_TYPE_INT /* ID for IPC */
}; };
@ -644,12 +637,17 @@ update_foreach( GtkTreeModel * model,
GtkTreeIter * iter, GtkTreeIter * iter,
gpointer data UNUSED) gpointer data UNUSED)
{ {
TrTorrent * tor; TrTorrent * gtor;
const tr_stat * torStat;
gtk_tree_model_get( model, iter, MC_TORRENT, &gtor, -1 );
gtk_tree_model_get( model, iter, MC_TORRENT, &tor, -1 ); torStat = tr_torrentStat( tr_torrent_handle( gtor ) );
tr_torrent_check_seeding_cap ( tor ); gtk_list_store_set( GTK_LIST_STORE( model ), iter,
g_object_unref( tor ); MC_STAT, (gpointer)torStat,
-1 );
tr_torrent_check_seeding_cap ( gtor );
g_object_unref( gtor );
return FALSE; return FALSE;
} }

View file

@ -181,6 +181,7 @@ enum
MC_HASH, MC_HASH,
MC_TORRENT, MC_TORRENT,
MC_TORRENT_RAW, MC_TORRENT_RAW,
MC_STAT,
MC_ID, MC_ID,
MC_ROW_COUNT MC_ROW_COUNT
}; };