[gnumeric] GUI: Fix drawing of the select-all button.



commit 529305c2263414021bfd449e640adcb91d525ffc
Author: Morten Welinder <terra gnome org>
Date:   Mon Mar 25 12:49:36 2013 -0400

    GUI: Fix drawing of the select-all button.

 ChangeLog               |    3 +++
 NEWS                    |    1 +
 src/gnumeric.css        |    7 +++++++
 src/item-bar.c          |    7 +++----
 src/item-bar.h          |    2 +-
 src/sheet-control-gui.c |   20 ++++++++++----------
 6 files changed, 25 insertions(+), 15 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 6f85e3d..a23883d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2013-03-25  Morten Welinder  <terra gnome org>
 
+       * src/sheet-control-gui.c (cb_select_all_btn_draw): Fix drawing of
+       the "all" button.
+
        * src/item-bar.c (ib_reload_style): Load fonts from style.
 
 2013-03-24  Morten Welinder  <terra gnome org>
diff --git a/NEWS b/NEWS
index 8956a69..1f211f5 100644
--- a/NEWS
+++ b/NEWS
@@ -6,6 +6,7 @@ Morten:
        * Embed more artwork.
        * Plug leaks.
        * Introspection improvements.
+       * Fix drawing of the select-all button.
 
 --------------------------------------------------------------------------
 Gnumeric 1.12.1
diff --git a/src/gnumeric.css b/src/gnumeric.css
index 67f00b0..8ca91b8 100644
--- a/src/gnumeric.css
+++ b/src/gnumeric.css
@@ -41,6 +41,13 @@ ItemBar:hover {
 }
 
 /* ------------------------------------------------------------------------- */
+/* This GtkDrawingArea is the select-all button above the row buttons.  */
+
+GtkDrawingArea all-button {
+}
+
+/* ------------------------------------------------------------------------- */
+
 /* GnmNotebook is a fake notebook holding just the sheet tabs area */
 
 GnmNotebook tab {
diff --git a/src/item-bar.c b/src/item-bar.c
index 6e8b9b2..e375523 100644
--- a/src/item-bar.c
+++ b/src/item-bar.c
@@ -226,13 +226,12 @@ item_bar_calc_size (ItemBar *ib)
  * item_bar_normal_font:
  * @ib: #ItemBar
  *
- * Returns: (transfer none): the bar normal font.
+ * Returns: (transfer full): the bar normal font.
  **/
-PangoFont *
+PangoFontDescription *
 item_bar_normal_font (ItemBar const *ib)
 {
-       /* Really? */
-       return ib->selection_fonts[COL_ROW_NO_SELECTION];
+       return pango_font_describe (ib->selection_fonts[COL_ROW_NO_SELECTION]);
 }
 
 int
diff --git a/src/item-bar.h b/src/item-bar.h
index 0c5d9a7..14c6e39 100644
--- a/src/item-bar.h
+++ b/src/item-bar.h
@@ -16,7 +16,7 @@ GType    item_bar_get_type    (void);
 int      item_bar_calc_size    (ItemBar *ib);
 int      item_bar_group_size   (ItemBar const *ib, int max_outline);
 int      item_bar_indent       (ItemBar const *ib);
-PangoFont *item_bar_normal_font        (ItemBar const *ib);
+PangoFontDescription *item_bar_normal_font (ItemBar const *ib);
 
 G_END_DECLS
 
diff --git a/src/sheet-control-gui.c b/src/sheet-control-gui.c
index fd6a638..4134804 100644
--- a/src/sheet-control-gui.c
+++ b/src/sheet-control-gui.c
@@ -336,7 +336,7 @@ scg_setup_group_buttons (SheetControlGUI *scg, unsigned max_outline,
                                           "is_cols", GINT_TO_POINTER (1));
        }
 
-       font_desc = pango_font_describe (item_bar_normal_font (ib));
+       font_desc = item_bar_normal_font (ib);
 
        /* size all of the button so things work after a zoom */
        for (i = 0 ; i < btns->len ; i++) {
@@ -611,20 +611,20 @@ cb_select_all_btn_draw (GtkWidget *widget, cairo_t *cr, SheetControlGUI *scg)
 {
        int offset = scg_sheet (scg)->text_is_rtl ? -1 : 0;
        GtkAllocation a;
-       GdkRGBA rgba;
        GtkStyleContext *ctxt = gtk_widget_get_style_context (widget);
 
+       gtk_style_context_save (ctxt);
+       gtk_style_context_add_class (ctxt, GTK_STYLE_CLASS_BUTTON);
+       gtk_style_context_set_state (ctxt, GTK_STATE_FLAG_NORMAL);
+       gtk_style_context_add_region (ctxt, "all-button", 0);
+
        gtk_widget_get_allocation (widget, &a);
 
-       /* This should be keep in sync with item_bar_cell code (item-bar.c) */
+       gtk_render_background (ctxt, cr, offset + 1, 1,
+                              a.width - 1, a.height - 1);
+       gtk_render_frame (ctxt, cr, offset, 0, a.width + 1, a.height + 1);
 
-       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);
-#warning GTK3: how do we select the shadow type there, see also item-bar.c
-       gtk_render_frame (gtk_widget_get_style_context (widget), cr,
-                         offset, 0, a.width + 1, a.height + 1);
+       gtk_style_context_restore (ctxt);
 }
 
 static gboolean


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