[gnumeric] Compilation: fix type confusion.



commit f49ccb0513697b4ab5f5129ef21cd83d507afd53
Author: Morten Welinder <terra gnome org>
Date:   Sat Feb 16 14:23:52 2013 -0500

    Compilation: fix type confusion.
    
    Different enums should not be mixed without good reason.

 ChangeLog                                 |    5 +++++
 plugins/excel/xlsx-read.c                 |    3 ++-
 src/dialogs/dialog-about.c                |    6 +++---
 src/dialogs/dialog-cell-format.c          |    2 +-
 src/dialogs/dialog-sheet-resize.c         |    2 +-
 src/dialogs/dialog-so-list.c              |    4 ++--
 src/dialogs/dialog-solver.c               |    2 +-
 src/gnm-pane.c                            |    6 +++---
 src/item-bar.c                            |   12 ++++++------
 src/sheet-control-gui.c                   |    4 ++--
 src/wbc-gtk.c                             |    6 +++---
 src/widgets/gnm-filter-combo-view.c       |    2 +-
 src/widgets/gnumeric-cell-renderer-text.c |    7 ++++---
 src/widgets/widget-editable-label.c       |    4 ++--
 src/widgets/widget-font-selector.c        |    2 +-
 15 files changed, 37 insertions(+), 30 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index a59a8e1..4a63c82 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2013-02-16  Morten Welinder  <terra gnome org>
+
+       * *.c: Clear up confusion between GtkStateType and GtkStateFlags.
+       (Most cases a matter of 0 vs. 0.)
+
 2013-02-16  Jean Brefort  <jean brefort normalesup org>
 
        * schemas/org.gnome.gnumeric.dialogs.gschema.xml.in.in: fixed default value
diff --git a/plugins/excel/xlsx-read.c b/plugins/excel/xlsx-read.c
index 84fd458..02713d4 100644
--- a/plugins/excel/xlsx-read.c
+++ b/plugins/excel/xlsx-read.c
@@ -2229,7 +2229,8 @@ xlsx_cond_fmt_rule_begin (GsfXMLIn *xin, xmlChar const **attrs)
        case XLSX_CF_TYPE_NOT_CONTAINS_BLANKS :
        case XLSX_CF_TYPE_CONTAINS_ERRORS :
        case XLSX_CF_TYPE_NOT_CONTAINS_ERRORS :
-               op = type;
+               /* GnmStyleCondOp and XlsxCFTypes share these. */
+               op = (GnmStyleCondOp)type;
                break;
 
        default :
diff --git a/src/dialogs/dialog-about.c b/src/dialogs/dialog-about.c
index 58bdfc1..4d6dddc 100644
--- a/src/dialogs/dialog-about.c
+++ b/src/dialogs/dialog-about.c
@@ -214,8 +214,8 @@ set_fade (AboutRenderer *r, AboutState *state, double f)
        GdkRGBA col, bg, fg;
        PangoAttribute *attr;
 
-       gtk_style_context_get_color (ctxt, GTK_STATE_NORMAL, &fg);
-       gtk_style_context_get_background_color (ctxt, GTK_STATE_NORMAL, &bg);
+       gtk_style_context_get_color (ctxt, GTK_STATE_FLAG_NORMAL, &fg);
+       gtk_style_context_get_background_color (ctxt, GTK_STATE_FLAG_NORMAL, &bg);
        col = blend_colors (&bg, &fg, f);
        attr = pango_attr_foreground_new
                (col.red * 65535., col.green * 65535., col.blue * 65535.);
@@ -293,7 +293,7 @@ text_item_renderer (AboutRenderer *r, AboutState *state)
        y -= height / 2;
 
        cr = r->cr;
-       gtk_style_context_get_color (ctxt, GTK_STATE_NORMAL, &color);
+       gtk_style_context_get_color (ctxt, GTK_STATE_FLAG_NORMAL, &color);
        gdk_cairo_set_source_rgba (cr, &color);
        cairo_move_to (cr, x / (double)PANGO_SCALE, y / (double)PANGO_SCALE);
        pango_cairo_show_layout (cr, layout);
