mirror of
https://github.com/transmission/transmission
synced 2024-12-25 01:03:01 +00:00
(gtk) reduce the load a little bit more when all the rows are selected.
This commit is contained in:
parent
60fb68cb7a
commit
6c562a770d
2 changed files with 10 additions and 14 deletions
14
gtk/main.c
14
gtk/main.c
|
@ -159,19 +159,17 @@ struct counts_data
|
|||
};
|
||||
|
||||
static void
|
||||
accumulateStatusForeach (GtkTreeModel * model,
|
||||
accumulateStatusForeach( GtkTreeModel * model,
|
||||
GtkTreePath * path UNUSED,
|
||||
GtkTreeIter * iter,
|
||||
gpointer user_data )
|
||||
{
|
||||
int status = 0;
|
||||
struct counts_data * counts = user_data;
|
||||
tr_torrent * tor;
|
||||
|
||||
++counts->totalCount;
|
||||
|
||||
gtk_tree_model_get( model, iter, MC_TORRENT_RAW, &tor, -1 );
|
||||
status = tr_torrentStat( tor )->status;
|
||||
gtk_tree_model_get( model, iter, MC_STATUS, &status, -1 );
|
||||
|
||||
if( TR_STATUS_IS_ACTIVE( status ) )
|
||||
++counts->activeCount;
|
||||
|
@ -185,11 +183,9 @@ accumulateCanUpdateForeach (GtkTreeModel * model,
|
|||
GtkTreeIter * iter,
|
||||
gpointer accumulated_status)
|
||||
{
|
||||
TrTorrent * gtor = NULL;
|
||||
gtk_tree_model_get( model, iter, MC_TORRENT, >or, -1 );
|
||||
*(int*)accumulated_status |=
|
||||
tr_torrentCanManualUpdate( tr_torrent_handle( gtor ) );
|
||||
g_object_unref( G_OBJECT( gtor ) );
|
||||
tr_torrent * tor;
|
||||
gtk_tree_model_get( model, iter, MC_TORRENT_RAW, &tor, -1 );
|
||||
*(int*)accumulated_status |= tr_torrentCanManualUpdate( tor );
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
@ -254,10 +254,10 @@ compareByState( GtkTreeModel * model,
|
|||
GtkTreeIter * b,
|
||||
gpointer user_data UNUSED )
|
||||
{
|
||||
tr_torrent *ta, *tb;
|
||||
gtk_tree_model_get( model, a, MC_TORRENT_RAW, &ta, -1 );
|
||||
gtk_tree_model_get( model, b, MC_TORRENT_RAW, &tb, -1 );
|
||||
return tr_torrentStatCached(ta)->status - tr_torrentStatCached(tb)->status;
|
||||
int sa, sb;
|
||||
gtk_tree_model_get( model, a, MC_STATUS, &sa, -1 );
|
||||
gtk_tree_model_get( model, b, MC_STATUS, &sb, -1 );
|
||||
return sa - sb;
|
||||
}
|
||||
|
||||
static int
|
||||
|
@ -654,7 +654,7 @@ update_foreach( GtkTreeModel * model,
|
|||
MC_STATUS, &oldStatus,
|
||||
-1 );
|
||||
|
||||
torStat = tr_torrentStat( tr_torrent_handle( gtor ) );
|
||||
torStat = tr_torrent_stat( gtor );
|
||||
|
||||
if( oldStatus != (int) torStat->status )
|
||||
gtk_list_store_set( GTK_LIST_STORE( model ), iter,
|
||||
|
|
Loading…
Reference in a new issue