1
0
Fork 0
mirror of https://github.com/transmission/transmission synced 2024-12-26 01:27:28 +00:00

(gtk) #1504: when the details dialog's peers list is sorted, some rows are duplicated

This commit is contained in:
Charles Kerr 2008-11-23 17:10:40 +00:00
parent aee1a0b9a0
commit e99e3243a0

View file

@ -325,8 +325,7 @@ static const char* peer_column_names[N_PEER_COLS] =
}; };
static int static int
compare_peers( const void * a, compare_peers( const void * a, const void * b )
const void * b )
{ {
const tr_peer_stat * pa = a; const tr_peer_stat * pa = a;
const tr_peer_stat * pb = b; const tr_peer_stat * pb = b;
@ -335,10 +334,8 @@ compare_peers( const void * a,
} }
static int static int
compare_addr_to_peer( const void * a, compare_addr_to_peer( const void * addr, const void * b )
const void * b )
{ {
const char * addr = (const char *) a;
const tr_peer_stat * peer = b; const tr_peer_stat * peer = b;
return strcmp( addr, peer->addr ); return strcmp( addr, peer->addr );
@ -388,8 +385,7 @@ peer_model_new( tr_torrent * tor )
G_TYPE_FLOAT, /* downloadFromRate */ G_TYPE_FLOAT, /* downloadFromRate */
G_TYPE_FLOAT, /* uploadToRate */ G_TYPE_FLOAT, /* uploadToRate */
G_TYPE_STRING, /* client */ G_TYPE_STRING, /* client */
G_TYPE_INT, /* progress [0..100] G_TYPE_INT, /* progress [0..100] */
*/
G_TYPE_BOOLEAN, /* isEncrypted */ G_TYPE_BOOLEAN, /* isEncrypted */
G_TYPE_STRING ); /* flagString */ G_TYPE_STRING ); /* flagString */
@ -486,6 +482,7 @@ typedef struct
GtkWidget * seeders_lb; GtkWidget * seeders_lb;
GtkWidget * leechers_lb; GtkWidget * leechers_lb;
GtkWidget * completed_lb; GtkWidget * completed_lb;
GtkWidget * peer_tree_view;
} }
PeerData; PeerData;
@ -587,6 +584,8 @@ refresh_peers( GtkWidget * top )
fmtpeercount ( p->completed_lb, stat->timesCompleted ); fmtpeercount ( p->completed_lb, stat->timesCompleted );
free( peers ); free( peers );
gtk_widget_queue_draw( p->peer_tree_view );
} }
#if GTK_CHECK_VERSION( 2, 12, 0 ) #if GTK_CHECK_VERSION( 2, 12, 0 )
@ -735,12 +734,14 @@ peer_page_new( TrTorrent * gtor )
m = peer_model_new ( tor ); m = peer_model_new ( tor );
v = GTK_WIDGET( g_object_new( GTK_TYPE_TREE_VIEW, v = GTK_WIDGET( g_object_new( GTK_TYPE_TREE_VIEW,
"model", m, "model", gtk_tree_model_sort_new_with_model( m ),
"rules-hint", TRUE, "rules-hint", TRUE,
#if GTK_CHECK_VERSION( 2, 12, 0 ) #if GTK_CHECK_VERSION( 2, 12, 0 )
"has-tooltip", TRUE, "has-tooltip", TRUE,
#endif #endif
NULL ) ); NULL ) );
p->peer_tree_view = v;
#if GTK_CHECK_VERSION( 2, 12, 0 ) #if GTK_CHECK_VERSION( 2, 12, 0 )
g_signal_connect( v, "query-tooltip", g_signal_connect( v, "query-tooltip",
G_CALLBACK( onPeerViewQueryTooltip ), NULL ); G_CALLBACK( onPeerViewQueryTooltip ), NULL );