Changeset 13656 for trunk/gtk/filter.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/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);
Note: See TracChangeset for help on using the changeset viewer.