From: Charles Kerr Date: Sun, 19 Dec 2010 09:33:02 +0000 (+0000) Subject: (trunk gtk) #3838 "Unselected active torrents not counted for quit check" -- fixed. X-Git-Tag: 2.20b1~178 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=5bf05ab31b6cc6745c3dc156fa469423a1a51a66;p=transmission (trunk gtk) #3838 "Unselected active torrents not counted for quit check" -- fixed. --- diff --git a/gtk/main.c b/gtk/main.c index eb99b6d37..a2d9b2677 100644 --- a/gtk/main.c +++ b/gtk/main.c @@ -339,8 +339,8 @@ refreshActions( gpointer gdata ) } { - const int total = tr_core_get_torrent_count( data->core ); - const int active = tr_core_get_active_torrent_count( data->core ); + const size_t total = tr_core_get_torrent_count( data->core ); + const size_t active = tr_core_get_active_torrent_count( data->core ); action_sensitize( "pause-all-torrents", active != 0 ); action_sensitize( "start-all-torrents", active != total ); } @@ -964,13 +964,8 @@ toggleMainWindow( struct cbdata * cbdata ) static gboolean shouldConfirmBeforeExiting( struct cbdata * data ) { - if( !pref_flag_get( PREF_KEY_ASKQUIT ) ) - return FALSE; - else { - struct counts_data counts; - getTorrentCounts( data, &counts ); - return counts.activeCount > 0; - } + return pref_flag_get( PREF_KEY_ASKQUIT ) + && tr_core_get_active_torrent_count( data->core ); } static void diff --git a/gtk/tr-core.c b/gtk/tr-core.c index 90838b6da..008b01644 100644 --- a/gtk/tr-core.c +++ b/gtk/tr-core.c @@ -1761,18 +1761,18 @@ tr_core_torrent_changed( TrCore * core, int id ) while( gtk_tree_model_iter_next( model, &iter ) ); } -int +size_t tr_core_get_torrent_count( TrCore * core ) { return gtk_tree_model_iter_n_children( tr_core_model( core ), NULL ); } -int +size_t tr_core_get_active_torrent_count( TrCore * core ) { GtkTreeIter iter; GtkTreeModel * model = tr_core_model( core ); - int activeCount = 0; + size_t activeCount = 0; if( gtk_tree_model_get_iter_first( model, &iter ) ) do { diff --git a/gtk/tr-core.h b/gtk/tr-core.h index 880c70fde..08244d4df 100644 --- a/gtk/tr-core.h +++ b/gtk/tr-core.h @@ -83,9 +83,9 @@ GtkTreeModel * tr_core_model( TrCore * self ); tr_session * tr_core_session( TrCore * self ); -int tr_core_get_active_torrent_count( TrCore * self ); +size_t tr_core_get_active_torrent_count( TrCore * self ); -int tr_core_get_torrent_count( TrCore * self ); +size_t tr_core_get_torrent_count( TrCore * self ); /****** *******