diff options
author | António Fernandes <antoniof@gnome.org> | 2021-01-06 00:57:28 +0000 |
---|---|---|
committer | António Fernandes <antoniof@gnome.org> | 2021-01-08 12:34:19 +0000 |
commit | d2be38db9011fd831527f5c040c82cfd2a9b0dfd (patch) | |
tree | bf1f4b28b5719a7ade9f12c583660a4832da996f | |
parent | ed6b8de612790b33b5d6c6448f8ae4c5ec0743fa (diff) | |
download | nautilus-d2be38db9011fd831527f5c040c82cfd2a9b0dfd.tar.gz |
file-conflict-dialog: Set max width for labels
Files with very long names, or verbose translations, can make this
dialog window too large.
To ensure a sane width, set a maximum width for the labels.
Fixes https://bugzilla.gnome.org/show_bug.cgi?id=786701 as well as the
issue reported in https://gitlab.gnome.org/GNOME/nautilus/-/issues/1727#note_998181
-rw-r--r-- | src/nautilus-file-conflict-dialog.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/nautilus-file-conflict-dialog.c b/src/nautilus-file-conflict-dialog.c index fdcaf2d81..c0a6ab9ec 100644 --- a/src/nautilus-file-conflict-dialog.c +++ b/src/nautilus-file-conflict-dialog.c @@ -55,6 +55,8 @@ struct _NautilusFileConflictDialog G_DEFINE_TYPE (NautilusFileConflictDialog, nautilus_file_conflict_dialog, GTK_TYPE_DIALOG); +#define MAX_LABEL_WIDTH 50 + void nautilus_file_conflict_dialog_set_text (NautilusFileConflictDialog *fcd, gchar *primary_text, @@ -67,6 +69,7 @@ nautilus_file_conflict_dialog_set_text (NautilusFileConflictDialog *fcd, gtk_label_set_line_wrap (GTK_LABEL (label), TRUE); gtk_label_set_line_wrap_mode (GTK_LABEL (label), PANGO_WRAP_WORD_CHAR); gtk_label_set_xalign (GTK_LABEL (label), 0.0); + gtk_label_set_max_width_chars (GTK_LABEL (label), MAX_LABEL_WIDTH); gtk_box_pack_start (GTK_BOX (fcd->titles_vbox), label, FALSE, FALSE, 0); gtk_widget_show (label); @@ -79,7 +82,9 @@ nautilus_file_conflict_dialog_set_text (NautilusFileConflictDialog *fcd, label = gtk_label_new (secondary_text); gtk_label_set_line_wrap (GTK_LABEL (label), TRUE); + gtk_label_set_line_wrap_mode (GTK_LABEL (label), PANGO_WRAP_WORD_CHAR); gtk_label_set_xalign (GTK_LABEL (label), 0.0); + gtk_label_set_max_width_chars (GTK_LABEL (label), MAX_LABEL_WIDTH); gtk_box_pack_start (GTK_BOX (fcd->titles_vbox), label, FALSE, FALSE, 0); gtk_widget_show (label); } |