Changeset 3586
- Timestamp:
- Oct 26, 2007, 11:29:18 PM (15 years ago)
- Location:
- branches/0.9x
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/0.9x/gtk/main.c
r3486 r3586 165 165 fatalsig(int sig); 166 166 167 struct counts_data 168 { 169 int totalCount; 170 int activeCount; 171 int inactiveCount; 172 }; 173 167 174 static void 168 175 accumulateStatusForeach (GtkTreeModel * model, 169 176 GtkTreePath * path UNUSED, 170 177 GtkTreeIter * iter, 171 gpointer accumulated_status)178 gpointer user_data ) 172 179 { 173 180 int status = 0; 181 struct counts_data * counts = user_data; 182 183 ++counts->totalCount; 184 174 185 gtk_tree_model_get( model, iter, MC_STAT, &status, -1 ); 175 *(int*)accumulated_status |= status; 186 if( TR_STATUS_IS_ACTIVE( status ) ) 187 ++counts->activeCount; 188 else 189 ++counts->inactiveCount; 176 190 } 177 191 … … 192 206 refreshTorrentActions( GtkTreeSelection * s ) 193 207 { 194 int status = 0; 195 gtk_tree_selection_selected_foreach( s, accumulateStatusForeach, &status ); 196 action_sensitize( "pause-torrent", TR_STATUS_IS_ACTIVE(status) ); 197 action_sensitize( "start-torrent", !TR_STATUS_IS_ACTIVE(status) ); 198 action_sensitize( "remove-torrent", status != 0); 199 action_sensitize( "verify-torrent", status != 0); 200 action_sensitize( "show-torrent-details", status != 0); 201 202 status = 0; 203 gtk_tree_selection_selected_foreach( s, accumulateCanUpdateForeach, &status ); 204 action_sensitize( "update-tracker", status != 0); 208 int canUpdate; 209 struct counts_data counts; 210 211 counts.activeCount = 0; 212 counts.inactiveCount = 0; 213 counts.totalCount = 0; 214 gtk_tree_selection_selected_foreach( s, accumulateStatusForeach, &counts ); 215 action_sensitize( "pause-torrent", counts.activeCount!=0 ); 216 action_sensitize( "start-torrent", counts.inactiveCount!=0 ); 217 action_sensitize( "remove-torrent", counts.totalCount!=0 ); 218 action_sensitize( "verify-torrent", counts.totalCount!=0 ); 219 action_sensitize( "show-torrent-details", counts.totalCount!=0 ); 220 221 canUpdate = 0; 222 gtk_tree_selection_selected_foreach( s, accumulateCanUpdateForeach, &canUpdate ); 223 action_sensitize( "update-tracker", canUpdate!=0 ); 205 224 } 206 225 -
branches/0.9x/libtransmission/transmission.c
r3573 r3586 323 323 free( h->tag ); 324 324 free( h ); 325 fprintf( stderr, "libtransmission closed cleanly.\n" );326 325 } 327 326
Note: See TracChangeset
for help on using the changeset viewer.