X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fui%2Fgui%2Fpsppire-dict.c;h=f491ebff7161c71a6064eb25172c2752cca07434;hb=bdb47a82fa02e10352fe188e3b4a67d5f637424c;hp=3bc39e40959c61a6f9db9d1d895d84d9a2d479d7;hpb=656e46ed80e20bf34312f01607a7bebdd2d8d622;p=pspp diff --git a/src/ui/gui/psppire-dict.c b/src/ui/gui/psppire-dict.c index 3bc39e4095..f491ebff71 100644 --- a/src/ui/gui/psppire-dict.c +++ b/src/ui/gui/psppire-dict.c @@ -99,6 +99,22 @@ gi (GListModel *list, guint id) gtk_button_set_label (GTK_BUTTON (button), var_get_name (v)); gtk_widget_set_tooltip_text (button, var_get_label (v)); + + PangoRectangle rect; + + PangoContext *context = gtk_widget_create_pango_context (button); + PangoLayout *layout = pango_layout_new (context); + + pango_layout_set_text (layout, "M", 1); + + pango_layout_get_extents (layout, NULL, &rect); + + g_object_unref (G_OBJECT (layout)); + g_object_unref (G_OBJECT (context)); + + gtk_widget_set_size_request (button, + var_get_display_width (v) * rect.width / PANGO_SCALE, + -1); } return button;