Changeset 13656 for trunk/gtk/stats.c


Ignore:
Timestamp:
Dec 13, 2012, 3:00:57 AM (9 years ago)
Author:
jordan
Message:

fewer redundant gobject dynamic casts

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gtk/stats.c

    r13625 r13656  
    2121enum
    2222{
    23     TR_RESPONSE_RESET = 1
     23  TR_RESPONSE_RESET = 1
    2424};
    2525
    2626struct stat_ui
    2727{
    28     GtkWidget *  one_up_lb;
    29     GtkWidget *  one_down_lb;
    30     GtkWidget *  one_ratio_lb;
    31     GtkWidget *  one_time_lb;
    32     GtkWidget *  all_up_lb;
    33     GtkWidget *  all_down_lb;
    34     GtkWidget *  all_ratio_lb;
    35     GtkWidget *  all_time_lb;
    36     GtkWidget *  all_sessions_lb;
    37     TrCore *     core;
     28  GtkLabel * one_up_lb;
     29  GtkLabel * one_down_lb;
     30  GtkLabel * one_ratio_lb;
     31  GtkLabel * one_time_lb;
     32
     33  GtkLabel * all_up_lb;
     34  GtkLabel * all_down_lb;
     35  GtkLabel * all_ratio_lb;
     36  GtkLabel * all_time_lb;
     37
     38  GtkLabel * all_sessions_lb;
     39
     40  TrCore * core;
    3841};
    3942
    4043static void
    41 setLabel (GtkWidget *  w, const char * str)
     44setLabel (GtkLabel * l, const char * str)
    4245{
    43     gtr_label_set_text (GTK_LABEL (w), str);
     46  gtr_label_set_text (l, str);
    4447}
    4548
    4649static void
    47 setLabelFromRatio (GtkWidget * w, double d)
     50setLabelFromRatio (GtkLabel * l, double d)
    4851{
    4952    char buf[128];
    5053
    5154    tr_strlratio (buf, d, sizeof (buf));
    52     setLabel (w, buf);
     55    setLabel (l, buf);
    5356}
    5457
     
    148151
    149152    hig_workarea_add_section_title (t, &row, _("Current Session"));
    150     l = ui->one_up_lb = gtk_label_new (NULL);
    151     gtk_label_set_single_line_mode (GTK_LABEL (l), TRUE);
     153    l = gtk_label_new (NULL);
     154    ui->one_up_lb = GTK_LABEL (l);
     155    gtk_label_set_single_line_mode (ui->one_up_lb, TRUE);
    152156    hig_workarea_add_row (t, &row, _("Uploaded:"), l, NULL);
    153     l = ui->one_down_lb = gtk_label_new (NULL);
    154     gtk_label_set_single_line_mode (GTK_LABEL (l), TRUE);
     157    l = gtk_label_new (NULL);
     158    ui->one_down_lb = GTK_LABEL (l);
     159    gtk_label_set_single_line_mode (ui->one_down_lb, TRUE);
    155160    hig_workarea_add_row (t, &row, _("Downloaded:"), l, NULL);
    156     l = ui->one_ratio_lb = gtk_label_new (NULL);
    157     gtk_label_set_single_line_mode (GTK_LABEL (l), TRUE);
     161    l = gtk_label_new (NULL);
     162    ui->one_ratio_lb = GTK_LABEL (l);
     163    gtk_label_set_single_line_mode (ui->one_ratio_lb, TRUE);
    158164    hig_workarea_add_row (t, &row, _("Ratio:"), l, NULL);
    159     l = ui->one_time_lb = gtk_label_new (NULL);
    160     gtk_label_set_single_line_mode (GTK_LABEL (l), TRUE);
     165    l = gtk_label_new (NULL);
     166    ui->one_time_lb = GTK_LABEL (l);
     167    gtk_label_set_single_line_mode (ui->one_time_lb, TRUE);
    161168    hig_workarea_add_row (t, &row, _("Duration:"), l, NULL);
    162169    hig_workarea_add_section_divider (t, &row);
    163170    hig_workarea_add_section_title (t, &row, _("Total"));
    164     l = ui->all_sessions_lb = gtk_label_new (_("Started %'d time"));
    165     gtk_label_set_single_line_mode (GTK_LABEL (l), TRUE);
     171    l = gtk_label_new (_("Started %'d time"));
     172    ui->all_sessions_lb = GTK_LABEL (l);
     173    gtk_label_set_single_line_mode (ui->all_sessions_lb, TRUE);
    166174    hig_workarea_add_label_w (t, row++, l);
    167     l = ui->all_up_lb = gtk_label_new (NULL);
    168     gtk_label_set_single_line_mode (GTK_LABEL (l), TRUE);
     175    l = gtk_label_new (NULL);
     176    ui->all_up_lb = GTK_LABEL (l);
     177    gtk_label_set_single_line_mode (ui->all_up_lb, TRUE);
    169178    hig_workarea_add_row (t, &row, _("Uploaded:"), l, NULL);
    170     l = ui->all_down_lb = gtk_label_new (NULL);
    171     gtk_label_set_single_line_mode (GTK_LABEL (l), TRUE);
     179    l = gtk_label_new (NULL);
     180    ui->all_down_lb = GTK_LABEL (l);
     181    gtk_label_set_single_line_mode (ui->all_down_lb, TRUE);
    172182    hig_workarea_add_row (t, &row, _("Downloaded:"), l, NULL);
    173     l = ui->all_ratio_lb = gtk_label_new (NULL);
    174     gtk_label_set_single_line_mode (GTK_LABEL (l), TRUE);
     183    l = gtk_label_new (NULL);
     184    ui->all_ratio_lb = GTK_LABEL (l);
     185    gtk_label_set_single_line_mode (ui->all_ratio_lb, TRUE);
    175186    hig_workarea_add_row (t, &row, _("Ratio:"), l, NULL);
    176     l = ui->all_time_lb = gtk_label_new (NULL);
    177     gtk_label_set_single_line_mode (GTK_LABEL (l), TRUE);
     187    l = gtk_label_new (NULL);
     188    ui->all_time_lb = GTK_LABEL (l);
     189    gtk_label_set_single_line_mode (ui->all_time_lb, TRUE);
    178190    hig_workarea_add_row (t, &row, _("Duration:"), l, NULL);
    179191    gtr_dialog_set_content (GTK_DIALOG (d), t);
Note: See TracChangeset for help on using the changeset viewer.