Changeset 7993
- Timestamp:
- Mar 2, 2009, 5:45:08 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gtk/details.c
r7951 r7993 1014 1014 refresh_activity( GtkWidget * top ) 1015 1015 { 1016 Activity * a = g_object_get_data ( G_OBJECT( 1017 top ), "activity-data" ); 1018 char * pch; 1019 char sizeStr[64]; 1020 char sizeStr2[64]; 1021 char buf[128]; 1016 int i; 1017 char * pch; 1018 char buf1[128]; 1019 char buf2[128]; 1020 Activity * a = g_object_get_data ( G_OBJECT( top ), "activity-data" ); 1022 1021 const tr_stat * stat = tr_torrent_stat( a->gtor ); 1023 1022 const tr_info * info = tr_torrent_info( a->gtor ); 1024 const double 1025 const double 1026 const double 1023 const double complete = stat->percentComplete * 100.0; 1024 const double done = stat->percentDone * 100.0; 1025 const double verifiedPieceCount = (double)stat->haveValid / info->pieceSize; 1027 1026 1028 1027 pch = tr_torrent_status_str( a->gtor ); … … 1034 1033 else 1035 1034 /* %1$.1f is percent of how much of what we want's been downloaded, 1036 %2$.1f is percent of how much of the whole torrent we've downloaded 1037 */ 1038 pch = g_strdup_printf( _( 1039 "%1$.1f%% (%2$.1f%% selected)" ), 1035 * %2$.1f is percent of how much of the whole torrent we've downloaded */ 1036 pch = g_strdup_printf( _( "%1$.1f%% (%2$.1f%% selected)" ), 1040 1037 complete, done ); 1041 1038 gtk_label_set_text ( GTK_LABEL( a->progress_lb ), pch ); 1042 1039 g_free ( pch ); 1043 1040 1044 tr_strlsize( sizeStr, stat->haveValid + stat->haveUnchecked, 1045 sizeof( sizeStr ) ); 1046 tr_strlsize( sizeStr2, stat->haveValid, 1047 sizeof( sizeStr2 ) ); 1041 i = (int) ceil( verifiedPieceCount ); 1042 tr_strlsize( buf1, stat->haveValid + stat->haveUnchecked, sizeof( buf1 ) ); 1043 tr_strlsize( buf2, stat->haveValid, sizeof( buf2 ) ); 1048 1044 /* %1$s is total size of what we've saved to disk 1049 %2$s is how much of it's passed the checksum test 1050 %3$s is how many pieces are verified */ 1051 g_snprintf( buf, sizeof( buf ), _( "%1$s (%2$s verified in %3$d pieces)" ), 1052 sizeStr, sizeStr2, (int)ceil(verifiedPieceCount) ); 1053 gtk_label_set_text( GTK_LABEL( a->have_lb ), buf ); 1054 1055 tr_strlsize( sizeStr, stat->downloadedEver, sizeof( sizeStr ) ); 1056 gtk_label_set_text( GTK_LABEL( a->dl_lb ), sizeStr ); 1057 1058 tr_strlsize( sizeStr, stat->uploadedEver, sizeof( sizeStr ) ); 1059 gtk_label_set_text( GTK_LABEL( a->ul_lb ), sizeStr ); 1060 1061 tr_strlsize( sizeStr, stat->corruptEver, sizeof( sizeStr ) ); 1062 gtk_label_set_text( GTK_LABEL( a->failed_lb ), sizeStr ); 1063 1064 tr_strlratio( buf, stat->ratio, sizeof( buf ) ); 1065 gtk_label_set_text( GTK_LABEL( a->ratio_lb ), buf ); 1066 1067 tr_strlspeed( buf, stat->swarmSpeed, sizeof( buf ) ); 1068 gtk_label_set_text ( GTK_LABEL( a->swarm_lb ), buf ); 1045 * %2$s is how much of it's passed the checksum test 1046 * %3$s is how many pieces are verified */ 1047 pch = g_strdup_printf( ngettext( "%1$s (%2$s verified in %3$d piece)", 1048 "%1$s (%2$s verified in %3$d pieces)", i ), 1049 buf1, buf2, i ); 1050 gtk_label_set_text( GTK_LABEL( a->have_lb ), pch ); 1051 g_free( pch ); 1052 1053 tr_strlsize( buf1, stat->downloadedEver, sizeof( buf1 ) ); 1054 gtk_label_set_text( GTK_LABEL( a->dl_lb ), buf1 ); 1055 1056 tr_strlsize( buf1, stat->uploadedEver, sizeof( buf1 ) ); 1057 gtk_label_set_text( GTK_LABEL( a->ul_lb ), buf1 ); 1058 1059 tr_strlsize( buf1, stat->corruptEver, sizeof( buf1 ) ); 1060 gtk_label_set_text( GTK_LABEL( a->failed_lb ), buf1 ); 1061 1062 tr_strlratio( buf1, stat->ratio, sizeof( buf1 ) ); 1063 gtk_label_set_text( GTK_LABEL( a->ratio_lb ), buf1 ); 1064 1065 tr_strlspeed( buf1, stat->swarmSpeed, sizeof( buf1 ) ); 1066 gtk_label_set_text ( GTK_LABEL( a->swarm_lb ), buf1 ); 1069 1067 1070 1068 gtk_label_set_text ( GTK_LABEL( a->err_lb ),
Note: See TracChangeset
for help on using the changeset viewer.