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

Bug#479325: cdebconf-gtk-entropy: minor usability issues



tag 479325 + patch
thanks

On Sun, May 04, 2008 at 12:40:21PM +0200, Frans Pop wrote:
> I've just tried out the entropy gathering in the graphical frontend, and it 
> seems to work great. However, I do have a few minor nitpicks.
> 
> * The text "You can speed up..." seems to have some hardcoded line feeds in
>   it, which means its not using the full width of the display as other
>   dialogs do.
> * The progress bar is missing a percentage indicator. However, that's really
>   a general issue in the graphical installer. I seem to miss it here more
>   than elsewhere though.
> * When entering character using the keyboard, cdebconf-newt-entropy will
>   periodically clear the text box so that it does not "overflow". The
>   gtk variant currently lacks that.

All of them should be addressed in the attached patch.  Could you please
confirm this?

Cheers,
-- 
Jérémy Bobbio                        .''`. 
lunar@debian.org                    : :Ⓐ  :  # apt-get install anarchism
                                    `. `'` 
                                      `-   
commit 86375ad7b7f59ca045358b3a3f881af16fdd418e
Author: Jérémy Bobbio <lunar@debian.org>
Date:   Mon May 5 22:42:12 2008 +0000

    Display the help text in a similar way than descriptions
    
    The help text is now displayed by the GTK+ entropy plugin with the same
    widget (and thus style) as normal extended descriptions.
    
    This slightly improve usability by adding more coherence to the interface.

diff --git a/packages/cdebconf-entropy/debian/changelog b/packages/cdebconf-entropy/debian/changelog
index fd8046a..60e87b2 100644
--- a/packages/cdebconf-entropy/debian/changelog
+++ b/packages/cdebconf-entropy/debian/changelog
@@ -1,3 +1,11 @@
+cdebconf-entropy (0.8) UNRELEASED; urgency=low
+
+  * Fix minor usability issues in the GTK+ plugin:
+    - Display the help text in a similar way than normal extended
+      descriptions.
+
+ -- Jérémy Bobbio <lunar@debian.org>  Mon, 05 May 2008 22:38:24 +0000
+
 cdebconf-entropy (0.7) unstable; urgency=low
 
   * Rename newt entropy plugin from "entropy-text" to "entropy".
diff --git a/packages/cdebconf-entropy/gtk-plugin-entropy.c b/packages/cdebconf-entropy/gtk-plugin-entropy.c
index d61a58d..41a41a0 100644
--- a/packages/cdebconf-entropy/gtk-plugin-entropy.c
+++ b/packages/cdebconf-entropy/gtk-plugin-entropy.c
@@ -51,7 +51,11 @@ static void handle_continue(GtkWidget * button, struct entropy * entropy_data)
 static gboolean add_help_text(struct entropy * entropy_data,
                               GtkWidget * container)
 {
-    GtkWidget * label;
+    GtkWidget * view;
+    GtkTextBuffer * buffer;
+    GtkTextIter start;
+    GtkTextIter end;
+    GtkStyle * style;
     char * help_text;
 
     help_text = cdebconf_gtk_get_text(
@@ -59,14 +63,27 @@ static gboolean add_help_text(struct entropy * entropy_data,
         "You can help speed up the process by entering random characters on "
         "the keyboard or by moving the mouse randomly, or just wait until "
         "enough key data has been collected (which can take a long time).");
-    label = gtk_label_new(help_text);
+    /* XXX: check NULL! */
+    view = gtk_text_view_new();
+    /* XXX: check NULL! */
+    buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(view));
+    gtk_text_buffer_set_text(buffer, help_text, -1 /* until '\0' */);
     g_free(help_text);
-
-    gtk_label_set_line_wrap(GTK_LABEL(label), TRUE);
-    gtk_misc_set_alignment(GTK_MISC(label), 0 /* left */, 0 /* top */);
-    gtk_box_pack_start(GTK_BOX(container), label, FALSE /* no expand */,
-                       TRUE /* fill */, DEFAULT_PADDING);
-
+    gtk_text_view_set_editable(GTK_TEXT_VIEW(view), FALSE);
+    gtk_text_view_set_cursor_visible(GTK_TEXT_VIEW(view), FALSE);
+    gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW(view), GTK_WRAP_WORD_CHAR);
+    gtk_text_view_set_left_margin(GTK_TEXT_VIEW(view), DEFAULT_PADDING);
+    gtk_text_view_set_right_margin(GTK_TEXT_VIEW(view), DEFAULT_PADDING);
+    gtk_text_buffer_create_tag(buffer, "italic", "style",
+                               PANGO_STYLE_ITALIC, NULL);
+    gtk_text_buffer_get_start_iter(buffer, &start);
+    gtk_text_buffer_get_end_iter(buffer, &end);
+    gtk_text_buffer_apply_tag_by_name(buffer, "italic", &start, &end);
+    style = gtk_widget_get_style(entropy_data->continue_button);
+    gtk_widget_modify_base(view, GTK_STATE_NORMAL, style->bg);
+    gtk_box_pack_start(GTK_BOX(container), view,
+                       FALSE /* don't expand */, FALSE /* don't fill */,
+                       DEFAULT_PADDING);
     return TRUE;
 }
 

commit bea3986ab2551aece06432fd900d6d6e0ddb626e
Author: Jérémy Bobbio <lunar@debian.org>
Date:   Mon May 5 22:53:56 2008 +0000

    Display a completion percentage while gathering entropy
    
    In the GTK+ plugin, a percentage is now displayed as progress bar text.
    This percentage is still replaced by the success message once enough
    entropy has been gathered.
    
    This should help users to keep faith that enough entropy will be gathered
    at some point, hence improving usability a bit.

diff --git a/packages/cdebconf-entropy/debian/changelog b/packages/cdebconf-entropy/debian/changelog
index 60e87b2..e65bf04 100644
--- a/packages/cdebconf-entropy/debian/changelog
+++ b/packages/cdebconf-entropy/debian/changelog
@@ -3,6 +3,7 @@ cdebconf-entropy (0.8) UNRELEASED; urgency=low
   * Fix minor usability issues in the GTK+ plugin:
     - Display the help text in a similar way than normal extended
       descriptions.
+    - Display a completion percentage while gathering entropy.
 
  -- Jérémy Bobbio <lunar@debian.org>  Mon, 05 May 2008 22:38:24 +0000
 
diff --git a/packages/cdebconf-entropy/gtk-plugin-entropy.c b/packages/cdebconf-entropy/gtk-plugin-entropy.c
index 41a41a0..a4d510a 100644
--- a/packages/cdebconf-entropy/gtk-plugin-entropy.c
+++ b/packages/cdebconf-entropy/gtk-plugin-entropy.c
@@ -171,12 +171,26 @@ static GtkWidget * create_entropy_widget(struct entropy * entropy_data)
 
 static void refresh_progress_bar(struct entropy * entropy_data)
 {
+    gdouble fraction;
+    gchar * label;
+
+    fraction = (gdouble) entropy_data->bytes_read /
+               (gdouble) entropy_data->keysize;
+    if (1.0 <= fraction) {
+        label = cdebconf_gtk_get_text(
+            entropy_data->fe, entropy_data->success_template,
+            "Key data has been created successfully.");
+    } else {
+        label = g_strdup_printf("%2.0f%%", fraction * 100.0);
+    }
     gdk_threads_enter();
     gtk_progress_bar_set_fraction(
         GTK_PROGRESS_BAR(entropy_data->progress_bar),
-        (gdouble) entropy_data->bytes_read /
-        (gdouble) entropy_data->keysize);
+        fraction);
+    gtk_progress_bar_set_text(GTK_PROGRESS_BAR(entropy_data->progress_bar),
+                              label);
     gdk_threads_leave();
+    g_free(label);
 }
 
 static gboolean move_byte(struct entropy * entropy_data)
@@ -201,14 +215,6 @@ static gboolean move_byte(struct entropy * entropy_data)
 
 static void allow_continue(struct entropy * entropy_data)
 {
-    gchar * label;
-
-    label = cdebconf_gtk_get_text(
-        entropy_data->fe, entropy_data->success_template,
-        "Key data has been created successfully.");
-    gtk_progress_bar_set_text(
-        GTK_PROGRESS_BAR(entropy_data->progress_bar), label);
-    g_free(label);
     gtk_widget_set_sensitive(entropy_data->continue_button, TRUE);
 }
 

commit de2cc09b0a90bb9655190656f2685b72418580a9
Author: Jérémy Bobbio <lunar@debian.org>
Date:   Mon May 5 22:58:13 2008 +0000

    Disallow entering more character once enough entropy has been gathered
    
    In the GTK+ plugin, the text entry is now disabled once enough entropy has
    been gathered.  This improves usability a little bit by giving the user a
    more visual feedback that the job has been done.

diff --git a/packages/cdebconf-entropy/debian/changelog b/packages/cdebconf-entropy/debian/changelog
index e65bf04..5254399 100644
--- a/packages/cdebconf-entropy/debian/changelog
+++ b/packages/cdebconf-entropy/debian/changelog
@@ -4,6 +4,7 @@ cdebconf-entropy (0.8) UNRELEASED; urgency=low
     - Display the help text in a similar way than normal extended
       descriptions.
     - Display a completion percentage while gathering entropy.
+    - Disallow entering more character once enough entropy has been gathered.
 
  -- Jérémy Bobbio <lunar@debian.org>  Mon, 05 May 2008 22:38:24 +0000
 
diff --git a/packages/cdebconf-entropy/gtk-plugin-entropy.c b/packages/cdebconf-entropy/gtk-plugin-entropy.c
index a4d510a..ed46fc8 100644
--- a/packages/cdebconf-entropy/gtk-plugin-entropy.c
+++ b/packages/cdebconf-entropy/gtk-plugin-entropy.c
@@ -215,6 +215,7 @@ static gboolean move_byte(struct entropy * entropy_data)
 
 static void allow_continue(struct entropy * entropy_data)
 {
+    gtk_widget_set_sensitive(entropy_data->entry, FALSE);
     gtk_widget_set_sensitive(entropy_data->continue_button, TRUE);
 }
 

commit 3488611755251da5e09c497300bc19418cf33064
Author: Jérémy Bobbio <lunar@debian.org>
Date:   Mon May 5 23:04:15 2008 +0000

    Reset text entry after gathering more entropy
    
    In the GTK+ plugin, the text entry is now reset each time more entropy
    bytes have been read.  All plugins now behave the same in this way, hence
    improve consistency.
    
    This last usability improvement allows us to close #479325.

diff --git a/packages/cdebconf-entropy/debian/changelog b/packages/cdebconf-entropy/debian/changelog
index 5254399..8bd95bf 100644
--- a/packages/cdebconf-entropy/debian/changelog
+++ b/packages/cdebconf-entropy/debian/changelog
@@ -1,10 +1,11 @@
 cdebconf-entropy (0.8) UNRELEASED; urgency=low
 
-  * Fix minor usability issues in the GTK+ plugin:
+  * Fix minor usability issues in the GTK+ plugin:            (Closes: #479325)
     - Display the help text in a similar way than normal extended
       descriptions.
     - Display a completion percentage while gathering entropy.
     - Disallow entering more character once enough entropy has been gathered.
+    - Reset text entry after gathering more entropy.
 
  -- Jérémy Bobbio <lunar@debian.org>  Mon, 05 May 2008 22:38:24 +0000
 
diff --git a/packages/cdebconf-entropy/gtk-plugin-entropy.c b/packages/cdebconf-entropy/gtk-plugin-entropy.c
index ed46fc8..9dfc8dd 100644
--- a/packages/cdebconf-entropy/gtk-plugin-entropy.c
+++ b/packages/cdebconf-entropy/gtk-plugin-entropy.c
@@ -232,6 +232,8 @@ static void * gather_entropy(struct entropy * entropy_data)
         }
         entropy_data->bytes_read++;
         refresh_progress_bar(entropy_data);
+        /* Reset text entry to prevent overflow. */
+        gtk_entry_set_text(GTK_ENTRY(entropy_data->entry), "");
     }
     allow_continue(entropy_data);
     return NULL /* no one cares */;

Attachment: signature.asc
Description: Digital signature


Reply to: