Changeset 13656


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

fewer redundant gobject dynamic casts

Location:
trunk/gtk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/gtk/filter.c

    r13625 r13656  
    483483    GtkCellRenderer * r;
    484484    GtkTreeModel * cat_model;
     485    GtkCellLayout * c_cell_layout;
     486    GtkComboBox * c_combo_box;
    485487
    486488    /* create the category combobox */
    487489    cat_model = category_filter_model_new (tmodel);
    488490    c = gtk_combo_box_new_with_model (cat_model);
     491    c_combo_box = GTK_COMBO_BOX (c);
     492    c_cell_layout = GTK_CELL_LAYOUT (c);
    489493    g_object_unref (cat_model);
    490     gtk_combo_box_set_row_separator_func (GTK_COMBO_BOX (c),
     494    gtk_combo_box_set_row_separator_func (c_combo_box,
    491495                                          is_it_a_separator, NULL, NULL);
    492     gtk_combo_box_set_active (GTK_COMBO_BOX (c), 0);
     496    gtk_combo_box_set_active (c_combo_box, 0);
    493497
    494498    r = gtk_cell_renderer_pixbuf_new ();
    495     gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (c), r, FALSE);
    496     gtk_cell_layout_set_cell_data_func (GTK_CELL_LAYOUT (c), r,
     499    gtk_cell_layout_pack_start (c_cell_layout, r, FALSE);
     500    gtk_cell_layout_set_cell_data_func (c_cell_layout, r,
    497501                                        render_pixbuf_func, NULL, NULL);
    498     gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (c), r,
     502    gtk_cell_layout_set_attributes (c_cell_layout, r,
    499503                                    "pixbuf", CAT_FILTER_COL_PIXBUF,
    500504                                    NULL);
    501505
    502506    r = gtk_cell_renderer_text_new ();
    503     gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (c), r, FALSE);
    504     gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (c), r,
     507    gtk_cell_layout_pack_start (c_cell_layout, r, FALSE);
     508    gtk_cell_layout_set_attributes (c_cell_layout, r,
    505509                                    "text", CAT_FILTER_COL_NAME,
    506510                                    NULL);
    507     gtk_cell_layout_set_cell_data_func (GTK_CELL_LAYOUT (c), r,
     511    gtk_cell_layout_set_cell_data_func (c_cell_layout, r,
    508512                                        is_capital_sensitive,
    509513                                        NULL, NULL);
     
    511515
    512516    r = number_renderer_new ();
    513     gtk_cell_layout_pack_end (GTK_CELL_LAYOUT (c), r, TRUE);
    514     gtk_cell_layout_set_cell_data_func (GTK_CELL_LAYOUT (c), r,
     517    gtk_cell_layout_pack_end (c_cell_layout, r, TRUE);
     518    gtk_cell_layout_set_cell_data_func (c_cell_layout, r,
    515519                                        render_number_func, NULL, NULL);
    516520
     
    789793    GtkCellRenderer * r;
    790794    GtkTreeModel * activity_model;
     795    GtkComboBox * c_combo_box;
     796    GtkCellLayout * c_cell_layout;
    791797
    792798    activity_model = activity_filter_model_new (tmodel);
    793799    c = gtk_combo_box_new_with_model (activity_model);
     800    c_combo_box = GTK_COMBO_BOX (c);
     801    c_cell_layout = GTK_CELL_LAYOUT (c);
    794802    g_object_unref (activity_model);
    795     gtk_combo_box_set_row_separator_func (GTK_COMBO_BOX (c),
    796                                        activity_is_it_a_separator, NULL, NULL);
    797     gtk_combo_box_set_active (GTK_COMBO_BOX (c), 0);
     803    gtk_combo_box_set_row_separator_func (c_combo_box,
     804                                          activity_is_it_a_separator, NULL, NULL);
     805    gtk_combo_box_set_active (c_combo_box, 0);
    798806
    799807    r = gtk_cell_renderer_pixbuf_new ();
    800     gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (c), r, FALSE);
    801     gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (c), r,
     808    gtk_cell_layout_pack_start (c_cell_layout, r, FALSE);
     809    gtk_cell_layout_set_attributes (c_cell_layout, r,
    802810                                    "stock-id", ACTIVITY_FILTER_COL_STOCK_ID,
    803811                                    NULL);
    804     gtk_cell_layout_set_cell_data_func (GTK_CELL_LAYOUT (c), r,
     812    gtk_cell_layout_set_cell_data_func (c_cell_layout, r,
    805813                                        render_activity_pixbuf_func, NULL, NULL);
    806814
    807815    r = gtk_cell_renderer_text_new ();
    808     gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (c), r, TRUE);
    809     gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (c), r,
     816    gtk_cell_layout_pack_start (c_cell_layout, r, TRUE);
     817    gtk_cell_layout_set_attributes (c_cell_layout, r,
    810818                                    "text", ACTIVITY_FILTER_COL_NAME,
    811819                                    NULL);
    812820
    813821    r = number_renderer_new ();
    814     gtk_cell_layout_pack_end (GTK_CELL_LAYOUT (c), r, TRUE);
    815     gtk_cell_layout_set_cell_data_func (GTK_CELL_LAYOUT (c), r,
     822    gtk_cell_layout_pack_end (c_cell_layout, r, TRUE);
     823    gtk_cell_layout_set_cell_data_func (c_cell_layout, r,
    816824                                        render_number_func, NULL, NULL);
    817825
     
    964972    GtkWidget * activity;
    965973    GtkWidget * category;
     974    GtkBox * h_box;
    966975    const char * str;
    967976    struct filter_data * data;
     
    990999
    9911000    h = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, GUI_PAD_SMALL);
     1001    h_box = GTK_BOX (h);
    9921002
    9931003    /* add the activity combobox */
     
    9971007    gtk_label_set_markup_with_mnemonic (GTK_LABEL (l), str);
    9981008    gtk_label_set_mnemonic_widget (GTK_LABEL (l), w);
    999     gtk_box_pack_start (GTK_BOX (h), l, FALSE, FALSE, 0);
    1000     gtk_box_pack_start (GTK_BOX (h), w, TRUE, TRUE, 0);
     1009    gtk_box_pack_start (h_box, l, FALSE, FALSE, 0);
     1010    gtk_box_pack_start (h_box, w, TRUE, TRUE, 0);
    10011011
    10021012    /* add a spacer */
    10031013    w = gtk_alignment_new (0.0f, 0.0f, 0.0f, 0.0f);
    10041014    gtk_widget_set_size_request (w, 0u, GUI_PAD_BIG);
    1005     gtk_box_pack_start (GTK_BOX (h), w, FALSE, FALSE, 0);
     1015    gtk_box_pack_start (h_box, w, FALSE, FALSE, 0);
    10061016
    10071017    /* add the category combobox */
    10081018    w = category;
    1009     gtk_box_pack_start (GTK_BOX (h), w, TRUE, TRUE, 0);
     1019    gtk_box_pack_start (h_box, w, TRUE, TRUE, 0);
    10101020
    10111021    /* add a spacer */
    10121022    w = gtk_alignment_new (0.0f, 0.0f, 0.0f, 0.0f);
    10131023    gtk_widget_set_size_request (w, 0u, GUI_PAD_BIG);
    1014     gtk_box_pack_start (GTK_BOX (h), w, FALSE, FALSE, 0);
     1024    gtk_box_pack_start (h_box, w, FALSE, FALSE, 0);
    10151025
    10161026    /* add the entry field */
     
    10181028    gtk_entry_set_icon_from_stock (GTK_ENTRY (s), GTK_ENTRY_ICON_SECONDARY, GTK_STOCK_CLEAR);
    10191029    g_signal_connect (s, "icon-release", G_CALLBACK (entry_clear), NULL);
    1020     gtk_box_pack_start (GTK_BOX (h), s, TRUE, TRUE, 0);
     1030    gtk_box_pack_start (h_box, s, TRUE, TRUE, 0);
    10211031
    10221032    g_signal_connect (s, "changed", G_CALLBACK (filter_entry_changed), data->filter_model);
  • 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);
  • trunk/gtk/tr-window.c

    r13625 r13656  
    5252    GtkWidget *           status;
    5353    GtkWidget *           status_menu;
    54     GtkWidget *           ul_lb;
    55     GtkWidget *           dl_lb;
    56     GtkWidget *           stats_lb;
    57     GtkWidget *           gutter_lb;
     54    GtkLabel *           ul_lb;
     55    GtkLabel *           dl_lb;
     56    GtkLabel *           stats_lb;
     57    GtkLabel *           gutter_lb;
    5858    GtkWidget *           alt_speed_image;
    5959    GtkWidget *           alt_speed_button;
     
    413413    int i, n;
    414414    GtkWidget *w, *m;
     415    GtkMenuShell * menu_shell;
    415416    const int speeds_KBps[] = { 5, 10, 20, 30, 40, 50, 75, 100, 150, 200, 250, 500, 750 };
    416417
    417418    m = gtk_menu_new ();
     419    menu_shell = GTK_MENU_SHELL (m);
    418420
    419421    w = gtk_radio_menu_item_new_with_label (NULL, _("Unlimited"));
     
    422424    g_object_set_data (G_OBJECT (w), ENABLED_KEY, GINT_TO_POINTER (FALSE));
    423425    g_signal_connect (w, "toggled", G_CALLBACK (onSpeedToggled), p);
    424     gtk_menu_shell_append (GTK_MENU_SHELL (m), w);
     426    gtk_menu_shell_append (menu_shell, w);
    425427
    426428    w = gtk_radio_menu_item_new_with_label_from_widget (GTK_RADIO_MENU_ITEM (w), "");
     
    429431    g_object_set_data (G_OBJECT (w), ENABLED_KEY, GINT_TO_POINTER (TRUE));
    430432    g_signal_connect (w, "toggled", G_CALLBACK (onSpeedToggled), p);
    431     gtk_menu_shell_append (GTK_MENU_SHELL (m), w);
     433    gtk_menu_shell_append (menu_shell, w);
    432434
    433435    w = gtk_separator_menu_item_new ();
    434     gtk_menu_shell_append (GTK_MENU_SHELL (m), w);
     436    gtk_menu_shell_append (menu_shell, w);
    435437
    436438    for (i=0, n=G_N_ELEMENTS (speeds_KBps); i<n; ++i)
     
    442444        g_object_set_data (G_OBJECT (w), SPEED_KEY, GINT_TO_POINTER (speeds_KBps[i]));
    443445        g_signal_connect (w, "activate", G_CALLBACK (onSpeedSet), p);
    444         gtk_menu_shell_append (GTK_MENU_SHELL (m), w);
     446        gtk_menu_shell_append (menu_shell, w);
    445447    }
    446448
     
    480482{
    481483    int i, n;
    482     GtkWidget *m, *w;
     484    GtkWidget *m, *w;
     485    GtkMenuShell * menu_shell;
    483486
    484487    m = gtk_menu_new ();
     488    menu_shell = GTK_MENU_SHELL (m);
    485489
    486490    w = gtk_radio_menu_item_new_with_label (NULL, _("Seed Forever"));
     
    488492    g_object_set_data (G_OBJECT (w), ENABLED_KEY, GINT_TO_POINTER (FALSE));
    489493    g_signal_connect (w, "toggled", G_CALLBACK (onRatioToggled), p);
    490     gtk_menu_shell_append (GTK_MENU_SHELL (m), w);
     494    gtk_menu_shell_append (menu_shell, w);
    491495
    492496    w = gtk_radio_menu_item_new_with_label_from_widget (GTK_RADIO_MENU_ITEM (w), "");
     
    494498    g_object_set_data (G_OBJECT (w), ENABLED_KEY, GINT_TO_POINTER (TRUE));
    495499    g_signal_connect (w, "toggled", G_CALLBACK (onRatioToggled), p);
    496     gtk_menu_shell_append (GTK_MENU_SHELL (m), w);
     500    gtk_menu_shell_append (menu_shell, w);
    497501
    498502    w = gtk_separator_menu_item_new ();
    499     gtk_menu_shell_append (GTK_MENU_SHELL (m), w);
     503    gtk_menu_shell_append (menu_shell, w);
    500504
    501505    for (i=0, n=G_N_ELEMENTS (stockRatios); i<n; ++i)
     
    506510        g_object_set_data (G_OBJECT (w), RATIO_KEY, GINT_TO_POINTER (i));
    507511        g_signal_connect (w, "activate", G_CALLBACK (onRatioSet), p);
    508         gtk_menu_shell_append (GTK_MENU_SHELL (m), w);
     512        gtk_menu_shell_append (menu_shell, w);
    509513    }
    510514
     
    521525    GtkWidget * m;
    522526    GtkWidget * top = gtk_menu_new ();
     527    GtkMenuShell * menu_shell = GTK_MENU_SHELL (top);
    523528
    524529    m = gtk_menu_item_new_with_label (_("Limit Download Speed"));
    525530    gtk_menu_item_set_submenu (GTK_MENU_ITEM (m), createSpeedMenu (p, TR_DOWN));
    526     gtk_menu_shell_append (GTK_MENU_SHELL (top), m);
     531    gtk_menu_shell_append (menu_shell, m);
    527532
    528533    m = gtk_menu_item_new_with_label (_("Limit Upload Speed"));
    529534    gtk_menu_item_set_submenu (GTK_MENU_ITEM (m), createSpeedMenu (p, TR_UP));
    530     gtk_menu_shell_append (GTK_MENU_SHELL (top), m);
     535    gtk_menu_shell_append (menu_shell, m);
    531536
    532537    m = gtk_separator_menu_item_new ();
    533     gtk_menu_shell_append (GTK_MENU_SHELL (top), m);
     538    gtk_menu_shell_append (menu_shell, m);
    534539
    535540    m = gtk_menu_item_new_with_label (_("Stop Seeding at Ratio"));
    536541    gtk_menu_item_set_submenu (GTK_MENU_ITEM (m), createRatioMenu (p));
    537     gtk_menu_shell_append (GTK_MENU_SHELL (top), m);
     542    gtk_menu_shell_append (menu_shell, m);
    538543
    539544    gtk_widget_show_all (top);
     
    586591    const char  * pch;
    587592    PrivateData * p;
     593    GtkWidget   * ul_lb, * dl_lb;
    588594    GtkWidget   * mainmenu, *toolbar, *filter, *list, *status;
    589595    GtkWidget   * vbox, *w, *self, *h, *hbox, *menu;
     
    669675        gtk_box_pack_start (GTK_BOX (h), w, 0, 0, 0);
    670676
    671         w = p->gutter_lb = gtk_label_new ("N Torrents");
    672         gtk_label_set_single_line_mode (GTK_LABEL (w), TRUE);
     677        w = gtk_label_new ("N Torrents");
     678        p->gutter_lb = GTK_LABEL (w);
     679        gtk_label_set_single_line_mode (p->gutter_lb, TRUE);
    673680        gtk_box_pack_start (GTK_BOX (h), w, 1, 1, GUI_PAD);
    674681
     
    677684            gtk_widget_set_size_request (w, GUI_PAD, 0u);
    678685            gtk_box_pack_start (GTK_BOX (hbox), w, FALSE, FALSE, 0);
    679             w = p->ul_lb = gtk_label_new (NULL);
    680             gtk_label_set_single_line_mode (GTK_LABEL (w), TRUE);
     686            w = ul_lb = gtk_label_new (NULL);
     687            p->ul_lb = GTK_LABEL (w);
     688            gtk_label_set_single_line_mode (p->ul_lb, TRUE);
    681689            gtk_box_pack_start (GTK_BOX (hbox), w, FALSE, FALSE, 0);
    682690            w = gtk_image_new_from_stock (GTK_STOCK_GO_UP, GTK_ICON_SIZE_MENU);
     
    688696            gtk_widget_set_size_request (w, GUI_PAD, 0u);
    689697            gtk_box_pack_start (GTK_BOX (hbox), w, FALSE, FALSE, 0);
    690             w = p->dl_lb = gtk_label_new (NULL);
    691             gtk_label_set_single_line_mode (GTK_LABEL (w), TRUE);
     698            w = dl_lb = gtk_label_new (NULL);
     699            p->dl_lb = GTK_LABEL (w);
     700            gtk_label_set_single_line_mode (p->dl_lb, TRUE);
    692701            gtk_box_pack_start (GTK_BOX (hbox), w, FALSE, FALSE, 0);
    693702            w = gtk_image_new_from_stock (GTK_STOCK_GO_DOWN, GTK_ICON_SIZE_MENU);
     
    702711            g_signal_connect (w, "clicked", G_CALLBACK (onYinYangReleased), p);
    703712            gtk_box_pack_start (GTK_BOX (hbox), w, FALSE, FALSE, 0);
    704             w = p->stats_lb = gtk_label_new (NULL);
    705             gtk_label_set_single_line_mode (GTK_LABEL (w), TRUE);
     713            w = gtk_label_new (NULL);
     714            p->stats_lb = GTK_LABEL (w);
     715            gtk_label_set_single_line_mode (p->stats_lb, TRUE);
    706716            gtk_box_pack_end (GTK_BOX (hbox), w, FALSE, FALSE, 0);
    707717        gtk_box_pack_end (GTK_BOX (h), hbox, FALSE, FALSE, 0);
     
    728738        int w=0, h=0;
    729739        PangoLayout * pango_layout;
    730         pango_layout = gtk_widget_create_pango_layout (p->ul_lb, "999.99 kB/s");
     740        pango_layout = gtk_widget_create_pango_layout (ul_lb, "999.99 kB/s");
    731741        pango_layout_get_pixel_size (pango_layout, &w, &h);
    732         gtk_widget_set_size_request (p->ul_lb, w, h);
    733         gtk_widget_set_size_request (p->dl_lb, w, h);
    734         gtk_misc_set_alignment (GTK_MISC (p->ul_lb), 1.0, 0.5);
    735         gtk_misc_set_alignment (GTK_MISC (p->dl_lb), 1.0, 0.5);
     742        gtk_widget_set_size_request (ul_lb, w, h);
     743        gtk_widget_set_size_request (dl_lb, w, h);
     744        gtk_misc_set_alignment (GTK_MISC (ul_lb), 1.0, 0.5);
     745        gtk_misc_set_alignment (GTK_MISC (dl_lb), 1.0, 0.5);
    736746        g_object_unref (G_OBJECT (pango_layout));
    737747    }
     
    759769updateTorrentCount (PrivateData * p)
    760770{
    761     if (p && p->core)
    762     {
    763         char      buf[512];
    764         const int torrentCount = gtk_tree_model_iter_n_children (gtr_core_model (p->core), NULL);
    765         const int visibleCount = gtk_tree_model_iter_n_children (p->filter_model, NULL);
    766 
    767         if (!torrentCount)
    768             *buf = '\0';
    769         else if (torrentCount != visibleCount)
    770             g_snprintf (buf, sizeof (buf),
    771                         ngettext ("%1$'d of %2$'d Torrent",
    772                                   "%1$'d of %2$'d Torrents",
    773                                   torrentCount),
    774                         visibleCount, torrentCount);
    775         else
    776             g_snprintf (buf, sizeof (buf),
    777                         ngettext ("%'d Torrent", "%'d Torrents", torrentCount),
    778                         torrentCount);
    779         gtr_label_set_text (GTK_LABEL (p->gutter_lb), buf);
     771  if (p && p->core)
     772    {
     773      char buf[512];
     774      const int torrentCount = gtk_tree_model_iter_n_children (gtr_core_model (p->core), NULL);
     775      const int visibleCount = gtk_tree_model_iter_n_children (p->filter_model, NULL);
     776
     777      if (!torrentCount)
     778        *buf = '\0';
     779      else if (torrentCount != visibleCount)
     780        g_snprintf (buf, sizeof (buf),
     781                    ngettext ("%1$'d of %2$'d Torrent",
     782                              "%1$'d of %2$'d Torrents",
     783                              torrentCount),
     784                    visibleCount, torrentCount);
     785      else
     786        g_snprintf (buf, sizeof (buf),
     787                    ngettext ("%'d Torrent", "%'d Torrents", torrentCount),
     788                    torrentCount);
     789
     790      gtr_label_set_text (p->gutter_lb, buf);
    780791    }
    781792}
     
    825836        g_snprintf (buf, sizeof (buf), _("Ratio: %s"), ratio);
    826837    }
    827     gtr_label_set_text (GTK_LABEL (p->stats_lb), buf);
     838    gtr_label_set_text (p->stats_lb, buf);
    828839}
    829840
     
    852863
    853864        tr_formatter_speed_KBps (buf, down, sizeof (buf));
    854         gtr_label_set_text (GTK_LABEL (p->dl_lb), buf);
     865        gtr_label_set_text (p->dl_lb, buf);
    855866
    856867        tr_formatter_speed_KBps (buf, up, sizeof (buf));
    857         gtr_label_set_text (GTK_LABEL (p->ul_lb), buf);
     868        gtr_label_set_text (p->ul_lb, buf);
    858869    }
    859870}
Note: See TracChangeset for help on using the changeset viewer.