[gnumeric] GUI: dead kittens.



commit 4f89cf635cc80fc2574a0d151a9307a03a199eb4
Author: Morten Welinder <terra gnome org>
Date:   Fri Apr 29 17:29:53 2016 -0400

    GUI: dead kittens.

 ChangeLog                           |    5 +++++
 NEWS                                |    1 +
 src/dialogs/dialog-about.c          |    2 +-
 src/dialogs/dialog-stf-fixed-page.c |    2 +-
 src/gnm-pane.c                      |    6 +++---
 src/gui-util.c                      |   15 +++++++++++++++
 src/gui-util.h                      |    3 +++
 src/item-bar.c                      |    7 ++++---
 src/item-edit.c                     |    2 +-
 src/item-grid.c                     |    4 ++--
 src/sheet-object-cell-comment.c     |    2 +-
 11 files changed, 37 insertions(+), 12 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index da55b01..300286f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2016-04-29  Morten Welinder  <terra gnome org>
+
+       * src/gui-util.c (gnm_style_context_get_color): Fix function
+       wrapping gtk_style_context_get_color which changed API.
+
 2016-04-24  Morten Welinder  <terra gnome org>
 
        * src/value-sheet.c (value_area_get_x_y): Use
diff --git a/NEWS b/NEWS
index 520dd53..ab852c9 100644
--- a/NEWS
+++ b/NEWS
@@ -9,6 +9,7 @@ Morten:
        * Test suite improvements.
        * Fix value-area problem.  [#765438]
        * Make xlsx shared strings parsing more robust.  [#765544]
+       * Dead kittens.
 
 --------------------------------------------------------------------------
 Gnumeric 1.12.28
diff --git a/src/dialogs/dialog-about.c b/src/dialogs/dialog-about.c
index d9e5dca..f65c966 100644
--- a/src/dialogs/dialog-about.c
+++ b/src/dialogs/dialog-about.c
@@ -267,7 +267,7 @@ text_item_renderer (AboutRenderer *r, AboutState *state)
        y -= height / 2;
 
        cr = r->cr;
-       gtk_style_context_get_color (ctxt, GTK_STATE_FLAG_NORMAL, &color);
+       gnm_style_context_get_color (ctxt, GTK_STATE_FLAG_NORMAL, &color);
        color.alpha = alpha;
        gdk_cairo_set_source_rgba (cr, &color);
        cairo_move_to (cr, x / (double)PANGO_SCALE, y / (double)PANGO_SCALE);
diff --git a/src/dialogs/dialog-stf-fixed-page.c b/src/dialogs/dialog-stf-fixed-page.c
index d4c4054..64d2aee 100644
--- a/src/dialogs/dialog-stf-fixed-page.c
+++ b/src/dialogs/dialog-stf-fixed-page.c
@@ -571,7 +571,7 @@ cb_treeview_draw (GtkWidget *widget,
        context = gtk_widget_get_style_context (GTK_WIDGET (pagedata->dialog));
        gtk_style_context_save (context);
        gtk_style_context_add_region (context, "fixed-format-ruler", 0);
-       gtk_style_context_get_color (context, GTK_STATE_FLAG_NORMAL,
+       gnm_style_context_get_color (context, GTK_STATE_FLAG_NORMAL,
                                     &ruler_color);
        gtk_style_context_restore (context);
 
diff --git a/src/gnm-pane.c b/src/gnm-pane.c
index 1a4fa1e..87aec9d 100644
--- a/src/gnm-pane.c
+++ b/src/gnm-pane.c
@@ -2111,7 +2111,7 @@ gnm_pane_size_guide_start (GnmPane *pane,
        gtk_style_context_add_class (context, colrow_class);
        if (is_colrow_resize)
                gtk_style_context_add_class (context, "end");
-       gtk_style_context_get_color (context, GTK_STATE_FLAG_SELECTED, &rgba);
+       gnm_style_context_get_color (context, GTK_STATE_FLAG_SELECTED, &rgba);
        go_color_from_gdk_rgba (&rgba, &style->line.color);
 
        if (is_colrow_resize) {
@@ -2125,7 +2125,7 @@ gnm_pane_size_guide_start (GnmPane *pane,
                gtk_style_context_add_class (context, guide_class);
                gtk_style_context_add_class (context, colrow_class);
                gtk_style_context_add_class (context, "start");
-               gtk_style_context_get_color (context, GTK_STATE_FLAG_SELECTED, &rgba);
+               gnm_style_context_get_color (context, GTK_STATE_FLAG_SELECTED, &rgba);
                go_color_from_gdk_rgba (&rgba, &style->line.color);
                style->line.width = width;
        }
@@ -2961,7 +2961,7 @@ set_acetate_coords (GnmPane *pane, SheetObject *so, GocItem **ctrl_pts,
                        style->line.width = 0.;
                        style->line.auto_color = FALSE;
                        style->line.color = 0;
-                       gtk_style_context_get_color (context, GTK_STATE_FLAG_NORMAL, &rgba);
+                       gnm_style_context_get_color (context, GTK_STATE_FLAG_NORMAL, &rgba);
                        go_color_from_gdk_rgba (&rgba, &style->line.fore);
                        go_styled_object_set_style (GO_STYLED_OBJECT (item),
                                                    style);
diff --git a/src/gui-util.c b/src/gui-util.c
index d634769..e8abef6 100644
--- a/src/gui-util.c
+++ b/src/gui-util.c
@@ -1338,3 +1338,18 @@ gnm_action_group_add_action (GtkActionGroup *group, GtkAction *act)
         */
        gtk_action_group_add_action_with_accel (group, act, NULL);
 }
+
+void
+gnm_style_context_get_color (GtkStyleContext *context,
+                            GtkStateFlags state,
+                            GdkRGBA *color)
+{
+       // As-of gtk+ 3.20 we have to set the context state to the state
+       // we are querying for.  This ought to work before gtk+ 3.20 too.
+       gtk_style_context_save (context);
+       gtk_style_context_set_state (context, state);
+       gtk_style_context_get_color (context,
+                                    gtk_style_context_get_state (context),
+                                    color);
+       gtk_style_context_restore (context);
+}
diff --git a/src/gui-util.h b/src/gui-util.h
index 37ca160..905d59e 100644
--- a/src/gui-util.h
+++ b/src/gui-util.h
@@ -183,6 +183,9 @@ void gnm_action_group_add_actions (GtkActionGroup *group,
                                   gpointer user);
 void gnm_action_group_add_action (GtkActionGroup *group, GtkAction *act);
 
+void gnm_style_context_get_color (GtkStyleContext *context,
+                                 GtkStateFlags state,
+                                 GdkRGBA *color);
 
 G_END_DECLS
 
diff --git a/src/item-bar.c b/src/item-bar.c
index 9637942..df581e6 100644
--- a/src/item-bar.c
+++ b/src/item-bar.c
@@ -113,16 +113,17 @@ ib_reload_color_style (GnmItemBar *ib)
        GtkStyleContext *context = goc_item_get_style_context (item);
        unsigned ui;
 
-       gtk_style_context_get_color (context, GTK_STATE_FLAG_NORMAL,
+       gnm_style_context_get_color (context, GTK_STATE_FLAG_NORMAL,
                                     &ib->grouping_color);
 
        for (ui = 0; ui < G_N_ELEMENTS (selection_type_flags); ui++) {
                GtkStateFlags state = selection_type_flags[ui];
-               gtk_style_context_get_color
+               gnm_style_context_get_color
                        (context, state, &ib->selection_colors[ui]);
        }
 }
 
+
 static void
 ib_reload_sizing_style (GnmItemBar *ib)
 {
@@ -353,7 +354,7 @@ ib_draw_cell (GnmItemBar const * const ib, cairo_t *cr,
                if (1) {
                        GdkRGBA c;
 
-                       gtk_style_context_get_color (ctxt, selection_type_flags[type], &c);
+                       gnm_style_context_get_color (ctxt, selection_type_flags[type], &c);
                        gdk_cairo_set_source_rgba (cr, &c);
                } else {
                        gdk_cairo_set_source_rgba (cr, &ib->selection_colors[type]);
diff --git a/src/item-edit.c b/src/item-edit.c
index ba31d56..0907e46 100644
--- a/src/item-edit.c
+++ b/src/item-edit.c
@@ -160,7 +160,7 @@ item_edit_draw (GocItem const *item, cairo_t *cr)
        }
 
        /* set the default color */
-       gtk_style_context_get_color (context, GTK_STATE_FLAG_NORMAL, &fcolor);
+       gnm_style_context_get_color (context, GTK_STATE_FLAG_NORMAL, &fcolor);
        gdk_cairo_set_source_rgba (cr, &fcolor);
        color = go_color_from_gdk_rgba (&fcolor, NULL);
 
diff --git a/src/item-grid.c b/src/item-grid.c
index 1e7f964..d9956af 100644
--- a/src/item-grid.c
+++ b/src/item-grid.c
@@ -109,7 +109,7 @@ ig_reload_style (GnmItemGrid *ig)
 
        gtk_style_context_save (context);
        gtk_style_context_add_region (context, "function-marker", 0);
-       gtk_style_context_get_color (context, GTK_STATE_FLAG_NORMAL,
+       gnm_style_context_get_color (context, GTK_STATE_FLAG_NORMAL,
                                     &ig->function_marker_color);
        gtk_style_context_get_border_color (context, state,
                                            &ig->function_marker_border_color);
@@ -117,7 +117,7 @@ ig_reload_style (GnmItemGrid *ig)
 
        gtk_style_context_save (context);
        gtk_style_context_add_region (context, "pane-divider", 0);
-       gtk_style_context_get_color (context, GTK_STATE_FLAG_NORMAL,
+       gnm_style_context_get_color (context, GTK_STATE_FLAG_NORMAL,
                                     &ig->pane_divider_color);
        gtk_style_context_get_border (context, GTK_STATE_FLAG_NORMAL, &border);
        ig->pane_divider_width = border.top;  /* Hack? */
diff --git a/src/sheet-object-cell-comment.c b/src/sheet-object-cell-comment.c
index 51c3e0f..657c479 100644
--- a/src/sheet-object-cell-comment.c
+++ b/src/sheet-object-cell-comment.c
@@ -70,7 +70,7 @@ comment_view_reload_style (CommentView *cv)
        GtkStyleContext *context;
 
        context = goc_item_get_style_context (item);
-       gtk_style_context_get_color (context, GTK_STATE_FLAG_NORMAL,
+       gnm_style_context_get_color (context, GTK_STATE_FLAG_NORMAL,
                                     &cv->comment_indicator_color);
 
        context = gtk_widget_get_style_context (GTK_WIDGET (pane));


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