Changeset 12092


Ignore:
Timestamp:
Mar 4, 2011, 3:49:51 PM (11 years ago)
Author:
jordan
Message:

(trunk gtk) copyediting.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gtk/stats.c

    r12068 r12092  
    3939
    4040static void
    41 setLabel( GtkWidget *  w,
    42           const char * str )
     41setLabel( GtkWidget *  w, const char * str )
    4342{
    4443    gtr_label_set_text( GTK_LABEL( w ), str );
     
    4645
    4746static void
    48 setLabelFromRatio( GtkWidget * w,
    49                    double      d )
     47setLabelFromRatio( GtkWidget * w, double d )
    5048{
    5149    char buf[128];
     
    5856updateStats( gpointer gdata )
    5957{
    60     const char *     fmt;
    61     char             buf[128];
    62 
     58    char buf[128];
     59    const char * fmt;
     60    tr_session_stats one, all;
     61    const size_t buflen = sizeof( buf );
    6362    struct stat_ui * ui = gdata;
    64     tr_session_stats one, all;
    6563
    6664    tr_sessionGetStats( gtr_core_session( ui->core ), &one );
    6765    tr_sessionGetCumulativeStats( gtr_core_session( ui->core ), &all );
    6866
    69     setLabel( ui->one_up_lb,
    70              tr_strlsize( buf, one.uploadedBytes, sizeof( buf ) ) );
    71     setLabel( ui->one_down_lb,
    72              tr_strlsize( buf, one.downloadedBytes, sizeof( buf ) ) );
    73     setLabel( ui->one_time_lb,
    74              tr_strltime( buf, one.secondsActive, sizeof( buf ) ) );
     67    setLabel( ui->one_up_lb, tr_strlsize( buf, one.uploadedBytes, buflen ) );
     68    setLabel( ui->one_down_lb, tr_strlsize( buf, one.downloadedBytes, buflen ) );
     69    setLabel( ui->one_time_lb, tr_strltime( buf, one.secondsActive, buflen ) );
    7570    setLabelFromRatio( ui->one_ratio_lb, one.ratio );
    7671
    7772    fmt = gtr_ngettext( "Started %'d time", "Started %'d times",
    7873                        (int)all.sessionCount );
    79     g_snprintf( buf, sizeof( buf ), fmt, (int)all.sessionCount );
     74    g_snprintf( buf, buflen, fmt, (int)all.sessionCount );
    8075    setLabel( ui->all_sessions_lb, buf );
    81     setLabel( ui->all_up_lb,
    82              tr_strlsize( buf, all.uploadedBytes, sizeof( buf ) ) );
    83     setLabel( ui->all_down_lb,
    84              tr_strlsize( buf, all.downloadedBytes, sizeof( buf ) ) );
    85     setLabel( ui->all_time_lb,
    86              tr_strltime( buf, all.secondsActive, sizeof( buf ) ) );
     76    setLabel( ui->all_up_lb, tr_strlsize( buf, all.uploadedBytes, buflen ) );
     77    setLabel( ui->all_down_lb, tr_strlsize( buf, all.downloadedBytes, buflen ) );
     78    setLabel( ui->all_time_lb, tr_strltime( buf, all.secondsActive, buflen ) );
    8779    setLabelFromRatio( ui->all_ratio_lb, all.ratio );
    8880
     
    9183
    9284static void
    93 dialogDestroyed( gpointer         p,
    94                  GObject * dialog UNUSED )
     85dialogDestroyed( gpointer p, GObject * dialog UNUSED )
    9586{
    9687    g_source_remove( GPOINTER_TO_UINT( p ) );
     
    9889
    9990static void
    100 dialogResponse( GtkDialog * dialog,
    101                 gint        response,
    102                 gpointer    gdata )
     91dialogResponse( GtkDialog * dialog, gint response, gpointer gdata )
    10392{
    10493    struct stat_ui * ui = gdata;
     
    130119
    131120    if( response == GTK_RESPONSE_CLOSE )
    132     {
    133121        gtk_widget_destroy( GTK_WIDGET( dialog ) );
    134     }
    135122}
    136123
     
    138125gtr_stats_dialog_new( GtkWindow * parent, TrCore * core )
    139126{
    140     guint            i;
    141     int              row = 0;
    142     GtkWidget *      d;
    143     GtkWidget *      t;
    144     GtkWidget *      l;
     127    guint i;
     128    GtkWidget * d;
     129    GtkWidget * t;
     130    GtkWidget * l;
     131    int row = 0;
    145132    struct stat_ui * ui = g_new0( struct stat_ui, 1 );
    146133
     
    200187    return d;
    201188}
    202 
Note: See TracChangeset for help on using the changeset viewer.