Long filename increased password dialog box
Submitted by emi..@..ra.com
Link to original bug (#785322)
Description
Created attachment 356243 Long Filename
Overview:
Password protected PDFs with long filenames cause the password dialog box to increase in width. This occurs with these types of filenames:
This is a very long filename name that increases the size of the dialog box.pdf
This_is_a_very_long_filename_name_that_increases_the_size_of_the_dialog_box.pdf
Underscores in the filename preclude the wrapping of the filename to the next line if the filename outgrows the natural window boundaries.
Steps to Reproduce:
- Use any password protected PDF with a long filename.
Actual Results:
- Dialog box increases its width to match the filename's length
- Evince window cuts off the filename because it cannot wrap long filenames with underscores
Expected Results:
- Keep the dialog box width constant while either ellipsizing or wrapping the filename
- Ellipsize or wrap the filename
PROPOSED SOLUTION:
Please bear with me and let me know if the thought process is correct.
ev-password-view.c, lines 296-305
label = gtk_label_new (NULL);
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
gtk_label_set_line_wrap (GTK_LABEL (label), TRUE);
file_name = g_file_get_basename (password_view->priv->uri_file);
text = g_markup_printf_escaped (_("The document “%s” is locked and requires a password before it can be opened."),
file_name);
markup = g_strdup_printf ("<span size=\"larger\" weight=\"bold\">%s`</span>`\n\n%s",
_("Password required"),
text);
gtk_label_set_markup (GTK_LABEL (label), markup);
For the password dialog box, move the filename outside of the g_markup_printf_escaped
and g_strdup_printf
and allow the box to manage the filename as it seems fit.
For the window container and dialog box, if the underscore filename exists wrap it as you would with spaces.
Attachment 356243, "Long Filename":
Version: git master