summaryrefslogtreecommitdiff
path: root/gtk/gtkmenuitem.c
diff options
context:
space:
mode:
authorBenjamin Otte <otte@redhat.com>2012-12-06 02:47:24 +0100
committerBenjamin Otte <otte@redhat.com>2012-12-06 02:57:18 +0100
commit7747910b9d9a58bd6a162a497d6cbfd692df132b (patch)
tree11fc4b34078ac6633d7264af0f81e55de154a441 /gtk/gtkmenuitem.c
parenta405c9917c550b72d8805fce9f29e63ccd57e5ed (diff)
downloadgtk+-7747910b9d9a58bd6a162a497d6cbfd692df132b.tar.gz
gtk: Use context's font
Instead of using gtk_style_context_get_font() in pango_context_get_metrics(), use pango_context_get_font_description(). The context contains the font description we are about to use after all.
Diffstat (limited to 'gtk/gtkmenuitem.c')
-rw-r--r--gtk/gtkmenuitem.c12
1 files changed, 2 insertions, 10 deletions
diff --git a/gtk/gtkmenuitem.c b/gtk/gtkmenuitem.c
index e6532bc891..c3f50e1d72 100644
--- a/gtk/gtkmenuitem.c
+++ b/gtk/gtkmenuitem.c
@@ -758,8 +758,6 @@ get_arrow_size (GtkWidget *widget,
gint *size,
gint *spacing)
{
- GtkStyleContext *style_context;
- GtkStateFlags state;
PangoContext *context;
PangoFontMetrics *metrics;
gfloat arrow_scaling;
@@ -776,11 +774,9 @@ get_arrow_size (GtkWidget *widget,
*spacing = arrow_spacing;
context = gtk_widget_get_pango_context (child);
- style_context = gtk_widget_get_style_context (child);
- state = gtk_widget_get_state_flags (child);
metrics = pango_context_get_metrics (context,
- gtk_style_context_get_font (style_context, state),
+ pango_context_get_font_description (context),
pango_context_get_language (context));
*size = (PANGO_PIXELS (pango_font_metrics_get_ascent (metrics) +
@@ -814,19 +810,15 @@ gtk_menu_item_accel_width_foreach (GtkWidget *widget,
static gint
get_minimum_width (GtkWidget *widget)
{
- GtkStyleContext *style_context;
- GtkStateFlags state;
PangoContext *context;
PangoFontMetrics *metrics;
gint width;
gint width_chars;
context = gtk_widget_get_pango_context (widget);
- style_context = gtk_widget_get_style_context (widget);
- state = gtk_widget_get_state_flags (widget);
metrics = pango_context_get_metrics (context,
- gtk_style_context_get_font (style_context, state),
+ pango_context_get_font_description (context),
pango_context_get_language (context));
width = pango_font_metrics_get_approximate_char_width (metrics);