[seahorse] pgp: Add suggestion to generate entropy while generating key



commit f36207c292d3de99c88aa7d38d7785e6f8495d2c
Author: Stef Walter <stefw gnome org>
Date:   Fri Jun 29 10:04:03 2012 +0200

    pgp: Add suggestion to generate entropy while generating key
    
    https://bugzilla.gnome.org/show_bug.cgi?id=678680

 libseahorse/seahorse-progress.c   |   19 +++++++++++++++++++
 libseahorse/seahorse-progress.h   |    5 +++++
 libseahorse/seahorse-progress.xml |   16 +++++++++++++---
 pgp/seahorse-gpgme-generate.c     |   10 +++++++++-
 4 files changed, 46 insertions(+), 4 deletions(-)
---
diff --git a/libseahorse/seahorse-progress.c b/libseahorse/seahorse-progress.c
index b1182cf..25f2f77 100644
--- a/libseahorse/seahorse-progress.c
+++ b/libseahorse/seahorse-progress.c
@@ -47,6 +47,7 @@ typedef struct {
 
 	SeahorseWidget *swidget;
 	gchar *title;
+	gchar *notice;
 	gboolean showing;
 
 	GQueue *parts;
@@ -133,6 +134,7 @@ tracked_task_free (gpointer data)
 	g_queue_foreach (task->parts, (GFunc)tracked_part_free, NULL);
 	g_queue_free (task->parts);
 	g_free (task->title);
+	g_free (task->notice);
 	if (task->swidget)
 		g_object_unref (task->swidget);
 	g_free (task);
@@ -547,6 +549,13 @@ on_timeout_show_progress (gpointer user_data)
 		g_free (text);
 	}
 
+	/* Setup the notice */
+	if (task->notice) {
+		widget = seahorse_widget_get_widget (swidget, "progress-notice");
+		gtk_label_set_label (GTK_LABEL (widget), task->notice);
+		gtk_widget_show (widget);
+	}
+
 	/* Setup the cancel button */
 	widget = seahorse_widget_get_widget (swidget, "progress-cancel");
 	g_signal_connect (widget, "clicked", G_CALLBACK (on_cancel_button_clicked),
@@ -566,6 +575,15 @@ seahorse_progress_show (GCancellable *cancellable,
                         const gchar *title,
                         gboolean delayed)
 {
+	seahorse_progress_show_with_notice (cancellable, title, NULL, delayed);
+}
+
+void
+seahorse_progress_show_with_notice (GCancellable *cancellable,
+                                    const gchar *title,
+                                    const gchar *notice,
+                                    gboolean delayed)
+{
 	TrackedTask *task;
 
 	g_return_if_fail (title != NULL && title[0] != '\0');
@@ -588,6 +606,7 @@ seahorse_progress_show (GCancellable *cancellable,
 
 	g_free (task->title);
 	task->title = g_strdup (title);
+	task->notice = g_strdup (notice);
 	task->showing = TRUE;
 
 	if (delayed)
diff --git a/libseahorse/seahorse-progress.h b/libseahorse/seahorse-progress.h
index d3bf910..7cb3e5c 100644
--- a/libseahorse/seahorse-progress.h
+++ b/libseahorse/seahorse-progress.h
@@ -54,6 +54,11 @@ void          seahorse_progress_show            (GCancellable *cancellable,
                                                  const gchar *title,
                                                  gboolean delayed);
 
+void          seahorse_progress_show_with_notice (GCancellable *cancellable,
+                                                 const gchar *title,
+                                                 const gchar *notice,
+                                                 gboolean delayed);
+
 void          seahorse_progress_attach          (GCancellable *cancellable,
                                                  SeahorseWidget *swidget);
 
diff --git a/libseahorse/seahorse-progress.xml b/libseahorse/seahorse-progress.xml
index ea61444..fcf04e6 100644
--- a/libseahorse/seahorse-progress.xml
+++ b/libseahorse/seahorse-progress.xml
@@ -60,6 +60,7 @@
                     <property name="can_focus">False</property>
                     <property name="stock">gtk-dialog-authentication</property>
                     <property name="icon-size">6</property>
+                    <property name="yalign">0.0</property>
                   </object>
                   <packing>
                     <property name="expand">False</property>
@@ -89,7 +90,7 @@
                         <property name="visible">True</property>
                         <property name="can_focus">False</property>
                         <property name="xalign">0</property>
-                        <property name="label">Progress Status</property>
+                        <property name="label"></property>
                       </object>
                       <packing>
                         <property name="expand">False</property>
@@ -98,7 +99,16 @@
                       </packing>
                     </child>
                     <child>
-                      <placeholder/>
+                      <object class="GtkLabel" id="progress-notice">
+                        <property name="visible">False</property>
+                        <property name="can_focus">False</property>
+                        <property name="wrap">False</property>
+                      </object>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="fill">True</property>
+                        <property name="position">2</property>
+                      </packing>
                     </child>
                   </object>
                   <packing>
@@ -118,7 +128,7 @@
               <object class="GtkProgressBar" id="progress-bar">
                 <property name="visible">True</property>
                 <property name="can_focus">False</property>
-                <property name="pulse_step">0.10000000149</property>
+                <property name="pulse_step">0.1</property>
               </object>
               <packing>
                 <property name="expand">False</property>
diff --git a/pgp/seahorse-gpgme-generate.c b/pgp/seahorse-gpgme-generate.c
index 7a056fd..4567ed4 100644
--- a/pgp/seahorse-gpgme-generate.c
+++ b/pgp/seahorse-gpgme-generate.c
@@ -209,6 +209,7 @@ seahorse_gpgme_generate_key (SeahorseGpgmeKeyring *keyring,
 	GCancellable *cancellable;
 	const gchar *pass;
 	GtkDialog *dialog;
+	const gchar *notice;
 
 	dialog = seahorse_passphrase_prompt_show (_("Passphrase for New PGP Key"),
 	                                          _("Enter the passphrase for your new key twice."),
@@ -220,7 +221,14 @@ seahorse_gpgme_generate_key (SeahorseGpgmeKeyring *keyring,
 		                                      pass, type, bits, expires,
 		                                      cancellable, on_generate_key_complete,
 		                                      NULL);
-		seahorse_progress_show (cancellable, _("Generating key"), FALSE);
+
+		/* Has line breaks because GtkLabel is completely broken WRT wrapping */
+		notice = _("When creating a key we need to generate a lot of\n"
+		           "random data and we need you to help. It's a good\n"
+		           "idea to perform some other action like typing on\n"
+		           "the keyboard, moving the mouse, using applications.\n"
+		           "This gives the system the random data that it needs.");
+		seahorse_progress_show_with_notice (cancellable, _("Generating key"), notice, FALSE);
 		g_object_unref (cancellable);
 	}
 



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