[evince] password: Fix width of dialog on long file names



commit d9af838bd7c61f5de066624c746b7dca02908efe
Author: Germán Poo-Caamaño <gpoo gnome org>
Date:   Mon Jul 9 21:00:22 2018 -0400

    password: Fix width of dialog on long file names
    
    Set a maximum of 64 (arbitrary) characters to the password dialog
    before wrapping the text.
    
    Fallback to CHARS if the words themselves are very long, like in
    file names without spaces.
    
    Fixes #797

 shell/ev-password-view.c | 10 ++++++++++
 1 file changed, 10 insertions(+)
---
diff --git a/shell/ev-password-view.c b/shell/ev-password-view.c
index 1d7d4d44..8fdecdb6 100644
--- a/shell/ev-password-view.c
+++ b/shell/ev-password-view.c
@@ -30,6 +30,9 @@
 #include "ev-keyring.h"
 #include "ev-password-view.h"
 
+/* Define a maximum width in case there is a file with a very long name */
+#define MAX_WIDHT_LABEL 64
+
 enum {
        UNLOCK,
        LAST_SIGNAL
@@ -291,6 +294,13 @@ ev_password_view_ask_password (EvPasswordView *password_view)
                                  _("Password required"),
                                   text);
        gtk_label_set_markup (GTK_LABEL (label), markup);
+
+       /* Prevent big dialog windows when the file name is too long, and
+        * Sometimes_the_file_might_not_have_spaces_to_wrap
+        */
+       gtk_label_set_max_width_chars (GTK_LABEL (label), MAX_WIDHT_LABEL);
+       gtk_label_set_line_wrap_mode (GTK_LABEL (label), PANGO_WRAP_WORD_CHAR);
+
        g_free (text);
        g_free (markup);
        gtk_box_pack_start (GTK_BOX (main_vbox), label,


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]