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).
This commit is contained in:
Cosimo Cecchi
2012-03-17 20:14:48 -04:00
committed by Matthew Barnes
parent 52a63c4a63
commit 54553974ca

View File

@ -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 */