[seahorse/be9ddd5: 6/8] GenerateCredentials - working



commit e522cf8f75ea7a1b9c953fa03aac29a24b7b6b2c
Author: Thorsten Sick <tsick src gnome org>
Date:   Sat Dec 5 10:04:44 2009 +0100

    GenerateCredentials - working
    
    This removes the part of ugly code from GenerateCredentials. A SeahoreSource is passed now
    to the code generating the key.

 daemon/seahorse-service.c     |    5 +----
 pgp/seahorse-gpgme-dialogs.h  |    2 +-
 pgp/seahorse-gpgme-generate.c |   17 +++++++++--------
 3 files changed, 11 insertions(+), 13 deletions(-)
---
diff --git a/daemon/seahorse-service.c b/daemon/seahorse-service.c
index f095a17..de5206d 100644
--- a/daemon/seahorse-service.c
+++ b/daemon/seahorse-service.c
@@ -214,10 +214,7 @@ seahorse_service_generate_credentials (SeahorseService *svc, gchar *ktype,
         if ((pval) && (G_VALUE_TYPE (pval) == G_TYPE_STRING))
             comment=g_value_dup_string (pval);
 
-        swidget = seahorse_widget_new ("pgp-generate", NULL);
-        g_object_ref(sksrc);
-        g_object_set_data_full(G_OBJECT(swidget), "source", sksrc, g_object_unref);
-        seahorse_gpgme_generate_key(swidget, name, email, comment,
+        seahorse_gpgme_generate_key(sksrc, name, email, comment,
                         DSA_ELGAMAL, 2048,0);
 
         g_free (name);
diff --git a/pgp/seahorse-gpgme-dialogs.h b/pgp/seahorse-gpgme-dialogs.h
index 83f6c9b..5aa48cc 100644
--- a/pgp/seahorse-gpgme-dialogs.h
+++ b/pgp/seahorse-gpgme-dialogs.h
@@ -50,7 +50,7 @@ void            seahorse_gpgme_generate_show        (SeahorseGpgmeSource *sksrc,
                                                      const char *email,
                                                      const gchar *comment);
 
-void            gpgme_generate_key                  (SeahorseWidget *swidget,
+void            seahorse_gpgme_generate_key         (SeahorseGpgmeSource *sksrc,
                                                      const gchar *name,
                                                      const gchar *email,
                                                      const gchar *comment,
diff --git a/pgp/seahorse-gpgme-generate.c b/pgp/seahorse-gpgme-generate.c
index 02f8c6f..c8a51e7 100644
--- a/pgp/seahorse-gpgme-generate.c
+++ b/pgp/seahorse-gpgme-generate.c
@@ -168,7 +168,7 @@ get_expiry_date (SeahorseWidget *swidget)
 
 /**
  * gpgme_generate_key:
- * @swidget: the #SeahorseWidget
+ * @sksrc: the seahorse source
  * @name: the user's full name
  * @email: the user's email address
  * @comment: a comment, added to the key
@@ -181,20 +181,15 @@ get_expiry_date (SeahorseWidget *swidget)
  * @expire sets the expiry date
  *
  */
-void seahorse_gpgme_generate_key (SeahorseWidget *swidget, const gchar *name, const gchar *email,
+void seahorse_gpgme_generate_key (SeahorseGpgmeSource *sksrc, const gchar *name, const gchar *email,
                             const gchar *comment, guint type, guint bits, time_t expires)
 {
-    SeahorseGpgmeSource *sksrc;
     SeahorseOperation *op;
     const gchar *pass;
     gpgme_error_t gerr;
     GtkDialog *dialog;
 
-    sksrc = SEAHORSE_GPGME_SOURCE (g_object_get_data (G_OBJECT (swidget), "source"));
-    g_assert (SEAHORSE_IS_GPGME_SOURCE (sksrc));
 
-    /* Less confusing with less on the screen */
-    gtk_widget_hide (seahorse_widget_get_toplevel (swidget));
 
     dialog = seahorse_passphrase_prompt_show (_("Passphrase for New PGP Key"),
                                               _("Enter the passphrase for your new key twice."),
@@ -301,7 +296,13 @@ on_gpgme_generate_response (GtkDialog *dialog, guint response, SeahorseWidget *s
         egg_datetime_get_as_time_t (EGG_DATETIME (widget), &expires);
     }
 
-    seahorse_gpgme_generate_key (swidget, name, email, comment, type, bits, expires);
+    sksrc = SEAHORSE_GPGME_SOURCE (g_object_get_data (G_OBJECT (swidget), "source"));
+    g_assert (SEAHORSE_IS_GPGME_SOURCE (sksrc));
+
+    /* Less confusing with less on the screen */
+    gtk_widget_hide (seahorse_widget_get_toplevel (swidget));
+
+    seahorse_gpgme_generate_key (sksrc, name, email, comment, type, bits, expires);
 
 
     seahorse_widget_destroy (swidget);



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