inspector: Limit the width of readonly properties

For readonly properties, we show the serialized value
in a label. If we don't take precautions, this can cause
our window to grow extremely wide, and break things.
So, ellipsize things at a reasonable size.

Fixes: #3278
This commit is contained in:
Matthias Clasen 2020-11-17 13:33:59 -05:00
parent 714e5c72f6
commit 34d547a2aa

View File

@ -1551,6 +1551,11 @@ constructed (GObject *object)
if (!can_modify)
{
label = gtk_label_new ("");
gtk_label_set_ellipsize (GTK_LABEL (label), PANGO_ELLIPSIZE_END);
gtk_label_set_max_width_chars (GTK_LABEL (label), 20);
gtk_label_set_xalign (GTK_LABEL (label), 0.0);
gtk_widget_set_hexpand (label, TRUE);
gtk_widget_set_halign (label, GTK_ALIGN_FILL);
gtk_widget_add_css_class (label, "dim-label");
gtk_box_append (GTK_BOX (box), label);