From 54553974cabc283b16c8e2be49ee481ac7d1bfde Mon Sep 17 00:00:00 2001 From: Cosimo Cecchi Date: Sat, 17 Mar 2012 20:14:48 -0400 Subject: [PATCH] Bug 671509 (2/2) - Some small UI/theming improvements table-header: use gtk_widget_create_pango_context() for header buttons Since we temporarily set custom style classes for the header button on the table's style context, we cannot rely on the PangoContext used by gtk_widget_create_pango_layout(), since the font values it will use are cached by GtkWidget. By creating a new PangoContext and using that to create our Pango layout, the text we render will correctly support the properties specified by the theme (such as bold column-header buttons as specified by Adwaita). --- widgets/table/e-table-header-utils.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/widgets/table/e-table-header-utils.c b/widgets/table/e-table-header-utils.c index 038a44a938..e3d4ced22c 100644 --- a/widgets/table/e-table-header-utils.c +++ b/widgets/table/e-table-header-utils.c @@ -131,6 +131,7 @@ e_table_header_draw_button (cairo_t *cr, gint inner_x, inner_y; gint inner_width, inner_height; gint arrow_width = 0, arrow_height = 0; + PangoContext *pango_context; PangoLayout *layout; GtkStyleContext *context; GtkBorder padding; @@ -200,7 +201,11 @@ e_table_header_draw_button (cairo_t *cr, return; /* nothing else fits */ } - layout = gtk_widget_create_pango_layout (widget, ecol->text); + pango_context = gtk_widget_create_pango_context (widget); + layout = pango_layout_new (pango_context); + g_object_unref (pango_context); + + pango_layout_set_text (layout, ecol->text, -1); pango_layout_set_ellipsize (layout, PANGO_ELLIPSIZE_END); /* Pixbuf or label */