diff --git a/src/dialogs/dialog-cell-format.c b/src/dialogs/dialog-cell-format.c
index 149cfef..656c6d2 100644
--- a/src/dialogs/dialog-cell-format.c
+++ b/src/dialogs/dialog-cell-format.c
@@ -2244,7 +2244,7 @@ fmt_dialog_impl (FormatState *state, FormatDialogPosition_t pageno)
        fmt_dialog_init_input_msg_page (state);
 
        ctxt = gtk_widget_get_style_context (GTK_WIDGET (state->dialog));
-       gtk_style_context_get_border_color (ctxt, GTK_STATE_NORMAL, &bc);
+       gtk_style_context_get_border_color (ctxt, GTK_STATE_FLAG_NORMAL, &bc);
        default_border_color = GO_COLOR_FROM_GDK_RGBA (bc);
 
        if (pageno == FD_CURRENT)
diff --git a/src/dialogs/dialog-sheet-resize.c b/src/dialogs/dialog-sheet-resize.c
index ee14e40..31c302e 100644
--- a/src/dialogs/dialog-sheet-resize.c
+++ b/src/dialogs/dialog-sheet-resize.c
@@ -179,7 +179,7 @@ dialog_sheet_resize (WBCGtk *wbcg)
                                    GNM_MAX_COLS / GNM_MIN_COLS)) *
                go_pango_measure_string
                (gtk_widget_get_pango_context (GTK_WIDGET (wbcg_toplevel (wbcg))),
-                gtk_style_context_get_font (ctxt, GTK_STATE_NORMAL), "00");
+                gtk_style_context_get_font (ctxt, GTK_STATE_FLAG_NORMAL), "00");
 
        state->columns_scale = go_gtk_builder_get_widget (gui, "columns_scale");
        gtk_widget_set_size_request (state->columns_scale, slider_width, -1);
diff --git a/src/dialogs/dialog-so-list.c b/src/dialogs/dialog-so-list.c
index 410c640..45fb449 100644
--- a/src/dialogs/dialog-so-list.c
+++ b/src/dialogs/dialog-so-list.c
@@ -86,9 +86,9 @@ cb_so_list_response (GtkWidget *dialog, gint response_id, GnmDialogSOList *state
 
                parse_pos_init (&pp, sheet->workbook, sheet, 0, 0);
                output = gnm_expr_entry_parse (state->link_entry,
-                                              &pp, NULL, FALSE, GNM_EE_FORCE_ABS_REF);
+                                              &pp, NULL, FALSE, GNM_EXPR_PARSE_FORCE_ABSOLUTE_REFERENCES);
                content = gnm_expr_entry_parse (state->content_entry,
-                                               &pp, NULL, FALSE, GNM_EE_FORCE_ABS_REF);
+                                               &pp, NULL, FALSE, GNM_EXPR_PARSE_FORCE_ABSOLUTE_REFERENCES);
                cmd_so_set_links (WORKBOOK_CONTROL (state->wbcg), state->so, output, content,
                                  gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON
                                                                (state->as_index_radio)));
