diff options
author | Cosimo Cecchi <cosimoc@gnome.org> | 2012-04-18 13:46:39 -0400 |
---|---|---|
committer | Cosimo Cecchi <cosimoc@gnome.org> | 2012-04-18 13:46:39 -0400 |
commit | eea0cb3a68e9848c04c6d49bb725fb1beb315433 (patch) | |
tree | 00960ccd2b792bddcfc74d6dde3a734b09e327a6 /gtk/gtkmessagedialog.c | |
parent | 8febbcaf6a049e5d62a851b76522783bdb43ec94 (diff) | |
download | gtk+-eea0cb3a68e9848c04c6d49bb725fb1beb315433.tar.gz |
messagedialog: don't use gtk_widget_override_font()
Instead of overriding the font theme settings, just set the Pango
attributes we want on the label. This fixes message dialogs growing on
style_update after recent GTK+ changes.
Diffstat (limited to 'gtk/gtkmessagedialog.c')
-rw-r--r-- | gtk/gtkmessagedialog.c | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/gtk/gtkmessagedialog.c b/gtk/gtkmessagedialog.c index 8ead95243f..3cc8053887 100644 --- a/gtk/gtkmessagedialog.c +++ b/gtk/gtkmessagedialog.c @@ -384,25 +384,27 @@ static void setup_primary_label_font (GtkMessageDialog *dialog) { GtkMessageDialogPrivate *priv = dialog->priv; - gint size; - PangoFontDescription *font_desc; - GtkStyleContext *context; - GtkStateFlags state; - - /* unset the font settings */ - gtk_widget_override_font (priv->label, NULL); if (priv->has_secondary_text && !priv->has_primary_markup) { - context = gtk_widget_get_style_context (priv->label); - state = gtk_widget_get_state_flags (priv->label); - - size = pango_font_description_get_size (gtk_style_context_get_font (context, state)); - font_desc = pango_font_description_new (); - pango_font_description_set_weight (font_desc, PANGO_WEIGHT_BOLD); - pango_font_description_set_size (font_desc, size * PANGO_SCALE_LARGE); - gtk_widget_override_font (priv->label, font_desc); - pango_font_description_free (font_desc); + PangoAttrList *attributes; + PangoAttribute *attr; + + attributes = pango_attr_list_new (); + + attr = pango_attr_weight_new (PANGO_WEIGHT_BOLD); + pango_attr_list_insert (attributes, attr); + + attr = pango_attr_scale_new (PANGO_SCALE_LARGE); + pango_attr_list_insert (attributes, attr); + + gtk_label_set_attributes (GTK_LABEL (priv->label), attributes); + pango_attr_list_unref (attributes); + } + else + { + /* unset the font settings */ + gtk_label_set_attributes (GTK_LABEL (priv->label), NULL); } } @@ -1007,7 +1009,5 @@ gtk_message_dialog_style_updated (GtkWidget *widget) MAX (0, border_width - 7)); } - setup_primary_label_font (dialog); - GTK_WIDGET_CLASS (gtk_message_dialog_parent_class)->style_updated (widget); } |