summaryrefslogtreecommitdiff
path: root/gtk/gtkfontbutton.c
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2014-08-15 14:10:55 -0400
committerMatthias Clasen <mclasen@redhat.com>2014-08-15 14:15:23 -0400
commite23f7c13b0fd951b89cf545b450ed50889b241dc (patch)
tree0e27c6e76bd017a0a51b34430de14f06a163da15 /gtk/gtkfontbutton.c
parentdd6c2391d2a1c63a7e0f91a7034043ea248ac991 (diff)
downloadgtk+-e23f7c13b0fd951b89cf545b450ed50889b241dc.tar.gz
GtkFontButton: Use the same font name as the font chooser
The font chooser constructs the display name for the font from the family and face names. Do the same in the font button, so we don't end up calling the same font by different names, which would be confusing.
Diffstat (limited to 'gtk/gtkfontbutton.c')
-rw-r--r--gtk/gtkfontbutton.c15
1 files changed, 6 insertions, 9 deletions
diff --git a/gtk/gtkfontbutton.c b/gtk/gtkfontbutton.c
index 734e878e05..22cca740ca 100644
--- a/gtk/gtkfontbutton.c
+++ b/gtk/gtkfontbutton.c
@@ -1142,20 +1142,17 @@ static void
gtk_font_button_update_font_info (GtkFontButton *font_button)
{
GtkFontButtonPrivate *priv = font_button->priv;
+ const gchar *fam_name;
+ const gchar *face_name;
gchar *family_style;
- g_assert (priv->font_desc != NULL);
+ fam_name = pango_font_family_get_name (priv->font_family);
+ face_name = pango_font_face_get_face_name (priv->font_face);
if (priv->show_style)
- {
- PangoFontDescription *desc = pango_font_description_copy_static (priv->font_desc);
-
- pango_font_description_unset_fields (desc, PANGO_FONT_MASK_SIZE);
- family_style = pango_font_description_to_string (desc);
- pango_font_description_free (desc);
- }
+ family_style = g_strconcat (fam_name, " ", face_name, NULL);
else
- family_style = g_strdup (pango_font_description_get_family (priv->font_desc));
+ family_style = g_strdup (fam_name);
gtk_label_set_text (GTK_LABEL (font_button->priv->font_label), family_style);
g_free (family_style);