[seahorse/be9ddd5: 2/8] This adds optional parameters to pre-fill the key-generation window with username and email address



commit e2a18acfc9dbde8902697bdff06f94da4b22a01b
Author: Thorsten Sick <thorsten sick email de>
Date:   Fri Oct 9 21:04:13 2009 +0200

    This adds optional parameters to pre-fill the key-generation window with username and email address

 pgp/seahorse-gpgme-dialogs.h  |    4 +++-
 pgp/seahorse-gpgme-generate.c |   20 ++++++++++++++++++--
 2 files changed, 21 insertions(+), 3 deletions(-)
---
diff --git a/pgp/seahorse-gpgme-dialogs.h b/pgp/seahorse-gpgme-dialogs.h
index eba74c9..2882ea7 100644
--- a/pgp/seahorse-gpgme-dialogs.h
+++ b/pgp/seahorse-gpgme-dialogs.h
@@ -44,7 +44,9 @@ void            seahorse_gpgme_sign_prompt_uid     (SeahorseGpgmeUid *uid,
 void            seahorse_gpgme_generate_register    (void);
 
 void            seahorse_gpgme_generate_show        (SeahorseGpgmeSource *sksrc,
-                                                     GtkWindow *parent);
+                                                     GtkWindow *parent,
+                                                     const char * name,
+                                                     const char *email);
 
 void            seahorse_gpgme_add_revoker_new      (SeahorseGpgmeKey *pkey,
                                                      GtkWindow *parent);
diff --git a/pgp/seahorse-gpgme-generate.c b/pgp/seahorse-gpgme-generate.c
index 5fbafbe..ef0b94f 100644
--- a/pgp/seahorse-gpgme-generate.c
+++ b/pgp/seahorse-gpgme-generate.c
@@ -72,7 +72,7 @@ on_pgp_generate_key (GtkAction *action, gpointer unused)
 	sksrc = seahorse_context_find_source (seahorse_context_for_app (), SEAHORSE_PGP_TYPE, SEAHORSE_LOCATION_LOCAL);
 	g_return_if_fail (sksrc != NULL);
 	
-	seahorse_gpgme_generate_show (SEAHORSE_GPGME_SOURCE (sksrc), NULL);
+	seahorse_gpgme_generate_show (SEAHORSE_GPGME_SOURCE (sksrc), NULL, NULL, NULL);
 }
 
 static const GtkActionEntry ACTION_ENTRIES[] = {
@@ -357,12 +357,14 @@ on_gpgme_generate_algorithm_changed (GtkComboBox *combo, SeahorseWidget *swidget
  * seahorse_gpgme_generate_show:
  * @sksrc: the gpgme source
  * @parent: the parent window
+ * @name: The user name, can be NULL if not available
+ * @email: The user's email address, can be NULL if not available
  *
  * Shows the gpg key generation dialog, sets default entries.
  *
  */
 void
-seahorse_gpgme_generate_show (SeahorseGpgmeSource *sksrc, GtkWindow *parent)
+seahorse_gpgme_generate_show (SeahorseGpgmeSource *sksrc, GtkWindow *parent, const gchar * name, const gchar *email)
 {
     SeahorseWidget *swidget;
     GtkWidget *widget, *datetime;
@@ -374,6 +376,20 @@ seahorse_gpgme_generate_show (SeahorseGpgmeSource *sksrc, GtkWindow *parent)
     /* Widget already present */
     if (swidget == NULL)
         return;
+
+    if (name)
+    {
+        widget = seahorse_widget_get_widget (swidget, "name-entry");
+        g_return_if_fail (widget != NULL);
+        gtk_entry_set_text(GTK_ENTRY(widget),name);
+    }
+
+    if (email)
+    {
+        widget = seahorse_widget_get_widget (swidget, "email-entry");
+        g_return_if_fail (widget != NULL);
+        gtk_entry_set_text(GTK_ENTRY(widget),email);
+    }
     
     widget = seahorse_widget_get_widget (swidget, "pgp-image");
     g_return_if_fail (widget != NULL);



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