diff --git a/src/dialogs/dialog-solver.c b/src/dialogs/dialog-solver.c
index ead2a45..fcbe803 100644
--- a/src/dialogs/dialog-solver.c
+++ b/src/dialogs/dialog-solver.c
@@ -718,7 +718,7 @@ run_solver (SolverState *state, GnmSolverParameters *param)
                        (w,
                         go_pango_measure_string
                         (context,
-                         gtk_style_context_get_font (ctxt, GTK_STATE_NORMAL),
+                         gtk_style_context_get_font (ctxt, GTK_STATE_FLAG_NORMAL),
                          "0") * (5 + GNM_DIG),
                         -1);
                gtk_table_attach_defaults (GTK_TABLE (table),
diff --git a/src/gnm-pane.c b/src/gnm-pane.c
index b21a9aa..42385be 100644
--- a/src/gnm-pane.c
+++ b/src/gnm-pane.c
@@ -665,9 +665,9 @@ gnm_pane_realize (GtkWidget *w)
        /* Set the default background color of the canvas itself to white.
         * This makes the redraws when the canvas scrolls flicker less. */
        ctxt = gtk_widget_get_style_context (w);
-       gtk_style_context_get_background_color (ctxt, GTK_STATE_SELECTED, &rgba);
-       gtk_widget_override_background_color (w, GTK_STATE_NORMAL, &gs_white);
-       gtk_widget_override_background_color (w, GTK_STATE_SELECTED, &rgba);
+       gtk_style_context_get_background_color (ctxt, GTK_STATE_FLAG_SELECTED, &rgba);
+       gtk_widget_override_background_color (w, GTK_STATE_FLAG_NORMAL, &gs_white);
+       gtk_widget_override_background_color (w, GTK_STATE_FLAG_SELECTED, &rgba);
 
        gtk_im_context_set_client_window
                (GNM_PANE (w)->im_context,
diff --git a/src/item-bar.c b/src/item-bar.c
index 00d3a83..ee0462b 100644
--- a/src/item-bar.c
+++ b/src/item-bar.c
@@ -264,7 +264,7 @@ ib_draw_cell (ItemBar const * const ib, cairo_t *cr,
        case COL_ROW_NO_SELECTION:
                font   = ib->normal_font;
                gtk_style_context_set_state (ctxt, GTK_STATE_FLAG_NORMAL);
-               gtk_style_context_get_background_color (ctxt, GTK_STATE_NORMAL, &rgba);
+               gtk_style_context_get_background_color (ctxt, GTK_STATE_FLAG_NORMAL, &rgba);
                color = GO_COLOR_FROM_GDK_RGBA (rgba);
                gtk_style_context_get_color (ctxt, GTK_STATE_FLAG_NORMAL, &rgba);
                font_color = GO_COLOR_FROM_GDK_RGBA (rgba);
@@ -361,7 +361,7 @@ item_bar_draw_region (GocItem const *item, cairo_t *cr, double x_0, double y_0,
 
        gtk_style_context_save (ctxt);
        gtk_style_context_add_class (ctxt, GTK_STYLE_CLASS_BUTTON);
-       gtk_style_context_get_color (ctxt, GTK_STATE_NORMAL, &rgba);
+       gtk_style_context_get_color (ctxt, GTK_STATE_FLAG_NORMAL, &rgba);
        color = GO_COLOR_FROM_GDK_RGBA (rgba);
        goc_canvas_c2w (item->canvas, x_0, y_0, &x0, &y0);
        goc_canvas_c2w (item->canvas, x_1, y_1, &x1, &y1);
@@ -472,7 +472,7 @@ item_bar_draw_region (GocItem const *item, cairo_t *cr, double x_0, double y_0,
                                                                safety = 6 - size;
 
                                                        gtk_style_context_set_state (ctxt, prev_visible ?
-                                                                                    GTK_STATE_NORMAL: 
GTK_STATE_SELECTED);
+                                                                                    GTK_STATE_FLAG_NORMAL: 
GTK_STATE_FLAG_SELECTED);
                                                        gtk_render_frame (ctxt, cr,
                                                                 left, top+safety, size, size);
                                                        if (size > 9) {
@@ -504,7 +504,7 @@ item_bar_draw_region (GocItem const *item, cairo_t *cr, double x_0, double y_0,
 
                                                        right = (rtl ? (total + pixels) : total) - size;
                                                        gtk_style_context_set_state (ctxt, prev_visible ?
-                                                                                    GTK_STATE_NORMAL: 
GTK_STATE_SELECTED);
+                                                                                    GTK_STATE_FLAG_NORMAL: 
GTK_STATE_FLAG_SELECTED);
                                                        gtk_render_frame (ctxt, cr,
                                                                 right, top+safety, size, size);
                                                        if (size > 9) {
@@ -633,7 +633,7 @@ item_bar_draw_region (GocItem const *item, cairo_t *cr, double x_0, double y_0,
                                                        if (rtl)
                                                                left -= size;
                                                        gtk_style_context_set_state (ctxt, prev_visible ?
-                                                                                    GTK_STATE_NORMAL: 
GTK_STATE_SELECTED);
+                                                                                    GTK_STATE_FLAG_NORMAL: 
GTK_STATE_FLAG_SELECTED);
                                                        gtk_render_frame (ctxt, cr,
                                                                left+safety, top, size, size);
                                                        if (size > 9) {
@@ -668,7 +668,7 @@ item_bar_draw_region (GocItem const *item, cairo_t *cr, double x_0, double y_0,
                                                                left -= size;
                                                        bottom = total - size;
                                                        gtk_style_context_set_state (ctxt, prev_visible ?
-                                                                                    GTK_STATE_NORMAL: 
GTK_STATE_SELECTED);
+                                                                                    GTK_STATE_FLAG_NORMAL: 
GTK_STATE_FLAG_SELECTED);
                                                        gtk_render_frame (ctxt,cr,
                                                                 left+safety*dir, bottom, size, size);
                                                        if (size > 9) {
diff --git a/src/sheet-control-gui.c b/src/sheet-control-gui.c
index 5b70d60..e446a1e 100644
--- a/src/sheet-control-gui.c
+++ b/src/sheet-control-gui.c
@@ -618,7 +618,7 @@ cb_select_all_btn_draw (GtkWidget *widget, cairo_t *cr, SheetControlGUI *scg)
 
        /* This should be keep in sync with item_bar_cell code (item-bar.c) */
 
-       gtk_style_context_get_background_color (ctxt, GTK_STATE_ACTIVE, &rgba);
+       gtk_style_context_get_background_color (ctxt, GTK_STATE_FLAG_ACTIVE, &rgba);
        gdk_cairo_set_source_rgba (cr, &rgba);
        cairo_rectangle (cr, offset + 1, 1, a.width - 1, a.height - 1);
        cairo_fill (cr);
@@ -1724,7 +1724,7 @@ sheet_control_gui_new (SheetView *sv, WBCGtk *wbcg)
                sv_attach_control (sv, SHEET_CONTROL (scg));
                if (scg->vs) {
 #warning GTK3: we used GtkStyle::white there */
-                       gtk_widget_override_background_color (scg->vs, GTK_STATE_NORMAL, &gs_white);
+                       gtk_widget_override_background_color (scg->vs, GTK_STATE_FLAG_NORMAL, &gs_white);
                        g_object_set_data (G_OBJECT (scg->vs), "sheet-control", scg);
                        if (sheet->sheet_objects) {
                                /* we need an idle function because not every thing is initialized at this 
point */
diff --git a/src/wbc-gtk.c b/src/wbc-gtk.c
index ad82708..bee655b 100644
--- a/src/wbc-gtk.c
+++ b/src/wbc-gtk.c
@@ -2670,7 +2670,7 @@ wbc_gtk_create_edit_area (WBCGtk *wbcg)
        /* Set a reasonable width for the selection box. */
        len = go_pango_measure_string (
                gtk_widget_get_pango_context (GTK_WIDGET (wbcg_toplevel (wbcg))),
-               gtk_style_context_get_font (gtk_widget_get_style_context (GTK_WIDGET (entry)), 
GTK_STATE_NORMAL),
+               gtk_style_context_get_font (gtk_widget_get_style_context (GTK_WIDGET (entry)), 
GTK_STATE_FLAG_NORMAL),
                cell_coord_name (GNM_MAX_COLS - 1, GNM_MAX_ROWS - 1));
        /*
         * Add a little extra since font might be proportional and since
@@ -4754,13 +4754,13 @@ wbc_gtk_create_status_area (WBCGtk *wbcg)
        gtk_widget_set_size_request (wbcg->auto_expr_label,
                go_pango_measure_string (
                gtk_widget_get_pango_context (GTK_WIDGET (wbcg->toplevel)),
-               gtk_style_context_get_font (gtk_widget_get_style_context (wbcg->auto_expr_label), 
GTK_STATE_NORMAL),
+               gtk_style_context_get_font (gtk_widget_get_style_context (wbcg->auto_expr_label), 
GTK_STATE_FLAG_NORMAL),
                AUTO_EXPR_SAMPLE), -1);
 
        gtk_widget_set_size_request (wbcg->status_text,
                go_pango_measure_string (
                gtk_widget_get_pango_context (GTK_WIDGET (wbcg->toplevel)),
-               gtk_style_context_get_font (gtk_widget_get_style_context (wbcg->status_text), 
GTK_STATE_NORMAL),
+               gtk_style_context_get_font (gtk_widget_get_style_context (wbcg->status_text), 
GTK_STATE_FLAG_NORMAL),
                "W") * 5, -1);
        ebox = GET_GUI_ITEM ("auto_expr_event_box");
        gtk_widget_override_background_color (GTK_WIDGET (ebox),
diff --git a/src/widgets/gnm-filter-combo-view.c b/src/widgets/gnm-filter-combo-view.c
index bd86d08..63b5a8c 100644
--- a/src/widgets/gnm-filter-combo-view.c
+++ b/src/widgets/gnm-filter-combo-view.c
@@ -302,7 +302,7 @@ fcombo_arrow_format (GnmFilterCombo *fcombo, GtkWidget *arrow)
        gtk_arrow_set (GTK_ARROW (arrow),
                fcombo->cond != NULL ? GTK_ARROW_RIGHT : GTK_ARROW_DOWN,
                GTK_SHADOW_IN);
-       gtk_widget_override_color (arrow, GTK_STATE_NORMAL,
+       gtk_widget_override_color (arrow, GTK_STATE_FLAG_NORMAL,
                fcombo->cond != NULL ? &gs_yellow : &gs_black);
 }
 
diff --git a/src/widgets/gnumeric-cell-renderer-text.c b/src/widgets/gnumeric-cell-renderer-text.c
index c1319b7..41f653a 100644
--- a/src/widgets/gnumeric-cell-renderer-text.c
+++ b/src/widgets/gnumeric-cell-renderer-text.c
@@ -62,16 +62,17 @@ gnumeric_cell_renderer_text_render (GtkCellRenderer     *cell,
 
 {
        GtkCellRendererText *celltext = (GtkCellRendererText *) cell;
-       GtkStateType state, frame_state;
+       GtkStateType state;
+       GtkStateFlags frame_state;
 
        if ((flags & GTK_CELL_RENDERER_SELECTED) == GTK_CELL_RENDERER_SELECTED) {
-               frame_state = GTK_STATE_ACTIVE;
+               frame_state = GTK_STATE_FLAG_ACTIVE;
                if (gtk_widget_has_focus (widget))
                        state = GTK_STATE_SELECTED;
                else
                        state = GTK_STATE_ACTIVE;
        } else {
-               frame_state = GTK_STATE_INSENSITIVE;
+               frame_state = GTK_STATE_FLAG_INSENSITIVE;
                if (gtk_widget_get_state (widget) == GTK_STATE_INSENSITIVE)
                        state = GTK_STATE_INSENSITIVE;
                else
diff --git a/src/widgets/widget-editable-label.c b/src/widgets/widget-editable-label.c
index dbd7cc8..ff2d220 100644
--- a/src/widgets/widget-editable-label.c
+++ b/src/widgets/widget-editable-label.c
@@ -385,8 +385,8 @@ editable_label_new (char const *text, GdkRGBA *base_color,
        GtkStyleContext *ctxt = gtk_widget_get_style_context (GTK_WIDGET (el));
        gtk_style_context_save (ctxt);
        gtk_style_context_add_class (ctxt, GTK_STYLE_CLASS_BUTTON);
-       gtk_style_context_get_background_color (ctxt, GTK_STATE_NORMAL, &el->base);
-       gtk_style_context_get_color (ctxt, GTK_STATE_NORMAL, &el->text);
+       gtk_style_context_get_background_color (ctxt, GTK_STATE_FLAG_NORMAL, &el->base);
+       gtk_style_context_get_color (ctxt, GTK_STATE_FLAG_NORMAL, &el->text);
        gtk_style_context_restore (ctxt);
 
        editable_label_set_color (el, base_color, text_color);
diff --git a/src/widgets/widget-font-selector.c b/src/widgets/widget-font-selector.c
index 885c874..6f7437b 100644
--- a/src/widgets/widget-font-selector.c
+++ b/src/widgets/widget-font-selector.c
@@ -393,7 +393,7 @@ fs_init (FontSelector *fs)
        w = g_object_new (GOC_TYPE_CANVAS, NULL);
        fs->font_preview_canvas = GOC_CANVAS (w);
        goc_canvas_scroll_to (fs->font_preview_canvas, 0, 0);
-       gtk_widget_override_background_color (w, GTK_STATE_NORMAL, &gs_white);
+       gtk_widget_override_background_color (w, GTK_STATE_FLAG_NORMAL, &gs_white);
        gtk_widget_show_all (w);
        w = go_gtk_builder_get_widget (fs->gui, "font-preview-frame");
        gtk_container_add (GTK_CONTAINER (w), GTK_WIDGET (fs->font_preview_canvas));


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]