seahorse r2669 - in trunk: . daemon libseahorse pgp



Author: nnielsen
Date: Tue Dec 16 02:49:26 2008
New Revision: 2669
URL: http://svn.gnome.org/viewvc/seahorse?rev=2669&view=rev

Log:
	* daemon/seahorse-hkp-server.c:
	* daemon/seahorse-service-crypto.c:
	* pgp/Makefile.am:
	* pgp/seahorse-gpgme-*: (added)
	* pgp/seahorse-gpgmex-*: (removed)
	* pgp/seahorse-gpg-op.c: (added)
	* pgp/seahorse-gpg-op.h: (added)
	* pgp/seahorse-gpg-options.c:
	* pgp/seahorse-hkp-source.c:
	* pgp/seahorse-ldap-source.c:
	* pgp/seahorse-pgp.c:
	* pgp/seahorse-pgp.h:
	* pgp/seahorse-pgp-add-subkey.c: (moved)
	* pgp/seahorse-pgp-add-uid.c: (moved)
	* pgp/seahorse-pgp-commands.c:
	* pgp/seahorse-pgp-dialogs.h:
	* pgp/seahorse-pgp-error.c: (removed)
	* pgp/seahorse-pgp-expires.c: (moved)
	* pgp/seahorse-pgp-generate.c: (moved)
	* pgp/seahorse-pgp-key.c:
	* pgp/seahorse-pgp-key.h: 
	* pgp/seahorse-pgp-key-op.c: (moved)
	* pgp/seahorse-pgp-key-op.h: (moved)
	* pgp/seahorse-pgp-key-properties.c:
	* pgp/seahorse-pgp-module.c: 
	* pgp/seahorse-pgp-operation.c: (moved)
	* pgp/seahorse-pgp-operation.h: (moved)
	* pgp/seahorse-pgp-photo.c:
	* pgp/seahorse-pgp-photo.h:
	* pgp/seahorse-pgp-photos.c: (moved)
	* pgp/seahorse-pgp-revoke.c: (moved)
	* pgp/seahorse-pgp-sign.c: (moved)
	* pgp/seahorse-pgp-signature.c: (added)
	* pgp/seahorse-pgp-signature.h: (added)
	* pgp/seahorse-pgp-source.c: (moved)
	* pgp/seahorse-pgp-source.h: (moved)
	* pgp/seahorse-pgp-uid.c: 
	* pgp/seahorse-pgp-uid.h:
	* pgp/seahorse-server-source.c:
	* libseahorse/seahorse-object.c:
	* libseahorse/seahorse-util.c: More cleanly split GPGME dependant
	code. Allow for non GPGME based PGP keys (ie: remote keys)


Added:
   trunk/pgp/seahorse-gpg-op.c   (contents, props changed)
      - copied, changed from r2661, /trunk/pgp/seahorse-gpgmex-op.c
   trunk/pgp/seahorse-gpg-op.h   (contents, props changed)
      - copied, changed from r2661, /trunk/pgp/seahorse-gpgmex.h
   trunk/pgp/seahorse-gpgme-add-subkey.c   (contents, props changed)
      - copied, changed from r2661, /trunk/pgp/seahorse-pgp-add-subkey.c
   trunk/pgp/seahorse-gpgme-add-uid.c   (contents, props changed)
      - copied, changed from r2661, /trunk/pgp/seahorse-pgp-add-uid.c
   trunk/pgp/seahorse-gpgme-data.c   (contents, props changed)
      - copied, changed from r2661, /trunk/pgp/seahorse-gpgme-io.c
   trunk/pgp/seahorse-gpgme-data.h   (contents, props changed)
      - copied, changed from r2661, /trunk/pgp/seahorse-gpgme-io.h
   trunk/pgp/seahorse-gpgme-dialogs.h
   trunk/pgp/seahorse-gpgme-expires.c   (contents, props changed)
      - copied, changed from r2661, /trunk/pgp/seahorse-pgp-expires.c
   trunk/pgp/seahorse-gpgme-generate.c   (contents, props changed)
      - copied, changed from r2661, /trunk/pgp/seahorse-pgp-generate.c
   trunk/pgp/seahorse-gpgme-key-op.c   (contents, props changed)
      - copied, changed from r2661, /trunk/pgp/seahorse-pgp-key-op.c
   trunk/pgp/seahorse-gpgme-key-op.h   (contents, props changed)
      - copied, changed from r2661, /trunk/pgp/seahorse-pgp-key-op.h
   trunk/pgp/seahorse-gpgme-key.c
   trunk/pgp/seahorse-gpgme-key.h
   trunk/pgp/seahorse-gpgme-operation.c   (contents, props changed)
      - copied, changed from r2661, /trunk/pgp/seahorse-pgp-operation.c
   trunk/pgp/seahorse-gpgme-operation.h   (contents, props changed)
      - copied, changed from r2661, /trunk/pgp/seahorse-pgp-operation.h
   trunk/pgp/seahorse-gpgme-photo.c
   trunk/pgp/seahorse-gpgme-photo.h
   trunk/pgp/seahorse-gpgme-photos.c   (contents, props changed)
      - copied, changed from r2661, /trunk/pgp/seahorse-pgp-photos.c
   trunk/pgp/seahorse-gpgme-revoke.c   (contents, props changed)
      - copied, changed from r2661, /trunk/pgp/seahorse-pgp-revoke.c
   trunk/pgp/seahorse-gpgme-sign.c   (contents, props changed)
      - copied, changed from r2661, /trunk/pgp/seahorse-pgp-sign.c
   trunk/pgp/seahorse-gpgme-source.c   (contents, props changed)
      - copied, changed from r2663, /trunk/pgp/seahorse-pgp-source.c
   trunk/pgp/seahorse-gpgme-source.h   (contents, props changed)
      - copied, changed from r2661, /trunk/pgp/seahorse-pgp-source.h
   trunk/pgp/seahorse-gpgme-subkey.c
   trunk/pgp/seahorse-gpgme-subkey.h
   trunk/pgp/seahorse-gpgme-uid.c
   trunk/pgp/seahorse-gpgme-uid.h
   trunk/pgp/seahorse-gpgme.c
   trunk/pgp/seahorse-gpgme.h
   trunk/pgp/seahorse-pgp-signature.c
   trunk/pgp/seahorse-pgp-signature.h
Removed:
   trunk/pgp/seahorse-gpgme-io.c
   trunk/pgp/seahorse-gpgme-io.h
   trunk/pgp/seahorse-gpgmex-op.c
   trunk/pgp/seahorse-gpgmex-util.c
   trunk/pgp/seahorse-gpgmex.h
   trunk/pgp/seahorse-pgp-add-subkey.c
   trunk/pgp/seahorse-pgp-add-uid.c
   trunk/pgp/seahorse-pgp-error.c
   trunk/pgp/seahorse-pgp-expires.c
   trunk/pgp/seahorse-pgp-generate.c
   trunk/pgp/seahorse-pgp-key-op.c
   trunk/pgp/seahorse-pgp-key-op.h
   trunk/pgp/seahorse-pgp-operation.c
   trunk/pgp/seahorse-pgp-operation.h
   trunk/pgp/seahorse-pgp-photos.c
   trunk/pgp/seahorse-pgp-revoke.c
   trunk/pgp/seahorse-pgp-sign.c
   trunk/pgp/seahorse-pgp-source.c
   trunk/pgp/seahorse-pgp-source.h
Modified:
   trunk/ChangeLog
   trunk/daemon/seahorse-hkp-server.c
   trunk/daemon/seahorse-service-crypto.c
   trunk/libseahorse/seahorse-object.c
   trunk/libseahorse/seahorse-util.c
   trunk/pgp/Makefile.am
   trunk/pgp/seahorse-gpg-options.c
   trunk/pgp/seahorse-hkp-source.c
   trunk/pgp/seahorse-ldap-source.c
   trunk/pgp/seahorse-pgp-commands.c
   trunk/pgp/seahorse-pgp-dialogs.h
   trunk/pgp/seahorse-pgp-key-properties.c
   trunk/pgp/seahorse-pgp-key.c
   trunk/pgp/seahorse-pgp-key.h
   trunk/pgp/seahorse-pgp-module.c
   trunk/pgp/seahorse-pgp-photo.c
   trunk/pgp/seahorse-pgp-photo.h
   trunk/pgp/seahorse-pgp-subkey.c
   trunk/pgp/seahorse-pgp-subkey.h
   trunk/pgp/seahorse-pgp-uid.c
   trunk/pgp/seahorse-pgp-uid.h
   trunk/pgp/seahorse-pgp.c
   trunk/pgp/seahorse-pgp.h
   trunk/pgp/seahorse-server-source.c

Modified: trunk/daemon/seahorse-hkp-server.c
==============================================================================
--- trunk/daemon/seahorse-hkp-server.c	(original)
+++ trunk/daemon/seahorse-hkp-server.c	Tue Dec 16 02:49:26 2008
@@ -27,7 +27,7 @@
 
 #include "seahorse-daemon.h"
 
-#include "pgp/seahorse-gpgmex.h"
+#include "pgp/seahorse-gpgme.h"
 
 /* 
  * DEBUG: Set to number other than zero, in order to run HKP 
@@ -350,7 +350,9 @@
         return lookup_handle_error (msg, "pks request did not include a <b>search</b> property", GPG_OK);
     
     /* Retrieve the key */
-    data = gpgmex_data_new ();
+    gerr = gpgme_data_new (&data);
+    if (!GPG_IS_OK (gerr))
+	    return lookup_handle_error (msg, "Internal error", gerr);
     
     gpgme_set_armor (gpgme_ctx, 1);
     gerr = gpgme_op_export (gpgme_ctx, search, 0, data);

Modified: trunk/daemon/seahorse-service-crypto.c
==============================================================================
--- trunk/daemon/seahorse-service-crypto.c	(original)
+++ trunk/daemon/seahorse-service-crypto.c	Tue Dec 16 02:49:26 2008
@@ -27,9 +27,10 @@
 #include "seahorse-util.h"
 #include "seahorse-libdialogs.h"
 
-#include "pgp/seahorse-pgp-dialogs.h"
-#include "pgp/seahorse-pgp-key.h"
-#include "pgp/seahorse-pgp-operation.h"
+#include "pgp/seahorse-gpgme.h"
+#include "pgp/seahorse-gpgme-dialogs.h"
+#include "pgp/seahorse-gpgme-key.h"
+#include "pgp/seahorse-gpgme-operation.h"
 
 #include <string.h>
 
@@ -61,7 +62,7 @@
 
 /* Returns result in result. Frees pop and cryptdata */
 static gboolean
-process_crypto_result (SeahorsePGPOperation *pop, gpgme_error_t gstarterr, 
+process_crypto_result (SeahorseGpgmeOperation *pop, gpgme_error_t gstarterr, 
                        gpgme_data_t cryptdata, gchar **result, GError **error)
 {
     size_t len;
@@ -113,15 +114,27 @@
 	recips = g_new0 (gpgme_key_t, g_list_length (keys) + 1);
 
 	for (i = 0; keys != NULL; keys = g_list_next (keys), i++) {
-		g_return_val_if_fail (SEAHORSE_IS_PGP_KEY (keys->data), recips);
-		recips[i] = seahorse_pgp_key_get_public (keys->data);
-		gpgmex_key_ref (recips[i]);
+		g_return_val_if_fail (SEAHORSE_IS_GPGME_KEY (keys->data), recips);
+		recips[i] = seahorse_gpgme_key_get_public (keys->data);
+		gpgme_key_ref (recips[i]);
 	}
 
 	return recips;
 }
 
 static void
+free_keys (gpgme_key_t* keys)
+{
+	gpgme_key_t* k = keys;
+	if (!keys)
+		return;
+	while (*k)
+		gpgme_key_unref (*(k++));
+	g_free (keys);
+}
+
+
+static void
 notify_signatures (const gchar* data, gpgme_verify_result_t status)
 {
 	const gchar *icon = NULL;
@@ -184,8 +197,8 @@
 		return;
 	default:
 		if (!GPG_IS_OK (status->signatures->status))
-			seahorse_pgp_handle_gpgme_error (status->signatures->status, 
-			                            _("Couldn't verify signature."));
+			seahorse_gpgme_handle_error (status->signatures->status, 
+			                             _("Couldn't verify signature."));
 		return;
 	};
 
@@ -223,7 +236,7 @@
                                       char **crypttext, GError **error)
 {
     GList *recipkeys = NULL;
-    SeahorsePGPOperation *pop; 
+    SeahorseGpgmeOperation *pop; 
     SeahorseObject *signkey = NULL;
     SeahorseObject *skey;
     gpgme_key_t *recips;
@@ -245,7 +258,7 @@
             return FALSE;
         }
         
-        if (!SEAHORSE_IS_PGP_KEY (signkey) || 
+        if (!SEAHORSE_IS_GPGME_KEY (signkey) || 
             !(seahorse_object_get_flags (signkey) & SEAHORSE_FLAG_CAN_SIGN)) {
             g_set_error (error, SEAHORSE_DBUS_ERROR, SEAHORSE_DBUS_ERROR_INVALID,
                          _("Key is not valid for signing: %s"), signer);
@@ -264,7 +277,7 @@
             return FALSE;
         }
         
-        if (!SEAHORSE_IS_PGP_KEY (skey) ||
+        if (!SEAHORSE_IS_GPGME_KEY (skey) ||
             !(seahorse_object_get_flags (skey) & SEAHORSE_FLAG_CAN_ENCRYPT)) {
             g_list_free (recipkeys);
             g_set_error (error, SEAHORSE_DBUS_ERROR, SEAHORSE_DBUS_ERROR_INVALID,
@@ -281,7 +294,7 @@
         return FALSE;
     }
     
-    pop = seahorse_pgp_operation_new (NULL);
+    pop = seahorse_gpgme_operation_new (NULL);
     
     /* new data form text */
     gerr = gpgme_data_new_from_mem (&plain, cleartext, strlen (cleartext), FALSE);
@@ -306,7 +319,7 @@
     
     /* Do the encryption */
     if (signkey) {
-        gpgme_signers_add (pop->gctx, seahorse_pgp_key_get_private (SEAHORSE_PGP_KEY (signkey)));
+        gpgme_signers_add (pop->gctx, seahorse_gpgme_key_get_private (SEAHORSE_GPGME_KEY (signkey)));
         gerr = gpgme_op_encrypt_sign_start (pop->gctx, recips, GPGME_ENCRYPT_ALWAYS_TRUST, 
                                             plain, cipher);
     } else {
@@ -314,7 +327,7 @@
                                        plain, cipher);
     }
     
-    gpgmex_free_keys (recips);
+    free_keys (recips);
 
     /* Frees cipher */
     ret = process_crypto_result (pop, gerr, cipher, crypttext, error);
@@ -331,7 +344,7 @@
 {
     SeahorseObject *signkey = NULL;
     gpgme_error_t gerr;
-    SeahorsePGPOperation *pop; 
+    SeahorseGpgmeOperation *pop; 
     gpgme_data_t plain, cipher;
     gboolean ret = TRUE;
     
@@ -352,14 +365,14 @@
         return FALSE;
     }
         
-    if (!SEAHORSE_IS_PGP_KEY (signkey) || 
+    if (!SEAHORSE_IS_GPGME_KEY (signkey) || 
         !(seahorse_object_get_flags (signkey) & SEAHORSE_FLAG_CAN_SIGN)) {
         g_set_error (error, SEAHORSE_DBUS_ERROR, SEAHORSE_DBUS_ERROR_INVALID,
                      _("Key is not valid for signing: %s"), signer);
         return FALSE;
     }
     
-    pop = seahorse_pgp_operation_new (NULL);
+    pop = seahorse_gpgme_operation_new (NULL);
     
     /* new data from text */
     gerr = gpgme_data_new_from_mem (&plain, cleartext, strlen (cleartext), FALSE);
@@ -372,7 +385,7 @@
     gpgme_set_armor (pop->gctx, TRUE);
 
     /* Do the signage */
-    gpgme_signers_add (pop->gctx, seahorse_pgp_key_get_private (SEAHORSE_PGP_KEY (signkey)));
+    gpgme_signers_add (pop->gctx, seahorse_gpgme_key_get_private (SEAHORSE_GPGME_KEY (signkey)));
     gerr = gpgme_op_sign_start (pop->gctx, plain, cipher, GPGME_SIG_MODE_CLEAR);
 
     /* Frees cipher */
@@ -391,7 +404,7 @@
 {
     gpgme_verify_result_t status;
     gpgme_error_t gerr;
-    SeahorsePGPOperation *pop; 
+    SeahorseGpgmeOperation *pop; 
     gpgme_data_t plain, cipher;
     gboolean ret = TRUE;
     GQuark keyid;
@@ -407,7 +420,7 @@
      * then all this logic will need to change. 
      */
     
-    pop = seahorse_pgp_operation_new (NULL);
+    pop = seahorse_gpgme_operation_new (NULL);
     
     /* new data from text */
     gerr = gpgme_data_new_from_mem (&cipher, crypttext, strlen (crypttext), FALSE);
@@ -454,7 +467,7 @@
 {
     gpgme_verify_result_t status;
     gpgme_error_t gerr;
-    SeahorsePGPOperation *pop; 
+    SeahorseGpgmeOperation *pop; 
     gpgme_data_t plain, cipher;
     gboolean ret = TRUE;
     GQuark keyid;
@@ -470,7 +483,7 @@
      * then all this logic will need to change. 
      */
 
-    pop = seahorse_pgp_operation_new (NULL);
+    pop = seahorse_gpgme_operation_new (NULL);
     
     /* new data from text */
     gerr = gpgme_data_new_from_mem (&cipher, crypttext, strlen (crypttext), FALSE);

Modified: trunk/libseahorse/seahorse-object.c
==============================================================================
--- trunk/libseahorse/seahorse-object.c	(original)
+++ trunk/libseahorse/seahorse-object.c	Tue Dec 16 02:49:26 2008
@@ -617,7 +617,6 @@
 seahorse_object_get_source (SeahorseObject *self)
 {
 	g_return_val_if_fail (SEAHORSE_IS_OBJECT (self), NULL);
-	seahorse_object_realize (self);
 	return self->pv->source;	
 }
 
@@ -643,7 +642,6 @@
 seahorse_object_get_context (SeahorseObject *self)
 {
 	g_return_val_if_fail (SEAHORSE_IS_OBJECT (self), NULL);
-	seahorse_object_realize (self);
 	return self->pv->context;
 }
 
@@ -651,7 +649,6 @@
 seahorse_object_get_preferred (SeahorseObject *self)
 {
 	g_return_val_if_fail (SEAHORSE_IS_OBJECT (self), NULL);
-	seahorse_object_realize (self);
 	return self->pv->preferred;
 }
 

Modified: trunk/libseahorse/seahorse-util.c
==============================================================================
--- trunk/libseahorse/seahorse-util.c	(original)
+++ trunk/libseahorse/seahorse-util.c	Tue Dec 16 02:49:26 2008
@@ -198,7 +198,7 @@
 	gchar *created_string;
 	
 	if (time == 0)
-		return "0";
+		return g_strdup ("");
 	
 	created_date = g_date_new ();
 	g_date_set_time_t (created_date, time);

Modified: trunk/pgp/Makefile.am
==============================================================================
--- trunk/pgp/Makefile.am	(original)
+++ trunk/pgp/Makefile.am	Tue Dec 16 02:49:26 2008
@@ -38,27 +38,33 @@
 endif
 
 libseahorse_pgp_la_SOURCES = \
-	seahorse-gpgme-io.c seahorse-gpgme-io.h \
-	seahorse-gpgmex.h seahorse-gpgmex-op.c seahorse-gpgmex-util.c \
+	seahorse-gpgme.c seahorse-gpgme.h \
+	seahorse-gpgme-add-subkey.c \
+	seahorse-gpgme-add-uid.c \
+	seahorse-gpgme-dialogs.h \
+	seahorse-gpgme-data.c seahorse-gpgme-data.h \
+	seahorse-gpgme-expires.c \
+	seahorse-gpgme-generate.c \
+	seahorse-gpgme-key.c seahorse-gpgme-key.h \
+	seahorse-gpgme-key-op.c seahorse-gpgme-key-op.h \
+	seahorse-gpgme-operation.c seahorse-gpgme-operation.h \
+	seahorse-gpgme-photo.c seahorse-gpgme-photo.h \
+	seahorse-gpgme-photos.c \
+	seahorse-gpgme-revoke.c \
+	seahorse-gpgme-sign.c \
+	seahorse-gpgme-source.c seahorse-gpgme-source.h \
+	seahorse-gpgme-subkey.c seahorse-gpgme-subkey.h \
+	seahorse-gpgme-uid.c seahorse-gpgme-uid.h \
+	seahorse-gpg-op.h seahorse-gpg-op.c \
 	seahorse-gpg-options.c seahorse-gpg-options.h \
 	seahorse-pgp.c seahorse-pgp.h \
-	seahorse-pgp-add-subkey.c \
-	seahorse-pgp-add-uid.c \
 	seahorse-pgp-commands.c seahorse-pgp-commands.h \
-	seahorse-pgp-error.c \
-	seahorse-pgp-expires.c \
-	seahorse-pgp-generate.c \
 	seahorse-pgp-key.c seahorse-pgp-key.h \
-	seahorse-pgp-key-op.c seahorse-pgp-key-op.h \
 	seahorse-pgp-key-properties.c \
 	seahorse-pgp-keysets.c seahorse-pgp-keysets.h \
-	seahorse-pgp-operation.c seahorse-pgp-operation.h \
 	seahorse-pgp-photo.c seahorse-pgp-photo.h \
-	seahorse-pgp-photos.c \
 	seahorse-pgp-module.c seahorse-pgp-module.h \
-	seahorse-pgp-revoke.c \
-	seahorse-pgp-source.c seahorse-pgp-source.h \
-	seahorse-pgp-sign.c \
+	seahorse-pgp-signature.c seahorse-pgp-signature.h \
 	seahorse-pgp-subkey.c seahorse-pgp-subkey.h \
 	seahorse-pgp-uid.c seahorse-pgp-uid.h \
 	seahorse-signer.c seahorse-pgp-dialogs.h \

Copied: trunk/pgp/seahorse-gpg-op.c (from r2661, /trunk/pgp/seahorse-gpgmex-op.c)
==============================================================================
--- /trunk/pgp/seahorse-gpgmex-op.c	(original)
+++ trunk/pgp/seahorse-gpg-op.c	Tue Dec 16 02:49:26 2008
@@ -23,7 +23,8 @@
 #include <gpgme.h>
 #include <string.h>
 
-#include "pgp/seahorse-gpgmex.h"
+#include "pgp/seahorse-gpg-op.h"
+#include "pgp/seahorse-gpgme.h"
 
 static gpgme_error_t
 execute_gpg_command (gpgme_ctx_t ctx, const gchar *args, gchar **std_out, 
@@ -59,9 +60,8 @@
 }
 
 gpgme_error_t        
-gpgmex_op_export_secret  (gpgme_ctx_t ctx, 
-                          const char *pattern,
-                          gpgme_data_t keydata)
+seahorse_gpg_op_export_secret  (gpgme_ctx_t ctx, const char *pattern,
+                                gpgme_data_t keydata)
 {
     gchar *output = NULL;
     gpgme_error_t err;
@@ -90,7 +90,7 @@
 }
 
 gpgme_error_t 
-gpgmex_op_num_uids (gpgme_ctx_t ctx, const char *pattern, guint *number)
+seahorse_gpg_op_num_uids (gpgme_ctx_t ctx, const char *pattern, guint *number)
 {
 	 gchar *output = NULL;
     gpgme_error_t err;

Copied: trunk/pgp/seahorse-gpg-op.h (from r2661, /trunk/pgp/seahorse-gpgmex.h)
==============================================================================
--- /trunk/pgp/seahorse-gpgmex.h	(original)
+++ trunk/pgp/seahorse-gpg-op.h	Tue Dec 16 02:49:26 2008
@@ -19,112 +19,19 @@
  * Boston, MA 02111-1307, USA.
  */
 
-/** 
- * Extensions to GPGME for not yet or 'won't support' features.
- */
-
-#ifndef __SEAHORSE_GPGMEX_H__
-#define __SEAHORSE_GPGMEX_H__
+#ifndef __SEAHORSE_GPG_OP_H__
+#define __SEAHORSE_GPG_OP_H__
 
 #include "config.h"
-#include <gpgme.h>
-#include <gdk-pixbuf/gdk-pixbuf.h>
-
-#include "seahorse-validity.h"
-
-/* -----------------------------------------------------------------------------
- * ERROR HANDLING 
- */
-
-#define GPG_IS_OK(e)        (gpgme_err_code (e) == GPG_ERR_NO_ERROR)
-#define GPG_OK              (gpgme_error (GPG_ERR_NO_ERROR))
-#define GPG_E(e)            (gpgme_error (e))
-
-#define SEAHORSE_GPGME_ERROR  (seahorse_gpgme_error_domain ())
-
-GQuark      seahorse_gpgme_error_domain    (void);
 
-void        seahorse_gpgme_to_error        (gpgme_error_t gerr, GError** err);
-
-/* -----------------------------------------------------------------------------
- * DATA ALLOCATION
- */
- 
-/* 
- * GTK/Glib use a model where if allocation fails, the program exits. These 
- * helper functions extend certain GPGME calls to provide the same behavior.
- */
- 
-gpgme_data_t        gpgmex_data_new          ();
-
-void                gpgmex_data_release      (gpgme_data_t data);
-
-int                 gpgmex_data_write_all    (gpgme_data_t data, const void* buffer, size_t len);
-
-gpgme_data_t        gpgmex_data_new_from_mem (const char *buffer, size_t size,
-                                              gboolean copy);
-
-/* -----------------------------------------------------------------------------
- * KEY ALLOCATION
- */
- 
-/*
- * Functions for allocating keys we find from sources other than 
- * GPGME, like servers for example. 
- * 
- * Yes, we allocate gpgme_key_t structures and use them. The structure 
- * is open, we play by the rules and don't use fields we're asked not 
- * to. Of course we should never pass these structures to GPGME functions
- * like gpgme_key_unref etc....
- */
-
-enum {
-    GPGMEX_KEY_REVOKED  = 0x01,
-    GPGMEX_KEY_DISABLED = 0x02
-};
-
-gpgme_key_t gpgmex_key_alloc         ();
-
-void        gpgmex_key_add_subkey    (gpgme_key_t key,
-                                      const char *fpr,
-                                      unsigned int flags,
-                                      long int timestamp,
-                                      long int expires,
-                                      unsigned int length,
-                                      gpgme_pubkey_algo_t algo);
-
-void        gpgmex_key_add_uid       (gpgme_key_t key,
-                                      const char *uid,
-                                      unsigned int flags);
-
-void        gpgmex_key_copy_subkey   (gpgme_key_t key,
-                                      gpgme_subkey_t subkey);
-
-void        gpgmex_key_copy_uid      (gpgme_key_t key,
-                                      gpgme_user_id_t uid);                                      
-                                      
-int         gpgmex_key_is_gpgme      (gpgme_key_t key);
-
-gpgme_key_t gpgmex_key_ref           (gpgme_key_t key);
-
-void        gpgmex_key_unref         (gpgme_key_t key);
-
-void        gpgmex_combine_keys      (gpgme_key_t k, gpgme_key_t key);
-
-void        gpgmex_free_keys         (gpgme_key_t* keys);
-
-/* -----------------------------------------------------------------------------
- * EXTRA FUNCTIONALITY
- */
-
-gpgme_error_t gpgmex_op_export_secret  (gpgme_ctx_t ctx, 
-                                        const char *pattern,
-                                        gpgme_data_t keydata);
-
-gpgme_error_t gpgmex_op_num_uids       (gpgme_ctx_t ctx, 
-                                        const char *pattern,
-                                        guint *number);
+#include <gpgme.h>
 
-SeahorseValidity    gpgmex_validity_to_seahorse    (gpgme_validity_t validity);
+gpgme_error_t seahorse_gpg_op_export_secret  (gpgme_ctx_t ctx, 
+                                              const char *pattern,
+                                              gpgme_data_t keydata);
+
+gpgme_error_t seahorse_gpg_op_num_uids       (gpgme_ctx_t ctx, 
+                                              const char *pattern,
+                                              guint *number);
 
-#endif /* __SEAHORSE_GPGMEX_H__ */
+#endif /* __SEAHORSE_GPG_OP_H__ */

Modified: trunk/pgp/seahorse-gpg-options.c
==============================================================================
--- trunk/pgp/seahorse-gpg-options.c	(original)
+++ trunk/pgp/seahorse-gpg-options.c	Tue Dec 16 02:49:26 2008
@@ -34,7 +34,7 @@
 #include "seahorse-util.h"
 #include "seahorse-context.h"
 
-#include "pgp/seahorse-gpgmex.h"
+#include "pgp/seahorse-gpgme.h"
 #include "pgp/seahorse-gpg-options.h"
 
 #define  GPG_CONF_HEADER    "# FILE CREATED BY SEAHORSE\n\n"

Copied: trunk/pgp/seahorse-gpgme-add-subkey.c (from r2661, /trunk/pgp/seahorse-pgp-add-subkey.c)
==============================================================================
--- /trunk/pgp/seahorse-pgp-add-subkey.c	(original)
+++ trunk/pgp/seahorse-gpgme-add-subkey.c	Tue Dec 16 02:49:26 2008
@@ -28,8 +28,8 @@
 #include "seahorse-object-widget.h"
 #include "seahorse-util.h"
 
-#include "seahorse-pgp-dialogs.h"
-#include "seahorse-pgp-key-op.h"
+#include "seahorse-gpgme-dialogs.h"
+#include "seahorse-gpgme-key-op.h"
 
 #define LENGTH "length"
 
@@ -72,7 +72,7 @@
 }
 
 static GtkWidget *
-_seahorse_add_subkey_get_expires (SeahorseWidget *swidget)
+get_expires (SeahorseWidget *swidget)
 {
     GtkWidget *widget;
     GList *children;
@@ -98,7 +98,7 @@
 {
     GtkWidget *widget;
 
-    widget = _seahorse_add_subkey_get_expires (swidget);
+    widget = get_expires (swidget);
     g_return_if_fail (widget);
 
     gtk_widget_set_sensitive (GTK_WIDGET (widget),
@@ -135,7 +135,7 @@
 	glade_xml_get_widget (swidget->xml, "never_expires"))))
 		expires = 0;
 	else {
-        widget = _seahorse_add_subkey_get_expires (swidget);
+        widget = get_expires (swidget);
         g_return_if_fail (widget);
 
         egg_datetime_get_as_time_t (EGG_DATETIME (widget), &expires);
@@ -158,18 +158,18 @@
 	
 	widget = glade_xml_get_widget (swidget->xml, swidget->name);
 	gtk_widget_set_sensitive (widget, FALSE);
-	err = seahorse_pgp_key_op_add_subkey (SEAHORSE_PGP_KEY (skwidget->object), 
-	                                      real_type, length, expires);
+	err = seahorse_gpgme_key_op_add_subkey (SEAHORSE_GPGME_KEY (skwidget->object), 
+	                                        real_type, length, expires);
 	gtk_widget_set_sensitive (widget, TRUE);
 	
 	if (!GPG_IS_OK (err))
-		seahorse_pgp_handle_gpgme_error (err, _("Couldn't add subkey"));
+		seahorse_gpgme_handle_error (err, _("Couldn't add subkey"));
 
 	seahorse_widget_destroy (swidget);
 }
 
 void
-seahorse_pgp_add_subkey_new (SeahorsePgpKey *pkey, GtkWindow *parent)
+seahorse_gpgme_add_subkey_new (SeahorseGpgmeKey *pkey, GtkWindow *parent)
 {
 	SeahorseWidget *swidget;
 	GtkComboBox* combo;

Copied: trunk/pgp/seahorse-gpgme-add-uid.c (from r2661, /trunk/pgp/seahorse-pgp-add-uid.c)
==============================================================================
--- /trunk/pgp/seahorse-pgp-add-uid.c	(original)
+++ trunk/pgp/seahorse-gpgme-add-uid.c	Tue Dec 16 02:49:26 2008
@@ -28,8 +28,8 @@
 #include "seahorse-object-widget.h"
 #include "seahorse-util.h"
 
-#include "seahorse-pgp-dialogs.h"
-#include "seahorse-pgp-key-op.h"
+#include "seahorse-gpgme-dialogs.h"
+#include "seahorse-gpgme-key-op.h"
 
 #define NAME "name"
 #define EMAIL "email"
@@ -79,10 +79,10 @@
 	comment = gtk_entry_get_text (GTK_ENTRY (
 		glade_xml_get_widget (swidget->xml, "comment")));
 	
-	err = seahorse_pgp_key_op_add_uid (SEAHORSE_PGP_KEY (object),
-	                                   name, email, comment);
+	err = seahorse_gpgme_key_op_add_uid (SEAHORSE_GPGME_KEY (object),
+	                                     name, email, comment);
 	if (!GPG_IS_OK (err))
-		seahorse_pgp_handle_gpgme_error (err, _("Couldn't add user id"));
+		seahorse_gpgme_handle_error (err, _("Couldn't add user id"));
 	else
 		seahorse_widget_destroy (swidget);
 }
@@ -94,7 +94,7 @@
  * Creates a new #SeahorseKeyWidget dialog for adding a user ID to @skey.
  **/
 void
-seahorse_pgp_add_uid_new (SeahorsePgpKey *pkey, GtkWindow *parent)
+seahorse_gpgme_add_uid_new (SeahorseGpgmeKey *pkey, GtkWindow *parent)
 {
 	SeahorseWidget *swidget;
 	const gchar *userid;

Copied: trunk/pgp/seahorse-gpgme-data.c (from r2661, /trunk/pgp/seahorse-gpgme-io.c)
==============================================================================
--- /trunk/pgp/seahorse-gpgme-io.c	(original)
+++ trunk/pgp/seahorse-gpgme-data.c	Tue Dec 16 02:49:26 2008
@@ -21,9 +21,8 @@
 
 #include "config.h"
 
-#include "seahorse-gpgme-io.h"
-
-#include "seahorse-gpgmex.h"
+#include "seahorse-gpgme.h"
+#include "seahorse-gpgme-data.h"
 
 #include <glib.h>
 #include <gio/gio.h>
@@ -31,6 +30,7 @@
 #include <gpgme.h>
 
 #include <sys/types.h>
+#include <string.h>
 #include <stdlib.h>
 #include <fcntl.h>
 #include <errno.h>
@@ -224,7 +224,7 @@
 };
 
 gpgme_data_t
-seahorse_gpgme_output_data (GOutputStream* output)
+seahorse_gpgme_data_output (GOutputStream* output)
 {
 	gpgme_error_t gerr;
 	gpgme_data_t ret = NULL;
@@ -318,7 +318,7 @@
 };
 
 gpgme_data_t
-seahorse_gpgme_input_data (GInputStream* input)
+seahorse_gpgme_data_input (GInputStream* input)
 {
 	gpgme_error_t gerr;
 	gpgme_data_t ret = NULL;
@@ -332,3 +332,84 @@
 	g_object_ref (input);
 	return ret;
 }
+
+gpgme_data_t 
+seahorse_gpgme_data_new ()
+{
+	gpgme_error_t gerr;
+	gpgme_data_t data;
+    
+	gerr = gpgme_data_new (&data);
+	if (!GPG_IS_OK (gerr)) {
+		if (gpgme_err_code_to_errno (gerr) == ENOMEM || 
+		    gpgme_err_code (gerr) == GPG_ERR_ENOMEM) {
+                
+			g_error ("%s: failed to allocate gpgme_data_t", G_STRLOC);
+                
+		} else {
+			/* The only reason this should fail is above */
+			g_assert_not_reached ();
+            
+			/* Just in case */
+			abort ();
+		}
+	}
+    
+	return data;
+}
+
+gpgme_data_t
+seahorse_gpgme_data_new_from_mem (const char *buffer, size_t size, gboolean copy)
+{
+	gpgme_data_t data;
+	gpgme_error_t gerr;
+    
+	gerr = gpgme_data_new_from_mem (&data, buffer, size, copy ? 1 : 0);
+	if (!GPG_IS_OK (gerr)) {
+		if (gpgme_err_code_to_errno (gerr) == ENOMEM || 
+		    gpgme_err_code (gerr) == GPG_ERR_ENOMEM) {
+                
+			g_error ("%s: failed to allocate gpgme_data_t", G_STRLOC);
+                
+		} else {
+			/* The only reason this should fail is above */
+			g_assert_not_reached ();
+            
+			/* Just in case */
+			abort ();
+		}
+	}
+    
+	return data;
+}
+
+int 
+seahorse_gpgme_data_write_all (gpgme_data_t data, const void* buffer, size_t len)
+{
+	guchar *text = (guchar*)buffer;
+	gint written = 0;
+    
+	if (len < 0)
+		len = strlen ((gchar*)text);
+    
+	while (len > 0) {
+		written = gpgme_data_write (data, (void*)text, len);
+		if (written < 0) {
+			if (errno == EAGAIN || errno == EINTR)
+				continue;
+			return -1;
+		}
+        
+		len -= written;
+		text += written;
+	}
+    
+	return written;
+}
+
+void
+seahorse_gpgme_data_release (gpgme_data_t data)
+{
+	if (data)
+		gpgme_data_release (data);
+}

Copied: trunk/pgp/seahorse-gpgme-data.h (from r2661, /trunk/pgp/seahorse-gpgme-io.h)
==============================================================================
--- /trunk/pgp/seahorse-gpgme-io.h	(original)
+++ trunk/pgp/seahorse-gpgme-data.h	Tue Dec 16 02:49:26 2008
@@ -30,7 +30,21 @@
 #include <gpgme.h>
 #include <gio/gio.h>
 
-gpgme_data_t        seahorse_gpgme_input_data           (GInputStream* input);
-gpgme_data_t        seahorse_gpgme_output_data          (GOutputStream* output);
+gpgme_data_t        seahorse_gpgme_data_input           (GInputStream* input);
+
+gpgme_data_t        seahorse_gpgme_data_output          (GOutputStream* output);
+
+/* 
+ * GTK/Glib use a model where if allocation fails, the program exits. These 
+ * helper functions extend certain GPGME calls to provide the same behavior.
+ */
+ 
+gpgme_data_t        seahorse_gpgme_data_new          (void);
+
+void                seahorse_gpgme_data_release      (gpgme_data_t data);
+
+int                 seahorse_gpgme_data_write_all    (gpgme_data_t data, const void* buffer, size_t len);
+
+gpgme_data_t        seahorse_gpgme_data_new_from_mem (const char *buffer, size_t size, gboolean copy);
 
 #endif /* __SEAHORSE_GPGME_IO__ */

Added: trunk/pgp/seahorse-gpgme-dialogs.h
==============================================================================
--- (empty file)
+++ trunk/pgp/seahorse-gpgme-dialogs.h	Tue Dec 16 02:49:26 2008
@@ -0,0 +1,71 @@
+/*
+ * Seahorse
+ *
+ * Copyright (C) 2003 Jacob Perkins
+ * Copyright (C) 2004-2005 Stefan Walter
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details.
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the
+ * Free Software Foundation, Inc.,
+ * 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+/*
+ * Various UI elements and dialogs used in pgp component.
+ */
+ 
+#ifndef __SEAHORSE_GPGME_DIALOGS_H__
+#define __SEAHORSE_GPGME_DIALOGS_H__
+
+#include <gtk/gtk.h>
+
+#include "pgp/seahorse-gpgme-key.h"
+#include "pgp/seahorse-gpgme-photo.h"
+#include "pgp/seahorse-gpgme-subkey.h"
+#include "pgp/seahorse-gpgme-source.h"
+#include "pgp/seahorse-gpgme-uid.h"
+
+void            seahorse_gpgme_sign_prompt         (SeahorseGpgmeKey *key,
+                                                    GtkWindow *parent);
+
+void            seahorse_gpgme_sign_prompt_uid     (SeahorseGpgmeUid *uid,
+                                                    GtkWindow *parent);
+
+void            seahorse_gpgme_generate_register    (void);
+
+void            seahorse_gpgme_generate_show        (SeahorseGpgmeSource *sksrc,
+                                                     GtkWindow *parent);
+
+void            seahorse_gpgme_add_revoker_new      (SeahorseGpgmeKey *pkey,
+                                                     GtkWindow *parent);
+
+void            seahorse_gpgme_expires_new          (SeahorseGpgmeSubkey *subkey,
+                                                     GtkWindow *parent);
+
+void            seahorse_gpgme_add_subkey_new       (SeahorseGpgmeKey *pkey,
+                                                     GtkWindow *parent);
+
+void            seahorse_gpgme_add_uid_new          (SeahorseGpgmeKey *pkey,
+                                                     GtkWindow *parent);
+
+void            seahorse_gpgme_revoke_new           (SeahorseGpgmeSubkey *subkey,
+                                                     GtkWindow *parent);
+
+gboolean        seahorse_gpgme_photo_add            (SeahorseGpgmeKey *pkey, 
+                                                     GtkWindow *parent,
+                                                     const gchar *path);
+                                         
+gboolean        seahorse_gpgme_photo_delete         (SeahorseGpgmePhoto *photo,
+                                                     GtkWindow *parent);
+
+#endif /* __SEAHORSE_GPGME_DIALOGS_H__ */

Copied: trunk/pgp/seahorse-gpgme-expires.c (from r2661, /trunk/pgp/seahorse-pgp-expires.c)
==============================================================================
--- /trunk/pgp/seahorse-pgp-expires.c	(original)
+++ trunk/pgp/seahorse-gpgme-expires.c	Tue Dec 16 02:49:26 2008
@@ -29,19 +29,20 @@
 #include "seahorse-libdialogs.h"
 #include "seahorse-util.h"
 
-#include "seahorse-pgp-dialogs.h"
-#include "seahorse-pgp-key-op.h"
+#include "seahorse-gpgme-dialogs.h"
+#include "seahorse-gpgme-key-op.h"
+#include "seahorse-gpgme-subkey.h"
 
 static void
 ok_clicked (GtkButton *button, SeahorseWidget *swidget)
 {
 	GtkWidget *widget; 
-	SeahorsePgpSubkey *subkey;
+	SeahorseGpgmeSubkey *subkey;
 	gpgme_error_t err;
 	time_t expiry = 0;
 	struct tm t;
 	
-	subkey = SEAHORSE_PGP_SUBKEY (g_object_get_data (G_OBJECT (swidget), "subkey"));
+	subkey = SEAHORSE_GPGME_SUBKEY (g_object_get_data (G_OBJECT (swidget), "subkey"));
 	
 	widget = glade_xml_get_widget (swidget->xml, "expire");
 	if (!gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget))) {
@@ -59,10 +60,10 @@
 	g_object_ref (swidget);
 	g_object_ref (subkey);
 	
-	if (expiry != seahorse_pgp_subkey_get_expires (subkey)) {
-		err = seahorse_pgp_key_op_set_expires (subkey, expiry);
+	if (expiry != seahorse_pgp_subkey_get_expires (SEAHORSE_PGP_SUBKEY (subkey))) {
+		err = seahorse_gpgme_key_op_set_expires (subkey, expiry);
 		if (!GPG_IS_OK (err))
-			seahorse_pgp_handle_gpgme_error (err, _("Couldn't change expiry date"));
+			seahorse_gpgme_handle_error (err, _("Couldn't change expiry date"));
 	}
     
 	g_object_unref (subkey);
@@ -83,14 +84,15 @@
 }
 
 void
-seahorse_pgp_expires_new (SeahorsePgpSubkey *subkey, GtkWindow *parent)
+seahorse_gpgme_expires_new (SeahorseGpgmeSubkey *subkey, GtkWindow *parent)
 {
 	SeahorseWidget *swidget;
 	GtkWidget *date, *expire;
 	gulong expires;
-	gchar *label, *title;
+	gchar *title;
+	const gchar *label;
 	
-	g_return_if_fail (subkey != NULL && SEAHORSE_IS_PGP_SUBKEY (subkey));
+	g_return_if_fail (subkey != NULL && SEAHORSE_IS_GPGME_SUBKEY (subkey));
 
 	swidget = seahorse_widget_new_allow_multiple ("expires", parent);
 	g_return_if_fail (swidget != NULL);
@@ -106,7 +108,7 @@
 	glade_xml_signal_connect_data (swidget->xml, "on_expire_toggled",
 	                               G_CALLBACK (expires_toggled), swidget);
 	
-	expires = seahorse_pgp_subkey_get_expires (subkey); 
+	expires = seahorse_pgp_subkey_get_expires (SEAHORSE_PGP_SUBKEY (subkey)); 
 	if (!expires) {
 		gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (expire), TRUE);
 		gtk_widget_set_sensitive (date, FALSE);
@@ -124,9 +126,8 @@
 		}
 	}
 	
-	label = seahorse_pgp_subkey_get_description (subkey);
+	label = seahorse_pgp_subkey_get_description (SEAHORSE_PGP_SUBKEY (subkey));
 	title = g_strdup_printf (_("Expiry: %s"), label);
 	gtk_window_set_title (GTK_WINDOW (glade_xml_get_widget (swidget->xml, swidget->name)), title);
 	g_free (title);
-	g_free (label);
 }

Copied: trunk/pgp/seahorse-gpgme-generate.c (from r2661, /trunk/pgp/seahorse-pgp-generate.c)
==============================================================================
--- /trunk/pgp/seahorse-pgp-generate.c	(original)
+++ trunk/pgp/seahorse-gpgme-generate.c	Tue Dec 16 02:49:26 2008
@@ -36,10 +36,11 @@
 #include "seahorse-gtkstock.h"
 
 #include "seahorse-pgp.h"
-#include "seahorse-pgp-dialogs.h"
-#include "seahorse-pgp-key.h"
-#include "seahorse-pgp-key-op.h"
-#include "seahorse-pgp-source.h"
+#include "seahorse-gpgme.h"
+#include "seahorse-gpgme-dialogs.h"
+#include "seahorse-gpgme-key.h"
+#include "seahorse-gpgme-key-op.h"
+#include "seahorse-gpgme-source.h"
 
 #include "common/seahorse-registry.h"
 
@@ -57,7 +58,7 @@
 	sksrc = seahorse_context_find_source (seahorse_context_for_app (), SEAHORSE_PGP_TYPE, SEAHORSE_LOCATION_LOCAL);
 	g_return_if_fail (sksrc != NULL);
 	
-	seahorse_pgp_generate_show (SEAHORSE_PGP_SOURCE (sksrc), NULL);
+	seahorse_gpgme_generate_show (SEAHORSE_GPGME_SOURCE (sksrc), NULL);
 }
 
 static const GtkActionEntry ACTION_ENTRIES[] = {
@@ -66,17 +67,17 @@
 };
 
 void
-seahorse_pgp_generate_register (void)
+seahorse_gpgme_generate_register (void)
 {
 	GtkActionGroup *actions;
 	
-	actions = gtk_action_group_new ("pgp-generate");
+	actions = gtk_action_group_new ("gpgme-generate");
 
 	gtk_action_group_set_translation_domain (actions, GETTEXT_PACKAGE);
 	gtk_action_group_add_actions (actions, ACTION_ENTRIES, G_N_ELEMENTS (ACTION_ENTRIES), NULL);
 	
 	/* Register this as a generator */
-	seahorse_registry_register_object (NULL, actions, SEAHORSE_PGP_TYPE_STR, "generator", NULL);
+	seahorse_registry_register_object (NULL, G_OBJECT (actions), SEAHORSE_PGP_TYPE_STR, "generator", NULL);
 }
 
 /* --------------------------------------------------------------------------
@@ -108,7 +109,7 @@
 }
 
 static GtkWidget *
-_seahorse_pgp_generate_get_expiry_date (SeahorseWidget *swidget)
+get_expiry_date (SeahorseWidget *swidget)
 {
     GtkWidget *widget;
     GList *children;
@@ -132,7 +133,7 @@
 static void
 on_response (GtkDialog *dialog, guint response, SeahorseWidget *swidget)
 {
-    SeahorsePGPSource *sksrc;
+    SeahorseGpgmeSource *sksrc;
     SeahorseOperation *op;
     GtkWidget *widget;
     gchar *name;
@@ -197,14 +198,14 @@
     if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget)))
         expires = 0;
     else {
-        widget = _seahorse_pgp_generate_get_expiry_date (swidget);
+        widget = get_expiry_date (swidget);
         g_return_if_fail (widget);
 
         egg_datetime_get_as_time_t (EGG_DATETIME (widget), &expires);
     }
 
-    sksrc = SEAHORSE_PGP_SOURCE (g_object_get_data (G_OBJECT (swidget), "source"));
-    g_assert (SEAHORSE_IS_PGP_SOURCE (sksrc));
+    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));
@@ -215,11 +216,11 @@
     if (gtk_dialog_run (dialog) == GTK_RESPONSE_ACCEPT)
     {
         pass = seahorse_passphrase_prompt_get (dialog);
-        op = seahorse_pgp_key_op_generate (sksrc, name, email, comment,
-                                           pass, type, bits, expires, &gerr);
+        op = seahorse_gpgme_key_op_generate (sksrc, name, email, comment,
+                                             pass, type, bits, expires, &gerr);
     
         if (!GPG_IS_OK (gerr)) {
-            seahorse_pgp_handle_gpgme_error (gerr, _("Couldn't generate key"));
+            seahorse_gpgme_handle_error (gerr, _("Couldn't generate key"));
         } else {
             seahorse_progress_show (op, _("Generating key"), TRUE);
             seahorse_operation_watch (op, (SeahorseDoneFunc)completion_handler, NULL, NULL, NULL);
@@ -255,7 +256,7 @@
 {
     GtkWidget *widget;
     
-    widget = _seahorse_pgp_generate_get_expiry_date (swidget);
+    widget = get_expiry_date (swidget);
     g_return_if_fail (widget);
 
     gtk_widget_set_sensitive (widget, !gtk_toggle_button_get_active (button));
@@ -279,7 +280,7 @@
 }
 
 void
-seahorse_pgp_generate_show (SeahorsePGPSource *sksrc, GtkWindow *parent)
+seahorse_gpgme_generate_show (SeahorseGpgmeSource *sksrc, GtkWindow *parent)
 {
     SeahorseWidget *swidget;
     GtkWidget *widget, *datetime;

Copied: trunk/pgp/seahorse-gpgme-key-op.c (from r2661, /trunk/pgp/seahorse-pgp-key-op.c)
==============================================================================
--- /trunk/pgp/seahorse-pgp-key-op.c	(original)
+++ trunk/pgp/seahorse-gpgme-key-op.c	Tue Dec 16 02:49:26 2008
@@ -35,9 +35,11 @@
 
 #include "common/seahorse-object-list.h"
 
-#include "pgp/seahorse-gpgmex.h"
-#include "pgp/seahorse-pgp-key-op.h"
-#include "pgp/seahorse-pgp-operation.h"
+#include "pgp/seahorse-gpgme.h"
+#include "pgp/seahorse-gpgme-data.h"
+#include "pgp/seahorse-gpg-op.h"
+#include "pgp/seahorse-gpgme-key-op.h"
+#include "pgp/seahorse-gpgme-operation.h"
 
 #define PROMPT "keyedit.prompt"
 #define QUIT "quit"
@@ -70,7 +72,7 @@
 #define GPG_ULTIMATE    5
 
 /**
- * seahorse_pgp_key_op_generate:
+ * seahorse_gpgme_key_op_generate:
  * @sksrc: #SeahorseSource
  * @name: User ID name, must be at least 5 characters long
  * @email: Optional user ID email
@@ -86,12 +88,12 @@
  * Returns: SeahorseOperation*
  **/
 SeahorseOperation*
-seahorse_pgp_key_op_generate (SeahorsePGPSource *psrc, const gchar *name,
-                              const gchar *email, const gchar *comment,
-                              const gchar *passphrase, const SeahorseKeyEncType type,
-                              const guint length, const time_t expires, gpgme_error_t *err)
+seahorse_gpgme_key_op_generate (SeahorseGpgmeSource *psrc, const gchar *name,
+                                const gchar *email, const gchar *comment,
+                                const gchar *passphrase, const SeahorseKeyEncType type,
+                                const guint length, const time_t expires, gpgme_error_t *err)
 {
-    SeahorsePGPOperation *pop = NULL;
+    SeahorseGpgmeOperation *pop = NULL;
     gchar *common, *key_type, *start, *expires_date;
     const gchar *parms;
     
@@ -147,7 +149,7 @@
         parms = g_strdup_printf ("%s%d\n%s", start, length, common);
 
     if (GPG_IS_OK (*err)) {
-        pop = seahorse_pgp_operation_new (NULL);
+        pop = seahorse_gpgme_operation_new (NULL);
         *err = gpgme_op_genkey_start (pop->gctx, parms, NULL, NULL);
      }
 
@@ -161,18 +163,18 @@
 
 /* helper function for deleting @skey */
 static gpgme_error_t
-op_delete (SeahorsePgpKey *pkey, gboolean secret)
+op_delete (SeahorseGpgmeKey *pkey, gboolean secret)
 {
-	SeahorsePGPSource *psrc;
+	SeahorseGpgmeSource *psrc;
 	gpgme_error_t err;
 	gpgme_key_t key;
     
-	psrc = SEAHORSE_PGP_SOURCE (seahorse_object_get_source (SEAHORSE_OBJECT (pkey)));
-	g_return_val_if_fail (psrc && SEAHORSE_IS_PGP_SOURCE (psrc), GPG_E (GPG_ERR_INV_KEYRING));
+	psrc = SEAHORSE_GPGME_SOURCE (seahorse_object_get_source (SEAHORSE_OBJECT (pkey)));
+	g_return_val_if_fail (psrc && SEAHORSE_IS_GPGME_SOURCE (psrc), GPG_E (GPG_ERR_INV_KEYRING));
 	
 	g_object_ref (pkey);
 	
-	seahorse_util_wait_until ((key = seahorse_pgp_key_get_public (pkey)) != NULL);
+	seahorse_util_wait_until ((key = seahorse_gpgme_key_get_public (pkey)) != NULL);
 	
 	err = gpgme_op_delete (psrc->gctx, key, secret);
 	if (GPG_IS_OK (err))
@@ -184,14 +186,14 @@
 }
 
 gpgme_error_t
-seahorse_pgp_key_op_delete (SeahorsePgpKey *pkey)
+seahorse_gpgme_key_op_delete (SeahorseGpgmeKey *pkey)
 {
 	return op_delete (pkey, FALSE);
 }
 
 
 gpgme_error_t
-seahorse_pgp_key_op_delete_pair (SeahorsePgpKey *pkey)
+seahorse_gpgme_key_op_delete_pair (SeahorseGpgmeKey *pkey)
 {
 	return op_delete (pkey, TRUE);
 }
@@ -239,8 +241,8 @@
 
 /* Edit callback for gpgme */
 static gpgme_error_t
-seahorse_pgp_key_op_edit (gpointer data, gpgme_status_code_t status,
-		      const gchar *args, int fd)
+seahorse_gpgme_key_op_edit (gpointer data, gpgme_status_code_t status,
+                            const gchar *args, int fd)
 {
 	SeahorseEditParm *parms = (SeahorseEditParm*)data;
 	
@@ -280,16 +282,17 @@
 	gpgme_key_ref (key);
     
 	if (!ctx) {
-		ctx = seahorse_pgp_source_new_context ();
+		ctx = seahorse_gpgme_source_new_context ();
 		g_return_val_if_fail (ctx, GPG_E (GPG_ERR_GENERAL));
 		own_context = TRUE;
 	}
     
-	out = gpgmex_data_new ();
+	out = seahorse_gpgme_data_new ();
     
 	/* do edit callback, release data */
-	gerr = gpgme_op_edit (ctx, key, seahorse_pgp_key_op_edit, parms, out);
-	gpgmex_data_release (out);
+	gerr = gpgme_op_edit (ctx, key, seahorse_gpgme_key_op_edit, parms, out);
+	
+	seahorse_gpgme_data_release (out);
     
 	if (own_context)
 		gpgme_release (ctx);
@@ -306,24 +309,24 @@
 	
 	gerr = edit_gpgme_key (ctx, key, parms);
 	if (GPG_IS_OK (gerr))
-		seahorse_pgp_key_refresh_matching (key);
+		seahorse_gpgme_key_refresh_matching (key);
 	
 	return gerr;
 }
 
 static gpgme_error_t
-edit_key (SeahorsePgpKey *pkey, SeahorseEditParm *parms)
+edit_key (SeahorseGpgmeKey *pkey, SeahorseEditParm *parms)
 {
-	SeahorsePGPSource *psrc;
+	SeahorseGpgmeSource *psrc;
 	gpgme_error_t err;
 	gpgme_key_t key;
     
-	psrc = SEAHORSE_PGP_SOURCE (seahorse_object_get_source (SEAHORSE_OBJECT (pkey)));
-	g_return_val_if_fail (psrc && SEAHORSE_IS_PGP_SOURCE (psrc), GPG_E (GPG_ERR_INV_KEYRING));
+	psrc = SEAHORSE_GPGME_SOURCE (seahorse_object_get_source (SEAHORSE_OBJECT (pkey)));
+	g_return_val_if_fail (psrc && SEAHORSE_IS_GPGME_SOURCE (psrc), GPG_E (GPG_ERR_INV_KEYRING));
 
 	g_object_ref (pkey);
 	
-	seahorse_util_wait_until ((key = seahorse_pgp_key_get_public (pkey)) != NULL);
+	seahorse_util_wait_until ((key = seahorse_gpgme_key_get_public (pkey)) != NULL);
   
 	err = edit_refresh_gpgme_key (psrc->gctx, key, parms);
 
@@ -505,7 +508,7 @@
 	gpgme_ctx_t ctx;
 	gpgme_error_t gerr;
 
-	ctx = seahorse_pgp_source_new_context ();
+	ctx = seahorse_gpgme_source_new_context ();
 	g_return_val_if_fail (ctx, GPG_E (GPG_ERR_GENERAL));
 	
         gerr = gpgme_signers_add (ctx, signing_key);
@@ -535,45 +538,45 @@
 }
 
 gpgme_error_t
-seahorse_pgp_key_op_sign_uid (SeahorsePgpUid *uid,  SeahorsePgpKey *signer, 
-                              SeahorseSignCheck check, SeahorseSignOptions options)
+seahorse_gpgme_key_op_sign_uid (SeahorseGpgmeUid *uid,  SeahorseGpgmeKey *signer, 
+                                SeahorseSignCheck check, SeahorseSignOptions options)
 {
 	gpgme_key_t signing_key;
 	gpgme_key_t signed_key;
 	guint sign_index;
 	
-	seahorse_pgp_key_get_private (signer);
+	seahorse_gpgme_key_get_private (signer);
 
-	g_return_val_if_fail (SEAHORSE_IS_PGP_UID (uid), GPG_E (GPG_ERR_WRONG_KEY_USAGE));
-	g_return_val_if_fail (SEAHORSE_IS_PGP_KEY (signer), GPG_E (GPG_ERR_WRONG_KEY_USAGE));
+	g_return_val_if_fail (SEAHORSE_IS_GPGME_UID (uid), GPG_E (GPG_ERR_WRONG_KEY_USAGE));
+	g_return_val_if_fail (SEAHORSE_IS_GPGME_KEY (signer), GPG_E (GPG_ERR_WRONG_KEY_USAGE));
 	
-	signing_key = seahorse_pgp_key_get_private (signer);
+	signing_key = seahorse_gpgme_key_get_private (signer);
 	g_return_val_if_fail (signing_key, GPG_E (GPG_ERR_WRONG_KEY_USAGE));
 	
-	signed_key = seahorse_pgp_uid_get_pubkey (uid);
+	signed_key = seahorse_gpgme_uid_get_pubkey (uid);
 	g_return_val_if_fail (signing_key, GPG_E (GPG_ERR_INV_VALUE));
 	
-	sign_index = seahorse_pgp_uid_get_gpgme_index (uid) + 1;
+	sign_index = seahorse_gpgme_uid_get_gpgme_index (uid) + 1;
 	
 	return sign_process (signed_key, signing_key, sign_index, check, options);
 }
 
 gpgme_error_t
-seahorse_pgp_key_op_sign (SeahorsePgpKey *pkey, SeahorsePgpKey *signer, 
-                          SeahorseSignCheck check, SeahorseSignOptions options)
+seahorse_gpgme_key_op_sign (SeahorseGpgmeKey *pkey, SeahorseGpgmeKey *signer, 
+                            SeahorseSignCheck check, SeahorseSignOptions options)
 {
 	gpgme_key_t signing_key;
 	gpgme_key_t signed_key;
 	
-	seahorse_pgp_key_get_private (signer);
+	seahorse_gpgme_key_get_private (signer);
 
-	g_return_val_if_fail (SEAHORSE_IS_PGP_KEY (pkey), GPG_E (GPG_ERR_WRONG_KEY_USAGE));
-	g_return_val_if_fail (SEAHORSE_IS_PGP_KEY (signer), GPG_E (GPG_ERR_WRONG_KEY_USAGE));
+	g_return_val_if_fail (SEAHORSE_IS_GPGME_KEY (pkey), GPG_E (GPG_ERR_WRONG_KEY_USAGE));
+	g_return_val_if_fail (SEAHORSE_IS_GPGME_KEY (signer), GPG_E (GPG_ERR_WRONG_KEY_USAGE));
 	
-	signing_key = seahorse_pgp_key_get_private (signer);
+	signing_key = seahorse_gpgme_key_get_private (signer);
 	g_return_val_if_fail (signing_key, GPG_E (GPG_ERR_WRONG_KEY_USAGE));
 	
-	signed_key = seahorse_pgp_key_get_public (pkey);
+	signed_key = seahorse_gpgme_key_get_public (pkey);
 
 	return sign_process (signed_key, signing_key, 0, check, options);
 }
@@ -684,12 +687,12 @@
 }
 
 gpgme_error_t
-seahorse_pgp_key_op_change_pass (SeahorsePgpKey *pkey)
+seahorse_gpgme_key_op_change_pass (SeahorseGpgmeKey *pkey)
 {
 	SeahorseEditParm *parms;
 	gpgme_error_t err;
 	
-	g_return_val_if_fail (SEAHORSE_IS_PGP_KEY (pkey), GPG_E (GPG_ERR_WRONG_KEY_USAGE));    
+	g_return_val_if_fail (SEAHORSE_IS_GPGME_KEY (pkey), GPG_E (GPG_ERR_WRONG_KEY_USAGE));    
 	g_return_val_if_fail (seahorse_object_get_usage (SEAHORSE_OBJECT (pkey)) == SEAHORSE_USAGE_PRIVATE_KEY, GPG_E (GPG_ERR_WRONG_KEY_USAGE));
 	
 	parms = seahorse_edit_parm_new (PASS_START, edit_pass_action, edit_pass_transit, NULL);
@@ -812,7 +815,7 @@
 }
 
 /**
- * seahorse_pgp_key_op_set_trust:
+ * seahorse_gpgme_key_op_set_trust:
  * @skey: #SeahorseKey whose trust will be changed
  * @trust: New trust value that must be at least SEAHORSE_VALIDITY_UNKNOWN.
  * If @skey is a #SeahorseKeyPair, then @trust cannot be SEAHORSE_VALIDITY_UNKNOWN.
@@ -823,16 +826,16 @@
  * Returns: Error value
  **/
 gpgme_error_t
-seahorse_pgp_key_op_set_trust (SeahorsePgpKey *pkey, SeahorseValidity trust)
+seahorse_gpgme_key_op_set_trust (SeahorseGpgmeKey *pkey, SeahorseValidity trust)
 {
 	SeahorseEditParm *parms;
 	gint menu_choice;
 	
-	DEBUG_OPERATION(("[PGP_KEY_OP] set_trust: trust = %i",trust));
+	DEBUG_OPERATION(("[GPGME_KEY_OP] set_trust: trust = %i",trust));
 	
-	g_return_val_if_fail (SEAHORSE_IS_PGP_KEY (pkey), GPG_E (GPG_ERR_WRONG_KEY_USAGE));
+	g_return_val_if_fail (SEAHORSE_IS_GPGME_KEY (pkey), GPG_E (GPG_ERR_WRONG_KEY_USAGE));
 	g_return_val_if_fail (trust >= GPGME_VALIDITY_UNKNOWN, GPG_E (GPG_ERR_INV_VALUE));
-	g_return_val_if_fail (seahorse_pgp_key_get_trust (pkey) != trust, GPG_E (GPG_ERR_INV_VALUE));
+	g_return_val_if_fail (seahorse_gpgme_key_get_trust (pkey) != trust, GPG_E (GPG_ERR_INV_VALUE));
 	
 	if (seahorse_object_get_usage (SEAHORSE_OBJECT (pkey)) == SEAHORSE_USAGE_PRIVATE_KEY)
 		g_return_val_if_fail (trust != SEAHORSE_VALIDITY_UNKNOWN, GPG_E (GPG_ERR_INV_VALUE));
@@ -935,7 +938,7 @@
 }
 
 /**
- * seahorse_pgp_key_op_set_disabled:
+ * seahorse_gpgme_key_op_set_disabled:
  * @skey: #SeahorseKey to change
  * @disabled: New disabled state
  *
@@ -944,12 +947,12 @@
  * Returns: Error value
  **/
 gpgme_error_t
-seahorse_pgp_key_op_set_disabled (SeahorsePgpKey *pkey, gboolean disabled)
+seahorse_gpgme_key_op_set_disabled (SeahorseGpgmeKey *pkey, gboolean disabled)
 {
 	gchar *command;
 	SeahorseEditParm *parms;
 	
-	g_return_val_if_fail (SEAHORSE_IS_PGP_KEY (pkey), GPG_E (GPG_ERR_WRONG_KEY_USAGE));
+	g_return_val_if_fail (SEAHORSE_IS_GPGME_KEY (pkey), GPG_E (GPG_ERR_WRONG_KEY_USAGE));
 	
 	/* Get command and op */
 	if (disabled)
@@ -1083,19 +1086,19 @@
 }
 
 gpgme_error_t
-seahorse_pgp_key_op_set_expires (SeahorsePgpSubkey *subkey, const time_t expires)
+seahorse_gpgme_key_op_set_expires (SeahorseGpgmeSubkey *subkey, const time_t expires)
 {
 	ExpireParm exp_parm;
 	SeahorseEditParm *parms;
 	gpgme_key_t key;
 	
-	g_return_val_if_fail (SEAHORSE_IS_PGP_SUBKEY (subkey), GPG_E (GPG_ERR_WRONG_KEY_USAGE));
-	g_return_val_if_fail (expires != seahorse_pgp_subkey_get_expires (subkey), GPG_E (GPG_ERR_INV_VALUE));
+	g_return_val_if_fail (SEAHORSE_IS_GPGME_SUBKEY (subkey), GPG_E (GPG_ERR_WRONG_KEY_USAGE));
+	g_return_val_if_fail (expires != seahorse_pgp_subkey_get_expires (SEAHORSE_PGP_SUBKEY (subkey)), GPG_E (GPG_ERR_INV_VALUE));
 	
-	key = seahorse_pgp_subkey_get_pubkey (subkey);
+	key = seahorse_gpgme_subkey_get_pubkey (subkey);
 	g_return_val_if_fail (key, GPG_E (GPG_ERR_INV_VALUE));
 	
-	exp_parm.index = seahorse_pgp_subkey_get_index (subkey); 
+	exp_parm.index = seahorse_pgp_subkey_get_index (SEAHORSE_PGP_SUBKEY (subkey)); 
 	exp_parm.expires = expires;
 	
 	parms = seahorse_edit_parm_new (EXPIRE_START, edit_expire_action, edit_expire_transit, &exp_parm);
@@ -1210,13 +1213,13 @@
 }
 
 gpgme_error_t
-seahorse_pgp_key_op_add_revoker (SeahorsePgpKey *pkey, SeahorsePgpKey *revoker)
+seahorse_gpgme_key_op_add_revoker (SeahorseGpgmeKey *pkey, SeahorseGpgmeKey *revoker)
 {
 	SeahorseEditParm *parms;
 	GQuark id;
 	
-	g_return_val_if_fail (SEAHORSE_IS_PGP_KEY (pkey), GPG_E (GPG_ERR_WRONG_KEY_USAGE));    
-	g_return_val_if_fail (SEAHORSE_IS_PGP_KEY (revoker), GPG_E (GPG_ERR_WRONG_KEY_USAGE));    
+	g_return_val_if_fail (SEAHORSE_IS_GPGME_KEY (pkey), GPG_E (GPG_ERR_WRONG_KEY_USAGE));    
+	g_return_val_if_fail (SEAHORSE_IS_GPGME_KEY (revoker), GPG_E (GPG_ERR_WRONG_KEY_USAGE));    
 	g_return_val_if_fail (seahorse_object_get_usage (SEAHORSE_OBJECT (pkey)) == SEAHORSE_USAGE_PRIVATE_KEY, GPG_E (GPG_ERR_WRONG_KEY_USAGE));
 	g_return_val_if_fail (seahorse_object_get_usage (SEAHORSE_OBJECT (revoker)) == SEAHORSE_USAGE_PRIVATE_KEY, GPG_E (GPG_ERR_WRONG_KEY_USAGE));
 
@@ -1354,13 +1357,13 @@
 }
 
 gpgme_error_t
-seahorse_pgp_key_op_add_uid (SeahorsePgpKey *pkey, const gchar *name, 
-                             const gchar *email, const gchar *comment)
+seahorse_gpgme_key_op_add_uid (SeahorseGpgmeKey *pkey, const gchar *name, 
+                               const gchar *email, const gchar *comment)
 {
 	SeahorseEditParm *parms;
 	UidParm *uid_parm;
 	
-    g_return_val_if_fail (SEAHORSE_IS_PGP_KEY (pkey), GPG_E (GPG_ERR_WRONG_KEY_USAGE));    
+    g_return_val_if_fail (SEAHORSE_IS_GPGME_KEY (pkey), GPG_E (GPG_ERR_WRONG_KEY_USAGE));    
     g_return_val_if_fail (seahorse_object_get_usage (SEAHORSE_OBJECT (pkey)) == SEAHORSE_USAGE_PRIVATE_KEY, GPG_E (GPG_ERR_WRONG_KEY_USAGE));
 	g_return_val_if_fail (name != NULL && strlen (name) >= 5, GPG_E (GPG_ERR_INV_VALUE));
 	
@@ -1487,13 +1490,13 @@
 }
 
 gpgme_error_t
-seahorse_pgp_key_op_add_subkey (SeahorsePgpKey *pkey, const SeahorseKeyEncType type, 
-                                const guint length, const time_t expires)
+seahorse_gpgme_key_op_add_subkey (SeahorseGpgmeKey *pkey, const SeahorseKeyEncType type, 
+                                  const guint length, const time_t expires)
 {
 	SeahorseEditParm *parms;
 	SubkeyParm *key_parm;
 	
-    g_return_val_if_fail (SEAHORSE_IS_PGP_KEY (pkey), GPG_E (GPG_ERR_WRONG_KEY_USAGE));    
+    g_return_val_if_fail (SEAHORSE_IS_GPGME_KEY (pkey), GPG_E (GPG_ERR_WRONG_KEY_USAGE));    
     g_return_val_if_fail (seahorse_object_get_usage (SEAHORSE_OBJECT (pkey)) == SEAHORSE_USAGE_PRIVATE_KEY, GPG_E (GPG_ERR_WRONG_KEY_USAGE));
 	
 	/* Check length range & type */
@@ -1626,18 +1629,18 @@
 }
 
 gpgme_error_t
-seahorse_pgp_key_op_del_subkey (SeahorsePgpSubkey *subkey)
+seahorse_gpgme_key_op_del_subkey (SeahorseGpgmeSubkey *subkey)
 {
 	SeahorseEditParm *parms;
 	gpgme_key_t key;
 	int index;
 	
-	g_return_val_if_fail (SEAHORSE_IS_PGP_SUBKEY (subkey), GPG_E (GPG_ERR_WRONG_KEY_USAGE));
+	g_return_val_if_fail (SEAHORSE_IS_GPGME_SUBKEY (subkey), GPG_E (GPG_ERR_WRONG_KEY_USAGE));
 	
-	key = seahorse_pgp_subkey_get_pubkey (subkey);
+	key = seahorse_gpgme_subkey_get_pubkey (subkey);
 	g_return_val_if_fail (key, GPG_E (GPG_ERR_INV_VALUE));
 	
-	index = seahorse_pgp_subkey_get_index (subkey);
+	index = seahorse_pgp_subkey_get_index (SEAHORSE_PGP_SUBKEY (subkey));
 	parms = seahorse_edit_parm_new (DEL_KEY_START, del_key_action,
 	                                del_key_transit, GUINT_TO_POINTER (index));
 	
@@ -1798,23 +1801,23 @@
 }
 
 gpgme_error_t
-seahorse_pgp_key_op_revoke_subkey (SeahorsePgpSubkey *subkey, SeahorseRevokeReason reason, 
-                                   const gchar *description)
+seahorse_gpgme_key_op_revoke_subkey (SeahorseGpgmeSubkey *subkey, SeahorseRevokeReason reason, 
+                                     const gchar *description)
 {
 	RevSubkeyParm rev_parm;
 	SeahorseEditParm *parms;
 	gpgme_subkey_t gsubkey;
 	gpgme_key_t key;
 	
-	g_return_val_if_fail (SEAHORSE_IS_PGP_SUBKEY (subkey), GPG_E (GPG_ERR_WRONG_KEY_USAGE));
+	g_return_val_if_fail (SEAHORSE_IS_GPGME_SUBKEY (subkey), GPG_E (GPG_ERR_WRONG_KEY_USAGE));
 	
-	gsubkey = seahorse_pgp_subkey_get_subkey (subkey);
+	gsubkey = seahorse_gpgme_subkey_get_subkey (subkey);
 	g_return_val_if_fail (!gsubkey->revoked, GPG_E (GPG_ERR_INV_VALUE));
 	
-	key = seahorse_pgp_subkey_get_pubkey (subkey);
+	key = seahorse_gpgme_subkey_get_pubkey (subkey);
 	g_return_val_if_fail (key, GPG_E (GPG_ERR_INV_VALUE));
 	
-	rev_parm.index = seahorse_pgp_subkey_get_index (subkey);
+	rev_parm.index = seahorse_pgp_subkey_get_index (SEAHORSE_PGP_SUBKEY (subkey));
 	rev_parm.reason = reason;
 	rev_parm.description = description;
 	
@@ -1933,24 +1936,24 @@
 }
                 
 gpgme_error_t   
-seahorse_pgp_key_op_primary_uid (SeahorsePgpUid *uid)
+seahorse_gpgme_key_op_primary_uid (SeahorseGpgmeUid *uid)
 {
 	PrimaryParm pri_parm;
 	SeahorseEditParm *parms;
 	gpgme_user_id_t userid;
 	gpgme_key_t key;
 
-	g_return_val_if_fail (SEAHORSE_IS_PGP_UID (uid), GPG_E (GPG_ERR_WRONG_KEY_USAGE));
+	g_return_val_if_fail (SEAHORSE_IS_GPGME_UID (uid), GPG_E (GPG_ERR_WRONG_KEY_USAGE));
     
 	/* Make sure not revoked */
-	userid = seahorse_pgp_uid_get_userid (uid);
+	userid = seahorse_gpgme_uid_get_userid (uid);
 	g_return_val_if_fail (userid != NULL && !userid->revoked && !userid->invalid, 
 	                      GPG_E (GPG_ERR_INV_VALUE));
     
-	key = seahorse_pgp_uid_get_pubkey (uid);
+	key = seahorse_gpgme_uid_get_pubkey (uid);
 	g_return_val_if_fail (key, GPG_E (GPG_ERR_INV_VALUE));
     
-	pri_parm.index = seahorse_pgp_uid_get_actual_index (uid);
+	pri_parm.index = seahorse_gpgme_uid_get_actual_index (uid);
    
 	parms = seahorse_edit_parm_new (PRIMARY_START, primary_action,
 	                                primary_transit, &pri_parm);
@@ -2083,18 +2086,18 @@
 }
                 
 gpgme_error_t   
-seahorse_pgp_key_op_del_uid (SeahorsePgpUid *uid)
+seahorse_gpgme_key_op_del_uid (SeahorseGpgmeUid *uid)
 {
 	DelUidParm del_uid_parm;
 	SeahorseEditParm *parms;
 	gpgme_key_t key;
 	
-	g_return_val_if_fail (SEAHORSE_IS_PGP_UID (uid), GPG_E (GPG_ERR_WRONG_KEY_USAGE));
+	g_return_val_if_fail (SEAHORSE_IS_GPGME_UID (uid), GPG_E (GPG_ERR_WRONG_KEY_USAGE));
     
-	key = seahorse_pgp_uid_get_pubkey (uid);
+	key = seahorse_gpgme_uid_get_pubkey (uid);
 	g_return_val_if_fail (key, GPG_E (GPG_ERR_INV_VALUE));
   
-	del_uid_parm.index = seahorse_pgp_uid_get_actual_index (uid);
+	del_uid_parm.index = seahorse_gpgme_uid_get_actual_index (uid);
    
 	parms = seahorse_edit_parm_new (DEL_UID_START, del_uid_action,
 	                                del_uid_transit, &del_uid_parm);
@@ -2211,16 +2214,16 @@
 }
 
 gpgme_error_t 
-seahorse_pgp_key_op_photo_add (SeahorsePgpKey *pkey, const gchar *filename)
+seahorse_gpgme_key_op_photo_add (SeahorseGpgmeKey *pkey, const gchar *filename)
 {
 	SeahorseEditParm *parms;
 	PhotoIdAddParm photoid_add_parm;
 	gpgme_key_t key;
 	
-	g_return_val_if_fail (SEAHORSE_IS_PGP_KEY (key), GPG_E (GPG_ERR_WRONG_KEY_USAGE));
+	g_return_val_if_fail (SEAHORSE_IS_GPGME_KEY (key), GPG_E (GPG_ERR_WRONG_KEY_USAGE));
 	g_return_val_if_fail (filename, GPG_E (GPG_ERR_INV_VALUE));
       
-	key = seahorse_pgp_key_get_public (pkey);
+	key = seahorse_gpgme_key_get_public (pkey);
 	g_return_val_if_fail (key, GPG_E (GPG_ERR_INV_VALUE));
     
 	photoid_add_parm.filename = filename;
@@ -2232,18 +2235,18 @@
 }
 
 gpgme_error_t 
-seahorse_pgp_key_op_photo_delete (SeahorsePgpPhoto *photo)
+seahorse_gpgme_key_op_photo_delete (SeahorseGpgmePhoto *photo)
 {
 	DelUidParm del_uid_parm;
 	SeahorseEditParm *parms;
 	gpgme_key_t key;
  
-	g_return_val_if_fail (SEAHORSE_IS_PGP_PHOTO (photo), GPG_E (GPG_ERR_WRONG_KEY_USAGE));
+	g_return_val_if_fail (SEAHORSE_IS_GPGME_PHOTO (photo), GPG_E (GPG_ERR_WRONG_KEY_USAGE));
       
-	key = seahorse_pgp_photo_get_pubkey (photo);
+	key = seahorse_gpgme_photo_get_pubkey (photo);
 	g_return_val_if_fail (key, GPG_E (GPG_ERR_INV_VALUE));
     
-	del_uid_parm.index = seahorse_pgp_photo_get_index (photo);
+	del_uid_parm.index = seahorse_gpgme_photo_get_index (photo);
    
 	parms = seahorse_edit_parm_new (DEL_UID_START, del_uid_action,
 	                                del_uid_transit, &del_uid_parm);
@@ -2301,7 +2304,7 @@
                       const gchar *args, gpointer data, gpgme_error_t *err)
 {
 	PhotoIdLoadParm *parm = (PhotoIdLoadParm*)data;
-	SeahorsePgpPhoto *photo;
+	SeahorseGpgmePhoto *photo;
 	GdkPixbuf *pixbuf;
 	guint next_state = 0;
 	struct stat st;
@@ -2332,7 +2335,7 @@
 		
 		if (g_file_test (parm->output_file, G_FILE_TEST_EXISTS)) {
 
-			photo = seahorse_pgp_photo_new (parm->key, NULL, parm->uid);
+			photo = seahorse_gpgme_photo_new (parm->key, NULL, parm->uid);
 			parm->photos = g_list_append (parm->photos, photo);
 			
 			if (g_stat (parm->output_file, &st) == -1) {
@@ -2356,7 +2359,7 @@
 				                                   "gnome-unknown", 48, 0, NULL);
 			}
 			    
-			seahorse_pgp_photo_set_pixbuf (photo, pixbuf);
+			seahorse_pgp_photo_set_pixbuf (SEAHORSE_PGP_PHOTO (photo), pixbuf);
 			g_object_unref (pixbuf);
 		}
 	
@@ -2405,17 +2408,8 @@
 	return next_state;
 }
 
-/**
- * seahorse_pgp_key_op_photoid_load
- * @skey: #SeahorseKey to get list of photoids for
- * @photoids: The location to put the photoids
- *
- * Tries to create list of photoids for skey.
- *
- * Returns: Error value
- **/
 gpgme_error_t 
-seahorse_pgp_key_op_photos_load (SeahorsePgpKey *pkey)
+seahorse_gpgme_key_op_photos_load (SeahorseGpgmeKey *pkey)
 {
 	/* Make sure there's enough room for the .jpg extension */
 	gchar image_path[]    = "/tmp/seahorse-photoid-XXXXXX\0\0\0\0";
@@ -2429,9 +2423,9 @@
 	gchar *path;
 	guint fd;
 
-	g_return_val_if_fail (SEAHORSE_IS_PGP_KEY (pkey), GPG_E (GPG_ERR_WRONG_KEY_USAGE));
+	g_return_val_if_fail (SEAHORSE_IS_GPGME_KEY (pkey), GPG_E (GPG_ERR_WRONG_KEY_USAGE));
 	
-	key = seahorse_pgp_key_get_public (pkey);
+	key = seahorse_gpgme_key_get_public (pkey);
 	g_return_val_if_fail (key, GPG_E (GPG_ERR_INV_VALUE));
 	g_return_val_if_fail (key->subkeys && key->subkeys->keyid, GPG_E (GPG_ERR_INV_VALUE));
 	keyid = key->subkeys->keyid;
@@ -2455,7 +2449,7 @@
 		photoid_load_parm.key = key;
         
 		DEBUG_OPERATION (("PhotoIdLoad KeyID %s\n", keyid));
-		gerr = gpgmex_op_num_uids (NULL, keyid, &(photoid_load_parm.num_uids));
+		gerr = seahorse_gpg_op_num_uids (NULL, keyid, &(photoid_load_parm.num_uids));
 		DEBUG_OPERATION (("PhotoIDLoad Number of UIDs %i\n", photoid_load_parm.num_uids));
         
 		if (GPG_IS_OK (gerr)) {
@@ -2475,7 +2469,7 @@
 			setenv ("PATH", oldpath, 1);
 
 			if (GPG_IS_OK (gerr))
-				seahorse_pgp_key_set_photos (pkey, photoid_load_parm.photos);
+				seahorse_pgp_key_set_photos (SEAHORSE_PGP_KEY (pkey), photoid_load_parm.photos);
 		}
 		
 		seahorse_object_list_free (photoid_load_parm.photos);
@@ -2487,18 +2481,18 @@
 }
 
 gpgme_error_t   
-seahorse_pgp_key_op_photo_primary (SeahorsePgpPhoto *photo)
+seahorse_gpgme_key_op_photo_primary (SeahorseGpgmePhoto *photo)
 {
 	PrimaryParm pri_parm;
 	SeahorseEditParm *parms;
 	gpgme_key_t key;
     
-	g_return_val_if_fail (SEAHORSE_IS_PGP_PHOTO (photo), GPG_E (GPG_ERR_WRONG_KEY_USAGE));
+	g_return_val_if_fail (SEAHORSE_IS_GPGME_PHOTO (photo), GPG_E (GPG_ERR_WRONG_KEY_USAGE));
       
-	key = seahorse_pgp_photo_get_pubkey (photo);
+	key = seahorse_gpgme_photo_get_pubkey (photo);
 	g_return_val_if_fail (key, GPG_E (GPG_ERR_INV_VALUE));
     
-	pri_parm.index = seahorse_pgp_photo_get_index (photo);
+	pri_parm.index = seahorse_gpgme_photo_get_index (photo);
    
 	parms = seahorse_edit_parm_new (PRIMARY_START, primary_action,
 	                                primary_transit, &pri_parm);

Copied: trunk/pgp/seahorse-gpgme-key-op.h (from r2661, /trunk/pgp/seahorse-pgp-key-op.h)
==============================================================================
--- /trunk/pgp/seahorse-pgp-key-op.h	(original)
+++ trunk/pgp/seahorse-gpgme-key-op.h	Tue Dec 16 02:49:26 2008
@@ -19,8 +19,8 @@
  * Boston, MA 02111-1307, USA.
  */
 
-#ifndef __SEAHORSE_PGP_KEY_OP_H__
-#define __SEAHORSE_PGP_KEY_OP_H__
+#ifndef __SEAHORSE_GPGME_KEY_OP_H__
+#define __SEAHORSE_GPGME_KEY_OP_H__
 
 #include <glib.h>
 #include <gpgme.h>
@@ -28,12 +28,11 @@
 
 #include "seahorse-operation.h"
 
-#include "pgp/seahorse-gpgmex.h"
-#include "pgp/seahorse-pgp-key.h"
-#include "pgp/seahorse-pgp-subkey.h"
-#include "pgp/seahorse-pgp-uid.h"
-#include "pgp/seahorse-pgp-photo.h"
-#include "pgp/seahorse-pgp-source.h"
+#include "pgp/seahorse-gpgme-key.h"
+#include "pgp/seahorse-gpgme-subkey.h"
+#include "pgp/seahorse-gpgme-uid.h"
+#include "pgp/seahorse-gpgme-source.h"
+#include "pgp/seahorse-gpgme-photo.h"
 
 /* Key type options. */
 typedef enum {
@@ -107,7 +106,7 @@
 	REVOKE_NOT_USED = 3
 } SeahorseRevokeReason;
 
-SeahorseOperation*    seahorse_pgp_key_op_generate           (SeahorsePGPSource  *sksrc,
+SeahorseOperation*    seahorse_gpgme_key_op_generate         (SeahorseGpgmeSource  *sksrc,
                                                               const gchar *name,
                                                               const gchar *email,
                                                               const gchar *comment,
@@ -117,61 +116,61 @@
                                                               time_t expires,
                                                               gpgme_error_t *err);
 
-gpgme_error_t         seahorse_pgp_key_op_delete             (SeahorsePgpKey *pkey);
+gpgme_error_t         seahorse_gpgme_key_op_delete           (SeahorseGpgmeKey *pkey);
 
-gpgme_error_t         seahorse_pgp_key_op_delete_pair        (SeahorsePgpKey *pkey);
+gpgme_error_t         seahorse_gpgme_key_op_delete_pair      (SeahorseGpgmeKey *pkey);
 
-gpgme_error_t         seahorse_pgp_key_op_sign               (SeahorsePgpKey *key,
-                                                              SeahorsePgpKey *signer,
+gpgme_error_t         seahorse_gpgme_key_op_sign             (SeahorseGpgmeKey *key,
+                                                              SeahorseGpgmeKey *signer,
                                                               SeahorseSignCheck check,
                                                               SeahorseSignOptions options);
 
-gpgme_error_t         seahorse_pgp_key_op_sign_uid           (SeahorsePgpUid *uid, 
-                                                              SeahorsePgpKey *signer, 
+gpgme_error_t         seahorse_gpgme_key_op_sign_uid         (SeahorseGpgmeUid *uid, 
+                                                              SeahorseGpgmeKey *signer, 
                                                               SeahorseSignCheck check, 
                                                               SeahorseSignOptions options);
 
-gpgme_error_t         seahorse_pgp_key_op_change_pass        (SeahorsePgpKey *pkey);
+gpgme_error_t         seahorse_gpgme_key_op_change_pass      (SeahorseGpgmeKey *pkey);
 
-gpgme_error_t         seahorse_pgp_key_op_set_trust          (SeahorsePgpKey *pkey,
+gpgme_error_t         seahorse_gpgme_key_op_set_trust        (SeahorseGpgmeKey *pkey,
                                                               SeahorseValidity validity);
 
-gpgme_error_t         seahorse_pgp_key_op_set_disabled       (SeahorsePgpKey *pkey,
+gpgme_error_t         seahorse_gpgme_key_op_set_disabled     (SeahorseGpgmeKey *pkey,
                                                               gboolean disabled);
 
-gpgme_error_t         seahorse_pgp_key_op_set_expires        (SeahorsePgpSubkey *subkey,
+gpgme_error_t         seahorse_gpgme_key_op_set_expires      (SeahorseGpgmeSubkey *subkey,
                                                               time_t expires);
 
-gpgme_error_t         seahorse_pgp_key_op_add_revoker        (SeahorsePgpKey *pkey, 
-                                                              SeahorsePgpKey *revoker);
+gpgme_error_t         seahorse_gpgme_key_op_add_revoker      (SeahorseGpgmeKey *pkey, 
+                                                              SeahorseGpgmeKey *revoker);
 
-gpgme_error_t         seahorse_pgp_key_op_add_uid            (SeahorsePgpKey *pkey,
+gpgme_error_t         seahorse_gpgme_key_op_add_uid          (SeahorseGpgmeKey *pkey,
                                                               const gchar *name,
                                                               const gchar *email,
                                                               const gchar *comment);
 
-gpgme_error_t         seahorse_pgp_key_op_primary_uid        (SeahorsePgpUid *uid);
+gpgme_error_t         seahorse_gpgme_key_op_primary_uid      (SeahorseGpgmeUid *uid);
 
-gpgme_error_t         seahorse_pgp_key_op_del_uid            (SeahorsePgpUid *uid);
+gpgme_error_t         seahorse_gpgme_key_op_del_uid          (SeahorseGpgmeUid *uid);
                              
-gpgme_error_t         seahorse_pgp_key_op_add_subkey         (SeahorsePgpKey *pkey,
+gpgme_error_t         seahorse_gpgme_key_op_add_subkey       (SeahorseGpgmeKey *pkey,
                                                               SeahorseKeyEncType type,
                                                               guint length,
                                                               time_t expires);
 
-gpgme_error_t         seahorse_pgp_key_op_del_subkey         (SeahorsePgpSubkey *subkey);
+gpgme_error_t         seahorse_gpgme_key_op_del_subkey       (SeahorseGpgmeSubkey *subkey);
 
-gpgme_error_t         seahorse_pgp_key_op_revoke_subkey      (SeahorsePgpSubkey *subkey,
+gpgme_error_t         seahorse_gpgme_key_op_revoke_subkey    (SeahorseGpgmeSubkey *subkey,
                                                               SeahorseRevokeReason reason,
                                                               const gchar *description);
 
-gpgme_error_t         seahorse_pgp_key_op_photo_add          (SeahorsePgpKey *pkey,
+gpgme_error_t         seahorse_gpgme_key_op_photo_add        (SeahorseGpgmeKey *pkey,
                                                               const gchar *filename);
  
-gpgme_error_t         seahorse_pgp_key_op_photo_delete       (SeahorsePgpPhoto *photo);
+gpgme_error_t         seahorse_gpgme_key_op_photo_delete     (SeahorseGpgmePhoto *photo);
                                                      
-gpgme_error_t         seahorse_pgp_key_op_photos_load        (SeahorsePgpKey *key);
+gpgme_error_t         seahorse_gpgme_key_op_photos_load      (SeahorseGpgmeKey *key);
 
-gpgme_error_t         seahorse_pgp_key_op_photo_primary      (SeahorsePgpPhoto *photo);
+gpgme_error_t         seahorse_gpgme_key_op_photo_primary    (SeahorseGpgmePhoto *photo);
 
-#endif /* __SEAHORSE_PGP_KEY_OP_H__ */
+#endif /* __SEAHORSE_GPGME_KEY_OP_H__ */

Added: trunk/pgp/seahorse-gpgme-key.c
==============================================================================
--- (empty file)
+++ trunk/pgp/seahorse-gpgme-key.c	Tue Dec 16 02:49:26 2008
@@ -0,0 +1,669 @@
+/*
+ * Seahorse
+ *
+ * Copyright (C) 2005 Stefan Walter
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details.
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the
+ * Free Software Foundation, Inc.,
+ * 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+#include "config.h"
+
+#include <string.h>
+
+#include <glib/gi18n.h>
+
+#include "seahorse-context.h"
+#include "seahorse-source.h"
+#include "seahorse-gtkstock.h"
+#include "seahorse-util.h"
+
+#include "common/seahorse-object-list.h"
+
+#include "pgp/seahorse-pgp-key.h"
+#include "pgp/seahorse-gpgme.h"
+#include "pgp/seahorse-gpgme-key-op.h"
+#include "pgp/seahorse-gpgme-photo.h"
+#include "pgp/seahorse-gpgme-source.h"
+#include "pgp/seahorse-gpgme-uid.h"
+
+enum {
+	PROP_0,
+	PROP_PUBKEY,
+	PROP_SECKEY,
+	PROP_VALIDITY,
+	PROP_TRUST
+};
+
+G_DEFINE_TYPE (SeahorseGpgmeKey, seahorse_gpgme_key, SEAHORSE_TYPE_PGP_KEY);
+
+struct _SeahorseGpgmeKeyPrivate {
+	gpgme_key_t pubkey;   		/* The public key */
+	gpgme_key_t seckey;      	/* The secret key */
+	gboolean has_secret;		/* Whether we have a secret key or not */
+
+	int list_mode;                  /* What to load our public key as */
+	gboolean photos_loaded;		/* Photos were loaded */
+};
+
+/* -----------------------------------------------------------------------------
+ * INTERNAL HELPERS
+ */
+
+static gboolean 
+load_gpgme_key (GQuark id, int mode, int secret, gpgme_key_t *key)
+{
+	GError *err = NULL;
+	gpgme_ctx_t ctx;
+	gpgme_error_t gerr;
+	
+	ctx = seahorse_gpgme_source_new_context ();
+	gpgme_set_keylist_mode (ctx, mode);
+	gerr = gpgme_op_keylist_start (ctx, seahorse_pgp_key_get_rawid (id), secret);
+	if (GPG_IS_OK (gerr)) {
+		gerr = gpgme_op_keylist_next (ctx, key);
+		gpgme_op_keylist_end (ctx);
+	}
+
+	gpgme_release (ctx);
+	
+	if (!GPG_IS_OK (gerr)) {
+		seahorse_gpgme_to_error (gerr, &err);
+		g_message ("couldn't load GPGME key: %s", err->message);
+		return FALSE;
+	}
+	
+	return TRUE;
+}
+
+static void
+load_key_public (SeahorseGpgmeKey *self, int list_mode)
+{
+	gpgme_key_t key = NULL;
+	gboolean ret;
+	GQuark id;
+	
+	list_mode |= self->pv->list_mode;
+	
+	id = seahorse_object_get_id (SEAHORSE_OBJECT (self));
+	g_return_if_fail (id);
+	
+	ret = load_gpgme_key (id, list_mode, FALSE, &key);
+	if (ret) {
+		self->pv->list_mode = list_mode;
+		seahorse_gpgme_key_set_public (self, key);
+		gpgme_key_unref (key);
+	}
+}
+
+static gboolean
+require_key_public (SeahorseGpgmeKey *self, int list_mode)
+{
+	if (!self->pv->pubkey || (self->pv->list_mode & list_mode) != list_mode)
+		load_key_public (self, list_mode);
+	return self->pv->pubkey && (self->pv->list_mode & list_mode) == list_mode;
+}
+
+static void
+load_key_private (SeahorseGpgmeKey *self)
+{
+	gpgme_key_t key = NULL;
+	gboolean ret;
+	GQuark id;
+	
+	if (!self->pv->has_secret)
+		return;
+	
+	id = seahorse_object_get_id (SEAHORSE_OBJECT (self));
+	g_return_if_fail (id);
+	
+	ret = load_gpgme_key (id, GPGME_KEYLIST_MODE_LOCAL, TRUE, &key);
+	if (ret) {
+		seahorse_gpgme_key_set_private (self, key);
+		gpgme_key_unref (key);
+	}
+}
+
+static gboolean
+require_key_private (SeahorseGpgmeKey *self)
+{
+	if (!self->pv->seckey)
+		load_key_private (self);
+	return self->pv->seckey != NULL;
+}
+
+static gboolean
+require_key_uids (SeahorseGpgmeKey *self)
+{
+	return require_key_public (self, GPGME_KEYLIST_MODE_LOCAL);
+}
+
+static gboolean
+require_key_subkeys (SeahorseGpgmeKey *self)
+{
+	return require_key_public (self, GPGME_KEYLIST_MODE_LOCAL);
+}
+
+static void
+load_key_photos (SeahorseGpgmeKey *self)
+{
+	gpgme_error_t gerr;
+	gerr = seahorse_gpgme_key_op_photos_load (self);
+	if (!GPG_IS_OK (gerr)) 
+		g_message ("couldn't load key photos: %s", gpgme_strerror (gerr));
+	else
+		self->pv->photos_loaded = TRUE;
+}
+
+static gboolean
+require_key_photos (SeahorseGpgmeKey *self)
+{
+	if (!self->pv->photos_loaded)
+		load_key_photos (self);
+	return self->pv->photos_loaded;
+}
+
+static void
+renumber_actual_uids (SeahorseGpgmeKey *self)
+{
+	GArray *index_map;
+	GList *photos, *uids, *l;
+	gboolean photos_loaded;
+	guint index, i;
+	
+	g_assert (SEAHORSE_IS_GPGME_KEY (self));
+	
+	/* 
+	 * This function is necessary because the uid stored in a gpgme_user_id_t
+	 * struct is only usable with gpgme functions.  Problems will be caused if 
+	 * that uid is used with functions found in seahorse-gpgme-key-op.h.  This 
+	 * function is only to be called with uids from gpgme_user_id_t structs.
+	 */
+
+	/* Prevent photos from actually loading if not already loaded */
+	photos_loaded = self->pv->photos_loaded;
+	self->pv->photos_loaded = TRUE;
+	photos = seahorse_pgp_key_get_photos (SEAHORSE_PGP_KEY (self));
+	self->pv->photos_loaded = photos_loaded;
+
+	/* First we build a bitmap of where all the photo uid indexes are */
+	index_map = g_array_new (FALSE, TRUE, sizeof (gboolean));
+	for (l = photos; l; l = g_list_next (l)) {
+		index = seahorse_gpgme_photo_get_index (l->data);
+		if (index >= index_map->len)
+			g_array_set_size (index_map, index + 1);
+		g_array_index (index_map, gboolean, index) = TRUE;
+	}
+	
+	/* Now for each UID we add however many photo indexes are below the gpgme index */
+	uids = seahorse_pgp_key_get_uids (SEAHORSE_PGP_KEY (self));
+	for (l = uids; l; l = g_list_next (l)) {
+		index = seahorse_gpgme_uid_get_gpgme_index (l->data);
+		for (i = 0; i < index_map->len && i < index; ++i) {
+			if(g_array_index (index_map, gboolean, index))
+				++index;
+		}
+		seahorse_gpgme_uid_set_actual_index (l->data, index);
+	}
+	
+	g_array_free (index_map, TRUE);
+}
+
+static void 
+realize_uids (SeahorseGpgmeKey *self)
+{
+	gpgme_user_id_t guid;
+	SeahorseGpgmeUid *uid;
+	GList *list = NULL;
+	
+	if (self->pv->pubkey) {
+
+		for (guid = self->pv->pubkey->uids; guid; guid = guid->next) {
+			uid = seahorse_gpgme_uid_new (self->pv->pubkey, guid);
+			list = seahorse_object_list_prepend (list, uid);
+			g_object_unref (uid);
+		}
+		
+		list = g_list_reverse (list);
+	}
+
+	seahorse_pgp_key_set_uids (SEAHORSE_PGP_KEY (self), list);
+	seahorse_object_list_free (list);
+}
+
+static void 
+realize_subkeys (SeahorseGpgmeKey *self)
+{
+	gpgme_subkey_t gsubkey;
+	SeahorseGpgmeSubkey *subkey;
+	GList *list = NULL;
+	
+	if (self->pv->pubkey) {
+
+		for (gsubkey = self->pv->pubkey->subkeys; gsubkey; gsubkey = gsubkey->next) {
+			subkey = seahorse_gpgme_subkey_new (self->pv->pubkey, gsubkey);
+			list = seahorse_object_list_prepend (list, subkey);
+			g_object_unref (subkey);
+		}
+		
+		list = g_list_reverse (list);
+	}
+
+	seahorse_pgp_key_set_subkeys (SEAHORSE_PGP_KEY (self), list);
+	seahorse_object_list_free (list);
+}
+
+static void
+refresh_each_object (SeahorseObject *object, gpointer data)
+{
+	seahorse_object_refresh (object);
+}
+
+/* -----------------------------------------------------------------------------
+ * OBJECT 
+ */
+
+static void
+seahorse_gpgme_key_realize (SeahorseObject *obj)
+{
+	SeahorseGpgmeKey *self = SEAHORSE_GPGME_KEY (obj);
+	SeahorseLocation loc;
+	SeahorseUsage usage;
+	const gchar *description, *icon, *identifier;
+	GQuark id;
+	guint flags;
+	
+	if (!self->pv->pubkey)
+		return;
+	
+	if (!require_key_public (self, GPGME_KEYLIST_MODE_LOCAL))
+		g_return_if_reached ();
+	
+	g_return_if_fail (self->pv->pubkey);
+	g_return_if_fail (self->pv->pubkey->subkeys);
+
+	/* Update the sub UIDs */
+	realize_uids (self);
+	realize_subkeys (self);
+
+	/* The flags */
+	flags = SEAHORSE_FLAG_EXPORTABLE;
+
+	if (!self->pv->pubkey->disabled && !self->pv->pubkey->expired && 
+	    !self->pv->pubkey->revoked && !self->pv->pubkey->invalid) {
+		if (seahorse_gpgme_key_get_validity (self) >= SEAHORSE_VALIDITY_MARGINAL)
+			flags |= SEAHORSE_FLAG_IS_VALID;
+		if (self->pv->pubkey->can_encrypt)
+			flags |= SEAHORSE_FLAG_CAN_ENCRYPT;
+		if (self->pv->seckey && self->pv->pubkey->can_sign)
+			flags |= SEAHORSE_FLAG_CAN_SIGN;
+	}
+
+	if (self->pv->pubkey->expired)
+		flags |= SEAHORSE_FLAG_EXPIRED;
+
+	if (self->pv->pubkey->revoked)
+		flags |= SEAHORSE_FLAG_REVOKED;
+
+	if (self->pv->pubkey->disabled)
+		flags |= SEAHORSE_FLAG_DISABLED;
+
+	if (seahorse_gpgme_key_get_trust (self) >= SEAHORSE_VALIDITY_MARGINAL && 
+	    !self->pv->pubkey->revoked && !self->pv->pubkey->disabled && 
+	    !self->pv->pubkey->expired)
+		flags |= SEAHORSE_FLAG_TRUSTED;
+
+	g_object_set (obj, "flags", flags, NULL);
+	
+	SEAHORSE_OBJECT_CLASS (seahorse_gpgme_key_parent_class)->realize (obj);
+	
+	/* The key id */
+	g_return_if_fail (self->pv->pubkey->subkeys);
+	identifier = self->pv->pubkey->subkeys->keyid;
+
+	/* The location */
+	loc = seahorse_object_get_location (obj);
+	
+	if (self->pv->pubkey->keylist_mode & GPGME_KEYLIST_MODE_EXTERN && 
+	    loc <= SEAHORSE_LOCATION_REMOTE)
+		loc = SEAHORSE_LOCATION_REMOTE;
+	
+	else if (loc <= SEAHORSE_LOCATION_LOCAL)
+		loc = SEAHORSE_LOCATION_LOCAL;
+
+	/* The type */
+	if (self->pv->seckey) {
+		usage = SEAHORSE_USAGE_PRIVATE_KEY;
+		description = _("Private GPGME Key");
+		icon = SEAHORSE_STOCK_SECRET;
+	} else {
+		usage = SEAHORSE_USAGE_PUBLIC_KEY;
+		description = _("Public GPGME Key");
+		icon = SEAHORSE_STOCK_KEY;
+	}
+
+	g_object_set (obj,
+		      "icon", icon,
+		      "usage", usage,
+		      "description", description,
+		      "location", loc,
+		      NULL);
+}
+
+static void
+seahorse_gpgme_key_refresh (SeahorseObject *obj)
+{
+	SeahorseGpgmeKey *self = SEAHORSE_GPGME_KEY (obj);
+	
+	if (self->pv->pubkey)
+		load_key_public (self, self->pv->list_mode);
+	if (self->pv->seckey)
+		load_key_private (self);
+	if (self->pv->photos_loaded)
+		load_key_photos (self);
+
+	SEAHORSE_OBJECT_CLASS (seahorse_gpgme_key_parent_class)->refresh (obj);
+}
+
+static SeahorseOperation*
+seahorse_gpgme_key_delete (SeahorseObject *obj)
+{
+	SeahorseGpgmeKey *self = SEAHORSE_GPGME_KEY (obj);
+	gpgme_error_t gerr;
+	GError *err = NULL;
+	
+	if (self->pv->seckey)
+		gerr = seahorse_gpgme_key_op_delete_pair (self);
+	else
+		gerr = seahorse_gpgme_key_op_delete (self);
+	
+	if (!GPG_IS_OK (gerr))
+		seahorse_gpgme_to_error (gerr, &err);
+	
+	return seahorse_operation_new_complete (err);
+}
+
+static GList*
+seahorse_gpgme_key_get_uids (SeahorsePgpKey *base)
+{
+	SeahorseGpgmeKey *self = SEAHORSE_GPGME_KEY (base);
+	require_key_uids (self);
+	return SEAHORSE_PGP_KEY_CLASS (seahorse_gpgme_key_parent_class)->get_uids (base);
+}
+
+static void
+seahorse_gpgme_key_set_uids (SeahorsePgpKey *base, GList *uids)
+{
+	SeahorseGpgmeKey *self = SEAHORSE_GPGME_KEY (base);
+	SEAHORSE_PGP_KEY_CLASS (seahorse_gpgme_key_parent_class)->set_uids (base, uids);
+	renumber_actual_uids (self);
+}
+
+static GList*
+seahorse_gpgme_key_get_subkeys (SeahorsePgpKey *base)
+{
+	SeahorseGpgmeKey *self = SEAHORSE_GPGME_KEY (base);
+	require_key_subkeys (self);
+	return SEAHORSE_PGP_KEY_CLASS (seahorse_gpgme_key_parent_class)->get_subkeys (base);
+}
+
+static GList*
+seahorse_gpgme_key_get_photos (SeahorsePgpKey *base)
+{
+	SeahorseGpgmeKey *self = SEAHORSE_GPGME_KEY (base);
+	require_key_photos (self);
+	return SEAHORSE_PGP_KEY_CLASS (seahorse_gpgme_key_parent_class)->get_photos (base);
+}
+
+static void
+seahorse_gpgme_key_set_photos (SeahorsePgpKey *base, GList *photos)
+{
+	SeahorseGpgmeKey *self = SEAHORSE_GPGME_KEY (base);
+	self->pv->photos_loaded = TRUE;
+	SEAHORSE_PGP_KEY_CLASS (seahorse_gpgme_key_parent_class)->set_photos (base, photos);
+	renumber_actual_uids (self);
+}
+
+static void
+seahorse_gpgme_key_init (SeahorseGpgmeKey *self)
+{
+	self->pv = G_TYPE_INSTANCE_GET_PRIVATE (self, SEAHORSE_TYPE_GPGME_KEY, SeahorseGpgmeKeyPrivate);
+}
+
+static void
+seahorse_gpgme_key_get_property (GObject *object, guint prop_id,
+                               GValue *value, GParamSpec *pspec)
+{
+	SeahorseGpgmeKey *self = SEAHORSE_GPGME_KEY (object);
+    
+	switch (prop_id) {
+	case PROP_PUBKEY:
+		g_value_set_boxed (value, seahorse_gpgme_key_get_public (self));
+		break;
+	case PROP_SECKEY:
+		g_value_set_boxed (value, seahorse_gpgme_key_get_private (self));
+		break;
+	case PROP_VALIDITY:
+		g_value_set_uint (value, seahorse_gpgme_key_get_validity (self));
+		break;
+	case PROP_TRUST:
+		g_value_set_uint (value, seahorse_gpgme_key_get_trust (self));
+		break;
+	}
+}
+
+static void
+seahorse_gpgme_key_set_property (GObject *object, guint prop_id, const GValue *value, 
+                               GParamSpec *pspec)
+{
+	SeahorseGpgmeKey *self = SEAHORSE_GPGME_KEY (object);
+
+	switch (prop_id) {
+	case PROP_PUBKEY:
+		seahorse_gpgme_key_set_public (self, g_value_get_boxed (value));
+		break;
+	case PROP_SECKEY:
+		seahorse_gpgme_key_set_private (self, g_value_get_boxed (value));
+		break;
+	}
+}
+
+static void
+seahorse_gpgme_key_object_dispose (GObject *obj)
+{
+	SeahorseGpgmeKey *self = SEAHORSE_GPGME_KEY (obj);
+
+	if (self->pv->pubkey)
+		gpgme_key_unref (self->pv->pubkey);
+	if (self->pv->seckey)
+		gpgme_key_unref (self->pv->seckey);
+	self->pv->pubkey = self->pv->seckey = NULL;
+
+	G_OBJECT_CLASS (seahorse_gpgme_key_parent_class)->dispose (obj);
+}
+
+static void
+seahorse_gpgme_key_object_finalize (GObject *obj)
+{
+	SeahorseGpgmeKey *self = SEAHORSE_GPGME_KEY (obj);
+
+	g_assert (self->pv->pubkey == NULL);
+	g_assert (self->pv->seckey == NULL);
+    
+	G_OBJECT_CLASS (seahorse_gpgme_key_parent_class)->finalize (obj);
+}
+
+static void
+seahorse_gpgme_key_class_init (SeahorseGpgmeKeyClass *klass)
+{
+	GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
+	SeahorseObjectClass *seahorse_class = SEAHORSE_OBJECT_CLASS (klass);
+	SeahorsePgpKeyClass *pgp_class = SEAHORSE_PGP_KEY_CLASS (klass);
+	
+	seahorse_gpgme_key_parent_class = g_type_class_peek_parent (klass);
+	g_type_class_add_private (klass, sizeof (SeahorseGpgmeKeyPrivate));
+
+	gobject_class->dispose = seahorse_gpgme_key_object_dispose;
+	gobject_class->finalize = seahorse_gpgme_key_object_finalize;
+	gobject_class->set_property = seahorse_gpgme_key_set_property;
+	gobject_class->get_property = seahorse_gpgme_key_get_property;
+	
+	seahorse_class->refresh = seahorse_gpgme_key_refresh;
+	seahorse_class->realize = seahorse_gpgme_key_realize;
+	seahorse_class->delete = seahorse_gpgme_key_delete;
+	
+	pgp_class->get_uids = seahorse_gpgme_key_get_uids;
+	pgp_class->set_uids = seahorse_gpgme_key_set_uids;
+	pgp_class->get_subkeys = seahorse_gpgme_key_get_subkeys;
+	pgp_class->get_photos = seahorse_gpgme_key_get_photos;
+	pgp_class->set_photos = seahorse_gpgme_key_set_photos;
+	
+	g_object_class_install_property (gobject_class, PROP_PUBKEY,
+	        g_param_spec_boxed ("pubkey", "GPGME Public Key", "GPGME Public Key that this object represents",
+	                            SEAHORSE_GPGME_BOXED_KEY, G_PARAM_READWRITE));
+
+	g_object_class_install_property (gobject_class, PROP_SECKEY,
+                g_param_spec_boxed ("seckey", "GPGME Secret Key", "GPGME Secret Key that this object represents",
+                                    SEAHORSE_GPGME_BOXED_KEY, G_PARAM_READWRITE));
+
+	g_object_class_override_property (gobject_class, PROP_VALIDITY, "validity");
+
+        g_object_class_override_property (gobject_class, PROP_TRUST, "trust");
+}
+
+
+/* -----------------------------------------------------------------------------
+ * PUBLIC 
+ */
+
+SeahorseGpgmeKey* 
+seahorse_gpgme_key_new (SeahorseSource *sksrc, gpgme_key_t pubkey, 
+                      gpgme_key_t seckey)
+{
+	return g_object_new (SEAHORSE_TYPE_GPGME_KEY, "source", sksrc,
+	                     "pubkey", pubkey, "seckey", seckey, NULL);
+}
+
+gpgme_key_t
+seahorse_gpgme_key_get_public (SeahorseGpgmeKey *self)
+{
+	g_return_val_if_fail (SEAHORSE_IS_GPGME_KEY (self), NULL);
+	if (require_key_public (self, GPGME_KEYLIST_MODE_LOCAL))
+		return self->pv->pubkey;
+	return NULL;
+}
+
+void
+seahorse_gpgme_key_set_public (SeahorseGpgmeKey *self, gpgme_key_t key)
+{
+	GObject *obj;
+	
+	g_return_if_fail (SEAHORSE_IS_GPGME_KEY (self));
+	
+	if (self->pv->pubkey)
+		gpgme_key_unref (self->pv->pubkey);
+	self->pv->pubkey = key;
+	if (self->pv->pubkey) {
+		gpgme_key_ref (self->pv->pubkey);
+		self->pv->list_mode |= self->pv->pubkey->keylist_mode;
+	}
+	
+	obj = G_OBJECT (self);
+	g_object_freeze_notify (obj);
+	seahorse_gpgme_key_realize (SEAHORSE_OBJECT (self));
+	g_object_notify (obj, "fingerprint");
+	g_object_notify (obj, "validity");
+	g_object_notify (obj, "validity-str");
+	g_object_notify (obj, "trust");
+	g_object_notify (obj, "trust-str");
+	g_object_notify (obj, "expires");
+	g_object_notify (obj, "expires-str");
+	g_object_notify (obj, "length");
+	g_object_notify (obj, "algo");
+	g_object_thaw_notify (obj);
+}
+
+gpgme_key_t
+seahorse_gpgme_key_get_private (SeahorseGpgmeKey *self)
+{
+	g_return_val_if_fail (SEAHORSE_IS_GPGME_KEY (self), NULL);
+	if (require_key_private (self))
+		return self->pv->seckey;
+	return NULL;	
+}
+
+void
+seahorse_gpgme_key_set_private (SeahorseGpgmeKey *self, gpgme_key_t key)
+{
+	GObject *obj;
+	
+	g_return_if_fail (SEAHORSE_IS_GPGME_KEY (self));
+	
+	if (self->pv->seckey)
+		gpgme_key_unref (self->pv->seckey);
+	self->pv->seckey = key;
+	if (self->pv->seckey)
+		gpgme_key_ref (self->pv->seckey);
+	
+	obj = G_OBJECT (self);
+	g_object_freeze_notify (obj);
+	seahorse_gpgme_key_realize (SEAHORSE_OBJECT (self));
+	g_object_thaw_notify (obj);
+}
+
+SeahorseValidity
+seahorse_gpgme_key_get_validity (SeahorseGpgmeKey *self)
+{
+	GList *uids;
+	
+	g_return_val_if_fail (SEAHORSE_IS_GPGME_KEY (self), SEAHORSE_VALIDITY_UNKNOWN);
+	
+	if (!require_key_public (self, GPGME_KEYLIST_MODE_LOCAL))
+		return SEAHORSE_VALIDITY_UNKNOWN;
+	
+	g_return_val_if_fail (self->pv->pubkey, SEAHORSE_VALIDITY_UNKNOWN);
+	
+	uids = seahorse_pgp_key_get_uids (SEAHORSE_PGP_KEY (self));
+	g_return_val_if_fail (uids, SEAHORSE_VALIDITY_UNKNOWN);
+
+	if (self->pv->pubkey->revoked)
+		return SEAHORSE_VALIDITY_REVOKED;
+	if (self->pv->pubkey->disabled)
+		return SEAHORSE_VALIDITY_DISABLED;
+	return seahorse_pgp_uid_get_validity (SEAHORSE_PGP_UID (uids->data));
+}
+
+SeahorseValidity
+seahorse_gpgme_key_get_trust (SeahorseGpgmeKey *self)
+{
+	g_return_val_if_fail (SEAHORSE_IS_GPGME_KEY (self), SEAHORSE_VALIDITY_UNKNOWN);
+	if (!require_key_public (self, GPGME_KEYLIST_MODE_LOCAL))
+		return SEAHORSE_VALIDITY_UNKNOWN;
+	
+	return seahorse_gpgme_convert_validity (self->pv->pubkey->owner_trust);
+}
+
+void
+seahorse_gpgme_key_refresh_matching (gpgme_key_t key)
+{
+	SeahorseObjectPredicate pred;
+	
+	g_return_if_fail (key->subkeys->keyid);
+	
+	memset (&pred, 0, sizeof (pred));
+	pred.type = SEAHORSE_TYPE_GPGME_KEY;
+	pred.id = seahorse_pgp_key_get_cannonical_id (key->subkeys->keyid);
+	
+	seahorse_context_for_objects_full (NULL, &pred, refresh_each_object, NULL);
+}

Added: trunk/pgp/seahorse-gpgme-key.h
==============================================================================
--- (empty file)
+++ trunk/pgp/seahorse-gpgme-key.h	Tue Dec 16 02:49:26 2008
@@ -0,0 +1,74 @@
+/*
+ * Seahorse
+ *
+ * Copyright (C) 2005 Stefan Walter
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details.
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the
+ * Free Software Foundation, Inc.,
+ * 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __SEAHORSE_GPGME_KEY_H__
+#define __SEAHORSE_GPGME_KEY_H__
+
+#include <glib-object.h>
+
+#include <gpgme.h>
+
+#include "seahorse-pgp-key.h"
+
+#define SEAHORSE_TYPE_GPGME_KEY            (seahorse_gpgme_key_get_type ())
+#define SEAHORSE_GPGME_KEY(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), SEAHORSE_TYPE_GPGME_KEY, SeahorseGpgmeKey))
+#define SEAHORSE_GPGME_KEY_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), SEAHORSE_TYPE_GPGME_KEY, SeahorseGpgmeKeyClass))
+#define SEAHORSE_IS_GPGME_KEY(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SEAHORSE_TYPE_GPGME_KEY))
+#define SEAHORSE_IS_GPGME_KEY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SEAHORSE_TYPE_GPGME_KEY))
+#define SEAHORSE_GPGME_KEY_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), SEAHORSE_TYPE_GPGME_KEY, SeahorseGpgmeKeyClass))
+
+
+typedef struct _SeahorseGpgmeKey SeahorseGpgmeKey;
+typedef struct _SeahorseGpgmeKeyClass SeahorseGpgmeKeyClass;
+typedef struct _SeahorseGpgmeKeyPrivate SeahorseGpgmeKeyPrivate;
+
+struct _SeahorseGpgmeKey {
+	SeahorsePgpKey parent;
+	SeahorseGpgmeKeyPrivate *pv;
+};
+
+struct _SeahorseGpgmeKeyClass {
+	SeahorsePgpKeyClass         parent_class;
+};
+
+SeahorseGpgmeKey* seahorse_gpgme_key_new                 (SeahorseSource *sksrc,
+                                                          gpgme_key_t pubkey,
+                                                          gpgme_key_t seckey);
+
+GType             seahorse_gpgme_key_get_type             (void);
+
+gpgme_key_t       seahorse_gpgme_key_get_public           (SeahorseGpgmeKey *self);
+
+void              seahorse_gpgme_key_set_public           (SeahorseGpgmeKey *self,
+                                                           gpgme_key_t key);
+
+gpgme_key_t       seahorse_gpgme_key_get_private          (SeahorseGpgmeKey *self);
+
+void              seahorse_gpgme_key_set_private          (SeahorseGpgmeKey *self,
+                                                           gpgme_key_t key);
+
+void              seahorse_gpgme_key_refresh_matching     (gpgme_key_t key);
+
+SeahorseValidity  seahorse_gpgme_key_get_validity         (SeahorseGpgmeKey *self);
+
+SeahorseValidity  seahorse_gpgme_key_get_trust            (SeahorseGpgmeKey *self);
+
+#endif /* __SEAHORSE_KEY_H__ */

Copied: trunk/pgp/seahorse-gpgme-operation.c (from r2661, /trunk/pgp/seahorse-pgp-operation.c)
==============================================================================
--- /trunk/pgp/seahorse-pgp-operation.c	(original)
+++ trunk/pgp/seahorse-gpgme-operation.c	Tue Dec 16 02:49:26 2008
@@ -23,9 +23,9 @@
 
 #include "seahorse-util.h"
 
-#include "pgp/seahorse-gpgmex.h"
-#include "pgp/seahorse-pgp-operation.h"
-#include "pgp/seahorse-pgp-source.h"
+#include "pgp/seahorse-gpgme.h"
+#include "pgp/seahorse-gpgme-operation.h"
+#include "pgp/seahorse-gpgme-source.h"
 
 #define DEBUG_OPERATION_ENABLE 0
 
@@ -48,7 +48,7 @@
  */
  
 typedef struct _WatchData {
-    SeahorsePGPOperation *op;   /* The operation we're working with */
+    SeahorseGpgmeOperation *op;   /* The operation we're working with */
     gint stag;                  /* IO watch source tag */
     gboolean registered;        /* Whether this watch is currently registered */
 
@@ -64,14 +64,14 @@
 #define READ_CONDITION (G_IO_IN | G_IO_HUP | G_IO_ERR)
 #define WRITE_CONDITION (G_IO_OUT | G_IO_ERR)
 
-typedef struct _SeahorsePGPOperationPrivate {
+typedef struct _SeahorseGpgmeOperationPrivate {
     gpgme_ctx_t gctx;               /* The context we watch for the async op to complete */
     gchar *message;                 /* A progress message to display (or NULL for GPGME messages) */
     struct gpgme_io_cbs io_cbs;     /* The GPGME IO callback vtable */
     GList *watches;                 /* Watches GPGME asked us to track */
     gboolean busy;                  /* If the context is currently executing something */
     guint def_total;                /* Default total */
-} SeahorsePGPOperationPrivate;
+} SeahorseGpgmeOperationPrivate;
 
 enum {
     PROP_0,
@@ -87,11 +87,11 @@
 
 static guint signals[LAST_SIGNAL] = { 0 };
 
-#define SEAHORSE_PGP_OPERATION_GET_PRIVATE(obj)  \
-    (G_TYPE_INSTANCE_GET_PRIVATE ((obj), SEAHORSE_TYPE_PGP_OPERATION, SeahorsePGPOperationPrivate))
+#define SEAHORSE_GPGME_OPERATION_GET_PRIVATE(obj)  \
+    (G_TYPE_INSTANCE_GET_PRIVATE ((obj), SEAHORSE_TYPE_GPGME_OPERATION, SeahorseGpgmeOperationPrivate))
 
 /* TODO: This is just nasty. Gotta get rid of these weird macros */
-IMPLEMENT_OPERATION_PROPS(PGP, pgp)
+IMPLEMENT_OPERATION_PROPS(Gpgme, gpgme)
 
     g_object_class_install_property (gobject_class, PROP_GCTX,
         g_param_spec_pointer ("gctx", "GPGME Context", "GPGME Context that this operation is watching.", 
@@ -105,11 +105,11 @@
         g_param_spec_uint ("default-total", "Default Total", "Default total to use instead of GPGME's progress total.",
                            0, G_MAXUINT, 0, G_PARAM_READABLE | G_PARAM_WRITABLE));
 
-    signals[RESULTS] = g_signal_new ("results", SEAHORSE_TYPE_PGP_OPERATION, 
-                G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (SeahorsePGPOperationClass, results),
+    signals[RESULTS] = g_signal_new ("results", SEAHORSE_TYPE_GPGME_OPERATION, 
+                G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (SeahorseGpgmeOperationClass, results),
                 NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
 
-    g_type_class_add_private (gobject_class, sizeof (SeahorsePGPOperationPrivate));
+    g_type_class_add_private (gobject_class, sizeof (SeahorseGpgmeOperationPrivate));
 
 END_IMPLEMENT_OPERATION_PROPS
 
@@ -122,7 +122,7 @@
 static gboolean
 io_callback (GIOChannel *source, GIOCondition condition, WatchData *watch)
 {
-    DEBUG_OPERATION (("PGPOP: io for GPGME on %d\n", watch->fd));
+    DEBUG_OPERATION (("GPGME OP: io for GPGME on %d\n", watch->fd));
     (watch->fnc) (watch->fnc_data, g_io_channel_unix_get_fd (source));
     return TRUE;
 }
@@ -136,7 +136,7 @@
     if (watch->registered)
         return;
     
-    DEBUG_OPERATION (("PGPOP: registering watch %d\n", watch->fd));
+    DEBUG_OPERATION (("GPGME OP: registering watch %d\n", watch->fd));
     
     channel = g_io_channel_unix_new (watch->fd);
     watch->stag = g_io_add_watch_full (channel, G_PRIORITY_DEFAULT, 
@@ -153,7 +153,7 @@
     if (!watch->registered)
         return;
     
-    DEBUG_OPERATION (("PGPOP: unregistering watch %d\n", watch->fd));
+    DEBUG_OPERATION (("GPGME OP: unregistering watch %d\n", watch->fd));
     
     g_source_remove (watch->stag);
     watch->stag = 0;
@@ -169,10 +169,10 @@
 progress_cb (void *data, const char *what, int type, 
              int current, int total)
 {
-    SeahorsePGPOperation *pop = SEAHORSE_PGP_OPERATION (data);
-    SeahorsePGPOperationPrivate *pv = SEAHORSE_PGP_OPERATION_GET_PRIVATE (pop);
+    SeahorseGpgmeOperation *pop = SEAHORSE_GPGME_OPERATION (data);
+    SeahorseGpgmeOperationPrivate *pv = SEAHORSE_GPGME_OPERATION_GET_PRIVATE (pop);
     
-    DEBUG_OPERATION (("PGPOP: got progress: %s %d/%d\n", what, current, total));
+    DEBUG_OPERATION (("GPGME OP: got progress: %s %d/%d\n", what, current, total));
     
     if (total <= 0)
         total = pv->def_total;
@@ -188,8 +188,8 @@
 register_cb (void *data, int fd, int dir, gpgme_io_cb_t fnc, void *fnc_data, 
              void **tag)
 {
-    SeahorsePGPOperation *pop = SEAHORSE_PGP_OPERATION (data);
-    SeahorsePGPOperationPrivate *pv = SEAHORSE_PGP_OPERATION_GET_PRIVATE (pop);
+    SeahorseGpgmeOperation *pop = SEAHORSE_GPGME_OPERATION (data);
+    SeahorseGpgmeOperationPrivate *pv = SEAHORSE_GPGME_OPERATION_GET_PRIVATE (pop);
     WatchData *watch;
     
     DEBUG_OPERATION (("PGPOP: request to register watch %d\n", fd));
@@ -219,10 +219,10 @@
 static void
 remove_cb (void *tag)
 {
-    SeahorsePGPOperationPrivate *pv;
+    SeahorseGpgmeOperationPrivate *pv;
     WatchData *watch = (WatchData*)tag;
 
-    pv = SEAHORSE_PGP_OPERATION_GET_PRIVATE (watch->op);
+    pv = SEAHORSE_GPGME_OPERATION_GET_PRIVATE (watch->op);
 
     DEBUG_OPERATION (("PGPOP: request to remove watch %d\n", watch->fd));
     
@@ -235,8 +235,8 @@
 static void
 event_cb (void *data, gpgme_event_io_t type, void *type_data)
 {
-    SeahorsePGPOperation *pop = SEAHORSE_PGP_OPERATION (data);
-    SeahorsePGPOperationPrivate *pv = SEAHORSE_PGP_OPERATION_GET_PRIVATE (pop);
+    SeahorseGpgmeOperation *pop = SEAHORSE_GPGME_OPERATION (data);
+    SeahorseGpgmeOperationPrivate *pv = SEAHORSE_GPGME_OPERATION_GET_PRIVATE (pop);
     gpg_error_t *gerr;
     GError *error = NULL;
     GList *list;
@@ -318,11 +318,11 @@
  */
 
 static void 
-seahorse_pgp_operation_init (SeahorsePGPOperation *pop)
+seahorse_gpgme_operation_init (SeahorseGpgmeOperation *pop)
 {
-    SeahorsePGPOperationPrivate *pv = SEAHORSE_PGP_OPERATION_GET_PRIVATE (pop);
+    SeahorseGpgmeOperationPrivate *pv = SEAHORSE_GPGME_OPERATION_GET_PRIVATE (pop);
     
-    pop->gctx = seahorse_pgp_source_new_context ();
+    pop->gctx = seahorse_gpgme_source_new_context ();
     g_return_if_fail (pop->gctx != NULL);
     
     pv->busy = FALSE;
@@ -338,11 +338,11 @@
 }
 
 static void 
-seahorse_pgp_operation_set_property (GObject *gobject, guint prop_id, 
+seahorse_gpgme_operation_set_property (GObject *gobject, guint prop_id, 
                                      const GValue *value, GParamSpec *pspec)
 {
-    SeahorsePGPOperation *pop = SEAHORSE_PGP_OPERATION (gobject);
-    SeahorsePGPOperationPrivate *pv = SEAHORSE_PGP_OPERATION_GET_PRIVATE (pop);
+    SeahorseGpgmeOperation *pop = SEAHORSE_GPGME_OPERATION (gobject);
+    SeahorseGpgmeOperationPrivate *pv = SEAHORSE_GPGME_OPERATION_GET_PRIVATE (pop);
     
     switch (prop_id) {
     case PROP_MESSAGE:
@@ -356,11 +356,11 @@
 }
 
 static void 
-seahorse_pgp_operation_get_property (GObject *gobject, guint prop_id, 
+seahorse_gpgme_operation_get_property (GObject *gobject, guint prop_id, 
                                      GValue *value, GParamSpec *pspec)
 {
-    SeahorsePGPOperation *pop = SEAHORSE_PGP_OPERATION (gobject);
-    SeahorsePGPOperationPrivate *pv = SEAHORSE_PGP_OPERATION_GET_PRIVATE (pop);
+    SeahorseGpgmeOperation *pop = SEAHORSE_GPGME_OPERATION (gobject);
+    SeahorseGpgmeOperationPrivate *pv = SEAHORSE_GPGME_OPERATION_GET_PRIVATE (pop);
     
     switch (prop_id) {
     case PROP_GCTX:
@@ -375,21 +375,21 @@
 }
 
 static void 
-seahorse_pgp_operation_dispose (GObject *gobject)
+seahorse_gpgme_operation_dispose (GObject *gobject)
 {
     /* Nothing to do */
-    G_OBJECT_CLASS (pgp_operation_parent_class)->dispose (gobject);
+    G_OBJECT_CLASS (gpgme_operation_parent_class)->dispose (gobject);
 }
 
 static void 
-seahorse_pgp_operation_finalize (GObject *gobject)
+seahorse_gpgme_operation_finalize (GObject *gobject)
 {
-    SeahorsePGPOperation *pop = SEAHORSE_PGP_OPERATION (gobject);
-    SeahorsePGPOperationPrivate *pv = SEAHORSE_PGP_OPERATION_GET_PRIVATE (pop);
+    SeahorseGpgmeOperation *pop = SEAHORSE_GPGME_OPERATION (gobject);
+    SeahorseGpgmeOperationPrivate *pv = SEAHORSE_GPGME_OPERATION_GET_PRIVATE (pop);
     GList *list;
     
     if (pv->busy) {
-        g_critical ("NASTY BUG. Disposing of a SeahorsePGPOperation while GPGME is "
+        g_critical ("NASTY BUG. Disposing of a SeahorseGpgmeOperation while GPGME is "
                     "still performing an operation. SeahorseOperation should ref"
                     "itself while active");
     }
@@ -410,14 +410,14 @@
     g_free (pv->message);
     pv->message = NULL;
     
-    G_OBJECT_CLASS (pgp_operation_parent_class)->finalize (gobject);
+    G_OBJECT_CLASS (gpgme_operation_parent_class)->finalize (gobject);
 }
 
 static void 
-seahorse_pgp_operation_cancel (SeahorseOperation *operation)
+seahorse_gpgme_operation_cancel (SeahorseOperation *operation)
 {
-    SeahorsePGPOperation *pop = SEAHORSE_PGP_OPERATION (operation);
-    SeahorsePGPOperationPrivate *pv = SEAHORSE_PGP_OPERATION_GET_PRIVATE (pop);
+    SeahorseGpgmeOperation *pop = SEAHORSE_GPGME_OPERATION (operation);
+    SeahorseGpgmeOperationPrivate *pv = SEAHORSE_GPGME_OPERATION_GET_PRIVATE (pop);
     
     g_return_if_fail (seahorse_operation_is_running (operation));
     g_return_if_fail (pop->gctx != NULL);
@@ -431,14 +431,14 @@
  * PUBLIC METHODS
  */
 
-SeahorsePGPOperation*
-seahorse_pgp_operation_new (const gchar *message)
+SeahorseGpgmeOperation*
+seahorse_gpgme_operation_new (const gchar *message)
 {
-    return g_object_new (SEAHORSE_TYPE_PGP_OPERATION, "message", message, NULL);
+    return g_object_new (SEAHORSE_TYPE_GPGME_OPERATION, "message", message, NULL);
 }
 
 void
-seahorse_pgp_operation_mark_failed (SeahorsePGPOperation *pop, gpgme_error_t gerr)
+seahorse_gpgme_operation_mark_failed (SeahorseGpgmeOperation *pop, gpgme_error_t gerr)
 {
     SeahorseOperation *op = SEAHORSE_OPERATION (pop);
     GError *err = NULL;

Copied: trunk/pgp/seahorse-gpgme-operation.h (from r2661, /trunk/pgp/seahorse-pgp-operation.h)
==============================================================================
--- /trunk/pgp/seahorse-pgp-operation.h	(original)
+++ trunk/pgp/seahorse-gpgme-operation.h	Tue Dec 16 02:49:26 2008
@@ -20,7 +20,7 @@
  */
 
 /** 
- * SeahorsePGPOperation: A way to track operations done via GPGME. 
+ * SeahorseGpgmeOperation: A way to track operations done via GPGME. 
  * 
  * - Derived from SeahorseOperation
  * - Uses the arcane gpgme_io_cbs API.
@@ -36,7 +36,7 @@
  *  default-total: (guint) When GPGME reports 0 as progress total, use this instead.
  * 
  * HOW TO USE: 
- * 1. Create a SeahorsePGPOperation with seahorse_pgp_operation_new. 
+ * 1. Create a SeahorseGpgmeOperation with seahorse_gpgme_operation_new. 
  * 2. You'll be using the gpgme_ctx_t out of the gctx data member.
  * 3. Use one of the gpgme_op_*_start functions to start an operation with gctx.
  * 4. Hand off the operation to seahorse_progress_* functions (which claim 
@@ -46,8 +46,8 @@
  * - Never use with gpgme_op_keylist_start and gpgme_op_trustlist_start. 
  */
  
-#ifndef __SEAHORSE_PGP_OPERATION_H__
-#define __SEAHORSE_PGP_OPERATION_H__
+#ifndef __SEAHORSE_GPGME_OPERATION_H__
+#define __SEAHORSE_GPGME_OPERATION_H__
 
 /*
  * TODO: Eventually most of the stuff from seahorse-pgp-key-op and 
@@ -56,39 +56,39 @@
 
 #include "seahorse-operation.h"
 
-#include "pgp/seahorse-gpgmex.h"
+#include "pgp/seahorse-gpgme.h"
 
-#define SEAHORSE_TYPE_PGP_OPERATION            (seahorse_pgp_operation_get_type ())
-#define SEAHORSE_PGP_OPERATION(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), SEAHORSE_TYPE_PGP_OPERATION, SeahorsePGPOperation))
-#define SEAHORSE_PGP_OPERATION_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), SEAHORSE_TYPE_PGP_OPERATION, SeahorsePGPOperationClass))
-#define SEAHORSE_IS_PGP_OPERATION(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SEAHORSE_TYPE_PGP_OPERATION))
-#define SEAHORSE_IS_PGP_OPERATION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SEAHORSE_TYPE_PGP_OPERATION))
-#define SEAHORSE_PGP_OPERATION_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), SEAHORSE_TYPE_PGP_OPERATION, SeahorsePGPOperationClass))
+#define SEAHORSE_TYPE_GPGME_OPERATION            (seahorse_gpgme_operation_get_type ())
+#define SEAHORSE_GPGME_OPERATION(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), SEAHORSE_TYPE_GPGME_OPERATION, SeahorseGpgmeOperation))
+#define SEAHORSE_GPGME_OPERATION_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), SEAHORSE_TYPE_GPGME_OPERATION, SeahorseGpgmeOperationClass))
+#define SEAHORSE_IS_GPGME_OPERATION(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SEAHORSE_TYPE_GPGME_OPERATION))
+#define SEAHORSE_IS_GPGME_OPERATION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SEAHORSE_TYPE_GPGME_OPERATION))
+#define SEAHORSE_GPGME_OPERATION_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), SEAHORSE_TYPE_GPGME_OPERATION, SeahorseGpgmeOperationClass))
 
-typedef struct _SeahorsePGPOperation SeahorsePGPOperation;
-typedef struct _SeahorsePGPOperationClass SeahorsePGPOperationClass;
+typedef struct _SeahorseGpgmeOperation SeahorseGpgmeOperation;
+typedef struct _SeahorseGpgmeOperationClass SeahorseGpgmeOperationClass;
 
-struct _SeahorsePGPOperation {
+struct _SeahorseGpgmeOperation {
     SeahorseOperation parent;
     
     /*< public >*/
     gpgme_ctx_t gctx;
 };
 
-struct _SeahorsePGPOperationClass {
+struct _SeahorseGpgmeOperationClass {
     SeahorseOperationClass parent_class;
 
     /* Signal that occurs when the results of the GPGME operation are ready */
-    void (*results) (SeahorsePGPOperation *pop);
+    void (*results) (SeahorseGpgmeOperation *pop);
 };
 
 
-GType                   seahorse_pgp_operation_get_type     (void);
+GType                   seahorse_gpgme_operation_get_type     (void);
 
-SeahorsePGPOperation*   seahorse_pgp_operation_new          (const gchar *message);
+SeahorseGpgmeOperation*   seahorse_gpgme_operation_new          (const gchar *message);
 
 /* Call when calling of gpgme_op_*_start failed */
-void                    seahorse_pgp_operation_mark_failed  (SeahorsePGPOperation *pop, 
+void                    seahorse_gpgme_operation_mark_failed  (SeahorseGpgmeOperation *pop, 
                                                              gpgme_error_t gerr);
 
-#endif /* __SEAHORSE_PGP_OPERATION_H__ */
+#endif /* __SEAHORSE_GPGME_OPERATION_H__ */

Added: trunk/pgp/seahorse-gpgme-photo.c
==============================================================================
--- (empty file)
+++ trunk/pgp/seahorse-gpgme-photo.c	Tue Dec 16 02:49:26 2008
@@ -0,0 +1,172 @@
+/*
+ * Seahorse
+ *
+ * Copyright (C) 2008 Stefan Walter
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details.
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the
+ * Free Software Foundation, Inc.,
+ * 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#include "config.h"
+
+#include "seahorse-gpgme.h"
+#include "seahorse-gpgme-photo.h"
+
+#include <string.h>
+
+#include <glib/gi18n.h>
+
+enum {
+	PROP_0,
+	PROP_PUBKEY,
+	PROP_INDEX
+};
+
+G_DEFINE_TYPE (SeahorseGpgmePhoto, seahorse_gpgme_photo, SEAHORSE_TYPE_PGP_PHOTO);
+
+struct _SeahorseGpgmePhotoPrivate {
+	gpgme_key_t pubkey;        /* Key that this photo is on */
+	guint index;               /* The GPGME index of the photo */
+};
+
+/* -----------------------------------------------------------------------------
+ * OBJECT 
+ */
+
+static void
+seahorse_gpgme_photo_init (SeahorseGpgmePhoto *self)
+{
+	self->pv = G_TYPE_INSTANCE_GET_PRIVATE (self, SEAHORSE_TYPE_GPGME_PHOTO, SeahorseGpgmePhotoPrivate);
+}
+
+static GObject*
+seahorse_gpgme_photo_constructor (GType type, guint n_props, GObjectConstructParam *props)
+{
+	GObject *obj = G_OBJECT_CLASS (seahorse_gpgme_photo_parent_class)->constructor (type, n_props, props);
+	SeahorseGpgmePhoto *self = NULL;
+	
+	if (obj) {
+		self = SEAHORSE_GPGME_PHOTO (obj);
+		g_return_val_if_fail (self->pv->pubkey, NULL);
+	}
+	
+	return obj;
+}
+
+static void
+seahorse_gpgme_photo_get_property (GObject *object, guint prop_id,
+                                  GValue *value, GParamSpec *pspec)
+{
+	SeahorseGpgmePhoto *self = SEAHORSE_GPGME_PHOTO (object);
+	
+	switch (prop_id) {
+	case PROP_PUBKEY:
+		g_value_set_boxed (value, seahorse_gpgme_photo_get_pubkey (self));
+		break;
+	case PROP_INDEX:
+		g_value_set_uint (value, seahorse_gpgme_photo_get_index (self));
+		break;
+	}
+}
+
+static void
+seahorse_gpgme_photo_set_property (GObject *object, guint prop_id, const GValue *value, 
+                                  GParamSpec *pspec)
+{
+	SeahorseGpgmePhoto *self = SEAHORSE_GPGME_PHOTO (object);
+
+	switch (prop_id) {
+	case PROP_PUBKEY:
+		g_return_if_fail (!self->pv->pubkey);
+		self->pv->pubkey = g_value_get_boxed (value);
+		if (self->pv->pubkey)
+			gpgme_key_ref (self->pv->pubkey);
+		break;
+	case PROP_INDEX:
+		seahorse_gpgme_photo_set_index (self, g_value_get_uint (value));
+		break;
+	}
+}
+
+static void
+seahorse_gpgme_photo_finalize (GObject *gobject)
+{
+	SeahorseGpgmePhoto *self = SEAHORSE_GPGME_PHOTO (gobject);
+
+	if (self->pv->pubkey)
+		gpgme_key_unref (self->pv->pubkey);
+	self->pv->pubkey = NULL;
+    
+	G_OBJECT_CLASS (seahorse_gpgme_photo_parent_class)->finalize (gobject);
+}
+
+static void
+seahorse_gpgme_photo_class_init (SeahorseGpgmePhotoClass *klass)
+{
+	GObjectClass *gobject_class = G_OBJECT_CLASS (klass);    
+
+	seahorse_gpgme_photo_parent_class = g_type_class_peek_parent (klass);
+	g_type_class_add_private (klass, sizeof (SeahorseGpgmePhotoPrivate));
+    
+	gobject_class->constructor = seahorse_gpgme_photo_constructor;
+	gobject_class->finalize = seahorse_gpgme_photo_finalize;
+	gobject_class->set_property = seahorse_gpgme_photo_set_property;
+	gobject_class->get_property = seahorse_gpgme_photo_get_property;
+    
+	g_object_class_install_property (gobject_class, PROP_PUBKEY,
+	        g_param_spec_boxed ("pubkey", "Public Key", "GPGME Public Key that this subkey is on",
+	                            SEAHORSE_GPGME_BOXED_KEY, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
+
+	g_object_class_install_property (gobject_class, PROP_INDEX,
+	        g_param_spec_uint ("index", "Index", "Index of photo UID",
+	                           0, G_MAXUINT, 0, G_PARAM_READWRITE));
+}
+
+/* -----------------------------------------------------------------------------
+ * PUBLIC 
+ */
+
+SeahorseGpgmePhoto* 
+seahorse_gpgme_photo_new (gpgme_key_t pubkey, GdkPixbuf *pixbuf, guint index) 
+{
+	return g_object_new (SEAHORSE_TYPE_GPGME_PHOTO,
+	                     "pubkey", pubkey,
+	                     "pixbuf", pixbuf, 
+	                     "index", index, NULL);
+}
+
+gpgme_key_t
+seahorse_gpgme_photo_get_pubkey (SeahorseGpgmePhoto *self)
+{
+	g_return_val_if_fail (SEAHORSE_IS_GPGME_PHOTO (self), NULL);
+	g_return_val_if_fail (self->pv->pubkey, NULL);
+	return self->pv->pubkey;
+}
+
+guint
+seahorse_gpgme_photo_get_index (SeahorseGpgmePhoto *self)
+{
+	g_return_val_if_fail (SEAHORSE_IS_GPGME_PHOTO (self), 0);
+	return self->pv->index;
+}
+
+void
+seahorse_gpgme_photo_set_index (SeahorseGpgmePhoto *self, guint index)
+{
+	g_return_if_fail (SEAHORSE_IS_GPGME_PHOTO (self));
+
+	self->pv->index = index;
+	g_object_notify (G_OBJECT (self), "index");
+}

Added: trunk/pgp/seahorse-gpgme-photo.h
==============================================================================
--- (empty file)
+++ trunk/pgp/seahorse-gpgme-photo.h	Tue Dec 16 02:49:26 2008
@@ -0,0 +1,65 @@
+/*
+ * Seahorse
+ *
+ * Copyright (C) 2008 Stefan Walter
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details.
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the
+ * Free Software Foundation, Inc.,
+ * 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __SEAHORSE_GPGME_PHOTO_H__
+#define __SEAHORSE_GPGME_PHOTO_H__
+
+#include <glib-object.h>
+
+#include <gpgme.h>
+
+#include "pgp/seahorse-gpgme.h"
+#include "pgp/seahorse-pgp-photo.h"
+
+#define SEAHORSE_TYPE_GPGME_PHOTO            (seahorse_gpgme_photo_get_type ())
+#define SEAHORSE_GPGME_PHOTO(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), SEAHORSE_TYPE_GPGME_PHOTO, SeahorseGpgmePhoto))
+#define SEAHORSE_GPGME_PHOTO_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), SEAHORSE_TYPE_GPGME_PHOTO, SeahorseGpgmePhotoClass))
+#define SEAHORSE_IS_GPGME_PHOTO(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SEAHORSE_TYPE_GPGME_PHOTO))
+#define SEAHORSE_IS_GPGME_PHOTO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SEAHORSE_TYPE_GPGME_PHOTO))
+#define SEAHORSE_GPGME_PHOTO_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), SEAHORSE_TYPE_GPGME_PHOTO, SeahorseGpgmePhotoClass))
+
+typedef struct _SeahorseGpgmePhoto SeahorseGpgmePhoto;
+typedef struct _SeahorseGpgmePhotoClass SeahorseGpgmePhotoClass;
+typedef struct _SeahorseGpgmePhotoPrivate SeahorseGpgmePhotoPrivate;
+
+struct _SeahorseGpgmePhoto {
+	SeahorsePgpPhoto parent;
+	SeahorseGpgmePhotoPrivate *pv;
+};
+
+struct _SeahorseGpgmePhotoClass {
+	SeahorsePgpPhotoClass parent_class;
+};
+
+GType               seahorse_gpgme_photo_get_type        (void);
+
+SeahorseGpgmePhoto* seahorse_gpgme_photo_new             (gpgme_key_t key,
+                                                          GdkPixbuf *pixbuf,
+                                                          guint index);
+
+gpgme_key_t         seahorse_gpgme_photo_get_pubkey      (SeahorseGpgmePhoto *self);
+
+guint               seahorse_gpgme_photo_get_index       (SeahorseGpgmePhoto *self);
+
+void                seahorse_gpgme_photo_set_index       (SeahorseGpgmePhoto *self,
+                                                          guint index);
+
+#endif /* __SEAHORSE_GPGME_PHOTO_H__ */

Copied: trunk/pgp/seahorse-gpgme-photos.c (from r2661, /trunk/pgp/seahorse-pgp-photos.c)
==============================================================================
--- /trunk/pgp/seahorse-pgp-photos.c	(original)
+++ trunk/pgp/seahorse-gpgme-photos.c	Tue Dec 16 02:49:26 2008
@@ -32,8 +32,8 @@
 #include "seahorse-widget.h"
 #include "seahorse-util.h"
 
-#include "seahorse-pgp-dialogs.h"
-#include "seahorse-pgp-key-op.h"
+#include "seahorse-gpgme-dialogs.h"
+#include "seahorse-gpgme-key-op.h"
 
 #define DEFAULT_WIDTH    120
 #define DEFAULT_HEIGHT   150
@@ -246,7 +246,7 @@
 
 
 gboolean
-seahorse_pgp_photo_add (SeahorsePgpKey *pkey, GtkWindow *parent, const gchar *path)
+seahorse_gpgme_photo_add (SeahorseGpgmeKey *pkey, GtkWindow *parent, const gchar *path)
 {
     gchar *filename = NULL;
     gchar *tempfile = NULL;
@@ -255,7 +255,7 @@
     GtkDialog *chooser;
     gboolean res = TRUE;
     
-    g_return_val_if_fail (SEAHORSE_IS_PGP_KEY (pkey), FALSE);
+    g_return_val_if_fail (SEAHORSE_IS_GPGME_KEY (pkey), FALSE);
 
     if (NULL == path) {
         chooser = seahorse_util_chooser_open_new (_("Choose Photo to Add to Key"), parent);
@@ -281,7 +281,7 @@
         return FALSE;
     }
     
-    gerr = seahorse_pgp_key_op_photo_add (pkey, tempfile ? tempfile : filename);
+    gerr = seahorse_gpgme_key_op_photo_add (pkey, tempfile ? tempfile : filename);
     if (!GPG_IS_OK (gerr)) {
         
         /* A special error value set by seahorse_key_op_photoid_add to 
@@ -291,7 +291,7 @@
                                       _("The file could not be loaded. It may be in an invalid format"));
         
         else
-            seahorse_pgp_handle_gpgme_error (gerr, _("Couldn't add photo"));
+            seahorse_gpgme_handle_error (gerr, _("Couldn't add photo"));
 
         res = FALSE;
     }
@@ -307,13 +307,13 @@
 }
 
 gboolean
-seahorse_pgp_photo_delete (SeahorsePgpPhoto *photo, GtkWindow *parent)
+seahorse_gpgme_photo_delete (SeahorseGpgmePhoto *photo, GtkWindow *parent)
 {
     gpgme_error_t gerr;
     GtkWidget *dlg;
     gint response; 
 
-    g_return_val_if_fail (SEAHORSE_IS_PGP_PHOTO (photo), FALSE);
+    g_return_val_if_fail (SEAHORSE_IS_GPGME_PHOTO (photo), FALSE);
     
     dlg = gtk_message_dialog_new (parent, GTK_DIALOG_MODAL,
                                   GTK_MESSAGE_QUESTION, GTK_BUTTONS_NONE,
@@ -328,9 +328,9 @@
     if (response != GTK_RESPONSE_ACCEPT)
         return FALSE;
     
-    gerr = seahorse_pgp_key_op_photo_delete (photo);
+    gerr = seahorse_gpgme_key_op_photo_delete (photo);
     if (!GPG_IS_OK (gerr)) {
-	    seahorse_pgp_handle_gpgme_error (gerr, _("Couldn't delete photo"));
+	    seahorse_gpgme_handle_error (gerr, _("Couldn't delete photo"));
         return FALSE;
     }
     

Copied: trunk/pgp/seahorse-gpgme-revoke.c (from r2661, /trunk/pgp/seahorse-pgp-revoke.c)
==============================================================================
--- /trunk/pgp/seahorse-pgp-revoke.c	(original)
+++ trunk/pgp/seahorse-gpgme-revoke.c	Tue Dec 16 02:49:26 2008
@@ -29,8 +29,9 @@
 #include "seahorse-libdialogs.h"
 #include "seahorse-util.h"
 
+#include "seahorse-gpgme-dialogs.h"
+#include "seahorse-gpgme-key-op.h"
 #include "seahorse-pgp-dialogs.h"
-#include "seahorse-pgp-key-op.h"
 
 enum {
   COLUMN_TEXT,
@@ -43,7 +44,7 @@
 ok_clicked (GtkButton *button, SeahorseWidget *swidget)
 {
 	SeahorseRevokeReason reason;
-	SeahorsePgpSubkey *subkey;
+	SeahorseGpgmeSubkey *subkey;
 	const gchar *description;
 	gpgme_error_t err;
 	GtkWidget *widget;
@@ -62,26 +63,26 @@
 	
 	description = gtk_entry_get_text (GTK_ENTRY (glade_xml_get_widget (swidget->xml, "description")));
 	subkey = g_object_get_data (G_OBJECT (swidget), "subkey");
-	g_return_if_fail (SEAHORSE_IS_PGP_SUBKEY (subkey));
+	g_return_if_fail (SEAHORSE_IS_GPGME_SUBKEY (subkey));
 	
-	err = seahorse_pgp_key_op_revoke_subkey (subkey, reason, description);
+	err = seahorse_gpgme_key_op_revoke_subkey (subkey, reason, description);
 	if (!GPG_IS_OK (err))
-		seahorse_pgp_handle_gpgme_error (err, _("Couldn't revoke subkey"));
+		seahorse_gpgme_handle_error (err, _("Couldn't revoke subkey"));
 	seahorse_widget_destroy (swidget);
 }
 
 void
-seahorse_pgp_revoke_new (SeahorsePgpSubkey *subkey, GtkWindow *parent)
+seahorse_gpgme_revoke_new (SeahorseGpgmeSubkey *subkey, GtkWindow *parent)
 {
 	SeahorseWidget *swidget;
 	gchar *title;
-	gchar *label;
+	const gchar *label;
 	GtkWidget *widget;
 	GtkListStore *store;
 	GtkTreeIter iter;
 	GtkCellRenderer *renderer;
 	
-	g_return_if_fail (SEAHORSE_IS_PGP_SUBKEY (subkey));
+	g_return_if_fail (SEAHORSE_IS_GPGME_SUBKEY (subkey));
 	
 	swidget = seahorse_widget_new ("revoke", parent);
 	g_return_if_fail (swidget != NULL);
@@ -89,11 +90,10 @@
 	glade_xml_signal_connect_data (swidget->xml, "ok_clicked",
 		G_CALLBACK (ok_clicked), swidget);
 	
-	label = seahorse_pgp_subkey_get_description (subkey);
+	label = seahorse_pgp_subkey_get_description (SEAHORSE_PGP_SUBKEY (subkey));
 	title = g_strdup_printf (_("Revoke: %s"), label);
 	gtk_window_set_title (GTK_WINDOW (glade_xml_get_widget (swidget->xml, swidget->name)), title);
-	g_free (title);
-	g_free (label);
+	g_free (title);;
 	
 	g_object_set_data (G_OBJECT (swidget), "subkey", subkey);
 
@@ -142,17 +142,17 @@
 }
 
 void
-seahorse_pgp_add_revoker_new (SeahorsePgpKey *pkey, GtkWindow *parent)
+seahorse_gpgme_add_revoker_new (SeahorseGpgmeKey *pkey, GtkWindow *parent)
 {
-	SeahorsePgpKey *revoker;
+	SeahorseGpgmeKey *revoker;
 	GtkWidget *dialog;
 	gint response;
 	gpgme_error_t err;
 	const gchar *userid1, *userid2;
 	
-	g_return_if_fail (pkey != NULL && SEAHORSE_IS_PGP_KEY (pkey));
+	g_return_if_fail (pkey != NULL && SEAHORSE_IS_GPGME_KEY (pkey));
 
-	revoker = SEAHORSE_PGP_KEY (seahorse_signer_get (parent));
+	revoker = SEAHORSE_GPGME_KEY (seahorse_signer_get (parent));
 	if (revoker == NULL)
 		return;
 	
@@ -171,7 +171,7 @@
 	if (response != GTK_RESPONSE_YES)
 		return;
 	
-	err = seahorse_pgp_key_op_add_revoker (pkey, revoker);
+	err = seahorse_gpgme_key_op_add_revoker (pkey, revoker);
 	if (!GPG_IS_OK (err))
-		seahorse_pgp_handle_gpgme_error (err, _("Couldn't add revoker"));
+		seahorse_gpgme_handle_error (err, _("Couldn't add revoker"));
 }

Copied: trunk/pgp/seahorse-gpgme-sign.c (from r2661, /trunk/pgp/seahorse-pgp-sign.c)
==============================================================================
--- /trunk/pgp/seahorse-pgp-sign.c	(original)
+++ trunk/pgp/seahorse-gpgme-sign.c	Tue Dec 16 02:49:26 2008
@@ -29,8 +29,8 @@
 #include "seahorse-set.h"
 #include "seahorse-util.h"
 
-#include "pgp/seahorse-pgp-dialogs.h"
-#include "pgp/seahorse-pgp-key-op.h"
+#include "pgp/seahorse-gpgme-dialogs.h"
+#include "pgp/seahorse-gpgme-key-op.h"
 #include "pgp/seahorse-pgp-keysets.h"
 
 #include <glib/gi18n.h>
@@ -81,19 +81,19 @@
     g_return_val_if_fail (w != NULL, FALSE);
     signer = seahorse_combo_keys_get_active (GTK_COMBO_BOX (w));
     
-    g_assert (!signer || (SEAHORSE_IS_PGP_KEY (signer) && 
+    g_assert (!signer || (SEAHORSE_IS_GPGME_KEY (signer) && 
                           seahorse_object_get_usage (SEAHORSE_OBJECT (signer)) == SEAHORSE_USAGE_PRIVATE_KEY));
     
     to_sign = g_object_get_data (G_OBJECT (swidget), "to-sign");
-    if (SEAHORSE_IS_PGP_UID (to_sign))
-	    err = seahorse_pgp_key_op_sign_uid (SEAHORSE_PGP_UID (to_sign), SEAHORSE_PGP_KEY (signer), check, options);
-    else if (SEAHORSE_IS_PGP_KEY (to_sign))
-	    err = seahorse_pgp_key_op_sign (SEAHORSE_PGP_KEY (to_sign), SEAHORSE_PGP_KEY (signer), check, options);
+    if (SEAHORSE_IS_GPGME_UID (to_sign))
+	    err = seahorse_gpgme_key_op_sign_uid (SEAHORSE_GPGME_UID (to_sign), SEAHORSE_GPGME_KEY (signer), check, options);
+    else if (SEAHORSE_IS_GPGME_KEY (to_sign))
+	    err = seahorse_gpgme_key_op_sign (SEAHORSE_GPGME_KEY (to_sign), SEAHORSE_GPGME_KEY (signer), check, options);
     else
 	    g_assert (FALSE);
     
     if (!GPG_IS_OK (err))
-        seahorse_pgp_handle_gpgme_error (err, _("Couldn't sign key"));
+        seahorse_gpgme_handle_error (err, _("Couldn't sign key"));
     
     seahorse_widget_destroy (swidget);
     
@@ -225,13 +225,13 @@
 }
 
 void
-seahorse_pgp_sign_prompt (SeahorsePgpKey *to_sign, GtkWindow *parent)
+seahorse_gpgme_sign_prompt (SeahorseGpgmeKey *to_sign, GtkWindow *parent)
 {
 	sign_internal (SEAHORSE_OBJECT (to_sign), parent);
 }
 
 void
-seahorse_pgp_sign_prompt_uid (SeahorsePgpUid *to_sign, GtkWindow *parent)
+seahorse_gpgme_sign_prompt_uid (SeahorseGpgmeUid *to_sign, GtkWindow *parent)
 {
 	sign_internal (SEAHORSE_OBJECT (to_sign), parent);
 }

Copied: trunk/pgp/seahorse-gpgme-source.c (from r2663, /trunk/pgp/seahorse-pgp-source.c)
==============================================================================
--- /trunk/pgp/seahorse-pgp-source.c	(original)
+++ trunk/pgp/seahorse-gpgme-source.c	Tue Dec 16 02:49:26 2008
@@ -23,14 +23,14 @@
 
 #include <glib/gi18n.h>
 #include <string.h>
-#include "seahorse-pgp-source.h"
+#include "seahorse-gpgme-source.h"
 
-#include "seahorse-gpgme-io.h"
-#include "seahorse-gpgmex.h"
+#include "seahorse-gpgme-data.h"
+#include "seahorse-gpgme.h"
+#include "seahorse-gpgme-key-op.h"
+#include "seahorse-gpgme-operation.h"
 #include "seahorse-gpg-options.h"
 #include "seahorse-pgp-key.h"
-#include "seahorse-pgp-key-op.h"
-#include "seahorse-pgp-operation.h"
 
 #include "seahorse-operation.h"
 #include "seahorse-util.h"
@@ -170,7 +170,7 @@
 
 DECLARE_OPERATION (Load, load)
     /*< private >*/
-    SeahorsePGPSource *psrc;        /* Key source to add keys to when found */
+    SeahorseGpgmeSource *psrc;        /* Key source to add keys to when found */
     gpgme_ctx_t ctx;                /* GPGME context we're loading from */
     gboolean secret;                /* Loading secret keys */
     guint loaded;                   /* Number of keys we've loaded */
@@ -182,7 +182,7 @@
 
 IMPLEMENT_OPERATION (Load, load)
 
-static SeahorseLoadOperation*   seahorse_load_operation_start   (SeahorsePGPSource *psrc, 
+static SeahorseLoadOperation*   seahorse_load_operation_start   (SeahorseGpgmeSource *psrc, 
                                                                  const gchar **pattern, 
                                                                  guint parts,
                                                                  gboolean secret);
@@ -211,7 +211,7 @@
 }
 
 static void
-export_key_callback (SeahorsePGPOperation *pop, ExportContext *ctx)
+export_key_callback (SeahorseGpgmeOperation *pop, ExportContext *ctx)
 {
     gpgme_error_t gerr;
     GError *err = NULL;
@@ -236,7 +236,7 @@
     ctx->at++;
     
     if (!GPG_IS_OK (gerr))
-        seahorse_pgp_operation_mark_failed (pop, gerr);
+        seahorse_gpgme_operation_mark_failed (pop, gerr);
 }
 
 
@@ -244,7 +244,7 @@
  * PGP Source
  */
     
-struct _SeahorsePGPSourcePrivate {
+struct _SeahorseGpgmeSourcePrivate {
     guint scheduled_refresh;                /* Source for refresh timeout */
     GFileMonitor *monitor_handle;           /* For monitoring the .gnupg directory */
     SeahorseMultiOperation *operations;     /* A list of all current operations */    
@@ -253,23 +253,23 @@
 
 static void seahorse_source_iface (SeahorseSourceIface *iface);
 
-G_DEFINE_TYPE_EXTENDED (SeahorsePGPSource, seahorse_pgp_source, G_TYPE_OBJECT, 0,
+G_DEFINE_TYPE_EXTENDED (SeahorseGpgmeSource, seahorse_gpgme_source, G_TYPE_OBJECT, 0,
                         G_IMPLEMENT_INTERFACE (SEAHORSE_TYPE_SOURCE, seahorse_source_iface));
 
 /* GObject handlers */
-static void seahorse_pgp_source_dispose         (GObject *gobject);
-static void seahorse_pgp_source_finalize        (GObject *gobject);
-static void seahorse_pgp_source_set_property    (GObject *object, guint prop_id, 
+static void seahorse_gpgme_source_dispose         (GObject *gobject);
+static void seahorse_gpgme_source_finalize        (GObject *gobject);
+static void seahorse_gpgme_source_set_property    (GObject *object, guint prop_id, 
                                                  const GValue *value, GParamSpec *pspec);
-static void seahorse_pgp_source_get_property    (GObject *object, guint prop_id,
+static void seahorse_gpgme_source_get_property    (GObject *object, guint prop_id,
                                                  GValue *value, GParamSpec *pspec);
 
 /* SeahorseSource methods */
-static SeahorseOperation*  seahorse_pgp_source_load             (SeahorseSource *src);
+static SeahorseOperation*  seahorse_gpgme_source_load             (SeahorseSource *src);
 
-static SeahorseOperation*  seahorse_pgp_source_import           (SeahorseSource *sksrc, 
+static SeahorseOperation*  seahorse_gpgme_source_import           (SeahorseSource *sksrc, 
                                                                  GInputStream *input);
-static SeahorseOperation*  seahorse_pgp_source_export           (SeahorseSource *sksrc, 
+static SeahorseOperation*  seahorse_gpgme_source_export           (SeahorseSource *sksrc, 
                                                                  GList *keys,
                                                                  GOutputStream *output);
 
@@ -279,13 +279,13 @@
                                                                  GFile *other_file,
                                                                  GFileMonitorEvent event_type,
                                                                  gpointer user_data);
-static void                cancel_scheduled_refresh             (SeahorsePGPSource *psrc);
+static void                cancel_scheduled_refresh             (SeahorseGpgmeSource *psrc);
                                                                  
 static GObjectClass *parent_class = NULL;
 
 /* Initialize the basic class stuff */
 static void
-seahorse_pgp_source_class_init (SeahorsePGPSourceClass *klass)
+seahorse_gpgme_source_class_init (SeahorseGpgmeSourceClass *klass)
 {
     GObjectClass *gobject_class;
     
@@ -298,16 +298,16 @@
    
     parent_class = g_type_class_peek_parent (klass);
     gobject_class = G_OBJECT_CLASS (klass);
-    gobject_class->dispose = seahorse_pgp_source_dispose;
-    gobject_class->finalize = seahorse_pgp_source_finalize;
-    gobject_class->set_property = seahorse_pgp_source_set_property;
-    gobject_class->get_property = seahorse_pgp_source_get_property;
+    gobject_class->dispose = seahorse_gpgme_source_dispose;
+    gobject_class->finalize = seahorse_gpgme_source_finalize;
+    gobject_class->set_property = seahorse_gpgme_source_set_property;
+    gobject_class->get_property = seahorse_gpgme_source_get_property;
  
 	g_object_class_override_property (gobject_class, PROP_KEY_TYPE, "key-type");
 	g_object_class_override_property (gobject_class, PROP_KEY_DESC, "key-desc");
 	g_object_class_override_property (gobject_class, PROP_LOCATION, "location");
 	
-	seahorse_registry_register_type (NULL, SEAHORSE_TYPE_PGP_SOURCE, "source", "local", SEAHORSE_PGP_STR, NULL);
+	seahorse_registry_register_type (NULL, SEAHORSE_TYPE_GPGME_SOURCE, "source", "local", SEAHORSE_PGP_STR, NULL);
 
 	seahorse_registry_register_function (NULL, seahorse_pgp_key_get_cannonical_id, "canonize", SEAHORSE_PGP_STR, NULL);
 }
@@ -315,15 +315,15 @@
 static void 
 seahorse_source_iface (SeahorseSourceIface *iface)
 {
-	iface->load = seahorse_pgp_source_load;
-	iface->import = seahorse_pgp_source_import;
-	iface->export = seahorse_pgp_source_export;
+	iface->load = seahorse_gpgme_source_load;
+	iface->import = seahorse_gpgme_source_import;
+	iface->export = seahorse_gpgme_source_export;
 }
 
 
 /* init context, private vars, set prefs, connect signals */
 static void
-seahorse_pgp_source_init (SeahorsePGPSource *psrc)
+seahorse_gpgme_source_init (SeahorseGpgmeSource *psrc)
 {
 	gpgme_error_t gerr;
 	GError *err = NULL;
@@ -334,7 +334,7 @@
 	g_return_if_fail (GPG_IS_OK (gerr));
     
 	/* init private vars */
-	psrc->pv = g_new0 (SeahorsePGPSourcePrivate, 1);
+	psrc->pv = g_new0 (SeahorseGpgmeSourcePrivate, 1);
     
 	psrc->pv->operations = seahorse_multi_operation_new ();
     
@@ -359,9 +359,9 @@
 
 /* dispose of all our internal references */
 static void
-seahorse_pgp_source_dispose (GObject *gobject)
+seahorse_gpgme_source_dispose (GObject *gobject)
 {
-    SeahorsePGPSource *psrc;
+    SeahorseGpgmeSource *psrc;
     GList *l;
     
     /*
@@ -372,7 +372,7 @@
      * This function should also be able to run multiple times.
      */
   
-    psrc = SEAHORSE_PGP_SOURCE (gobject);
+    psrc = SEAHORSE_GPGME_SOURCE (gobject);
     g_assert (psrc->pv);
     
     /* Clear out all operations */
@@ -403,11 +403,11 @@
 
 /* free private vars */
 static void
-seahorse_pgp_source_finalize (GObject *gobject)
+seahorse_gpgme_source_finalize (GObject *gobject)
 {
-    SeahorsePGPSource *psrc;
+    SeahorseGpgmeSource *psrc;
   
-    psrc = SEAHORSE_PGP_SOURCE (gobject);
+    psrc = SEAHORSE_GPGME_SOURCE (gobject);
     g_assert (psrc->pv);
     
     /* All monitoring and scheduling should be done */
@@ -420,14 +420,14 @@
 }
 
 static void 
-seahorse_pgp_source_set_property (GObject *object, guint prop_id, const GValue *value, 
+seahorse_gpgme_source_set_property (GObject *object, guint prop_id, const GValue *value, 
                                   GParamSpec *pspec)
 {
     
 }
 
 static void 
-seahorse_pgp_source_get_property (GObject *object, guint prop_id, GValue *value, 
+seahorse_gpgme_source_get_property (GObject *object, guint prop_id, GValue *value, 
                                   GParamSpec *pspec)
 {
     switch (prop_id) {
@@ -449,7 +449,7 @@
 
 /* Remove the given key from the context */
 static void
-remove_key_from_context (gpointer kt, SeahorseObject *dummy, SeahorsePGPSource *psrc)
+remove_key_from_context (gpointer kt, SeahorseObject *dummy, SeahorseGpgmeSource *psrc)
 {
     /* This function gets called as a GHRFunc on the lctx->checks hashtable. */
     GQuark keyid = GPOINTER_TO_UINT (kt);
@@ -461,11 +461,11 @@
 }
 
 /* Add a key to the context  */
-static SeahorsePgpKey*
-add_key_to_context (SeahorsePGPSource *psrc, gpgme_key_t key)
+static SeahorseGpgmeKey*
+add_key_to_context (SeahorseGpgmeSource *psrc, gpgme_key_t key)
 {
-	SeahorsePgpKey *pkey = NULL;
-	SeahorsePgpKey *prev;
+	SeahorseGpgmeKey *pkey = NULL;
+	SeahorseGpgmeKey *prev;
 	const gchar *id;
 	gpgme_key_t seckey;
 	GQuark keyid;
@@ -477,8 +477,8 @@
 	keyid = seahorse_pgp_key_get_cannonical_id (id);
 	g_return_val_if_fail (keyid, NULL);
     
-	g_assert (SEAHORSE_IS_PGP_SOURCE (psrc));
-	prev = SEAHORSE_PGP_KEY (seahorse_context_get_object (SCTX_APP (), SEAHORSE_SOURCE (psrc), keyid));
+	g_assert (SEAHORSE_IS_GPGME_SOURCE (psrc));
+	prev = SEAHORSE_GPGME_KEY (seahorse_context_get_object (SCTX_APP (), SEAHORSE_SOURCE (psrc), keyid));
     
 	/* Check if we can just replace the key on the object */
 	if (prev != NULL) {
@@ -491,7 +491,7 @@
     
 	/* Create a new key with secret */    
 	if (key->secret) {
-		pkey = seahorse_pgp_key_new (SEAHORSE_SOURCE (psrc), NULL, key);
+		pkey = seahorse_gpgme_key_new (SEAHORSE_SOURCE (psrc), NULL, key);
         
 		/* Since we don't have a public key yet, save this away */
 		psrc->pv->orphan_secret = g_list_append (psrc->pv->orphan_secret, pkey);
@@ -505,7 +505,7 @@
 	/* Check for orphans */
 	for (l = psrc->pv->orphan_secret; l; l = g_list_next (l)) {
         
-		seckey = seahorse_pgp_key_get_private (l->data);
+		seckey = seahorse_gpgme_key_get_private (l->data);
 		g_return_val_if_fail (seckey && seckey->subkeys && seckey->subkeys->keyid, NULL);
 		g_assert (seckey);
 		
@@ -513,7 +513,7 @@
 		if (g_str_equal (id, seckey->subkeys->keyid)) {
             
 			/* Set it up properly */
-			pkey = SEAHORSE_PGP_KEY (l->data);
+			pkey = SEAHORSE_GPGME_KEY (l->data);
 			g_object_set (pkey, "pubkey", key, NULL);
             
 			/* Remove item from orphan list cleanly */
@@ -524,7 +524,7 @@
 	}
 
 	if (pkey == NULL)
-		pkey = seahorse_pgp_key_new (SEAHORSE_SOURCE (psrc), key, NULL);
+		pkey = seahorse_gpgme_key_new (SEAHORSE_SOURCE (psrc), key, NULL);
     
 	/* Add to context */ 
 	seahorse_context_take_object (SCTX_APP (), SEAHORSE_OBJECT (pkey));
@@ -539,7 +539,7 @@
 static gboolean
 scheduled_refresh (gpointer data)
 {
-    SeahorsePGPSource *psrc = SEAHORSE_PGP_SOURCE (data);
+    SeahorseGpgmeSource *psrc = SEAHORSE_GPGME_SOURCE (data);
 
     DEBUG_REFRESH ("scheduled refresh event ocurring now\n");
     cancel_scheduled_refresh (psrc);
@@ -551,14 +551,14 @@
 static gboolean
 scheduled_dummy (gpointer data)
 {
-    SeahorsePGPSource *psrc = SEAHORSE_PGP_SOURCE (data);
+    SeahorseGpgmeSource *psrc = SEAHORSE_GPGME_SOURCE (data);
     DEBUG_REFRESH ("dummy refresh event occurring now\n");
     psrc->pv->scheduled_refresh = 0;
     return FALSE; /* don't run again */    
 }
 
 static void
-cancel_scheduled_refresh (SeahorsePGPSource *psrc)
+cancel_scheduled_refresh (SeahorseGpgmeSource *psrc)
 {
     if (psrc->pv->scheduled_refresh != 0) {
         DEBUG_REFRESH ("cancelling scheduled refresh event\n");
@@ -571,7 +571,7 @@
 monitor_gpg_homedir (GFileMonitor *handle, GFile *file, GFile *other_file,
                      GFileMonitorEvent event_type, gpointer user_data)
 {
-	SeahorsePGPSource *psrc = SEAHORSE_PGP_SOURCE (user_data);
+	SeahorseGpgmeSource *psrc = SEAHORSE_GPGME_SOURCE (user_data);
 	gchar *name;
 	
 	if (event_type == G_FILE_MONITOR_EVENT_CHANGED || 
@@ -662,7 +662,7 @@
 static gboolean
 keyload_handler (SeahorseLoadOperation *lop)
 {
-    SeahorsePgpKey *pkey;
+    SeahorseGpgmeKey *pkey;
     gpgme_key_t key;
     guint batch;
     GQuark keyid;
@@ -692,7 +692,7 @@
         
         /* Invalid id from GPG ? */
         if (!keyid) {
-            gpgmex_key_unref (key);
+            gpgme_key_unref (key);
             continue;
         }
         
@@ -708,9 +708,9 @@
 
         /* Load additional info */
         if (pkey && lop->parts & LOAD_PHOTOS)
-        	seahorse_pgp_key_op_photos_load (pkey);
+        	seahorse_gpgme_key_op_photos_load (pkey);
 
-        gpgmex_key_unref (key);
+        gpgme_key_unref (key);
         lop->loaded++;
     }
     
@@ -732,16 +732,16 @@
 }
 
 static SeahorseLoadOperation*
-seahorse_load_operation_start (SeahorsePGPSource *psrc, const gchar **pattern, 
+seahorse_load_operation_start (SeahorseGpgmeSource *psrc, const gchar **pattern, 
                                guint parts, gboolean secret)
 {
-    SeahorsePGPSourcePrivate *priv;
+    SeahorseGpgmeSourcePrivate *priv;
     SeahorseLoadOperation *lop;
     gpgme_error_t err;
     GList *keys, *l;
     SeahorseObject *sobj;
     
-    g_assert (SEAHORSE_IS_PGP_SOURCE (psrc));
+    g_assert (SEAHORSE_IS_GPGME_SOURCE (psrc));
     priv = psrc->pv;
 
     lop = g_object_new (SEAHORSE_TYPE_LOAD_OPERATION, NULL);    
@@ -788,7 +788,7 @@
 }    
 
 static void
-prepare_import_results (SeahorsePGPOperation *pop, SeahorsePGPSource *psrc)
+prepare_import_results (SeahorseGpgmeOperation *pop, SeahorseGpgmeSource *psrc)
 {
     SeahorseObject *sobj;
     SeahorseLoadOperation *lop;
@@ -872,13 +872,13 @@
  */
 
 static SeahorseOperation*
-seahorse_pgp_source_load (SeahorseSource *src)
+seahorse_gpgme_source_load (SeahorseSource *src)
 {
-    SeahorsePGPSource *psrc;
+    SeahorseGpgmeSource *psrc;
     SeahorseLoadOperation *lop;
     
     g_assert (SEAHORSE_IS_SOURCE (src));
-    psrc = SEAHORSE_PGP_SOURCE (src);
+    psrc = SEAHORSE_GPGME_SOURCE (src);
     
     /* Schedule a dummy refresh. This blocks all monitoring for a while */
     cancel_scheduled_refresh (psrc);
@@ -900,55 +900,55 @@
 }
 
 static SeahorseOperation* 
-seahorse_pgp_source_import (SeahorseSource *sksrc, GInputStream *input)
+seahorse_gpgme_source_import (SeahorseSource *sksrc, GInputStream *input)
 {
-	SeahorsePGPOperation *pop;
-	SeahorsePGPSource *psrc;
+	SeahorseGpgmeOperation *pop;
+	SeahorseGpgmeSource *psrc;
 	gpgme_error_t gerr;
 	gpgme_data_t data;
     
-    	g_return_val_if_fail (SEAHORSE_IS_PGP_SOURCE (sksrc), NULL);
-    	psrc = SEAHORSE_PGP_SOURCE (sksrc);
+    	g_return_val_if_fail (SEAHORSE_IS_GPGME_SOURCE (sksrc), NULL);
+    	psrc = SEAHORSE_GPGME_SOURCE (sksrc);
     
     	g_return_val_if_fail (G_IS_INPUT_STREAM (input), NULL);
     
-    	pop = seahorse_pgp_operation_new (_("Importing Keys"));
+    	pop = seahorse_gpgme_operation_new (_("Importing Keys"));
     	g_return_val_if_fail (pop != NULL, NULL);
     
-	data = seahorse_gpgme_input_data (input);
+	data = seahorse_gpgme_data_input (input);
 	g_return_val_if_fail (data, NULL);
     
 	gerr = gpgme_op_import_start (pop->gctx, data);
     
 	g_signal_connect (pop, "results", G_CALLBACK (prepare_import_results), psrc);
 	g_object_set_data_full (G_OBJECT (pop), "source-data", data, 
-	                        (GDestroyNotify)gpgmex_data_release);
+	                        (GDestroyNotify)gpgme_data_release);
     
 	/* Couldn't start import */
 	if (!GPG_IS_OK (gerr))
-		seahorse_pgp_operation_mark_failed (pop, gerr);
+		seahorse_gpgme_operation_mark_failed (pop, gerr);
     
 	return SEAHORSE_OPERATION (pop);
 }
 
 static SeahorseOperation* 
-seahorse_pgp_source_export (SeahorseSource *sksrc, GList *keys, GOutputStream *output)
+seahorse_gpgme_source_export (SeahorseSource *sksrc, GList *keys, GOutputStream *output)
 {
-	SeahorsePGPOperation *pop;
-	SeahorsePGPSource *psrc;
-	SeahorsePgpKey *pkey;
+	SeahorseGpgmeOperation *pop;
+	SeahorseGpgmeSource *psrc;
+	SeahorseGpgmeKey *pkey;
 	SeahorseObject *object;
 	ExportContext *ctx;
 	gpgme_data_t data;
 	const gchar *keyid;
 	GList *l;
     
-    	g_return_val_if_fail (SEAHORSE_IS_PGP_SOURCE (sksrc), NULL);
+    	g_return_val_if_fail (SEAHORSE_IS_GPGME_SOURCE (sksrc), NULL);
     	g_return_val_if_fail (output == NULL || G_IS_OUTPUT_STREAM (output), NULL);
     
-    	psrc = SEAHORSE_PGP_SOURCE (sksrc);
+    	psrc = SEAHORSE_GPGME_SOURCE (sksrc);
 
-    	pop = seahorse_pgp_operation_new (_("Exporting Keys"));
+    	pop = seahorse_gpgme_operation_new (_("Exporting Keys"));
     	g_return_val_if_fail (pop != NULL, NULL);
 
 	g_object_ref (output);
@@ -958,7 +958,7 @@
         gpgme_set_armor (pop->gctx, TRUE);
         gpgme_set_textmode (pop->gctx, TRUE);
         
-        data = seahorse_gpgme_output_data (output);
+        data = seahorse_gpgme_data_output (output);
         g_return_val_if_fail (data, NULL);
 
         /* Export context for asynchronous export */
@@ -975,13 +975,13 @@
         		continue;
         
         	g_return_val_if_fail (SEAHORSE_IS_PGP_KEY (l->data), NULL);
-        	pkey = SEAHORSE_PGP_KEY (l->data);
+        	pkey = SEAHORSE_GPGME_KEY (l->data);
         
         	object = SEAHORSE_OBJECT (l->data);
         	g_return_val_if_fail (seahorse_object_get_source (object) == sksrc, NULL);
         
         	/* Building list */
-        	keyid = seahorse_pgp_key_get_keyid (pkey);
+        	keyid = seahorse_pgp_key_get_keyid (SEAHORSE_PGP_KEY (pkey));
         	g_array_append_val (ctx->keyids, keyid);
         }
 
@@ -996,20 +996,20 @@
  */
 
 /**
- * seahorse_pgp_source_new
+ * seahorse_gpgme_source_new
  * 
  * Creates a new PGP key source
  * 
  * Returns: The key source.
  **/
-SeahorsePGPSource*
-seahorse_pgp_source_new (void)
+SeahorseGpgmeSource*
+seahorse_gpgme_source_new (void)
 {
-   return g_object_new (SEAHORSE_TYPE_PGP_SOURCE, NULL);
+   return g_object_new (SEAHORSE_TYPE_GPGME_SOURCE, NULL);
 }   
 
 gpgme_ctx_t          
-seahorse_pgp_source_new_context ()
+seahorse_gpgme_source_new_context ()
 {
     gpgme_ctx_t ctx = NULL;
     g_return_val_if_fail (GPG_IS_OK (init_gpgme (&ctx)), NULL);

Copied: trunk/pgp/seahorse-gpgme-source.h (from r2661, /trunk/pgp/seahorse-pgp-source.h)
==============================================================================
--- /trunk/pgp/seahorse-pgp-source.h	(original)
+++ trunk/pgp/seahorse-gpgme-source.h	Tue Dec 16 02:49:26 2008
@@ -20,7 +20,7 @@
  */
 
 /** 
- * SeahorsePGPSource: A key source for PGP keys retrieved from GPGME. 
+ * SeahorseGpgmeSource: A key source for PGP keys retrieved from GPGME. 
  * 
  * - Derived from SeahorseSource
  * - Since GPGME represents secret keys as seperate from public keys, this
@@ -37,38 +37,38 @@
  *         source. (ie: SEAHORSE_LOCATION_LOCAL, SEAHORSE_LOCATION_REMOTE)
  */
  
-#ifndef __SEAHORSE_PGP_SOURCE_H__
-#define __SEAHORSE_PGP_SOURCE_H__
+#ifndef __SEAHORSE_GPGME_SOURCE_H__
+#define __SEAHORSE_GPGME_SOURCE_H__
 
 #include "seahorse-source.h"
 
 #include <gpgme.h>
 
-#define SEAHORSE_TYPE_PGP_SOURCE            (seahorse_pgp_source_get_type ())
-#define SEAHORSE_PGP_SOURCE(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), SEAHORSE_TYPE_PGP_SOURCE, SeahorsePGPSource))
-#define SEAHORSE_PGP_SOURCE_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), SEAHORSE_TYPE_PGP_SOURCE, SeahorsePGPSourceClass))
-#define SEAHORSE_IS_PGP_SOURCE(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SEAHORSE_TYPE_PGP_SOURCE))
-#define SEAHORSE_IS_PGP_SOURCE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SEAHORSE_TYPE_PGP_SOURCE))
-#define SEAHORSE_PGP_SOURCE_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), SEAHORSE_TYPE_PGP_SOURCE, SeahorsePGPSourceClass))
-
-typedef struct _SeahorsePGPSource SeahorsePGPSource;
-typedef struct _SeahorsePGPSourceClass SeahorsePGPSourceClass;
-typedef struct _SeahorsePGPSourcePrivate SeahorsePGPSourcePrivate;
+#define SEAHORSE_TYPE_GPGME_SOURCE            (seahorse_gpgme_source_get_type ())
+#define SEAHORSE_GPGME_SOURCE(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), SEAHORSE_TYPE_GPGME_SOURCE, SeahorseGpgmeSource))
+#define SEAHORSE_GPGME_SOURCE_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), SEAHORSE_TYPE_GPGME_SOURCE, SeahorseGpgmeSourceClass))
+#define SEAHORSE_IS_GPGME_SOURCE(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SEAHORSE_TYPE_GPGME_SOURCE))
+#define SEAHORSE_IS_GPGME_SOURCE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SEAHORSE_TYPE_GPGME_SOURCE))
+#define SEAHORSE_GPGME_SOURCE_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), SEAHORSE_TYPE_GPGME_SOURCE, SeahorseGpgmeSourceClass))
+
+typedef struct _SeahorseGpgmeSource SeahorseGpgmeSource;
+typedef struct _SeahorseGpgmeSourceClass SeahorseGpgmeSourceClass;
+typedef struct _SeahorseGpgmeSourcePrivate SeahorseGpgmeSourcePrivate;
 
-struct _SeahorsePGPSource {
+struct _SeahorseGpgmeSource {
 	GObject parent;
 	gpgme_ctx_t gctx;
-	SeahorsePGPSourcePrivate *pv;
+	SeahorseGpgmeSourcePrivate *pv;
 };
 
-struct _SeahorsePGPSourceClass {
+struct _SeahorseGpgmeSourceClass {
 	GObjectClass parent_class;
 };
 
-GType                seahorse_pgp_source_get_type       (void);
+GType                seahorse_gpgme_source_get_type       (void);
 
-SeahorsePGPSource*   seahorse_pgp_source_new            (void);
+SeahorseGpgmeSource*   seahorse_gpgme_source_new            (void);
 
-gpgme_ctx_t          seahorse_pgp_source_new_context    ();
+gpgme_ctx_t          seahorse_gpgme_source_new_context    ();
 
-#endif /* __SEAHORSE_PGP_SOURCE_H__ */
+#endif /* __SEAHORSE_GPGME_SOURCE_H__ */

Added: trunk/pgp/seahorse-gpgme-subkey.c
==============================================================================
--- (empty file)
+++ trunk/pgp/seahorse-gpgme-subkey.c	Tue Dec 16 02:49:26 2008
@@ -0,0 +1,224 @@
+/*
+ * Seahorse
+ *
+ * Copyright (C) 2008 Stefan Walter
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details.
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the
+ * Free Software Foundation, Inc.,
+ * 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#include "config.h"
+
+#include "seahorse-pgp.h"
+#include "seahorse-gpgme.h"
+#include "seahorse-gpgme-subkey.h"
+#include "seahorse-gpgme-uid.h"
+
+#include <string.h>
+
+#include <glib/gi18n.h>
+
+enum {
+	PROP_0,
+	PROP_PUBKEY,
+	PROP_SUBKEY
+};
+
+G_DEFINE_TYPE (SeahorseGpgmeSubkey, seahorse_gpgme_subkey, SEAHORSE_TYPE_PGP_SUBKEY);
+
+struct _SeahorseGpgmeSubkeyPrivate {
+	gpgme_key_t pubkey;         /* The public key that this subkey is part of */
+	gpgme_subkey_t subkey;      /* The subkey referred to */
+};
+
+/* -----------------------------------------------------------------------------
+ * OBJECT 
+ */
+
+static void
+seahorse_gpgme_subkey_init (SeahorseGpgmeSubkey *self)
+{
+	self->pv = G_TYPE_INSTANCE_GET_PRIVATE (self, SEAHORSE_TYPE_GPGME_SUBKEY, SeahorseGpgmeSubkeyPrivate);
+}
+
+static GObject*
+seahorse_gpgme_subkey_constructor (GType type, guint n_props, GObjectConstructParam *props)
+{
+	GObject *obj = G_OBJECT_CLASS (seahorse_gpgme_subkey_parent_class)->constructor (type, n_props, props);
+	SeahorseGpgmeSubkey *self = NULL;
+	
+	if (obj) {
+		self = SEAHORSE_GPGME_SUBKEY (obj);
+		g_return_val_if_fail (self->pv->pubkey, NULL);
+	}
+	
+	return obj;
+}
+
+static void
+seahorse_gpgme_subkey_get_property (GObject *object, guint prop_id,
+                                  GValue *value, GParamSpec *pspec)
+{
+	SeahorseGpgmeSubkey *self = SEAHORSE_GPGME_SUBKEY (object);
+	
+	switch (prop_id) {
+	case PROP_PUBKEY:
+		g_value_set_boxed (value, seahorse_gpgme_subkey_get_pubkey (self));
+		break;
+	case PROP_SUBKEY:
+		g_value_set_pointer (value, seahorse_gpgme_subkey_get_subkey (self));
+		break;
+	}
+}
+
+static void
+seahorse_gpgme_subkey_set_property (GObject *object, guint prop_id, const GValue *value, 
+                                  GParamSpec *pspec)
+{
+	SeahorseGpgmeSubkey *self = SEAHORSE_GPGME_SUBKEY (object);
+
+	switch (prop_id) {
+	case PROP_PUBKEY:
+		g_return_if_fail (!self->pv->pubkey);
+		self->pv->pubkey = g_value_get_boxed (value);
+		if (self->pv->pubkey)
+			gpgme_key_ref (self->pv->pubkey);
+		break;
+	case PROP_SUBKEY:
+		seahorse_gpgme_subkey_set_subkey (self, g_value_get_pointer (value));
+		break;
+	}
+}
+
+static void
+seahorse_gpgme_subkey_finalize (GObject *gobject)
+{
+	SeahorseGpgmeSubkey *self = SEAHORSE_GPGME_SUBKEY (gobject);
+
+	/* Unref the key */
+	if (self->pv->pubkey)
+		gpgme_key_unref (self->pv->pubkey);
+	self->pv->pubkey = NULL;
+	self->pv->subkey = NULL;
+    
+	G_OBJECT_CLASS (seahorse_gpgme_subkey_parent_class)->finalize (gobject);
+}
+
+static void
+seahorse_gpgme_subkey_class_init (SeahorseGpgmeSubkeyClass *klass)
+{
+	GObjectClass *gobject_class = G_OBJECT_CLASS (klass);    
+
+	seahorse_gpgme_subkey_parent_class = g_type_class_peek_parent (klass);
+	g_type_class_add_private (klass, sizeof (SeahorseGpgmeSubkeyPrivate));
+
+	gobject_class->constructor = seahorse_gpgme_subkey_constructor;
+	gobject_class->finalize = seahorse_gpgme_subkey_finalize;
+	gobject_class->set_property = seahorse_gpgme_subkey_set_property;
+	gobject_class->get_property = seahorse_gpgme_subkey_get_property;
+    
+	g_object_class_install_property (gobject_class, PROP_PUBKEY,
+	        g_param_spec_boxed ("pubkey", "Public Key", "GPGME Public Key that this subkey is on",
+	                            SEAHORSE_GPGME_BOXED_KEY, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
+
+	g_object_class_install_property (gobject_class, PROP_SUBKEY,
+	        g_param_spec_pointer ("subkey", "Subkey", "GPGME Subkey",
+	                              G_PARAM_READWRITE));
+}
+
+/* -----------------------------------------------------------------------------
+ * PUBLIC 
+ */
+
+SeahorseGpgmeSubkey* 
+seahorse_gpgme_subkey_new (gpgme_key_t pubkey, gpgme_subkey_t subkey) 
+{
+	return g_object_new (SEAHORSE_TYPE_GPGME_SUBKEY, 
+	                     "pubkey", pubkey, 
+	                     "subkey", subkey, NULL);
+}
+
+
+gpgme_key_t
+seahorse_gpgme_subkey_get_pubkey (SeahorseGpgmeSubkey *self)
+{
+	g_return_val_if_fail (SEAHORSE_IS_GPGME_SUBKEY (self), NULL);
+	g_return_val_if_fail (self->pv->pubkey, NULL);
+	return self->pv->pubkey;
+}
+
+gpgme_subkey_t
+seahorse_gpgme_subkey_get_subkey (SeahorseGpgmeSubkey *self)
+{
+	g_return_val_if_fail (SEAHORSE_IS_GPGME_SUBKEY (self), NULL);
+	g_return_val_if_fail (self->pv->subkey, NULL);
+	return self->pv->subkey;
+}
+
+void
+seahorse_gpgme_subkey_set_subkey (SeahorseGpgmeSubkey *self, gpgme_subkey_t subkey)
+{
+	gchar *description, *fingerprint, *name;
+	SeahorsePgpSubkey *base;
+	const gchar *algo_type;
+	GObject *obj;
+	gpgme_subkey_t sub;
+	gint i, index;
+	
+	g_return_if_fail (SEAHORSE_IS_GPGME_SUBKEY (self));
+	g_return_if_fail (subkey);
+	
+	/* Make sure that this subkey is in the pubkey */
+	index = -1;
+	for (i = 0, sub = self->pv->pubkey->subkeys; sub; ++i, sub = sub->next) {
+		if(sub == subkey) {
+			index = i;
+			break;
+		}
+	}
+	g_return_if_fail (index >= 0);
+	
+	/* Calculate the algorithm */
+	algo_type = gpgme_pubkey_algo_name (subkey->pubkey_algo);
+	if (algo_type == NULL)
+		algo_type = _("Unknown");
+	else if (g_str_equal ("Elg", algo_type) || g_str_equal("ELG-E", algo_type))
+		algo_type = _("ElGamal");
+
+	/* Additional properties */
+	fingerprint = seahorse_pgp_subkey_calc_fingerprint (subkey->fpr);
+	name = seahorse_gpgme_uid_calc_name (self->pv->pubkey->uids);
+	description = seahorse_pgp_subkey_calc_description (name, index);
+	
+	self->pv->subkey = subkey;
+	
+	obj = G_OBJECT (self);
+	g_object_freeze_notify (obj);
+	
+	base = SEAHORSE_PGP_SUBKEY (self);
+	seahorse_pgp_subkey_set_index (base, index);
+	seahorse_pgp_subkey_set_keyid (base, subkey->keyid);
+	seahorse_pgp_subkey_set_algorithm (base, algo_type);
+	seahorse_pgp_subkey_set_length (base, subkey->length);
+	seahorse_pgp_subkey_set_description (base, description);
+	seahorse_pgp_subkey_set_fingerprint (base, fingerprint);
+	
+	g_object_notify (obj, "subkey");
+	g_object_thaw_notify (obj);
+	
+	g_free (description);
+	g_free (name);
+	g_free (fingerprint);
+}

Added: trunk/pgp/seahorse-gpgme-subkey.h
==============================================================================
--- (empty file)
+++ trunk/pgp/seahorse-gpgme-subkey.h	Tue Dec 16 02:49:26 2008
@@ -0,0 +1,63 @@
+/*
+ * Seahorse
+ *
+ * Copyright (C) 2008 Stefan Walter
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details.
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the
+ * Free Software Foundation, Inc.,
+ * 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __SEAHORSE_GPGME_SUBKEY_H__
+#define __SEAHORSE_GPGME_SUBKEY_H__
+
+#include <glib-object.h>
+
+#include <gpgme.h>
+
+#include "pgp/seahorse-pgp-subkey.h"
+
+#define SEAHORSE_TYPE_GPGME_SUBKEY            (seahorse_gpgme_subkey_get_type ())
+#define SEAHORSE_GPGME_SUBKEY(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), SEAHORSE_TYPE_GPGME_SUBKEY, SeahorseGpgmeSubkey))
+#define SEAHORSE_GPGME_SUBKEY_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), SEAHORSE_TYPE_GPGME_SUBKEY, SeahorseGpgmeSubkeyClass))
+#define SEAHORSE_IS_GPGME_SUBKEY(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SEAHORSE_TYPE_GPGME_SUBKEY))
+#define SEAHORSE_IS_GPGME_SUBKEY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SEAHORSE_TYPE_GPGME_SUBKEY))
+#define SEAHORSE_GPGME_SUBKEY_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), SEAHORSE_TYPE_GPGME_SUBKEY, SeahorseGpgmeSubkeyClass))
+
+typedef struct _SeahorseGpgmeSubkey SeahorseGpgmeSubkey;
+typedef struct _SeahorseGpgmeSubkeyClass SeahorseGpgmeSubkeyClass;
+typedef struct _SeahorseGpgmeSubkeyPrivate SeahorseGpgmeSubkeyPrivate;
+
+struct _SeahorseGpgmeSubkey {
+	SeahorsePgpSubkey parent;
+	SeahorseGpgmeSubkeyPrivate *pv;
+};
+
+struct _SeahorseGpgmeSubkeyClass {
+	SeahorsePgpSubkeyClass parent_class;
+};
+
+GType                 seahorse_gpgme_subkey_get_type          (void);
+
+SeahorseGpgmeSubkey*  seahorse_gpgme_subkey_new               (gpgme_key_t pubkey,
+                                                               gpgme_subkey_t subkey);
+
+gpgme_key_t           seahorse_gpgme_subkey_get_pubkey        (SeahorseGpgmeSubkey *self);
+
+gpgme_subkey_t        seahorse_gpgme_subkey_get_subkey        (SeahorseGpgmeSubkey *self);
+
+void                  seahorse_gpgme_subkey_set_subkey        (SeahorseGpgmeSubkey *self,
+                                                               gpgme_subkey_t subkey);
+
+#endif /* __SEAHORSE_GPGME_SUBKEY_H__ */

Added: trunk/pgp/seahorse-gpgme-uid.c
==============================================================================
--- (empty file)
+++ trunk/pgp/seahorse-gpgme-uid.c	Tue Dec 16 02:49:26 2008
@@ -0,0 +1,362 @@
+/*
+ * Seahorse
+ *
+ * Copyright (C) 2008 Stefan Walter
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details.
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the
+ * Free Software Foundation, Inc.,
+ * 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#include "config.h"
+
+#include "seahorse-gpgme.h"
+#include "seahorse-gpgme-uid.h"
+#include "seahorse-pgp.h"
+#include "seahorse-pgp-key.h"
+#include "seahorse-pgp-signature.h"
+
+#include "common/seahorse-object-list.h"
+
+#include <string.h>
+
+#include <glib/gi18n.h>
+
+enum {
+	PROP_0,
+	PROP_PUBKEY,
+	PROP_USERID,
+	PROP_GPGME_INDEX,
+	PROP_ACTUAL_INDEX
+};
+
+G_DEFINE_TYPE (SeahorseGpgmeUid, seahorse_gpgme_uid, SEAHORSE_TYPE_PGP_UID);
+
+struct _SeahorseGpgmeUidPrivate {
+	gpgme_key_t pubkey;         /* The public key that this uid is part of */
+	gpgme_user_id_t userid;     /* The userid referred to */
+	guint gpgme_index;          /* The GPGME index of the UID */
+	gint actual_index;          /* The actual index of this UID */
+};
+
+/* -----------------------------------------------------------------------------
+ * INTERNAL HELPERS
+ */
+
+static gchar*
+convert_string (const gchar *str)
+{
+	if (!str)
+  	      return NULL;
+    
+	/* If not utf8 valid, assume latin 1 */
+ 	if (!g_utf8_validate (str, -1, NULL))
+ 		return g_convert (str, -1, "UTF-8", "ISO-8859-1", NULL, NULL, NULL);
+
+	return g_strdup (str);
+}
+
+static void
+realize_signatures (SeahorseGpgmeUid *self, gpgme_user_id_t userid)
+{
+	gpgme_key_sig_t gsig;
+	SeahorsePgpSignature *sig;
+	GList *sigs = NULL;
+	guint flags;
+	
+	for (gsig = userid->signatures; gsig; gsig = gsig->next) {
+		sig = seahorse_pgp_signature_new (gsig->keyid);
+		
+		/* Order of parsing these flags is important */
+		flags = 0;
+		if (gsig->revoked)
+			flags |= SEAHORSE_FLAG_REVOKED;
+		if (gsig->expired)
+			flags |= SEAHORSE_FLAG_EXPIRED;
+		if (flags == 0 && !gsig->invalid)
+			flags = SEAHORSE_FLAG_IS_VALID;
+		if (gsig->exportable)
+			flags |= SEAHORSE_FLAG_EXPORTABLE;
+	
+		seahorse_pgp_signature_set_flags (sig, flags);
+		sigs = g_list_prepend (sigs, sig);
+	}
+	
+	seahorse_pgp_uid_set_signatures (SEAHORSE_PGP_UID (self), sigs);
+	seahorse_object_list_free (sigs);
+}
+
+
+/* -----------------------------------------------------------------------------
+ * OBJECT 
+ */
+
+static void
+seahorse_gpgme_uid_init (SeahorseGpgmeUid *self)
+{
+	self->pv = G_TYPE_INSTANCE_GET_PRIVATE (self, SEAHORSE_TYPE_GPGME_UID, SeahorseGpgmeUidPrivate);
+	self->pv->gpgme_index = 0;
+	self->pv->actual_index = -1;
+}
+
+static GObject*
+seahorse_gpgme_uid_constructor (GType type, guint n_props, GObjectConstructParam *props)
+{
+	GObject *obj = G_OBJECT_CLASS (seahorse_gpgme_uid_parent_class)->constructor (type, n_props, props);
+	SeahorseGpgmeUid *self = NULL;
+	SeahorseLocation loc;
+	
+	if (obj) {
+		self = SEAHORSE_GPGME_UID (obj);
+		g_return_val_if_fail (self->pv->pubkey, NULL);
+		
+		loc = seahorse_object_get_location (SEAHORSE_OBJECT (self));
+		if (self->pv->pubkey->keylist_mode & GPGME_KEYLIST_MODE_EXTERN && 
+		    loc <= SEAHORSE_LOCATION_REMOTE)
+			loc = SEAHORSE_LOCATION_REMOTE;
+
+		else if (loc <= SEAHORSE_LOCATION_LOCAL)
+			loc = SEAHORSE_LOCATION_LOCAL;
+		
+		g_object_set (self, "location", loc, NULL);
+	}
+	
+	return obj;
+}
+
+static void
+seahorse_gpgme_uid_get_property (GObject *object, guint prop_id,
+                               GValue *value, GParamSpec *pspec)
+{
+	SeahorseGpgmeUid *self = SEAHORSE_GPGME_UID (object);
+	
+	switch (prop_id) {
+	case PROP_PUBKEY:
+		g_value_set_boxed (value, seahorse_gpgme_uid_get_pubkey (self));
+		break;
+	case PROP_USERID:
+		g_value_set_pointer (value, seahorse_gpgme_uid_get_userid (self));
+		break;
+	case PROP_GPGME_INDEX:
+		g_value_set_uint (value, seahorse_gpgme_uid_get_gpgme_index (self));
+		break;
+	case PROP_ACTUAL_INDEX:
+		g_value_set_uint (value, seahorse_gpgme_uid_get_actual_index (self));
+		break;
+	}
+}
+
+static void
+seahorse_gpgme_uid_set_property (GObject *object, guint prop_id, const GValue *value, 
+                               GParamSpec *pspec)
+{
+	SeahorseGpgmeUid *self = SEAHORSE_GPGME_UID (object);
+
+	switch (prop_id) {
+	case PROP_PUBKEY:
+		g_return_if_fail (!self->pv->pubkey);
+		self->pv->pubkey = g_value_get_boxed (value);
+		if (self->pv->pubkey)
+			gpgme_key_ref (self->pv->pubkey);
+		break;
+	case PROP_ACTUAL_INDEX:
+		seahorse_gpgme_uid_set_actual_index (self, g_value_get_uint (value));
+		break;
+	case PROP_USERID:
+		seahorse_gpgme_uid_set_userid (self, g_value_get_pointer (value));
+		break;
+	}
+}
+
+static void
+seahorse_gpgme_uid_object_finalize (GObject *gobject)
+{
+	SeahorseGpgmeUid *self = SEAHORSE_GPGME_UID (gobject);
+
+	/* Unref the key */
+	if (self->pv->pubkey)
+		gpgme_key_unref (self->pv->pubkey);
+	self->pv->pubkey = NULL;
+	self->pv->userid = NULL;
+    
+	G_OBJECT_CLASS (seahorse_gpgme_uid_parent_class)->finalize (gobject);
+}
+
+static void
+seahorse_gpgme_uid_class_init (SeahorseGpgmeUidClass *klass)
+{
+	GObjectClass *gobject_class = G_OBJECT_CLASS (klass);    
+
+	seahorse_gpgme_uid_parent_class = g_type_class_peek_parent (klass);
+	g_type_class_add_private (klass, sizeof (SeahorseGpgmeUidPrivate));
+
+	gobject_class->constructor = seahorse_gpgme_uid_constructor;
+	gobject_class->finalize = seahorse_gpgme_uid_object_finalize;
+	gobject_class->set_property = seahorse_gpgme_uid_set_property;
+	gobject_class->get_property = seahorse_gpgme_uid_get_property;
+    
+	g_object_class_install_property (gobject_class, PROP_PUBKEY,
+	        g_param_spec_boxed ("pubkey", "Public Key", "GPGME Public Key that this uid is on",
+	                            SEAHORSE_GPGME_BOXED_KEY, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
+
+	g_object_class_install_property (gobject_class, PROP_USERID,
+	        g_param_spec_pointer ("userid", "User ID", "GPGME User ID",
+	                              G_PARAM_READWRITE));
+                      
+	g_object_class_install_property (gobject_class, PROP_GPGME_INDEX,
+	        g_param_spec_uint ("gpgme-index", "GPGME Index", "GPGME User ID Index",
+	                           0, G_MAXUINT, 0, G_PARAM_READWRITE));
+	
+	g_object_class_install_property (gobject_class, PROP_ACTUAL_INDEX,
+	        g_param_spec_uint ("actual-index", "Actual Index", "Actual GPG Index",
+	                           0, G_MAXUINT, 0, G_PARAM_READWRITE));
+}
+
+/* -----------------------------------------------------------------------------
+ * PUBLIC 
+ */
+
+SeahorseGpgmeUid* 
+seahorse_gpgme_uid_new (gpgme_key_t pubkey, gpgme_user_id_t userid) 
+{
+	return g_object_new (SEAHORSE_TYPE_GPGME_UID, 
+	                     "pubkey", pubkey, 
+	                     "userid", userid, NULL);
+}
+
+gpgme_key_t
+seahorse_gpgme_uid_get_pubkey (SeahorseGpgmeUid *self)
+{
+	g_return_val_if_fail (SEAHORSE_IS_GPGME_UID (self), NULL);
+	g_return_val_if_fail (self->pv->pubkey, NULL);
+	return self->pv->pubkey;
+}
+
+gpgme_user_id_t
+seahorse_gpgme_uid_get_userid (SeahorseGpgmeUid *self)
+{
+	g_return_val_if_fail (SEAHORSE_IS_GPGME_UID (self), NULL);
+	g_return_val_if_fail (self->pv->userid, NULL);
+	return self->pv->userid;
+}
+
+void
+seahorse_gpgme_uid_set_userid (SeahorseGpgmeUid *self, gpgme_user_id_t userid)
+{
+	SeahorsePgpUid *base;
+	GObject *obj;
+	gpgme_user_id_t uid;
+	gchar *string;
+	gint index, i;
+	
+	g_return_if_fail (SEAHORSE_IS_GPGME_UID (self));
+	g_return_if_fail (userid);
+	
+	/* Make sure that this userid is in the pubkey */
+	index = -1;
+	for (i = 0, uid = self->pv->pubkey->uids; uid; ++i, uid = uid->next) {
+		if(userid == uid) {
+			index = i;
+			break;
+		}
+	}
+	
+	g_return_if_fail (index >= 0);
+	
+	self->pv->userid = userid;
+	self->pv->gpgme_index = index;
+	
+	obj = G_OBJECT (self);
+	g_object_freeze_notify (obj);
+	g_object_notify (obj, "userid");
+	g_object_notify (obj, "gpgme_index");
+	
+	base = SEAHORSE_PGP_UID (self);
+	
+	string = convert_string (userid->name);
+	seahorse_pgp_uid_set_name (base, string);
+	g_free (string);
+	
+	string = convert_string (userid->email);
+	seahorse_pgp_uid_set_email (base, string);
+	g_free (string);
+	
+	string = convert_string (userid->comment);
+	seahorse_pgp_uid_set_comment (base, string);
+	g_free (string);
+	
+	realize_signatures (self, userid);
+
+	seahorse_pgp_uid_set_validity (base, seahorse_gpgme_convert_validity (userid->validity));
+
+	g_object_thaw_notify (obj);
+}
+
+guint
+seahorse_gpgme_uid_get_gpgme_index (SeahorseGpgmeUid *self)
+{
+	g_return_val_if_fail (SEAHORSE_IS_GPGME_UID (self), 0);
+	return self->pv->gpgme_index;
+}
+
+guint
+seahorse_gpgme_uid_get_actual_index (SeahorseGpgmeUid *self)
+{
+	g_return_val_if_fail (SEAHORSE_IS_GPGME_UID (self), 0);
+	if(self->pv->actual_index < 0)
+		return self->pv->gpgme_index;
+	return self->pv->actual_index;
+}
+
+void
+seahorse_gpgme_uid_set_actual_index (SeahorseGpgmeUid *self, guint actual_index)
+{
+	g_return_if_fail (SEAHORSE_IS_GPGME_UID (self));
+	self->pv->actual_index = actual_index;
+	g_object_notify (G_OBJECT (self), "actual-index");
+}
+
+gchar*
+seahorse_gpgme_uid_calc_label (gpgme_user_id_t userid)
+{
+	g_return_val_if_fail (userid, NULL);
+	return convert_string (userid->uid);
+}
+
+gchar*
+seahorse_gpgme_uid_calc_name (gpgme_user_id_t userid)
+{
+	g_return_val_if_fail (userid, NULL);
+	return convert_string (userid->name);
+}
+
+gchar*
+seahorse_gpgme_uid_calc_markup (gpgme_user_id_t userid, guint flags)
+{
+	gchar *email, *name, *comment, *ret;
+
+	g_return_val_if_fail (userid, NULL);
+	
+	name = convert_string (userid->name);
+	email = convert_string (userid->email);
+	comment = convert_string (userid->comment);
+	
+	ret = seahorse_pgp_uid_calc_markup (name, email, comment, flags);
+	
+	g_free (name);
+	g_free (email);
+	g_free (comment);
+	
+	return ret;
+}

Added: trunk/pgp/seahorse-gpgme-uid.h
==============================================================================
--- (empty file)
+++ trunk/pgp/seahorse-gpgme-uid.h	Tue Dec 16 02:49:26 2008
@@ -0,0 +1,79 @@
+/*
+ * Seahorse
+ *
+ * Copyright (C) 2008 Stefan Walter
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details.
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the
+ * Free Software Foundation, Inc.,
+ * 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __SEAHORSE_GPGME_UID_H__
+#define __SEAHORSE_GPGME_UID_H__
+
+#include <glib-object.h>
+
+#include <gpgme.h>
+
+#include "seahorse-object.h"
+
+#include "pgp/seahorse-pgp-uid.h"
+
+#define SEAHORSE_TYPE_GPGME_UID            (seahorse_gpgme_uid_get_type ())
+#define SEAHORSE_GPGME_UID(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), SEAHORSE_TYPE_GPGME_UID, SeahorseGpgmeUid))
+#define SEAHORSE_GPGME_UID_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), SEAHORSE_TYPE_GPGME_UID, SeahorseGpgmeUidClass))
+#define SEAHORSE_IS_GPGME_UID(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SEAHORSE_TYPE_GPGME_UID))
+#define SEAHORSE_IS_GPGME_UID_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SEAHORSE_TYPE_GPGME_UID))
+#define SEAHORSE_GPGME_UID_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), SEAHORSE_TYPE_GPGME_UID, SeahorseGpgmeUidClass))
+
+typedef struct _SeahorseGpgmeUid SeahorseGpgmeUid;
+typedef struct _SeahorseGpgmeUidClass SeahorseGpgmeUidClass;
+typedef struct _SeahorseGpgmeUidPrivate SeahorseGpgmeUidPrivate;
+
+struct _SeahorseGpgmeUid {
+	SeahorsePgpUid parent;
+	SeahorseGpgmeUidPrivate *pv;
+};
+
+struct _SeahorseGpgmeUidClass {
+	SeahorsePgpUidClass parent_class;
+};
+
+GType               seahorse_gpgme_uid_get_type             (void);
+
+SeahorseGpgmeUid*   seahorse_gpgme_uid_new                  (gpgme_key_t pubkey,
+                                                             gpgme_user_id_t userid);
+
+gpgme_key_t         seahorse_gpgme_uid_get_pubkey           (SeahorseGpgmeUid *self);
+
+gpgme_user_id_t     seahorse_gpgme_uid_get_userid           (SeahorseGpgmeUid *self);
+
+void                seahorse_gpgme_uid_set_userid           (SeahorseGpgmeUid *self,
+                                                             gpgme_user_id_t userid);
+
+guint               seahorse_gpgme_uid_get_gpgme_index      (SeahorseGpgmeUid *self);
+
+guint               seahorse_gpgme_uid_get_actual_index     (SeahorseGpgmeUid *self);
+
+void                seahorse_gpgme_uid_set_actual_index     (SeahorseGpgmeUid *self,
+                                                             guint actual_index);
+
+gchar*              seahorse_gpgme_uid_calc_name            (gpgme_user_id_t userid);
+
+gchar*              seahorse_gpgme_uid_calc_label           (gpgme_user_id_t userid);
+
+gchar*              seahorse_gpgme_uid_calc_markup          (gpgme_user_id_t userid,
+                                                             guint flags);
+
+#endif /* __SEAHORSE_GPGME_UID_H__ */

Added: trunk/pgp/seahorse-gpgme.c
==============================================================================
--- (empty file)
+++ trunk/pgp/seahorse-gpgme.c	Tue Dec 16 02:49:26 2008
@@ -0,0 +1,120 @@
+/* 
+ * Seahorse
+ * 
+ * Copyright (C) 2008 Stefan Walter
+ * 
+ * This program is free software; you can redistribute it and/or modify 
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *  
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *  
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+ * 02111-1307, USA.  
+ */
+
+#include "config.h"
+
+#include "seahorse-gpgme.h"
+
+#include "seahorse-util.h"
+
+#include <glib/gi18n.h>
+
+GQuark
+seahorse_gpgme_error_domain (void)
+{
+	static GQuark q = 0;
+	if (q == 0)
+		q = g_quark_from_static_string ("seahorse-gpgme-error");
+	return q;
+}
+
+void    
+seahorse_gpgme_to_error (gpgme_error_t gerr, GError** err)
+{
+	gpgme_err_code_t code;
+    
+    	/* Make sure this is actually an error */
+    	code = gpgme_err_code (gerr);
+   	g_return_if_fail (code != 0);
+    
+    	/* Special case some error messages */
+    	if (code == GPG_ERR_DECRYPT_FAILED) {
+    		g_set_error (err, SEAHORSE_GPGME_ERROR, code, "%s", 
+    		             _("Decryption failed. You probably do not have the decryption key."));
+    	} else {
+    		g_set_error (err, SEAHORSE_GPGME_ERROR, code, "%s", 
+    		             gpgme_strerror (gerr));
+    	}
+}
+
+void
+seahorse_gpgme_handle_error (gpgme_error_t err, const char* desc, ...)
+{
+	gchar *t = NULL;
+
+	switch (gpgme_err_code(err)) {
+	case GPG_ERR_CANCELED:
+	case GPG_ERR_NO_ERROR:
+	case GPG_ERR_ECANCELED:
+		return;
+	default: 
+		break;
+	}
+
+	va_list ap;
+	va_start(ap, desc);
+  
+	if (desc) 
+		t = g_strdup_vprintf (desc, ap);
+
+	va_end(ap);
+        
+	seahorse_util_show_error (NULL, t, gpgme_strerror (err));
+	g_free(t);
+}
+
+static gpgme_key_t
+ref_return_key (gpgme_key_t key)
+{
+	gpgme_key_ref (key);
+	return key;
+}
+
+
+GType
+seahorse_gpgme_boxed_key_type (void)
+{
+	static GType type = 0;
+	if (!type)
+		type = g_boxed_type_register_static ("gpgme_key_t", 
+		                                     (GBoxedCopyFunc)ref_return_key,
+		                                     (GBoxedFreeFunc)gpgme_key_unref);
+	return type;
+}
+
+SeahorseValidity
+seahorse_gpgme_convert_validity (gpgme_validity_t validity)
+{
+	switch (validity) {
+	case GPGME_VALIDITY_NEVER:
+		return SEAHORSE_VALIDITY_NEVER;
+	case GPGME_VALIDITY_MARGINAL:
+		return SEAHORSE_VALIDITY_MARGINAL;
+	case GPGME_VALIDITY_FULL:
+		return SEAHORSE_VALIDITY_FULL;
+	case GPGME_VALIDITY_ULTIMATE:
+		return SEAHORSE_VALIDITY_ULTIMATE;
+	case GPGME_VALIDITY_UNDEFINED:
+	case GPGME_VALIDITY_UNKNOWN:
+	default:
+		return SEAHORSE_VALIDITY_UNKNOWN;
+	}	
+}

Added: trunk/pgp/seahorse-gpgme.h
==============================================================================
--- (empty file)
+++ trunk/pgp/seahorse-gpgme.h	Tue Dec 16 02:49:26 2008
@@ -0,0 +1,52 @@
+/* 
+ * Seahorse
+ * 
+ * Copyright (C) 2008 Stefan Walter
+ * 
+ * This program is free software; you can redistribute it and/or modify 
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *  
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *  
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+ * 02111-1307, USA.  
+ */
+
+#ifndef SEAHORSEGPGME_H_
+#define SEAHORSEGPGME_H_
+
+#include <glib.h>
+#include <glib-object.h>
+
+#include <gpgme.h>
+
+#include "seahorse-validity.h"
+
+/* TODO: I think these are extraneous and can be removed. In actuality OK == 0 */
+#define GPG_IS_OK(e)        (gpgme_err_code (e) == GPG_ERR_NO_ERROR)
+#define GPG_OK              (gpgme_error (GPG_ERR_NO_ERROR))
+#define GPG_E(e)            (gpgme_error (e))
+
+#define            SEAHORSE_GPGME_ERROR             (seahorse_gpgme_error_domain ())
+
+GQuark             seahorse_gpgme_error_domain      (void);
+
+void               seahorse_gpgme_to_error          (gpgme_error_t gerr, GError** err);
+
+void               seahorse_gpgme_handle_error      (gpgme_error_t err, 
+                                                     const gchar* desc, ...);
+
+#define            SEAHORSE_GPGME_BOXED_KEY         (seahorse_gpgme_boxed_key_type ())
+
+GType              seahorse_gpgme_boxed_key_type    (void);
+
+SeahorseValidity   seahorse_gpgme_convert_validity  (gpgme_validity_t validity);
+
+#endif /* SEAHORSEGPGME_H_ */

Modified: trunk/pgp/seahorse-hkp-source.c
==============================================================================
--- trunk/pgp/seahorse-hkp-source.c	(original)
+++ trunk/pgp/seahorse-hkp-source.c	Tue Dec 16 02:49:26 2008
@@ -19,7 +19,7 @@
  * Boston, MA 02111-1307, USA.
  */
  
-#include <config.h>
+#include "config.h"
  
 #include <stdlib.h>
 #include <string.h>
@@ -28,8 +28,9 @@
 
 #include "seahorse-hkp-source.h"
 
-#include "seahorse-gpgmex.h"
 #include "seahorse-pgp-key.h"
+#include "seahorse-pgp-subkey.h"
+#include "seahorse-pgp-uid.h"
 
 #include "seahorse-gconf.h"
 #include "seahorse-operation.h"
@@ -37,6 +38,7 @@
 #include "seahorse-util.h"
 
 #include "common/seahorse-registry.h"
+#include "common/seahorse-object-list.h"
 
 #include <libsoup/soup.h>
 
@@ -385,142 +387,155 @@
 static GList*
 parse_hkp_index (const gchar *response)
 {
-    /* 
-     * Luckily enough, both the HKP server and NAI HKP interface to their
-     * LDAP server are close enough in output so the same function can
-     * parse them both. 
-     */
+	/* 
+	 * Luckily enough, both the HKP server and NAI HKP interface to their
+	 * LDAP server are close enough in output so the same function can
+	 * parse them both. 
+	 */
 
-    /* pub  2048/<a href="/pks/lookup?op=get&search=0x3CB3B415">3CB3B415</a> 1998/04/03 David M. Shaw &lt;<a href="/pks/lookup?op=get&search=0x3CB3B415">dshaw jabberwocky com</a>&gt; */
+	/* pub  2048/<a href="/pks/lookup?op=get&search=0x3CB3B415">3CB3B415</a> 1998/04/03 David M. Shaw &lt;<a href="/pks/lookup?op=get&search=0x3CB3B415">dshaw jabberwocky com</a>&gt; */
 
-    gchar **lines, **l;
-    gchar **v;
-    gchar *line, *t;
+	gchar **lines, **l;
+	gchar **v;
+	gchar *line, *t;
     
-    GList *keys = NULL;
-    gpgme_key_t key = NULL;
+	SeahorsePgpKey *key;
+	GList *keys = NULL;
+	GList *subkeys = NULL;
+	GList *uids = NULL;
     
-    lines = g_strsplit (response, "\n", 0);
+	lines = g_strsplit (response, "\n", 0);
     
-    for (l = lines; *l; l++) {
+	for (l = lines; *l; l++) {
 
-        line = *l;
-        dehtmlize(line);
+		line = *l;
+		dehtmlize (line);
 
-        /* Start a new key */
-        if (g_ascii_strncasecmp (line, "pub ", 4) == 0) {
+		/* Start a new key */
+		if (g_ascii_strncasecmp (line, "pub ", 4) == 0) {
             
-            t = line + 4;
-            while (*t && g_ascii_isspace (*t))
-                t++;
-            
-            v = g_strsplit_set (t, " ", 3);
-            if (!v[0] || !v[1] || !v[2]) {
-                g_warning ("Invalid key line from server: %s", line);
-                
-            } else {
-                gchar *fpr = NULL;
-                unsigned int flags = 0;
-                gpgme_pubkey_algo_t algo;
-                gboolean has_uid = TRUE;
-
-                /* Allocate a new key */
-                key = gpgmex_key_alloc ();
-                g_return_val_if_fail (key != NULL, keys);
-                keys = g_list_prepend (keys, key);
+			t = line + 4;
+			while (*t && g_ascii_isspace (*t))
+				t++;
+            
+			v = g_strsplit_set (t, " ", 3);
+			if (!v[0] || !v[1] || !v[2]) {
+				g_warning ("Invalid key line from server: %s", line);
                 
-                /* Cut the length and fingerprint */
-                fpr = strchr (v[0], '/');
-                if (fpr == NULL) {
-                    g_warning ("couldn't find key fingerprint in line from server: %s", line);
-                    fpr = "";
-                } else {
-                    *(fpr++) = 0;
-                }
+			} else {
+				gchar *fingerprint, *fpr = NULL;
+				gboolean revoked = FALSE;
+				const gchar *algo;
+				gboolean has_uid = TRUE;
+				SeahorsePgpSubkey *subkey;
+
+				key = seahorse_pgp_key_new ();
+				keys = g_list_prepend (keys, key);
+
+				/* Cut the length and fingerprint */
+				fpr = strchr (v[0], '/');
+				if (fpr == NULL) {
+					g_warning ("couldn't find key fingerprint in line from server: %s", line);
+					fpr = "";
+				} else {
+					*(fpr++) = 0;
+				}
                 
-                /* Check out the key type */
-                switch (g_ascii_toupper (v[0][strlen(v[0]) - 1])) {
-                case 'D':
-                    algo = GPGME_PK_DSA;
-                    break;
-                case 'R':
-                    algo = GPGME_PK_RSA;
-                    break;
-                default:
-                    algo = 0;
-                    break;
-                };
+				/* Check out the key type */
+				switch (g_ascii_toupper (v[0][strlen(v[0]) - 1])) {
+				case 'D':
+					algo = "DSA";
+					break;
+				case 'R':
+					algo = "RSA";
+					break;
+				default:
+					algo = "";
+					break;
+				};
 
-                /* Format the date for our parse function */
-                g_strdelimit (v[1], "/", '-');
+				/* Format the date for our parse function */
+				g_strdelimit (v[1], "/", '-');
                 
-                /* Cleanup the UID */
-                g_strstrip (v[2]);
+				/* Cleanup the UID */
+				g_strstrip (v[2]);
             
-                if (g_ascii_strcasecmp (v[2], "*** KEY REVOKED ***") == 0) {
-                    flags |= GPGMEX_KEY_REVOKED;
-                    has_uid = FALSE;
-                } 
+				if (g_ascii_strcasecmp (v[2], "*** KEY REVOKED ***") == 0) {
+					revoked = TRUE;
+					has_uid = FALSE;
+				} 
                 
-                /* Add all the info to the key */
-                gpgmex_key_add_subkey (key, fpr, flags, 
-                                       parse_hkp_date (v[1]), 
-                                       0, strtol (v[0], NULL, 10), algo);
-
-                /* And the UID if one was found */                
-                if (has_uid)
-                    gpgmex_key_add_uid (key, v[2], 0);
-            }
-            
-            g_strfreev (v);
-            
-        /* A UID for the key */
-        } else if (key && g_ascii_strncasecmp (line, "    ", 4) == 0) {
-            
-            g_strstrip (line);
-            gpgmex_key_add_uid (key, line, 0);
-            
-        /* Signatures */
-        } else if (key && g_ascii_strncasecmp (line, "sig ", 4) == 0) {
-            
-            /* TODO: Implement signatures */
-            
-        /* Other junk */
-        } else {
-            
-            /* The end of the key */
-            key = NULL;
-        }
-    }
+				/* Add all the info to the key */
+				subkey = seahorse_pgp_subkey_new ();
+				seahorse_pgp_subkey_set_keyid (subkey, fpr);
+				fingerprint = seahorse_pgp_subkey_calc_fingerprint (fpr);
+				seahorse_pgp_subkey_set_fingerprint (subkey, fingerprint);
+				g_free (fingerprint);
+				if(revoked)
+					seahorse_pgp_subkey_set_validity (subkey, SEAHORSE_VALIDITY_REVOKED);
+				seahorse_pgp_subkey_set_created (subkey, parse_hkp_date (v[1]));
+				seahorse_pgp_subkey_set_length (subkey, strtol (v[0], NULL, 10));
+				seahorse_pgp_subkey_set_algorithm (subkey, algo);
+				subkeys = g_list_prepend (subkeys, subkey);
+
+				/* And the UID if one was found */                
+				if (has_uid) {
+					SeahorsePgpUid *uid = seahorse_pgp_uid_new (v[2]);
+					uids = g_list_prepend (uids, uid);
+				}
+			}
+            
+			g_strfreev (v);
+            
+		/* A UID for the key */
+		} else if (key && g_ascii_strncasecmp (line, "    ", 4) == 0) {
+            
+			SeahorsePgpUid *uid;
+			
+			g_strstrip (line);
+			uid = seahorse_pgp_uid_new (line);
+			uids = g_list_prepend (uids, uid);
+            
+		/* Signatures */
+		} else if (key && g_ascii_strncasecmp (line, "sig ", 4) == 0) {
+            
+			/* TODO: Implement signatures */
+            
+		/* Other junk */
+		} else {
+            
+			/* Allocate a new key */
+			seahorse_pgp_key_set_uids (SEAHORSE_PGP_KEY (key), uids);
+			seahorse_object_list_free (uids);
+			seahorse_pgp_key_set_subkeys (SEAHORSE_PGP_KEY (key), subkeys);
+			seahorse_object_list_free (subkeys);
+			uids = subkeys = NULL;
+		}
+	}
     
-    g_strfreev (lines);
+	g_strfreev (lines);
                         
-    return keys; 
+	return keys; 
 }
 
 static void
-add_key (SeahorseHKPSource *ssrc, gpgme_key_t key)
+add_key (SeahorseHKPSource *ssrc, SeahorsePgpKey *key)
 {
-    SeahorseObject *prev;
-    SeahorsePgpKey *pkey;
-    GQuark keyid;
+	SeahorseObject *prev;
+	GQuark keyid;
        
-    g_return_if_fail (key && key->subkeys && key->subkeys->keyid);
-
-    keyid = seahorse_pgp_key_get_cannonical_id (key->subkeys->keyid);
-    prev = seahorse_context_get_object (SCTX_APP (), SEAHORSE_SOURCE (ssrc), keyid);
-    
-    if (prev != NULL) {
-        g_return_if_fail (SEAHORSE_IS_PGP_KEY (prev));
-        gpgmex_combine_keys (seahorse_pgp_key_get_public (SEAHORSE_PGP_KEY (prev)), key);
-        return;
-    }
-
-    /* A public key */
-    pkey = seahorse_pgp_key_new (SEAHORSE_SOURCE (ssrc), key, NULL);
-
-    /* Add to context */ 
-    seahorse_context_add_object (SCTX_APP (), SEAHORSE_OBJECT (pkey));
+	keyid = seahorse_pgp_key_get_cannonical_id (seahorse_pgp_key_get_keyid (key));
+	prev = seahorse_context_get_object (SCTX_APP (), SEAHORSE_SOURCE (ssrc), keyid);
+	if (prev != NULL) {
+		g_return_if_fail (SEAHORSE_IS_PGP_KEY (prev));
+		seahorse_pgp_key_set_uids (SEAHORSE_PGP_KEY (prev), seahorse_pgp_key_get_uids (key));
+		seahorse_pgp_key_set_subkeys (SEAHORSE_PGP_KEY (prev), seahorse_pgp_key_get_subkeys (key));
+		return;
+	}
+
+	/* Add to context */ 
+	seahorse_object_set_source (SEAHORSE_OBJECT (key), SEAHORSE_SOURCE (ssrc));
+	seahorse_context_add_object (SCTX_APP (), SEAHORSE_OBJECT (key));
 }
 
 static void 
@@ -538,12 +553,9 @@
     
     keys = parse_hkp_index (msg->response_body->data);
     
-    for (k = keys; k; k = g_list_next (k)) {
-        add_key (hop->hsrc, (gpgme_key_t)(k->data));
-        gpgmex_key_unref ((gpgme_key_t)(k->data));
-    }
-    
-    g_list_free (keys);
+    for (k = keys; k; k = g_list_next (k))
+        add_key (hop->hsrc, SEAHORSE_PGP_KEY (k->data));
+    seahorse_object_list_free (keys);
 
     if (--hop->requests <= 0)
         seahorse_operation_mark_done (SEAHORSE_OPERATION (hop), FALSE, NULL);

Modified: trunk/pgp/seahorse-ldap-source.c
==============================================================================
--- trunk/pgp/seahorse-ldap-source.c	(original)
+++ trunk/pgp/seahorse-ldap-source.c	Tue Dec 16 02:49:26 2008
@@ -29,14 +29,16 @@
 
 #include "seahorse-ldap-source.h"
 
-#include "seahorse-gpgmex.h"
 #include "seahorse-pgp-key.h"
+#include "seahorse-pgp-subkey.h"
+#include "seahorse-pgp-uid.h"
 
 #include "seahorse-operation.h"
 #include "seahorse-servers.h"
 #include "seahorse-util.h"
 
 #include "common/seahorse-registry.h"
+#include "common/seahorse-object-list.h"
 
 #include <ldap.h>
 
@@ -255,29 +257,30 @@
     return d;         
 }
 
-static gpgme_pubkey_algo_t
+static const gchar*
 get_algo_attribute (LDAP* ld, LDAPMessage *res, const char *attribute)
 {
-    gpgme_pubkey_algo_t a = 0;
-    gchar **vals;
+	const gchar *a = NULL;
+	gchar **vals;
     
-    vals = get_ldap_values (ld, res, attribute);
-    if (!vals)
-        return 0;
+	vals = get_ldap_values (ld, res, attribute);
+	if (!vals)
+		return 0;
+    
+	if (vals[0]) {
+		if (g_ascii_strcasecmp (vals[0], "DH/DSS") == 0 || 
+		    g_ascii_strcasecmp (vals[0], "Elg") == 0 ||
+		    g_ascii_strcasecmp (vals[0], "Elgamal") == 0 ||
+		    g_ascii_strcasecmp (vals[0], "DSS/DH") == 0)
+			a = "Elgamal";
+		if (g_ascii_strcasecmp (vals[0], "RSA") == 0)
+			a = "RSA";
+		if (g_ascii_strcasecmp (vals[0], "DSA") == 0)
+			a = "DSA";     
+	}
     
-    if (vals[0]) {
-        if (g_ascii_strcasecmp (vals[0], "DH/DSS") == 0 || 
-            g_ascii_strcasecmp (vals[0], "Elg") == 0 ||
-            g_ascii_strcasecmp (vals[0], "Elgamal") == 0)
-            a = GPGME_PK_ELG;
-        if (g_ascii_strcasecmp (vals[0], "RSA") == 0)
-            a = GPGME_PK_RSA;
-        if (g_ascii_strcasecmp (vals[0], "DSA") == 0)
-            a = GPGME_PK_DSA;     
-    }
-    
-    g_strfreev (vals);
-    return a;
+	g_strfreev (vals);
+	return a;
 }
 
 /* 
@@ -748,68 +751,93 @@
 };
 
 static void
-add_key (SeahorseLDAPSource *ssrc, gpgme_key_t key)
+add_key (SeahorseLDAPSource *ssrc, SeahorsePgpKey *key)
 {
-    SeahorseObject *prev;
-    SeahorsePgpKey *pkey;
-    GQuark keyid;
-
-    g_return_if_fail (key && key->subkeys && key->subkeys->keyid);
+	SeahorseObject *prev;
+	GQuark keyid;
 
-    keyid = seahorse_pgp_key_get_cannonical_id (key->subkeys->keyid);
-    prev = seahorse_context_get_object (SCTX_APP (), SEAHORSE_SOURCE (ssrc), keyid);
+	keyid = seahorse_pgp_key_get_cannonical_id (seahorse_pgp_key_get_keyid (key));
+	prev = seahorse_context_get_object (SCTX_APP (), SEAHORSE_SOURCE (ssrc), keyid);
     
-    /* TODO: This function needs reworking after we get more key types */
-    if (prev != NULL) {
-        g_return_if_fail (SEAHORSE_IS_PGP_KEY (prev));
-        gpgmex_combine_keys (seahorse_pgp_key_get_public (SEAHORSE_PGP_KEY (prev)), key);
-        return;
-    }
-
-    /* A public key */
-    pkey = seahorse_pgp_key_new (SEAHORSE_SOURCE (ssrc), key, NULL);
-
-    /* Add to context */ 
-    seahorse_context_add_object (SCTX_APP (), SEAHORSE_OBJECT (pkey));
+	if (prev != NULL) {
+		g_return_if_fail (SEAHORSE_IS_PGP_KEY (prev));
+		seahorse_pgp_key_set_uids (SEAHORSE_PGP_KEY (prev), seahorse_pgp_key_get_uids (key));
+		seahorse_pgp_key_set_subkeys (SEAHORSE_PGP_KEY (prev), seahorse_pgp_key_get_subkeys (key));
+		return;
+	}
+
+	/* Add to context */ 
+	seahorse_object_set_source (SEAHORSE_OBJECT (key), SEAHORSE_SOURCE (ssrc));
+	seahorse_context_add_object (SCTX_APP (), SEAHORSE_OBJECT (key));
 }
 
 /* Add a key to the key source from an LDAP entry */
 static void
 parse_key_from_ldap_entry (SeahorseLDAPOperation *lop, LDAPMessage *res)
 {
-    gpgme_pubkey_algo_t algo;
-    long int timestamp;
-    long int expires;
-    gpgme_key_t key;
-    gchar *fpr;
-    gchar *uid;
-    guint flags = 0;
-    int length;
+	const gchar *algo;
+	long int timestamp;
+	long int expires;
+        gchar *fpr, *fingerprint;
+        gchar *uidstr;
+        gboolean revoked;
+        gboolean disabled;
+        int length;
         
-    g_assert (SEAHORSE_IS_LDAP_OPERATION (lop));
-    g_return_if_fail (res && ldap_msgtype (res) == LDAP_RES_SEARCH_ENTRY);  
+        g_assert (SEAHORSE_IS_LDAP_OPERATION (lop));
+        g_return_if_fail (res && ldap_msgtype (res) == LDAP_RES_SEARCH_ENTRY);  
     
-    fpr = get_string_attribute (lop->ldap, res, "pgpcertid");
-    uid = get_string_attribute (lop->ldap, res, "pgpuserid");
-    flags |= (get_boolean_attribute (lop->ldap, res, "pgprevoked") ? GPGMEX_KEY_REVOKED : 0);
-    flags |= (get_boolean_attribute (lop->ldap, res, "pgpdisabled") ? GPGMEX_KEY_DISABLED : 0);
-    timestamp = get_date_attribute (lop->ldap, res, "pgpkeycreatetime");
-    expires = get_date_attribute (lop->ldap, res, "pgpkeyexpiretime");
-    algo = get_algo_attribute (lop->ldap, res, "pgpkeytype");
-    length = get_int_attribute (lop->ldap, res, "pgpkeysize");
-    
-    if (fpr && uid) {
-        key = gpgmex_key_alloc ();
-        gpgmex_key_add_subkey (key, fpr, flags, timestamp, 
-                               expires, length, algo);
-        gpgmex_key_add_uid (key, uid, flags);
+        fpr = get_string_attribute (lop->ldap, res, "pgpcertid");
+        uidstr = get_string_attribute (lop->ldap, res, "pgpuserid");
+        revoked = get_boolean_attribute (lop->ldap, res, "pgprevoked");
+        disabled = get_boolean_attribute (lop->ldap, res, "pgpdisabled");
+        timestamp = get_date_attribute (lop->ldap, res, "pgpkeycreatetime");
+        expires = get_date_attribute (lop->ldap, res, "pgpkeyexpiretime");
+        algo = get_algo_attribute (lop->ldap, res, "pgpkeytype");
+        length = get_int_attribute (lop->ldap, res, "pgpkeysize");
+    
+        if (fpr && uidstr) {
+
+        	SeahorsePgpSubkey *subkey;
+        	SeahorsePgpKey *key;
+        	SeahorsePgpUid *uid;
+                GList *list;
+
+        	/* Build up a subkey */
+        	subkey = seahorse_pgp_subkey_new ();
+        	seahorse_pgp_subkey_set_keyid (subkey, fpr);
+        	fingerprint = seahorse_pgp_subkey_calc_fingerprint (fpr);
+        	seahorse_pgp_subkey_set_fingerprint (subkey, fingerprint);
+        	g_free (fingerprint);
+        	if (revoked)
+        		seahorse_pgp_subkey_set_validity (subkey, SEAHORSE_VALIDITY_REVOKED);
+        	else if (disabled)
+        		seahorse_pgp_subkey_set_validity (subkey, SEAHORSE_VALIDITY_DISABLED);
+        	seahorse_pgp_subkey_set_created (subkey, timestamp);
+        	seahorse_pgp_subkey_set_expires (subkey, expires);
+        	seahorse_pgp_subkey_set_algorithm (subkey, algo);
+        	seahorse_pgp_subkey_set_length (subkey, length);
+        	
+        	/* Build up a uid */
+        	uid = seahorse_pgp_uid_new (uidstr);
+        	if (revoked)
+        		seahorse_pgp_subkey_set_validity (subkey, SEAHORSE_VALIDITY_REVOKED);
+        	
+        	/* Now build them into a key */
+        	key = seahorse_pgp_key_new ();
+        	list = g_list_prepend (NULL, uid);
+        	seahorse_pgp_key_set_uids (key, list);
+        	seahorse_object_list_free (list);
+        	list = g_list_prepend (NULL, subkey);
+        	seahorse_pgp_key_set_subkeys (key, list);
+        	seahorse_object_list_free (list);
         
-        add_key (lop->lsrc, key);
-        gpgmex_key_unref (key);
-    }
+        	add_key (lop->lsrc, key);
+        	g_object_unref (key);
+        }
     
-    g_free (fpr);
-    g_free (uid);
+        g_free (fpr);
+        g_free (uidstr);
 }
 
 /* Got a search result */

Modified: trunk/pgp/seahorse-pgp-commands.c
==============================================================================
--- trunk/pgp/seahorse-pgp-commands.c	(original)
+++ trunk/pgp/seahorse-pgp-commands.c	Tue Dec 16 02:49:26 2008
@@ -23,6 +23,9 @@
 
 #include <glib/gi18n.h>
 
+#include "seahorse-gpgme-dialogs.h"
+#include "seahorse-gpgme-key.h"
+#include "seahorse-gpgme-uid.h"
 #include "seahorse-pgp.h"
 #include "seahorse-pgp-commands.h"
 #include "seahorse-pgp-dialogs.h"
@@ -78,10 +81,10 @@
 	if (key == NULL)
 		return;
 
-	if (G_TYPE_FROM_INSTANCE (key) == SEAHORSE_TYPE_PGP_KEY) {
-		seahorse_pgp_sign_prompt (SEAHORSE_PGP_KEY (key), seahorse_commands_get_window (SEAHORSE_COMMANDS (self)));
-	} else if (G_TYPE_FROM_INSTANCE (key) == SEAHORSE_TYPE_PGP_UID) {
-		seahorse_pgp_sign_prompt_uid (SEAHORSE_PGP_UID (key), seahorse_commands_get_window (SEAHORSE_COMMANDS (self)));
+	if (G_TYPE_FROM_INSTANCE (key) == SEAHORSE_TYPE_GPGME_KEY) {
+		seahorse_gpgme_sign_prompt (SEAHORSE_GPGME_KEY (key), seahorse_commands_get_window (SEAHORSE_COMMANDS (self)));
+	} else if (G_TYPE_FROM_INSTANCE (key) == SEAHORSE_TYPE_GPGME_UID) {
+		seahorse_gpgme_sign_prompt_uid (SEAHORSE_GPGME_UID (key), seahorse_commands_get_window (SEAHORSE_COMMANDS (self)));
 	}
 }
 
@@ -125,10 +128,12 @@
 	g_return_if_fail (SEAHORSE_IS_OBJECT (obj));
 	g_return_if_fail (seahorse_object_get_tag (obj) == SEAHORSE_PGP_TYPE);
 	
-	if (G_TYPE_FROM_INSTANCE (G_OBJECT (obj)) == SEAHORSE_PGP_TYPE_UID)
+	if (G_TYPE_FROM_INSTANCE (G_OBJECT (obj)) == SEAHORSE_TYPE_PGP_UID || 
+	    G_TYPE_FROM_INSTANCE (G_OBJECT (obj)) == SEAHORSE_TYPE_GPGME_UID)
 		obj = seahorse_object_get_parent (obj);
 
-	g_return_if_fail (G_TYPE_FROM_INSTANCE (G_OBJECT (obj)) == SEAHORSE_PGP_TYPE_KEY);
+	g_return_if_fail (G_TYPE_FROM_INSTANCE (G_OBJECT (obj)) == SEAHORSE_TYPE_PGP_KEY || 
+	                  G_TYPE_FROM_INSTANCE (G_OBJECT (obj)) == SEAHORSE_TYPE_GPGME_KEY);
 	seahorse_pgp_key_properties_show (SEAHORSE_PGP_KEY (obj), seahorse_commands_get_window (base));
 }
 
@@ -161,12 +166,12 @@
 	
 	for (l = objects; l; l = g_list_next (l)) {
 		obj = SEAHORSE_OBJECT (l->data);
-		if (G_OBJECT_TYPE (obj) == SEAHORSE_PGP_TYPE_UID) {
+		if (G_OBJECT_TYPE (obj) == SEAHORSE_TYPE_PGP_UID) {
 			if (g_list_find (objects, seahorse_object_get_parent (obj)) == NULL) {
 				to_delete = g_list_prepend (to_delete, obj);
 				++num_identities;
 			}
-		} else if (G_OBJECT_TYPE (obj) == SEAHORSE_PGP_TYPE_KEY) {
+		} else if (G_OBJECT_TYPE (obj) == SEAHORSE_TYPE_PGP_KEY) {
 			to_delete = g_list_prepend (to_delete, obj);
 			++num_keys;
 		}
@@ -231,6 +236,8 @@
 		
 		seahorse_view_register_commands (view, base, SEAHORSE_TYPE_PGP_KEY);
 		seahorse_view_register_commands (view, base, SEAHORSE_TYPE_PGP_UID);
+		seahorse_view_register_commands (view, base, SEAHORSE_TYPE_GPGME_KEY);
+		seahorse_view_register_commands (view, base, SEAHORSE_TYPE_GPGME_UID);
 		seahorse_view_register_ui (view, UI_DEFINITION, self->pv->command_actions);
 	}
 	

Modified: trunk/pgp/seahorse-pgp-dialogs.h
==============================================================================
--- trunk/pgp/seahorse-pgp-dialogs.h	(original)
+++ trunk/pgp/seahorse-pgp-dialogs.h	Tue Dec 16 02:49:26 2008
@@ -27,52 +27,13 @@
 #ifndef __SEAHORSE_PGP_DIALOGS_H__
 #define __SEAHORSE_PGP_DIALOGS_H__
 
-#include <glib.h>
+#include <gtk/gtk.h>
 
 #include "pgp/seahorse-pgp-key.h"
-#include "pgp/seahorse-pgp-photo.h"
-#include "pgp/seahorse-pgp-subkey.h"
-#include "pgp/seahorse-pgp-uid.h"
-
-void            seahorse_pgp_sign_prompt           (SeahorsePgpKey *key,
-                                                    GtkWindow *parent);
-
-void            seahorse_pgp_sign_prompt_uid       (SeahorsePgpUid *uid,
-                                                    GtkWindow *parent);
 
 SeahorsePgpKey* seahorse_signer_get                 (GtkWindow *parent);
 
-void            seahorse_pgp_handle_gpgme_error     (gpgme_error_t err, 
-                                                     const gchar* desc, ...);
-
 void            seahorse_pgp_key_properties_show    (SeahorsePgpKey *pkey,
                                                      GtkWindow *parent);
 
-void            seahorse_pgp_generate_register      (void);
-
-void            seahorse_pgp_generate_show          (SeahorsePGPSource *sksrc,
-                                                     GtkWindow *parent);
-
-void            seahorse_pgp_add_revoker_new        (SeahorsePgpKey *pkey,
-                                                     GtkWindow *parent);
-
-void            seahorse_pgp_expires_new            (SeahorsePgpSubkey *subkey,
-                                                     GtkWindow *parent);
-
-void            seahorse_pgp_add_subkey_new         (SeahorsePgpKey *pkey,
-                                                     GtkWindow *parent);
-
-void            seahorse_pgp_add_uid_new            (SeahorsePgpKey *pkey,
-                                                     GtkWindow *parent);
-
-void            seahorse_pgp_revoke_new             (SeahorsePgpSubkey *subkey,
-                                                     GtkWindow *parent);
-
-gboolean        seahorse_pgp_photo_add              (SeahorsePgpKey *pkey, 
-                                                     GtkWindow *parent,
-                                                     const gchar *path);
-                                         
-gboolean        seahorse_pgp_photo_delete           (SeahorsePgpPhoto *photo,
-                                                     GtkWindow *parent);
-
 #endif /* __SEAHORSE_PGP_DIALOGS_H__ */

Modified: trunk/pgp/seahorse-pgp-key-properties.c
==============================================================================
--- trunk/pgp/seahorse-pgp-key-properties.c	(original)
+++ trunk/pgp/seahorse-pgp-key-properties.c	Tue Dec 16 02:49:26 2008
@@ -36,9 +36,15 @@
 #include "seahorse-object-widget.h"
 #include "seahorse-util.h"
 
+#include "seahorse-gpgme-dialogs.h"
+#include "seahorse-gpgme-key.h"
+#include "seahorse-gpgme-key-op.h"
+#include "seahorse-gpg-op.h"
 #include "seahorse-pgp-dialogs.h"
 #include "seahorse-pgp-key.h"
-#include "seahorse-pgp-key-op.h"
+#include "seahorse-pgp-uid.h"
+#include "seahorse-pgp-signature.h"
+#include "seahorse-pgp-subkey.h"
 
 #include "common/seahorse-bind.h"
 
@@ -198,8 +204,10 @@
 static void
 names_add_clicked (GtkWidget *widget, SeahorseWidget *swidget)
 {
-	seahorse_pgp_add_uid_new (SEAHORSE_PGP_KEY (SEAHORSE_OBJECT_WIDGET (swidget)->object), 
-	                          GTK_WINDOW (glade_xml_get_widget (swidget->xml, swidget->name)));
+	SeahorseObject *obj = SEAHORSE_OBJECT_WIDGET (swidget)->object;
+	g_return_if_fail (SEAHORSE_IS_GPGME_KEY (obj));
+	seahorse_gpgme_add_uid_new (SEAHORSE_GPGME_KEY (obj), 
+	                            GTK_WINDOW (glade_xml_get_widget (swidget->xml, swidget->name)));
 }
 
 static void 
@@ -210,9 +218,10 @@
     
 	uid = names_get_selected_uid (swidget);
 	if (uid) {
-		err = seahorse_pgp_key_op_primary_uid (uid);
+		g_return_if_fail (SEAHORSE_IS_GPGME_UID (uid));
+		err = seahorse_gpgme_key_op_primary_uid (SEAHORSE_GPGME_UID (uid));
 		if (!GPG_IS_OK (err)) 
-			seahorse_pgp_handle_gpgme_error (err, _("Couldn't change primary user ID"));
+			seahorse_gpgme_handle_error (err, _("Couldn't change primary user ID"));
 	}
 }
 
@@ -228,6 +237,7 @@
 	if (uid == NULL)
 		return;
 	
+	g_return_if_fail (SEAHORSE_IS_GPGME_UID (uid));
 	message = g_strdup_printf (_("Are you sure you want to permanently delete the '%s' user ID?"), 
 	                           seahorse_object_get_label (SEAHORSE_OBJECT (uid)));
 	ret = seahorse_util_prompt_delete (message, seahorse_widget_get_toplevel (swidget));
@@ -236,9 +246,9 @@
 	if (ret == FALSE)
 		return;
 	
-	gerr = seahorse_pgp_key_op_del_uid (uid);
+	gerr = seahorse_gpgme_key_op_del_uid (SEAHORSE_GPGME_UID (uid));
 	if (!GPG_IS_OK (gerr))
-		seahorse_pgp_handle_gpgme_error (gerr, _("Couldn't delete user ID"));
+		seahorse_gpgme_handle_error (gerr, _("Couldn't delete user ID"));
 }
 
 static void 
@@ -247,8 +257,11 @@
 	SeahorsePgpUid *uid;
 
 	uid = names_get_selected_uid (swidget);
-	if (uid != NULL)
-		seahorse_pgp_sign_prompt_uid (uid, GTK_WINDOW (glade_xml_get_widget (swidget->xml, swidget->name)));
+	if (uid != NULL) {
+		g_return_if_fail (SEAHORSE_IS_GPGME_UID (uid));
+		seahorse_gpgme_sign_prompt_uid (SEAHORSE_GPGME_UID (uid), 
+		                                GTK_WINDOW (glade_xml_get_widget (swidget->xml, swidget->name)));
+	}
 }
 
 static void 
@@ -279,7 +292,10 @@
 update_names (GtkTreeSelection *selection, SeahorseWidget *swidget)
 {
 	SeahorsePgpUid *uid = names_get_selected_uid (swidget);
-	gint index = uid ? seahorse_pgp_uid_get_gpgme_index (uid) : -1;
+	gint index = -1;
+	
+	if (uid && SEAHORSE_IS_GPGME_UID (uid))
+		index = seahorse_gpgme_uid_get_gpgme_index (SEAHORSE_GPGME_UID (uid));
 
 	sensitive_glade_widget (swidget, "names-primary-button", index > 0);
 	sensitive_glade_widget (swidget, "names-delete-button", index >= 0);
@@ -322,14 +338,12 @@
 names_populate (SeahorseWidget *swidget, GtkTreeStore *store, SeahorsePgpKey *pkey)
 {
 	SeahorseObject *object;
-	gpgme_key_sig_t sig;
-	gpgme_user_id_t userid;
 	GtkTreeIter uiditer, sigiter;
 	GSList *rawids = NULL;
-	int j;
+	SeahorsePgpUid *uid;
 	GList *keys, *l;
 	GList *uids, *u;
-	SeahorsePgpUid *uid;
+	GList *sigs, *s;
 
 	/* Insert all the fun-ness */
 	uids = seahorse_pgp_key_get_uids (pkey);
@@ -337,7 +351,6 @@
 	for (u = uids; u; u = g_list_next (u)) {
 
 		uid = SEAHORSE_PGP_UID (u->data);
-		userid = seahorse_pgp_uid_get_userid (uid);
 
 		gtk_tree_store_append (store, &uiditer, NULL);
 		gtk_tree_store_set (store, &uiditer,  
@@ -348,11 +361,12 @@
         
         
 		/* Build a list of all the keyids */
-		for (j = 1, sig = userid->signatures; sig; sig = sig->next, j++) {
+		sigs = seahorse_pgp_uid_get_signatures (uid);
+		for (s = sigs; s; s = g_list_next (s)) {
 			/* Never show self signatures, they're implied */
-			if (seahorse_pgp_key_has_keyid (pkey, sig->keyid))
+			if (seahorse_pgp_key_has_keyid (pkey, seahorse_pgp_signature_get_keyid (s->data)))
 				continue;
-			rawids = g_slist_prepend (rawids, sig->keyid);
+			rawids = g_slist_prepend (rawids, (gpointer)seahorse_pgp_signature_get_keyid (s->data));
 		}
         
 		/* Pass it to 'DiscoverKeys' for resolution/download */
@@ -477,13 +491,13 @@
                            SeahorseWidget *swidget)
 {       
     gboolean dnd_success = FALSE;
-    SeahorsePgpKey *pkey;
+    SeahorseGpgmeKey *pkey;
     gchar **uri_list;
     gint len = 0;
     gchar *uri;
     
-    pkey = SEAHORSE_PGP_KEY (SEAHORSE_OBJECT_WIDGET (swidget)->object);
-    g_assert (SEAHORSE_IS_PGP_KEY (pkey)); 
+    pkey = SEAHORSE_GPGME_KEY (SEAHORSE_OBJECT_WIDGET (swidget)->object);
+    g_return_if_fail (SEAHORSE_IS_GPGME_KEY (pkey));
     
     /* 
      * This needs to be improved, support should be added for remote images 
@@ -500,9 +514,7 @@
             if (!uri)
                 continue;
                 
-            dnd_success = seahorse_pgp_photo_add (pkey, 
-                                                  GTK_WINDOW (seahorse_widget_get_toplevel (swidget)),
-                                                  uri);
+            dnd_success = seahorse_gpgme_photo_add (pkey, GTK_WINDOW (seahorse_widget_get_toplevel (swidget)), uri);
             g_free (uri);
             
             if (!dnd_success)
@@ -519,24 +531,24 @@
 static void
 owner_photo_add_button_clicked (GtkWidget *widget, SeahorseWidget *swidget)
 {
-    SeahorsePgpKey *pkey;
+	SeahorsePgpKey *pkey;
 
-    pkey = SEAHORSE_PGP_KEY (SEAHORSE_OBJECT_WIDGET (swidget)->object);
-    g_assert (SEAHORSE_IS_PGP_KEY (pkey));
+	pkey = SEAHORSE_PGP_KEY (SEAHORSE_OBJECT_WIDGET (swidget)->object);
+	g_return_if_fail (SEAHORSE_IS_GPGME_KEY (pkey)); 
     
-    if (seahorse_pgp_photo_add (pkey, GTK_WINDOW (seahorse_widget_get_toplevel (swidget)), NULL))
-        g_object_set_data (G_OBJECT (swidget), "current-photoid", NULL);
+	if (seahorse_gpgme_photo_add (SEAHORSE_GPGME_KEY (pkey), GTK_WINDOW (seahorse_widget_get_toplevel (swidget)), NULL))
+		g_object_set_data (G_OBJECT (swidget), "current-photoid", NULL);
 }
  
 static void
 owner_photo_delete_button_clicked (GtkWidget *widget, SeahorseWidget *swidget)
 {
-	SeahorsePgpPhoto *photo;
+	SeahorseGpgmePhoto *photo;
 
 	photo = g_object_get_data (G_OBJECT (swidget), "current-photoid");
-	g_return_if_fail (SEAHORSE_IS_PGP_PHOTO (photo));
+	g_return_if_fail (SEAHORSE_IS_GPGME_PHOTO (photo));
 
-	if (seahorse_pgp_key_op_photo_delete (photo))
+	if (seahorse_gpgme_key_op_photo_delete (photo))
 		g_object_set_data (G_OBJECT (swidget), "current-photoid", NULL);
 }
 
@@ -544,14 +556,14 @@
 owner_photo_primary_button_clicked (GtkWidget *widget, SeahorseWidget *swidget)
 {
 	gpgme_error_t gerr;
-	SeahorsePgpPhoto *photo;
+	SeahorseGpgmePhoto *photo;
 
 	photo = g_object_get_data (G_OBJECT (swidget), "current-photoid");
-	g_return_if_fail (SEAHORSE_IS_PGP_PHOTO (photo));
+	g_return_if_fail (SEAHORSE_IS_GPGME_PHOTO (photo));
         
-	gerr = seahorse_pgp_key_op_photo_primary (photo);
+	gerr = seahorse_gpgme_key_op_photo_primary (photo);
 	if (!GPG_IS_OK (gerr))
-		seahorse_pgp_handle_gpgme_error (gerr, _("Couldn't change primary photo"));
+		seahorse_gpgme_handle_error (gerr, _("Couldn't change primary photo"));
 }
 
 static void
@@ -560,6 +572,7 @@
 	SeahorseUsage etype; 
 	GtkWidget *photo_image;
 	SeahorsePgpPhoto *photo;
+	gboolean is_gpgme;
 	GdkPixbuf *pixbuf;
 	GList *photos;
 
@@ -568,18 +581,19 @@
 	
 	photo = g_object_get_data (G_OBJECT (swidget), "current-photoid");
 	g_return_if_fail (!photo || SEAHORSE_IS_PGP_PHOTO (photo));
+	is_gpgme = (photo && SEAHORSE_IS_GPGME_PHOTO (photo));
 
 	/* Show when adding a photo is possible */
 	show_glade_widget (swidget, "owner-photo-add-button", 
-	                   etype == SEAHORSE_USAGE_PRIVATE_KEY);
+	                   is_gpgme && etype == SEAHORSE_USAGE_PRIVATE_KEY);
 
 	/* Show when we have a photo to set as primary */
 	show_glade_widget (swidget, "owner-photo-primary-button", 
-	                   etype == SEAHORSE_USAGE_PRIVATE_KEY && photo);
+	                   is_gpgme && etype == SEAHORSE_USAGE_PRIVATE_KEY && photo);
 
 	/* Display this when there are any photo ids */
 	show_glade_widget (swidget, "owner-photo-delete-button", 
-	                   etype == SEAHORSE_USAGE_PRIVATE_KEY && photo);
+	                   is_gpgme && etype == SEAHORSE_USAGE_PRIVATE_KEY && photo);
 
 	/* Sensitive when not the first photo id */
 	sensitive_glade_widget (swidget, "owner-photo-previous-button", 
@@ -719,16 +733,19 @@
 	SeahorsePgpUid *uid;
 
 	uid = owner_get_selected_uid (swidget);
-	if (uid != NULL)
-		seahorse_pgp_sign_prompt_uid (uid, GTK_WINDOW (glade_xml_get_widget (swidget->xml, swidget->name)));
+	if (uid != NULL) {
+		g_return_if_fail (SEAHORSE_IS_GPGME_UID (uid));
+		seahorse_gpgme_sign_prompt_uid (SEAHORSE_GPGME_UID (uid), GTK_WINDOW (glade_xml_get_widget (swidget->xml, swidget->name)));
+	}
 }
 
 static void
 owner_passphrase_button_clicked (GtkWidget *widget, SeahorseWidget *swidget)
 {
 	SeahorseObject *object = SEAHORSE_OBJECT_WIDGET (swidget)->object;
-	if (seahorse_object_get_usage (object) == SEAHORSE_USAGE_PRIVATE_KEY)
-		seahorse_pgp_key_op_change_pass (SEAHORSE_PGP_KEY (object));
+	if (seahorse_object_get_usage (object) == SEAHORSE_USAGE_PRIVATE_KEY && 
+	    SEAHORSE_IS_GPGME_KEY (object))
+		seahorse_gpgme_key_op_change_pass (SEAHORSE_GPGME_KEY (object));
 }
 
 static void
@@ -828,22 +845,19 @@
 	if (uids != NULL) {
 		uid = SEAHORSE_PGP_UID (uids->data);
     
-		text = seahorse_pgp_uid_get_name (uid);
+		label = seahorse_pgp_uid_get_name (uid);
 		widget = glade_xml_get_widget (swidget->xml, "owner-name-label");
-		gtk_label_set_text (GTK_LABEL (widget), text ? text : NULL); 
+		gtk_label_set_text (GTK_LABEL (widget), label); 
 		widget = glade_xml_get_widget (swidget->xml, swidget->name);
-		gtk_window_set_title (GTK_WINDOW (widget), text);
-		g_free (text);
+		gtk_window_set_title (GTK_WINDOW (widget), label);
 
-		text = seahorse_pgp_uid_get_email (uid);
+		label = seahorse_pgp_uid_get_email (uid);
 		widget = glade_xml_get_widget (swidget->xml, "owner-email-label");
-		gtk_label_set_text (GTK_LABEL (widget), text ? text : NULL); 
-		g_free (text);	
+		gtk_label_set_text (GTK_LABEL (widget), label); 
 
-		text = seahorse_pgp_uid_get_comment (uid);
+		label = seahorse_pgp_uid_get_comment (uid);
 		widget = glade_xml_get_widget (swidget->xml, "owner-comment-label");
-		gtk_label_set_text (GTK_LABEL (widget), text ? text : NULL); 
-		g_free (text);
+		gtk_label_set_text (GTK_LABEL (widget), label); 
     
 		widget = glade_xml_get_widget (swidget->xml, "owner-keyid-label");
 		if (widget) {
@@ -916,7 +930,7 @@
     G_TYPE_STRING,  /* expires */
     G_TYPE_STRING,  /* status  */
     G_TYPE_STRING,  /* type */
-    G_TYPE_STRING   /* length*/
+    G_TYPE_UINT     /* length*/
 };
 
 /* trust combo box list */
@@ -940,8 +954,9 @@
 static void
 details_add_subkey_button_clicked (GtkButton *button, SeahorseWidget *swidget)
 {
-	SeahorsePgpKey *pkey = SEAHORSE_PGP_KEY (SEAHORSE_OBJECT_WIDGET (swidget)->object);
-	seahorse_pgp_add_subkey_new (pkey, GTK_WINDOW (glade_xml_get_widget (swidget->xml, swidget->name)));
+	SeahorseObject *object = SEAHORSE_OBJECT_WIDGET (swidget)->object;
+	g_return_if_fail (SEAHORSE_IS_GPGME_KEY (object));
+	seahorse_gpgme_add_subkey_new (SEAHORSE_GPGME_KEY (object), GTK_WINDOW (glade_xml_get_widget (swidget->xml, swidget->name)));
 }
 
 static void
@@ -960,6 +975,8 @@
 	if (!subkey)
 		return;
 	
+	g_return_if_fail (SEAHORSE_IS_GPGME_SUBKEY (subkey));
+	
 	index = seahorse_pgp_subkey_get_index (subkey);
 	label = seahorse_object_get_label (SEAHORSE_OBJECT (pkey));
 	message = g_strdup_printf (_("Are you sure you want to permanently delete subkey %d of %s?"), index, label);
@@ -969,17 +986,19 @@
 	if (ret == FALSE)
 		return;
 	
-	err = seahorse_pgp_key_op_del_subkey (subkey);
+	err = seahorse_gpgme_key_op_del_subkey (SEAHORSE_GPGME_SUBKEY (subkey));
 	if (!GPG_IS_OK (err))
-		seahorse_pgp_handle_gpgme_error (err, _("Couldn't delete subkey"));
+		seahorse_gpgme_handle_error (err, _("Couldn't delete subkey"));
 }
 
 static void
 details_revoke_subkey_button_clicked (GtkButton *button, SeahorseWidget *swidget)
 {
 	SeahorsePgpSubkey *subkey = get_selected_subkey (swidget);
-	if (subkey != NULL)
-		seahorse_pgp_revoke_new (subkey, GTK_WINDOW (glade_xml_get_widget (swidget->xml, swidget->name)));
+	if (subkey != NULL) {
+		g_return_if_fail (SEAHORSE_IS_GPGME_SUBKEY (subkey));
+		seahorse_gpgme_revoke_new (SEAHORSE_GPGME_SUBKEY (subkey), GTK_WINDOW (glade_xml_get_widget (swidget->xml, swidget->name)));
+	}
 }
 
 static void
@@ -997,14 +1016,15 @@
 		return;
 	
 	object = SEAHORSE_OBJECT_WIDGET (swidget)->object;
+	g_return_if_fail (SEAHORSE_IS_GPGME_KEY (object));
     	
 	model = gtk_combo_box_get_model (selection);
 	gtk_tree_model_get (model, &iter, TRUST_VALIDITY, &trust, -1);
                                   
 	if (seahorse_pgp_key_get_trust (SEAHORSE_PGP_KEY (object)) != trust) {
-		err = seahorse_pgp_key_op_set_trust (SEAHORSE_PGP_KEY (object), trust);
+		err = seahorse_gpgme_key_op_set_trust (SEAHORSE_GPGME_KEY (object), trust);
 		if (err)
-    			seahorse_pgp_handle_gpgme_error (err, _("Unable to change trust"));
+    			seahorse_gpgme_handle_error (err, _("Unable to change trust"));
 	}
 }
 
@@ -1029,7 +1049,6 @@
 details_export_button_clicked (GtkWidget *widget, SeahorseWidget *swidget)
 {
 	SeahorseObject *object;
-	SeahorsePgpKey *pkey;
 	GtkDialog *dialog;
 	gchar* uri = NULL;
 	GError *err = NULL;
@@ -1042,9 +1061,9 @@
 	gpgme_key_t seckey;
     
 	object = SEAHORSE_OBJECT_WIDGET (swidget)->object;
-	pkey = SEAHORSE_PGP_KEY (object);
+	g_return_if_fail (SEAHORSE_IS_GPGME_KEY (object));
 
-	seckey = seahorse_pgp_key_get_private (pkey);
+	seckey = seahorse_gpgme_key_get_private (SEAHORSE_GPGME_KEY (object));
 	g_return_if_fail (seckey && seckey->subkeys && seckey->subkeys->keyid);
 
 	dialog = seahorse_util_chooser_save_new (_("Export Complete Key"), 
@@ -1059,9 +1078,9 @@
 	/* Export to a data block */
 	gerr = gpgme_data_new (&data);
 	g_return_if_fail (GPG_IS_OK (gerr));
-	ctx = seahorse_pgp_source_new_context ();
+	ctx = seahorse_gpgme_source_new_context ();
 	g_return_if_fail (ctx);
-	gerr = gpgmex_op_export_secret (ctx, seckey->subkeys->keyid, data);
+	gerr = seahorse_gpg_op_export_secret (ctx, seckey->subkeys->keyid, data);
 	gpgme_release (ctx);
 	results = gpgme_data_release_and_get_mem (data, &n_results);
 
@@ -1093,10 +1112,12 @@
 		if (subkeys)
 			subkey = subkeys->data;
 	}
+	
+	g_return_if_fail (SEAHORSE_IS_GPGME_SUBKEY (subkey));
 
 	if (subkey != NULL)
-		seahorse_pgp_expires_new (subkey, GTK_WINDOW (glade_xml_get_widget (swidget->xml, swidget->name)));
-	
+		seahorse_gpgme_expires_new (SEAHORSE_GPGME_SUBKEY (subkey), 
+		                            GTK_WINDOW (glade_xml_get_widget (swidget->xml, swidget->name)));
 }
 
 static void
@@ -1209,15 +1230,14 @@
 {
     SeahorseObject *object;
     SeahorsePgpKey *pkey;
-    gpgme_subkey_t subkey;
-    gpgme_key_t pubkey;
+    SeahorsePgpSubkey *subkey;
     GtkWidget *widget;
     GtkListStore *store;
     GtkTreeModel *model;
     GtkTreeIter iter;
     gchar dbuffer[G_ASCII_DTOSTR_BUF_SIZE];
-    gchar *fp_label, *expiration_date, *created_date;
-    const gchar *label, *status, *length;
+    gchar *fp_label;
+    const gchar *label;
     gint trust;
     GList *subkeys, *l;
     guint keyloc;
@@ -1226,12 +1246,9 @@
     object = SEAHORSE_OBJECT_WIDGET (swidget)->object;
     pkey = SEAHORSE_PGP_KEY (object);
     
-    pubkey = seahorse_pgp_key_get_public (pkey);
-    g_return_if_fail (pubkey);
-    
     subkeys = seahorse_pgp_key_get_subkeys (pkey);
-    g_return_if_fail (subkeys);
-    subkey = seahorse_pgp_subkey_get_subkey (subkeys->data);
+    g_return_if_fail (subkeys && subkeys->data);
+    subkey = SEAHORSE_PGP_SUBKEY (subkeys->data);
     
     keyloc = seahorse_object_get_location (object);
 
@@ -1243,7 +1260,7 @@
 
     widget = glade_xml_get_widget (swidget->xml, "details-fingerprint-label");
     if (widget) {
-        fp_label = seahorse_pgp_key_get_fingerprint (pkey); 
+        fp_label = g_strdup (seahorse_pgp_key_get_fingerprint (pkey)); 
         if (strlen (fp_label) > 24)
             fp_label[24] = '\n';
         gtk_label_set_text (GTK_LABEL (widget), fp_label);
@@ -1258,25 +1275,26 @@
 
     widget = glade_xml_get_widget (swidget->xml, "details-created-label");
     if (widget) {
-        fp_label = seahorse_util_get_display_date_string (subkey->timestamp); 
+        fp_label = seahorse_util_get_display_date_string (seahorse_pgp_subkey_get_created (subkey));
         gtk_label_set_text (GTK_LABEL (widget), fp_label);
         g_free (fp_label);
     }
 
     widget = glade_xml_get_widget (swidget->xml, "details-strength-label");
     if (widget) {
-        g_ascii_dtostr (dbuffer, G_ASCII_DTOSTR_BUF_SIZE, subkey->length);
+        g_ascii_dtostr (dbuffer, G_ASCII_DTOSTR_BUF_SIZE, seahorse_pgp_subkey_get_length (subkey));
         gtk_label_set_text (GTK_LABEL (widget), dbuffer);
     }
 
     widget = glade_xml_get_widget (swidget->xml, "details-expires-label");
     if (widget) {
+        gulong expires = seahorse_pgp_subkey_get_expires (subkey);
         if (seahorse_object_get_location (object) == SEAHORSE_LOCATION_REMOTE)
             fp_label = NULL;
-        else if (subkey->expires == 0)
+        else if (expires == 0)
             fp_label = g_strdup (C_("Expires", "Never"));
         else
-            fp_label = seahorse_util_get_display_date_string (subkey->expires);
+            fp_label = seahorse_util_get_display_date_string (expires);
         gtk_label_set_text (GTK_LABEL (widget), fp_label);
         g_free (fp_label);
     }
@@ -1285,7 +1303,7 @@
     widget = glade_xml_get_widget (swidget->xml, "details-trust-combobox");
     
     if (widget) {
-        gtk_widget_set_sensitive (widget, !pubkey->disabled);
+        gtk_widget_set_sensitive (widget, seahorse_object_get_flags (object) & SEAHORSE_FLAG_DISABLED);
         model = gtk_combo_box_get_model (GTK_COMBO_BOX (widget));
         
         valid = gtk_tree_model_get_iter_first (model, &iter);
@@ -1337,40 +1355,50 @@
                                                      "text", SUBKEY_LENGTH, NULL);
     }
 
-    for (l = subkeys; l; l = g_list_next (l)) {
-
-        subkey = seahorse_pgp_subkey_get_subkey (l->data);
-
-        if (subkey->revoked)
-        	status = _("Revoked");
-        else if (subkey->expired)
-        	status = _("Expired");
-        else
-        	status = _("Good");
-
-        if (subkey->expires == 0)
-            expiration_date = g_strdup (C_("Expires", "Never"));
-        else
-            expiration_date = seahorse_util_get_display_date_string (subkey->expires);
-
-        created_date = seahorse_util_get_display_date_string (subkey->timestamp);
-        
-        length = g_ascii_dtostr(dbuffer, G_ASCII_DTOSTR_BUF_SIZE, subkey->length);
+	for (l = subkeys; l; l = g_list_next (l)) {
+		
+		const gchar *status = NULL;
+		gchar *expiration_date;
+		gchar *created_date;
+		gulong expires;
+		
+		subkey = SEAHORSE_PGP_SUBKEY (l->data);
+		expires = seahorse_pgp_subkey_get_expires (subkey);
+		status = NULL;
+        
+		if (seahorse_pgp_subkey_get_validity (subkey) == SEAHORSE_VALIDITY_REVOKED) {
+			status = _("Revoked");
+		} else if (expires) {
+			GTimeVal timev;
+			g_get_current_time(&timev);
+			if (expires < timev.tv_sec)
+				status = _("Expired");
+		}
+    
+		if (status == NULL)
+			status = _("Good");
 
-        gtk_list_store_append (store, &iter);
-        gtk_list_store_set (store, &iter,  
-                            SUBKEY_OBJECT, l->data,
-                            SUBKEY_ID, seahorse_pgp_subkey_get_keyid (l->data),
-                            SUBKEY_TYPE, seahorse_pgp_subkey_get_algorithm (l->data),
-                            SUBKEY_CREATED, created_date,
-                            SUBKEY_EXPIRES, expiration_date,
-                            SUBKEY_STATUS,  status, 
-                            SUBKEY_LENGTH, length,
-                            -1);
+		if (expires == 0)
+			expiration_date = g_strdup (C_("Expires", "Never"));
+		else
+			expiration_date = seahorse_util_get_display_date_string (expires);
+
+		created_date = seahorse_util_get_display_date_string (seahorse_pgp_subkey_get_created (subkey));
+        
+		gtk_list_store_append (store, &iter);
+		gtk_list_store_set (store, &iter,  
+		                    SUBKEY_OBJECT, l->data,
+		                    SUBKEY_ID, seahorse_pgp_subkey_get_keyid (l->data),
+		                    SUBKEY_TYPE, seahorse_pgp_subkey_get_algorithm (l->data),
+		                    SUBKEY_CREATED, created_date,
+		                    SUBKEY_EXPIRES, expiration_date,
+		                    SUBKEY_STATUS,  status, 
+		                    SUBKEY_LENGTH, seahorse_pgp_subkey_get_length (subkey),
+		                    -1);
         
-        g_free (expiration_date);
-        g_free (created_date);
-    } 
+		g_free (expiration_date);
+		g_free (created_date);
+	} 
 }
 
 /* -----------------------------------------------------------------------------
@@ -1412,14 +1440,15 @@
     gpgme_error_t err;
     
     object = SEAHORSE_OBJECT_WIDGET (swidget)->object;
+    g_return_if_fail (SEAHORSE_IS_GPGME_KEY (object));
     
     trust = gtk_toggle_button_get_active (toggle) ?
             SEAHORSE_VALIDITY_MARGINAL : SEAHORSE_VALIDITY_UNKNOWN;
     
     if (seahorse_pgp_key_get_trust (SEAHORSE_PGP_KEY (object)) != trust) {
-        err = seahorse_pgp_key_op_set_trust (SEAHORSE_PGP_KEY (object), trust);
+        err = seahorse_gpgme_key_op_set_trust (SEAHORSE_GPGME_KEY (object), trust);
         if (err)
-        	seahorse_pgp_handle_gpgme_error (err, _("Unable to change trust"));
+        	seahorse_gpgme_handle_error (err, _("Unable to change trust"));
     }
 }
 
@@ -1469,11 +1498,10 @@
 	SeahorsePgpKey *pkey;
 	GtkTreeIter iter;
 	GtkWidget *widget;
-	gpgme_user_id_t userid;
-	gpgme_key_sig_t sig;
 	gboolean have_sigs = FALSE;
 	GSList *rawids = NULL;
 	GList *keys, *l, *uids;
+	GList *sigs, *s;
 
 	pkey = SEAHORSE_PGP_KEY (SEAHORSE_OBJECT_WIDGET (swidget)->object);
 	widget = glade_xml_get_widget (swidget->xml, "signatures-tree");
@@ -1484,13 +1512,13 @@
 
 	/* Build a list of all the keyids */        
 	for (l = uids; l; l = g_list_next (l)) {
-		userid = seahorse_pgp_uid_get_userid (l->data);
-		for (sig = userid->signatures; sig; sig = sig->next) {
+		sigs = seahorse_pgp_uid_get_signatures (l->data);
+		for (s = sigs; s; s = g_list_next (s)) {
 			/* Never show self signatures, they're implied */
-			if (seahorse_pgp_key_has_keyid (pkey, sig->keyid))
+			if (seahorse_pgp_key_has_keyid (pkey, seahorse_pgp_signature_get_keyid (s->data)))
 				continue;
 			have_sigs = TRUE;
-			rawids = g_slist_prepend (rawids, sig->keyid);
+			rawids = g_slist_prepend (rawids, (gpointer)seahorse_pgp_signature_get_keyid (s->data));
 		}
 	}
     
@@ -1533,14 +1561,10 @@
 static void 
 trust_sign_clicked (GtkWidget *widget, SeahorseWidget *swidget)
 {
-	SeahorsePgpKey *pkey;
-	GList *uids;
-	
-	pkey = SEAHORSE_PGP_KEY (SEAHORSE_OBJECT_WIDGET (swidget)->object);
-	uids = seahorse_pgp_key_get_uids (pkey);
-	g_return_if_fail (uids);
-	
-	seahorse_pgp_sign_prompt (uids->data, GTK_WINDOW (glade_xml_get_widget (swidget->xml, swidget->name)));
+	SeahorseObject *object;
+	object = SEAHORSE_OBJECT_WIDGET (swidget)->object;
+	g_return_if_fail (SEAHORSE_IS_GPGME_KEY (object));
+	seahorse_gpgme_sign_prompt (SEAHORSE_GPGME_KEY (object), GTK_WINDOW (glade_xml_get_widget (swidget->xml, swidget->name)));
 }
 
 static void
@@ -1604,14 +1628,14 @@
 gboolean        
 key_have_signatures (SeahorsePgpKey *pkey, guint types)
 {
-	gpgme_key_t key;
-	gpgme_user_id_t uid;
-	gpgme_key_sig_t sig;
-	
-	key = seahorse_pgp_key_get_public (pkey);
-	for (uid = key->uids; uid; uid = uid->next) {
-		for (sig = uid->signatures; sig; sig = sig->next) {
-			if (seahorse_pgp_uid_signature_get_type (sig) & types)
+	GList *uids, *u;
+	GList *sigs, *s;
+	
+	uids = seahorse_pgp_key_get_uids (pkey);
+	for (u = uids; u; u = g_list_next (u)) {
+		sigs = seahorse_pgp_uid_get_signatures (u->data);
+		for (s = sigs; s; s = g_list_next (s)) {
+			if (seahorse_pgp_signature_get_sigtype (s->data) & types)
 				return TRUE;
 		}
 	}

Modified: trunk/pgp/seahorse-pgp-key.c
==============================================================================
--- trunk/pgp/seahorse-pgp-key.c	(original)
+++ trunk/pgp/seahorse-pgp-key.c	Tue Dec 16 02:49:26 2008
@@ -32,14 +32,12 @@
 #include "common/seahorse-object-list.h"
 
 #include "pgp/seahorse-pgp.h"
-#include "pgp/seahorse-gpgmex.h"
 #include "pgp/seahorse-pgp-key.h"
-#include "pgp/seahorse-pgp-key-op.h"
+#include "pgp/seahorse-pgp-uid.h"
+#include "pgp/seahorse-pgp-subkey.h"
 
 enum {
 	PROP_0,
-	PROP_PUBKEY,
-	PROP_SECKEY,
 	PROP_PHOTOS,
 	PROP_SUBKEYS,
 	PROP_UIDS,
@@ -57,393 +55,144 @@
 G_DEFINE_TYPE (SeahorsePgpKey, seahorse_pgp_key, SEAHORSE_TYPE_OBJECT);
 
 struct _SeahorsePgpKeyPrivate {
-	gpgme_key_t pubkey;   		/* The public key */
-	gpgme_key_t seckey;      	/* The secret key */
-	gboolean has_secret;		/* Whether we have a secret key or not */
-
-	int list_mode;                  /* What to load our public key as */
-	
 	GList *uids;			/* All the UID objects */
 	GList *subkeys;                 /* All the Subkey objects */
-	
 	GList *photos;                  /* List of photos */
-	gboolean photos_loaded;		/* Photos were loaded */
 };
 
 /* -----------------------------------------------------------------------------
  * INTERNAL HELPERS
  */
 
-static gboolean 
-load_gpgme_key (GQuark id, int mode, int secret, gpgme_key_t *key)
-{
-	GError *err = NULL;
-	gpgme_ctx_t ctx;
-	gpgme_error_t gerr;
-	
-	ctx = seahorse_pgp_source_new_context ();
-	gpgme_set_keylist_mode (ctx, mode);
-	gerr = gpgme_op_keylist_start (ctx, seahorse_pgp_key_get_rawid (id), secret);
-	if (GPG_IS_OK (gerr)) {
-		gerr = gpgme_op_keylist_next (ctx, key);
-		gpgme_op_keylist_end (ctx);
-	}
-
-	gpgme_release (ctx);
-	
-	if (!GPG_IS_OK (gerr)) {
-		seahorse_gpgme_to_error (gerr, &err);
-		g_message ("couldn't load PGP key: %s", err->message);
-		return FALSE;
-	}
-	
-	return TRUE;
-}
-
-static void
-load_key_public (SeahorsePgpKey *self, int list_mode)
-{
-	gpgme_key_t key = NULL;
-	gboolean ret;
-	GQuark id;
-	
-	list_mode |= self->pv->list_mode;
-	
-	id = seahorse_object_get_id (SEAHORSE_OBJECT (self));
-	g_return_if_fail (id);
-	
-	ret = load_gpgme_key (id, list_mode, FALSE, &key);
-	if (ret) {
-		self->pv->list_mode = list_mode;
-		seahorse_pgp_key_set_public (self, key);
-		gpgmex_key_unref (key);
-	}
-}
-
-static gboolean
-require_key_public (SeahorsePgpKey *self, int list_mode)
+static const gchar* 
+calc_short_name (SeahorsePgpKey *self)
 {
-	if (!self->pv->pubkey || (self->pv->list_mode & list_mode) != list_mode)
-		load_key_public (self, list_mode);
-	return self->pv->pubkey && (self->pv->list_mode & list_mode) == list_mode;
+	GList *uids = seahorse_pgp_key_get_uids (self);
+	return uids ? seahorse_pgp_uid_get_name (uids->data) : NULL;
 }
 
-static void
-load_key_private (SeahorsePgpKey *self)
+static gchar* 
+calc_name (SeahorsePgpKey *self)
 {
-	gpgme_key_t key = NULL;
-	gboolean ret;
-	GQuark id;
-	
-	if (!self->pv->has_secret)
-		return;
-	
-	id = seahorse_object_get_id (SEAHORSE_OBJECT (self));
-	g_return_if_fail (id);
-	
-	ret = load_gpgme_key (id, GPGME_KEYLIST_MODE_LOCAL, TRUE, &key);
-	if (ret) {
-		seahorse_pgp_key_set_private (self, key);
-		gpgmex_key_unref (key);
-	}
+	GList *uids = seahorse_pgp_key_get_uids (self);
+	return uids ? seahorse_pgp_uid_calc_label (seahorse_pgp_uid_get_name (uids->data),
+	                                           seahorse_pgp_uid_get_email (uids->data),
+	                                           seahorse_pgp_uid_get_comment (uids->data)) : "";
 }
 
-static gboolean
-require_key_private (SeahorsePgpKey *self)
+static gchar* 
+calc_markup (SeahorsePgpKey *self, guint flags)
 {
-	if (!self->pv->seckey)
-		load_key_private (self);
-	return self->pv->seckey != NULL;
+	GList *uids = seahorse_pgp_key_get_uids (self);
+	return uids ? seahorse_pgp_uid_calc_markup (seahorse_pgp_uid_get_name (uids->data),
+	                                            seahorse_pgp_uid_get_email (uids->data),
+	                                            seahorse_pgp_uid_get_comment (uids->data), flags) : "";
 }
 
-static gboolean
-require_key_uids (SeahorsePgpKey *self)
-{
-	return require_key_public (self, GPGME_KEYLIST_MODE_LOCAL);
-}
+/* -----------------------------------------------------------------------------
+ * OBJECT 
+ */
 
-static gboolean
-require_key_subkeys (SeahorsePgpKey *self)
+static GList*
+_seahorse_pgp_key_get_uids (SeahorsePgpKey *self)
 {
-	return require_key_public (self, GPGME_KEYLIST_MODE_LOCAL);
+	g_return_val_if_fail (SEAHORSE_IS_PGP_KEY (self), NULL);
+	return self->pv->uids;
 }
 
 static void
-load_key_photos (SeahorsePgpKey *self)
-{
-	gpgme_error_t gerr;
-	gerr = seahorse_pgp_key_op_photos_load (self);
-	if (!GPG_IS_OK (gerr)) 
-		g_warning ("couldn't load key photos: %s", gpgme_strerror (gerr));
-	else
-		self->pv->photos_loaded = TRUE;
-}
-
-static gboolean
-require_key_photos (SeahorsePgpKey *self)
-{
-	if (!self->pv->photos_loaded)
-		load_key_photos (self);
-	return self->pv->photos_loaded;
-}
-
-static gchar* 
-calc_short_name (SeahorsePgpKey *self)
+_seahorse_pgp_key_set_uids (SeahorsePgpKey *self, GList *uids)
 {
-	SeahorsePgpUid *uid;
+	GList *l;
 	
-	if (!require_key_uids (self))
-		return NULL;
-
-	uid = self->pv->uids->data;
-	return uid ? seahorse_pgp_uid_get_name (uid) : NULL;
-}
+	g_return_if_fail (SEAHORSE_IS_PGP_KEY (self));
 
-static gchar* 
-calc_name (SeahorsePgpKey *self)
-{
-	SeahorsePgpUid *uid;
+	/* Remove the parent on each old one */
+	for (l = self->pv->uids; l; l = g_list_next (l)) 
+		seahorse_object_set_parent (l->data, NULL);
 
-	if (!require_key_uids (self))
-		return NULL;
+	seahorse_object_list_free (self->pv->uids);
+	self->pv->uids = seahorse_object_list_copy (uids);
 
-	uid = self->pv->uids->data;
-	return uid ? seahorse_pgp_uid_calc_label (seahorse_pgp_uid_get_userid (uid)) : "";
+	/* Set parent and source on each new one, except the first */
+	for (l = self->pv->uids ? g_list_next (self->pv->uids) : NULL;
+	     l; l = g_list_next (l))
+		seahorse_object_set_parent (l->data, SEAHORSE_OBJECT (self));
+	
+	g_object_notify (G_OBJECT (self), "uids");
 }
 
-static gchar* 
-calc_markup (SeahorsePgpKey *self, guint flags)
+static GList*
+_seahorse_pgp_key_get_subkeys (SeahorsePgpKey *self)
 {
-	SeahorsePgpUid *uid;
-
-	if (!require_key_uids (self))
-		return NULL;
-
-	uid = self->pv->uids->data;
-	return uid ? seahorse_pgp_uid_calc_markup (seahorse_pgp_uid_get_userid (uid), flags) : "";
+	g_return_val_if_fail (SEAHORSE_IS_PGP_KEY (self), NULL);
+	return self->pv->subkeys;
 }
 
 static void
-renumber_actual_uids (SeahorsePgpKey *self)
+_seahorse_pgp_key_set_subkeys (SeahorsePgpKey *self, GList *subkeys)
 {
-	GArray *index_map;
-	GList *l;
-	guint index, i;
-	
-	g_assert (SEAHORSE_IS_PGP_KEY (self));
+	GQuark id;
 	
-	/* 
-	 * This function is necessary because the uid stored in a gpgme_user_id_t
-	 * struct is only usable with gpgme functions.  Problems will be caused if 
-	 * that uid is used with functions found in seahorse-pgp-key-op.h.  This 
-	 * function is only to be called with uids from gpgme_user_id_t structs.
-	 */
-	
-	/* First we build a bitmap of where all the photo uid indexes are */
-	index_map = g_array_new (FALSE, TRUE, sizeof (gboolean));
-	for (l = self->pv->photos; l; l = g_list_next (l)) {
-		index = seahorse_pgp_photo_get_index (l->data);
-		if (index >= index_map->len)
-			g_array_set_size (index_map, index + 1);
-		g_array_index (index_map, gboolean, index) = TRUE;
-	}
+	g_return_if_fail (SEAHORSE_IS_PGP_KEY (self));
+	g_return_if_fail (subkeys);
 	
-	/* Now for each UID we add however many photo indexes are below the gpgme index */
-	for (l = self->pv->uids; l; l = g_list_next (l)) {
-		index = seahorse_pgp_uid_get_gpgme_index (l->data);
-		for (i = 0; i < index_map->len && i < index; ++i) {
-			if(g_array_index (index_map, gboolean, index))
-				++index;
-		}
-		seahorse_pgp_uid_set_actual_index (l->data, index);
-	}
+	seahorse_object_list_free (self->pv->subkeys);
+	self->pv->subkeys = seahorse_object_list_copy (subkeys);
 	
-	g_array_free (index_map, TRUE);
-}
-
-static void 
-realize_uids (SeahorsePgpKey *self)
-{
-	gpgme_user_id_t guid;
-	SeahorsePgpUid *uid;
-	GList *list = NULL;
+	id = seahorse_pgp_key_get_cannonical_id (seahorse_pgp_subkey_get_keyid (subkeys->data));
+	g_object_set (self, "id", id, NULL); 
 	
-	if (self->pv->pubkey) {
-
-		for (guid = self->pv->pubkey->uids; guid; guid = guid->next) {
-			uid = seahorse_pgp_uid_new (self->pv->pubkey, guid);
-			list = seahorse_object_list_prepend (list, uid);
-			g_object_unref (uid);
-		}
-		
-		list = g_list_reverse (list);
-	}
-
-	seahorse_pgp_key_set_uids (self, list);
-	seahorse_object_list_free (list);
+	g_object_notify (G_OBJECT (self), "subkeys");
 }
 
-static void 
-realize_subkeys (SeahorsePgpKey *self)
+static GList*
+_seahorse_pgp_key_get_photos (SeahorsePgpKey *self)
 {
-	gpgme_subkey_t gsubkey;
-	SeahorsePgpSubkey *subkey;
-	GList *list = NULL;
-	
-	if (self->pv->pubkey) {
-
-		for (gsubkey = self->pv->pubkey->subkeys; gsubkey; gsubkey = gsubkey->next) {
-			subkey = seahorse_pgp_subkey_new (self->pv->pubkey, gsubkey);
-			list = seahorse_object_list_prepend (list, subkey);
-			g_object_unref (subkey);
-		}
-		
-		list = g_list_reverse (list);
-	}
-
-	seahorse_pgp_key_set_subkeys (self, list);
-	seahorse_object_list_free (list);
+	g_return_val_if_fail (SEAHORSE_IS_PGP_KEY (self), NULL);
+	return self->pv->photos;
 }
 
 static void
-refresh_each_object (SeahorseObject *object, gpointer data)
+_seahorse_pgp_key_set_photos (SeahorsePgpKey *self, GList *photos)
 {
-	seahorse_object_refresh (object);
+	g_return_if_fail (SEAHORSE_IS_PGP_KEY (self));
+	
+	seahorse_object_list_free (self->pv->photos);
+	self->pv->photos = seahorse_object_list_copy (photos);
+	
+	g_object_notify (G_OBJECT (self), "photos");
 }
 
-/* -----------------------------------------------------------------------------
- * OBJECT 
- */
-
 static void
 seahorse_pgp_key_realize (SeahorseObject *obj)
 {
 	SeahorsePgpKey *self = SEAHORSE_PGP_KEY (obj);
-	SeahorseLocation loc;
-	SeahorseUsage usage;
-	const gchar *description, *icon, *identifier;
-	gchar *name, *markup, *nickname;
-	GQuark id;
-	guint flags;
+	const gchar *identifier, *nickname;
+	gchar *markup, *name;
+	GList *subkeys;
 	
-	if (!require_key_public (self, GPGME_KEYLIST_MODE_LOCAL))
-		g_return_if_reached ();
-	
-	g_return_if_fail (self->pv->pubkey);
-	g_return_if_fail (self->pv->pubkey->subkeys);
-	id = seahorse_pgp_key_get_cannonical_id (self->pv->pubkey->subkeys->keyid);
-	g_object_set (self, "id", id, NULL); 
 	
 	SEAHORSE_OBJECT_CLASS (seahorse_pgp_key_parent_class)->realize (obj);
 	
-	/* Update the sub UIDs */
-	realize_uids (self);
-	realize_subkeys (self);
-	
-	/* The key id */
-	g_return_if_fail (self->pv->pubkey->subkeys);
-	identifier = self->pv->pubkey->subkeys->keyid;
-
-	/* The location */
-	loc = seahorse_object_get_location (obj);
-	
-	if (self->pv->pubkey->keylist_mode & GPGME_KEYLIST_MODE_EXTERN && 
-	    loc <= SEAHORSE_LOCATION_REMOTE)
-		loc = SEAHORSE_LOCATION_REMOTE;
-	
-	else if (loc <= SEAHORSE_LOCATION_LOCAL)
-		loc = SEAHORSE_LOCATION_LOCAL;
-
-	/* The type */
-	if (self->pv->seckey) {
-		usage = SEAHORSE_USAGE_PRIVATE_KEY;
-		description = _("Private PGP Key");
-		icon = SEAHORSE_STOCK_SECRET;
-	} else {
-		usage = SEAHORSE_USAGE_PUBLIC_KEY;
-		description = _("Public PGP Key");
-		icon = SEAHORSE_STOCK_KEY;
-	}
-
-	/* The flags */
-	flags = SEAHORSE_FLAG_EXPORTABLE;
+	identifier = "";
+	subkeys = seahorse_pgp_key_get_subkeys (self);
+	if (subkeys)
+		identifier = seahorse_pgp_subkey_get_keyid (subkeys->data);
 
-	if (!self->pv->pubkey->disabled && !self->pv->pubkey->expired && 
-	    !self->pv->pubkey->revoked && !self->pv->pubkey->invalid) {
-		if (seahorse_pgp_key_get_validity (self) >= SEAHORSE_VALIDITY_MARGINAL)
-			flags |= SEAHORSE_FLAG_IS_VALID;
-		if (self->pv->pubkey->can_encrypt)
-			flags |= SEAHORSE_FLAG_CAN_ENCRYPT;
-		if (self->pv->seckey && self->pv->pubkey->can_sign)
-			flags |= SEAHORSE_FLAG_CAN_SIGN;
-	}
-
-	if (self->pv->pubkey->expired)
-		flags |= SEAHORSE_FLAG_EXPIRED;
-
-	if (self->pv->pubkey->revoked)
-		flags |= SEAHORSE_FLAG_REVOKED;
-
-	if (self->pv->pubkey->disabled)
-		flags |= SEAHORSE_FLAG_DISABLED;
-
-	if (seahorse_pgp_key_get_trust (self) >= SEAHORSE_VALIDITY_MARGINAL && 
-	    !self->pv->pubkey->revoked && !self->pv->pubkey->disabled && 
-	    !self->pv->pubkey->expired)
-		flags |= SEAHORSE_FLAG_TRUSTED;
-		
 	name = calc_name (self);
-	markup = calc_markup (self, flags);
+	markup = calc_markup (self, seahorse_object_get_flags (obj));
 	nickname = calc_short_name (self);
 		
 	g_object_set (obj,
 		      "label", name,
-		      "icon", icon,
-		      "usage", usage,
 		      "markup", markup,
 		      "nickname", nickname,
 		      "identifier", identifier,
-		      "description", description,
-		      "location", loc,
-		      "flags", flags,
 		      NULL);
 		
-	g_free (name);
 	g_free (markup);
-	g_free (nickname);
-}
-
-static void
-seahorse_pgp_key_refresh (SeahorseObject *obj)
-{
-	SeahorsePgpKey *self = SEAHORSE_PGP_KEY (obj);
-	
-	if (self->pv->pubkey)
-		load_key_public (self, self->pv->list_mode);
-	if (self->pv->seckey)
-		load_key_private (self);
-	if (self->pv->photos_loaded)
-		load_key_photos (self);
-
-	SEAHORSE_OBJECT_CLASS (seahorse_pgp_key_parent_class)->refresh (obj);
-}
-
-static SeahorseOperation*
-seahorse_pgp_key_delete (SeahorseObject *obj)
-{
-	SeahorsePgpKey *self = SEAHORSE_PGP_KEY (obj);
-	gpgme_error_t gerr;
-	GError *err = NULL;
-	
-	if (self->pv->seckey)
-		gerr = seahorse_pgp_key_op_delete_pair (self);
-	else
-		gerr = seahorse_pgp_key_op_delete (self);
-	
-	if (!GPG_IS_OK (gerr))
-		seahorse_gpgme_to_error (gerr, &err);
-	
-	return seahorse_operation_new_complete (err);
+	g_free (name);
 }
 
 static void
@@ -459,33 +208,21 @@
 	SeahorsePgpKey *self = SEAHORSE_PGP_KEY (object);
     
 	switch (prop_id) {
-	case PROP_PUBKEY:
-		g_value_set_boxed (value, seahorse_pgp_key_get_public (self));
-		break;
-	case PROP_SECKEY:
-		g_value_set_boxed (value, seahorse_pgp_key_get_private (self));
-		break;
 	case PROP_PHOTOS:
 		g_value_set_boxed (value, seahorse_pgp_key_get_photos (self));
 		break;
 	case PROP_SUBKEYS:
-		g_value_set_pointer (value, seahorse_pgp_key_get_subkeys (self));
+		g_value_set_boxed (value, seahorse_pgp_key_get_subkeys (self));
 		break;
 	case PROP_UIDS:
 		g_value_set_boxed (value, seahorse_pgp_key_get_uids (self));
 		break;
 	case PROP_FINGERPRINT:
-		g_value_take_string (value, seahorse_pgp_key_get_fingerprint (self));
-		break;
-	case PROP_VALIDITY:
-		g_value_set_uint (value, seahorse_pgp_key_get_validity (self));
+		g_value_set_string (value, seahorse_pgp_key_get_fingerprint (self));
 		break;
 	case PROP_VALIDITY_STR:
 		g_value_set_string (value, seahorse_pgp_key_get_validity_str (self));
 		break;
-	case PROP_TRUST:
-		g_value_set_uint (value, seahorse_pgp_key_get_trust (self));
-		break;
 	case PROP_TRUST_STR:
 		g_value_set_string (value, seahorse_pgp_key_get_trust_str (self));
 		break;
@@ -501,6 +238,11 @@
 	case PROP_ALGO:
 		g_value_set_string (value, seahorse_pgp_key_get_algo (self));
 		break;
+	case PROP_VALIDITY:
+	case PROP_TRUST:
+		g_warning ("This property %s getter must be overridden in class %s",
+		           pspec->name, G_OBJECT_TYPE_NAME (object));
+		break;
 	}
 }
 
@@ -509,13 +251,16 @@
                                GParamSpec *pspec)
 {
 	SeahorsePgpKey *self = SEAHORSE_PGP_KEY (object);
-
+    
 	switch (prop_id) {
-	case PROP_PUBKEY:
-		seahorse_pgp_key_set_public (self, g_value_get_boxed (value));
+	case PROP_UIDS:
+		seahorse_pgp_key_set_uids (self, g_value_get_boxed (value));
+		break;
+	case PROP_SUBKEYS:
+		seahorse_pgp_key_set_subkeys (self, g_value_get_boxed (value));
 		break;
-	case PROP_SECKEY:
-		seahorse_pgp_key_set_private (self, g_value_get_boxed (value));
+	case PROP_PHOTOS:
+		seahorse_pgp_key_set_photos (self, g_value_get_boxed (value));
 		break;
 	}
 }
@@ -524,6 +269,7 @@
 seahorse_pgp_key_object_dispose (GObject *obj)
 {
 	SeahorsePgpKey *self = SEAHORSE_PGP_KEY (obj);
+
 	GList *l;
 	
 	/* Free all the attached UIDs */
@@ -535,18 +281,11 @@
 	/* Free all the attached Photos */
 	seahorse_object_list_free (self->pv->photos);
 	self->pv->photos = NULL;
-	self->pv->photos_loaded = FALSE;
 	
 	/* Free all the attached Subkeys */
 	seahorse_object_list_free (self->pv->subkeys);
 	self->pv->subkeys = NULL;
 
-	if (self->pv->pubkey)
-		gpgmex_key_unref (self->pv->pubkey);
-	if (self->pv->seckey)
-		gpgmex_key_unref (self->pv->seckey);
-	self->pv->pubkey = self->pv->seckey = NULL;
-
 	G_OBJECT_CLASS (seahorse_pgp_key_parent_class)->dispose (obj);
 }
 
@@ -556,11 +295,9 @@
 	SeahorsePgpKey *self = SEAHORSE_PGP_KEY (obj);
 
 	g_assert (self->pv->uids == NULL);
-	g_assert (self->pv->pubkey == NULL);
-	g_assert (self->pv->seckey == NULL);
 	g_assert (self->pv->photos == NULL);
 	g_assert (self->pv->subkeys == NULL);
-    
+
 	G_OBJECT_CLASS (seahorse_pgp_key_parent_class)->finalize (obj);
 }
 
@@ -578,25 +315,22 @@
 	gobject_class->set_property = seahorse_pgp_key_set_property;
 	gobject_class->get_property = seahorse_pgp_key_get_property;
 	
-	seahorse_class->refresh = seahorse_pgp_key_refresh;
 	seahorse_class->realize = seahorse_pgp_key_realize;
-	seahorse_class->delete = seahorse_pgp_key_delete;
 	
-	g_object_class_install_property (gobject_class, PROP_PUBKEY,
-	        g_param_spec_boxed ("pubkey", "GPGME Public Key", "GPGME Public Key that this object represents",
-	                            SEAHORSE_PGP_BOXED_KEY, G_PARAM_READWRITE));
-
-	g_object_class_install_property (gobject_class, PROP_SECKEY,
-                g_param_spec_boxed ("seckey", "GPGME Secret Key", "GPGME Secret Key that this object represents",
-                                    SEAHORSE_PGP_BOXED_KEY, G_PARAM_READWRITE));
-
+	klass->get_uids = _seahorse_pgp_key_get_uids;
+	klass->set_uids = _seahorse_pgp_key_set_uids;
+	klass->get_subkeys = _seahorse_pgp_key_get_subkeys;
+	klass->set_subkeys = _seahorse_pgp_key_set_subkeys;
+	klass->get_photos = _seahorse_pgp_key_get_photos;
+	klass->set_photos = _seahorse_pgp_key_set_photos;
+	
 	g_object_class_install_property (gobject_class, PROP_PHOTOS,
                 g_param_spec_boxed ("photos", "Key Photos", "Photos for the key",
                                     SEAHORSE_BOXED_OBJECT_LIST, G_PARAM_READWRITE));
 	
 	g_object_class_install_property (gobject_class, PROP_SUBKEYS,
                 g_param_spec_boxed ("subkeys", "PGP subkeys", "PGP subkeys",
-                                    SEAHORSE_BOXED_OBJECT_LIST, G_PARAM_READABLE));
+                                    SEAHORSE_BOXED_OBJECT_LIST, G_PARAM_READWRITE));
 	
 	g_object_class_install_property (gobject_class, PROP_UIDS,
                 g_param_spec_boxed ("uids", "PGP User Ids", "PGP User Ids",
@@ -644,34 +378,26 @@
  * PUBLIC 
  */
 
-SeahorsePgpKey* 
-seahorse_pgp_key_new (SeahorseSource *sksrc, gpgme_key_t pubkey, 
-                      gpgme_key_t seckey)
-{
-	return g_object_new (SEAHORSE_TYPE_PGP_KEY, "source", sksrc,
-	                     "pubkey", pubkey, "seckey", seckey, NULL);
-}
-
 GQuark
 seahorse_pgp_key_get_cannonical_id (const gchar *id)
 {
-    guint len = strlen (id);
-    GQuark keyid;
-    gchar *t;
+	guint len = strlen (id);
+	GQuark keyid;
+	gchar *t;
     
-    if (len < 16) {
-        g_warning ("invalid keyid (less than 16 chars): %s", id);
-        return 0;
-    }
+	if (len < 16) {
+		g_warning ("invalid keyid (less than 16 chars): %s", id);
+		return 0;
+	}
     
-    if (len > 16)
-        id += len - 16;
+	if (len > 16)
+		id += len - 16;
     
-    t = g_strdup_printf ("%s:%s", SEAHORSE_PGP_STR, id);
-    keyid = g_quark_from_string (t);
-    g_free (t);
+	t = g_strdup_printf ("%s:%s", SEAHORSE_PGP_STR, id);
+	keyid = g_quark_from_string (t);
+	g_free (t);
     
-    return keyid;
+	return keyid;
 }
 
 const gchar* 
@@ -686,302 +412,200 @@
 	return rawid ? rawid + 1 : id;
 }
 
-gpgme_key_t
-seahorse_pgp_key_get_public (SeahorsePgpKey *self)
-{
-	g_return_val_if_fail (SEAHORSE_IS_PGP_KEY (self), NULL);
-	if (require_key_public (self, GPGME_KEYLIST_MODE_LOCAL))
-		return self->pv->pubkey;
-	return NULL;
-}
-
-void
-seahorse_pgp_key_set_public (SeahorsePgpKey *self, gpgme_key_t key)
-{
-	GObject *obj;
-	
-	g_return_if_fail (SEAHORSE_IS_PGP_KEY (self));
-	
-	if (self->pv->pubkey)
-		gpgmex_key_unref (self->pv->pubkey);
-	self->pv->pubkey = key;
-	if (self->pv->pubkey) {
-		gpgmex_key_ref (self->pv->pubkey);
-		self->pv->list_mode |= self->pv->pubkey->keylist_mode;
-	}
-	
-	obj = G_OBJECT (self);
-	g_object_freeze_notify (obj);
-	seahorse_pgp_key_realize (SEAHORSE_OBJECT (self));
-	g_object_notify (obj, "fingerprint");
-	g_object_notify (obj, "validity");
-	g_object_notify (obj, "validity-str");
-	g_object_notify (obj, "trust");
-	g_object_notify (obj, "trust-str");
-	g_object_notify (obj, "expires");
-	g_object_notify (obj, "expires-str");
-	g_object_notify (obj, "length");
-	g_object_notify (obj, "algo");
-	g_object_thaw_notify (obj);
-}
-
-gpgme_key_t
-seahorse_pgp_key_get_private (SeahorsePgpKey *self)
-{
-	g_return_val_if_fail (SEAHORSE_IS_PGP_KEY (self), NULL);
-	if (require_key_private (self))
-		return self->pv->seckey;
-	return NULL;	
-}
-
-void
-seahorse_pgp_key_set_private (SeahorsePgpKey *self, gpgme_key_t key)
+SeahorsePgpKey*
+seahorse_pgp_key_new (void)
 {
-	GObject *obj;
-	
-	g_return_if_fail (SEAHORSE_IS_PGP_KEY (self));
-	
-	if (self->pv->seckey)
-		gpgmex_key_unref (self->pv->seckey);
-	self->pv->seckey = key;
-	if (self->pv->seckey)
-		gpgmex_key_ref (self->pv->seckey);
-	
-	obj = G_OBJECT (self);
-	g_object_freeze_notify (obj);
-	seahorse_pgp_key_realize (SEAHORSE_OBJECT (self));
-	g_object_thaw_notify (obj);
+	return g_object_new (SEAHORSE_TYPE_PGP_KEY, NULL);
 }
 
 GList*
 seahorse_pgp_key_get_uids (SeahorsePgpKey *self)
 {
 	g_return_val_if_fail (SEAHORSE_IS_PGP_KEY (self), NULL);
-	if (!require_key_uids (self))
+	if (!SEAHORSE_PGP_KEY_GET_CLASS (self)->get_uids)
 		return NULL;
-	return self->pv->uids;
+	return SEAHORSE_PGP_KEY_GET_CLASS (self)->get_uids (self);
 }
 
 void
 seahorse_pgp_key_set_uids (SeahorsePgpKey *self, GList *uids)
 {
-	SeahorseSource *source;
-	GList *l;
-	
 	g_return_if_fail (SEAHORSE_IS_PGP_KEY (self));
-
-	/* Remove the parent on each old one */
-	for (l = self->pv->uids; l; l = g_list_next (l)) 
-		seahorse_object_set_parent (l->data, NULL);
-
-	seahorse_object_list_free (self->pv->uids);
-	self->pv->uids = seahorse_object_list_copy (uids);
-
-	source = seahorse_object_get_source (SEAHORSE_OBJECT (self));
-	g_return_if_fail (SEAHORSE_IS_SOURCE (source));
-
-	/* Set parent and source on each new one, except the first */
-	for (l = self->pv->uids ? g_list_next (self->pv->uids) : NULL;
-	     l; l = g_list_next (l)) {
-		g_object_set (l->data, "source", source, NULL);
-		seahorse_object_set_parent (l->data, SEAHORSE_OBJECT (self));
-	}
-	
-	renumber_actual_uids (self);
-	g_object_notify (G_OBJECT (self), "uids");
+	g_return_if_fail (SEAHORSE_PGP_KEY_GET_CLASS (self)->set_uids);
+	SEAHORSE_PGP_KEY_GET_CLASS (self)->set_uids (self, uids);
 }
 
 GList*
 seahorse_pgp_key_get_subkeys (SeahorsePgpKey *self)
 {
 	g_return_val_if_fail (SEAHORSE_IS_PGP_KEY (self), NULL);
-	if (!require_key_subkeys (self))
+	if (!SEAHORSE_PGP_KEY_GET_CLASS (self)->get_subkeys)
 		return NULL;
-	return self->pv->subkeys;
+	return SEAHORSE_PGP_KEY_GET_CLASS (self)->get_subkeys (self);
 }
 
 void
 seahorse_pgp_key_set_subkeys (SeahorsePgpKey *self, GList *subkeys)
 {
 	g_return_if_fail (SEAHORSE_IS_PGP_KEY (self));
-	
-	seahorse_object_list_free (self->pv->subkeys);
-	self->pv->subkeys = seahorse_object_list_copy (subkeys);
-	
-	g_object_notify (G_OBJECT (self), "subkeys");
+	g_return_if_fail (SEAHORSE_PGP_KEY_GET_CLASS (self)->set_subkeys);
+	SEAHORSE_PGP_KEY_GET_CLASS (self)->set_subkeys (self, subkeys);
 }
 
 GList*
 seahorse_pgp_key_get_photos (SeahorsePgpKey *self)
 {
 	g_return_val_if_fail (SEAHORSE_IS_PGP_KEY (self), NULL);
-	if (!require_key_photos (self))
+	if (!SEAHORSE_PGP_KEY_GET_CLASS (self)->get_photos)
 		return NULL;
-	return self->pv->photos;
+	return SEAHORSE_PGP_KEY_GET_CLASS (self)->get_photos (self);
 }
 
 void
 seahorse_pgp_key_set_photos (SeahorsePgpKey *self, GList *photos)
 {
 	g_return_if_fail (SEAHORSE_IS_PGP_KEY (self));
-	
-	seahorse_object_list_free (self->pv->photos);
-	self->pv->photos = seahorse_object_list_copy (photos);
-	self->pv->photos_loaded = TRUE;
-	
-	renumber_actual_uids (self);
-	g_object_notify (G_OBJECT (self), "photos");
+	g_return_if_fail (SEAHORSE_PGP_KEY_GET_CLASS (self)->set_photos);
+	SEAHORSE_PGP_KEY_GET_CLASS (self)->set_photos (self, photos);
 }
 
-gchar*
+const gchar*
 seahorse_pgp_key_get_fingerprint (SeahorsePgpKey *self)
 {
-	const gchar *raw;
-	GString *string;
-	guint index, len;
-	gchar *fpr;
+	GList *subkeys;
 	    
 	g_return_val_if_fail (SEAHORSE_IS_PGP_KEY (self), NULL);
-	if (!require_key_public (self, GPGME_KEYLIST_MODE_LOCAL))
-		return NULL;
-	
-	g_return_val_if_fail (self->pv->pubkey && self->pv->pubkey->subkeys, NULL);
 
-	raw = self->pv->pubkey->subkeys->fpr;
-	g_return_val_if_fail (raw != NULL, NULL);
-
-	string = g_string_new ("");
-	len = strlen (raw);
-	    
-	for (index = 0; index < len; index++) {
-		if (index > 0 && index % 4 == 0)
-			g_string_append (string, " ");
-		g_string_append_c (string, raw[index]);
-	}
-	    
-	fpr = string->str;
-	g_string_free (string, FALSE);
-	    
-	return fpr;
+	subkeys = seahorse_pgp_key_get_subkeys (self);
+	if (!subkeys)
+		return "";
+	
+	return seahorse_pgp_subkey_get_fingerprint (subkeys->data);
 }
 
 SeahorseValidity
 seahorse_pgp_key_get_validity (SeahorsePgpKey *self)
 {
-	g_return_val_if_fail (SEAHORSE_IS_PGP_KEY (self), SEAHORSE_VALIDITY_UNKNOWN);
-	if (!require_key_public (self, GPGME_KEYLIST_MODE_LOCAL))
-		return SEAHORSE_VALIDITY_UNKNOWN;
-	
-	g_return_val_if_fail (self->pv->pubkey, SEAHORSE_VALIDITY_UNKNOWN);
-	g_return_val_if_fail (self->pv->uids, SEAHORSE_VALIDITY_UNKNOWN);
-
-	if (self->pv->pubkey->revoked)
-		return SEAHORSE_VALIDITY_REVOKED;
-	if (self->pv->pubkey->disabled)
-		return SEAHORSE_VALIDITY_DISABLED;
-	return seahorse_pgp_uid_get_validity (self->pv->uids->data);
+	guint validity = SEAHORSE_VALIDITY_UNKNOWN;
+	g_object_get (self, "validity", &validity, NULL);
+	return validity;
 }
 
 const gchar*
 seahorse_pgp_key_get_validity_str (SeahorsePgpKey *self)
 {
-	SeahorseValidity validity = seahorse_pgp_key_get_validity (self);
-	return seahorse_validity_get_string (validity);
+	return seahorse_validity_get_string (seahorse_pgp_key_get_validity (self));
 }
 
 gulong
 seahorse_pgp_key_get_expires (SeahorsePgpKey *self)
 {
+	GList *subkeys;
+	    
 	g_return_val_if_fail (SEAHORSE_IS_PGP_KEY (self), 0);
-	if (!require_key_public (self, GPGME_KEYLIST_MODE_LOCAL))
+
+	subkeys = seahorse_pgp_key_get_subkeys (self);
+	if (!subkeys)
 		return 0;
-	g_return_val_if_fail (self->pv->pubkey->subkeys, 0);
-	return self->pv->pubkey->subkeys->expires;
+	
+	return seahorse_pgp_subkey_get_expires (subkeys->data);
 }
 
 gchar*
 seahorse_pgp_key_get_expires_str (SeahorsePgpKey *self)
 {
-	g_return_val_if_fail (SEAHORSE_IS_PGP_KEY (self), SEAHORSE_VALIDITY_UNKNOWN);
-	if (!require_key_public (self, GPGME_KEYLIST_MODE_LOCAL))
+	GTimeVal timeval;
+	gulong expires;
+	
+	g_return_val_if_fail (SEAHORSE_IS_PGP_KEY (self), NULL);
+	
+	expires = seahorse_pgp_key_get_expires (self);
+	if (expires == 0)
 		return g_strdup ("");
 	
-	if (self->pv->pubkey->expired) {
+	g_get_current_time (&timeval);
+	if (timeval.tv_sec > expires)
 		return g_strdup (_("Expired"));
-	} else {
-		g_return_val_if_fail (self->pv->pubkey->subkeys, NULL);
-		if (self->pv->pubkey->subkeys->expires == 0)
-			return g_strdup ("");
-		else 
-			return seahorse_util_get_date_string (self->pv->pubkey->subkeys->expires);
-	}
+	
+	return seahorse_util_get_date_string (expires);
 }
 
 SeahorseValidity
 seahorse_pgp_key_get_trust (SeahorsePgpKey *self)
 {
-	g_return_val_if_fail (SEAHORSE_IS_PGP_KEY (self), SEAHORSE_VALIDITY_UNKNOWN);
-	if (!require_key_public (self, GPGME_KEYLIST_MODE_LOCAL))
-		return SEAHORSE_VALIDITY_UNKNOWN;
-	
-	return gpgmex_validity_to_seahorse (self->pv->pubkey->owner_trust);
+	guint trust = SEAHORSE_VALIDITY_UNKNOWN;
+	g_object_get (self, "trust", &trust, NULL);
+	return trust;
 }
 
 const gchar*
 seahorse_pgp_key_get_trust_str (SeahorsePgpKey *self)
 {
-	SeahorseValidity trust = seahorse_pgp_key_get_trust (self);
-	return seahorse_validity_get_string (trust);
+	return seahorse_validity_get_string (seahorse_pgp_key_get_trust (self));
 }
 
 guint
 seahorse_pgp_key_get_length (SeahorsePgpKey *self)
 {
+	GList *subkeys;
+	    
 	g_return_val_if_fail (SEAHORSE_IS_PGP_KEY (self), 0);
-	if (!require_key_public (self, GPGME_KEYLIST_MODE_LOCAL))
+
+	subkeys = seahorse_pgp_key_get_subkeys (self);
+	if (!subkeys)
 		return 0;
 	
-	g_return_val_if_fail (self->pv->pubkey->subkeys, 0);
-	return self->pv->pubkey->subkeys->length;
+	return seahorse_pgp_subkey_get_length (subkeys->data);
 }
 
 const gchar*
 seahorse_pgp_key_get_algo (SeahorsePgpKey *self)
 {
-	g_return_val_if_fail (SEAHORSE_IS_PGP_KEY (self), NULL);
-	if (!require_key_subkeys (self))
-		return "";
-	g_return_val_if_fail (self->pv->subkeys, NULL);
-	return seahorse_pgp_subkey_get_algorithm (self->pv->subkeys->data);
+	GList *subkeys;
+	    
+	g_return_val_if_fail (SEAHORSE_IS_PGP_KEY (self), 0);
+
+	subkeys = seahorse_pgp_key_get_subkeys (self);
+	if (!subkeys)
+		return 0;
+	
+	return seahorse_pgp_subkey_get_algorithm (subkeys->data);
 }
 
 const gchar*
 seahorse_pgp_key_get_keyid (SeahorsePgpKey *self)
 {
-	g_return_val_if_fail (SEAHORSE_IS_PGP_KEY (self), NULL);
-	g_return_val_if_fail (self->pv->pubkey, NULL);
-	g_return_val_if_fail (self->pv->pubkey->subkeys, NULL);
-	g_return_val_if_fail (self->pv->pubkey->subkeys->keyid, NULL);
-	return self->pv->pubkey->subkeys->keyid;
+	GList *subkeys;
+	    
+	g_return_val_if_fail (SEAHORSE_IS_PGP_KEY (self), 0);
+
+	subkeys = seahorse_pgp_key_get_subkeys (self);
+	if (!subkeys)
+		return 0;
+	
+	return seahorse_pgp_subkey_get_keyid (subkeys->data);
 }
 
 gboolean
 seahorse_pgp_key_has_keyid (SeahorsePgpKey *self, const gchar *match)
 {
-	gpgme_subkey_t subkey;
+	GList *subkeys, *l;
+	SeahorsePgpSubkey *subkey;
 	const gchar *keyid;
 	guint n_match, n_keyid;
 	
 	g_return_val_if_fail (SEAHORSE_IS_PGP_KEY (self), FALSE);
 	g_return_val_if_fail (match, FALSE);
-	g_return_val_if_fail (self->pv->pubkey, FALSE);
-	g_return_val_if_fail (self->pv->pubkey->subkeys, FALSE);
+
+	subkeys = seahorse_pgp_key_get_subkeys (self);
+	if (!subkeys)
+		return FALSE;
 	
 	n_match = strlen (match);
 	
-	for (subkey = self->pv->pubkey->subkeys; subkey; subkey = subkey->next) {
-		g_return_val_if_fail (subkey->keyid, FALSE);
-		keyid = subkey->keyid;
+	for (l = subkeys; l && (subkey = SEAHORSE_PGP_SUBKEY (l->data)); l = g_list_next (l)) {
+		keyid = seahorse_pgp_subkey_get_keyid (subkey);
+		g_return_val_if_fail (keyid, FALSE);
 		n_keyid = strlen (keyid);
 		if (n_match <= n_keyid) {
 			keyid += (n_keyid - n_match);
@@ -993,16 +617,3 @@
 	return FALSE;
 }
 
-void
-seahorse_pgp_key_refresh_matching (gpgme_key_t key)
-{
-	SeahorseObjectPredicate pred;
-	
-	g_return_if_fail (key->subkeys->keyid);
-	
-	memset (&pred, 0, sizeof (pred));
-	pred.type = SEAHORSE_TYPE_PGP_KEY;
-	pred.id = seahorse_pgp_key_get_cannonical_id (key->subkeys->keyid);
-	
-	seahorse_context_for_objects_full (NULL, &pred, refresh_each_object, NULL);
-}

Modified: trunk/pgp/seahorse-pgp-key.h
==============================================================================
--- trunk/pgp/seahorse-pgp-key.h	(original)
+++ trunk/pgp/seahorse-pgp-key.h	Tue Dec 16 02:49:26 2008
@@ -24,14 +24,10 @@
 
 #include <glib-object.h>
 
-#include <gpgme.h>
+#include "pgp/seahorse-pgp-module.h"
 
 #include "seahorse-object.h"
-
-#include "pgp/seahorse-gpgmex.h"
-#include "pgp/seahorse-pgp-module.h"
-#include "pgp/seahorse-pgp-source.h"
-#include "pgp/seahorse-pgp-uid.h"
+#include "seahorse-validity.h"
 
 enum {
     SKEY_PGPSIG_TRUSTED = 0x0001,
@@ -39,10 +35,6 @@
 };
 
 #define SEAHORSE_TYPE_PGP_KEY            (seahorse_pgp_key_get_type ())
-
-/* For vala's sake */
-#define SEAHORSE_PGP_TYPE_KEY            SEAHORSE_TYPE_PGP_KEY
-
 #define SEAHORSE_PGP_KEY(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), SEAHORSE_TYPE_PGP_KEY, SeahorsePgpKey))
 #define SEAHORSE_PGP_KEY_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), SEAHORSE_TYPE_PGP_KEY, SeahorsePgpKeyClass))
 #define SEAHORSE_IS_PGP_KEY(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SEAHORSE_TYPE_PGP_KEY))
@@ -60,24 +52,22 @@
 };
 
 struct _SeahorsePgpKeyClass {
-	SeahorseObjectClass         parent_class;
+	SeahorseObjectClass parent_class;
+	
+	/* virtual methods */
+	GList* (*get_uids) (SeahorsePgpKey *self);
+	void   (*set_uids) (SeahorsePgpKey *self, GList *uids);
+	
+	GList* (*get_subkeys) (SeahorsePgpKey *self);
+	void   (*set_subkeys) (SeahorsePgpKey *self, GList *uids);
+	
+	GList* (*get_photos) (SeahorsePgpKey *self);
+	void   (*set_photos) (SeahorsePgpKey *self, GList *uids);
 };
 
-SeahorsePgpKey*   seahorse_pgp_key_new                  (SeahorseSource *sksrc,
-                                                         gpgme_key_t pubkey,
-                                                         gpgme_key_t seckey);
-
 GType             seahorse_pgp_key_get_type             (void);
 
-gpgme_key_t       seahorse_pgp_key_get_public           (SeahorsePgpKey *self);
-
-void              seahorse_pgp_key_set_public           (SeahorsePgpKey *self,
-                                                         gpgme_key_t key);
-
-gpgme_key_t       seahorse_pgp_key_get_private          (SeahorsePgpKey *self);
-
-void              seahorse_pgp_key_set_private          (SeahorsePgpKey *self,
-                                                         gpgme_key_t key);
+SeahorsePgpKey*   seahorse_pgp_key_new                  (void);
 
 GList*            seahorse_pgp_key_get_subkeys          (SeahorsePgpKey *self);
 
@@ -94,7 +84,7 @@
 void              seahorse_pgp_key_set_photos           (SeahorsePgpKey *self,
                                                          GList *subkeys);
 
-gchar*            seahorse_pgp_key_get_fingerprint      (SeahorsePgpKey *self);
+const gchar*      seahorse_pgp_key_get_fingerprint      (SeahorsePgpKey *self);
 
 SeahorseValidity  seahorse_pgp_key_get_validity         (SeahorsePgpKey *self);
 
@@ -121,6 +111,4 @@
 gboolean          seahorse_pgp_key_has_keyid            (SeahorsePgpKey *self, 
                                                          const gchar *keyid);
 
-void              seahorse_pgp_key_refresh_matching     (gpgme_key_t key);
-
 #endif /* __SEAHORSE_KEY_H__ */

Modified: trunk/pgp/seahorse-pgp-module.c
==============================================================================
--- trunk/pgp/seahorse-pgp-module.c	(original)
+++ trunk/pgp/seahorse-pgp-module.c	Tue Dec 16 02:49:26 2008
@@ -23,9 +23,9 @@
 
 #include "seahorse-pgp-module.h"
 
+#include "seahorse-gpgme-source.h"
+#include "seahorse-gpgme-dialogs.h"
 #include "seahorse-pgp-commands.h"
-#include "seahorse-pgp-source.h"
-#include "seahorse-pgp-dialogs.h"
 
 #ifdef WITH_LDAP
 #include "seahorse-ldap-source.h"
@@ -42,10 +42,10 @@
 	SeahorseSource *source;
 
 	/* Always have a default pgp source added */
-	source = g_object_new (SEAHORSE_TYPE_PGP_SOURCE, NULL);
+	source = g_object_new (SEAHORSE_TYPE_GPGME_SOURCE, NULL);
 	seahorse_context_take_source (NULL, source);
 
-	g_type_class_unref (g_type_class_ref (SEAHORSE_TYPE_PGP_SOURCE));
+	g_type_class_unref (g_type_class_ref (SEAHORSE_TYPE_GPGME_SOURCE));
 	g_type_class_unref (g_type_class_ref (SEAHORSE_TYPE_PGP_COMMANDS));
 #ifdef WITH_LDAP
 	g_type_class_unref (g_type_class_ref (SEAHORSE_TYPE_LDAP_SOURCE));
@@ -54,5 +54,5 @@
 	g_type_class_unref (g_type_class_ref (SEAHORSE_TYPE_HKP_SOURCE));
 #endif 
 	
-	seahorse_pgp_generate_register ();
+	seahorse_gpgme_generate_register ();
 }

Modified: trunk/pgp/seahorse-pgp-photo.c
==============================================================================
--- trunk/pgp/seahorse-pgp-photo.c	(original)
+++ trunk/pgp/seahorse-pgp-photo.c	Tue Dec 16 02:49:26 2008
@@ -30,17 +30,13 @@
 
 enum {
 	PROP_0,
-	PROP_PUBKEY,
-	PROP_PIXBUF,
-	PROP_INDEX
+	PROP_PIXBUF
 };
 
 G_DEFINE_TYPE (SeahorsePgpPhoto, seahorse_pgp_photo, G_TYPE_OBJECT);
 
 struct _SeahorsePgpPhotoPrivate {
-	gpgme_key_t pubkey;        /* Key that this photo is on */
-	GdkPixbuf *pixbuf;         /* The public key that this photo is part of */
-	guint index;               /* The GPGME index of the photo */
+	GdkPixbuf *pixbuf;         
 };
 
 /* -----------------------------------------------------------------------------
@@ -51,21 +47,6 @@
 seahorse_pgp_photo_init (SeahorsePgpPhoto *self)
 {
 	self->pv = G_TYPE_INSTANCE_GET_PRIVATE (self, SEAHORSE_TYPE_PGP_PHOTO, SeahorsePgpPhotoPrivate);
-	self->pv->index = 0;
-}
-
-static GObject*
-seahorse_pgp_photo_constructor (GType type, guint n_props, GObjectConstructParam *props)
-{
-	GObject *obj = G_OBJECT_CLASS (seahorse_pgp_photo_parent_class)->constructor (type, n_props, props);
-	SeahorsePgpPhoto *self = NULL;
-	
-	if (obj) {
-		self = SEAHORSE_PGP_PHOTO (obj);
-		g_return_val_if_fail (self->pv->pubkey, NULL);
-	}
-	
-	return obj;
 }
 
 static void
@@ -75,15 +56,9 @@
 	SeahorsePgpPhoto *self = SEAHORSE_PGP_PHOTO (object);
 	
 	switch (prop_id) {
-	case PROP_PUBKEY:
-		g_value_set_boxed (value, seahorse_pgp_photo_get_pubkey (self));
-		break;
 	case PROP_PIXBUF:
 		g_value_set_object (value, seahorse_pgp_photo_get_pixbuf (self));
 		break;
-	case PROP_INDEX:
-		g_value_set_uint (value, seahorse_pgp_photo_get_index (self));
-		break;
 	}
 }
 
@@ -94,18 +69,9 @@
 	SeahorsePgpPhoto *self = SEAHORSE_PGP_PHOTO (object);
 
 	switch (prop_id) {
-	case PROP_PUBKEY:
-		g_return_if_fail (!self->pv->pubkey);
-		self->pv->pubkey = g_value_get_boxed (value);
-		if (self->pv->pubkey)
-			gpgmex_key_ref (self->pv->pubkey);
-		break;		
 	case PROP_PIXBUF:
 		seahorse_pgp_photo_set_pixbuf (self, g_value_get_object (value));
 		break;
-	case PROP_INDEX:
-		seahorse_pgp_photo_set_index (self, g_value_get_uint (value));
-		break;
 	}
 }
 
@@ -129,22 +95,13 @@
 	seahorse_pgp_photo_parent_class = g_type_class_peek_parent (klass);
 	g_type_class_add_private (klass, sizeof (SeahorsePgpPhotoPrivate));
     
-	gobject_class->constructor = seahorse_pgp_photo_constructor;
 	gobject_class->finalize = seahorse_pgp_photo_finalize;
 	gobject_class->set_property = seahorse_pgp_photo_set_property;
 	gobject_class->get_property = seahorse_pgp_photo_get_property;
     
-	g_object_class_install_property (gobject_class, PROP_PUBKEY,
-	        g_param_spec_boxed ("pubkey", "Public Key", "GPGME Public Key that this subkey is on",
-	                            SEAHORSE_PGP_BOXED_KEY, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
-
 	g_object_class_install_property (gobject_class, PROP_PIXBUF,
 	        g_param_spec_object ("pixbuf", "Pixbuf", "Photo Pixbuf",
 	                             GDK_TYPE_PIXBUF, G_PARAM_READWRITE));
-
-	g_object_class_install_property (gobject_class, PROP_INDEX,
-	        g_param_spec_uint ("index", "Index", "Index of photo UID",
-	                           0, G_MAXUINT, 0, G_PARAM_READWRITE));
 }
 
 /* -----------------------------------------------------------------------------
@@ -152,20 +109,9 @@
  */
 
 SeahorsePgpPhoto* 
-seahorse_pgp_photo_new (gpgme_key_t pubkey, GdkPixbuf *pixbuf, guint index) 
-{
-	return g_object_new (SEAHORSE_TYPE_PGP_PHOTO,
-	                     "pubkey", pubkey,
-	                     "pixbuf", pixbuf, 
-	                     "index", index, NULL);
-}
-
-gpgme_key_t
-seahorse_pgp_photo_get_pubkey (SeahorsePgpPhoto *self)
+seahorse_pgp_photo_new (GdkPixbuf *pixbuf) 
 {
-	g_return_val_if_fail (SEAHORSE_IS_PGP_PHOTO (self), NULL);
-	g_return_val_if_fail (self->pv->pubkey, NULL);
-	return self->pv->pubkey;
+	return g_object_new (SEAHORSE_TYPE_PGP_PHOTO, "pixbuf", pixbuf, NULL);
 }
 
 GdkPixbuf*
@@ -188,19 +134,3 @@
 	
 	g_object_notify (G_OBJECT (self), "pixbuf");
 }
-
-guint
-seahorse_pgp_photo_get_index (SeahorsePgpPhoto *self)
-{
-	g_return_val_if_fail (SEAHORSE_IS_PGP_PHOTO (self), 0);
-	return self->pv->index;
-}
-
-void
-seahorse_pgp_photo_set_index (SeahorsePgpPhoto *self, guint index)
-{
-	g_return_if_fail (SEAHORSE_IS_PGP_PHOTO (self));
-
-	self->pv->index = index;
-	g_object_notify (G_OBJECT (self), "index");
-}

Modified: trunk/pgp/seahorse-pgp-photo.h
==============================================================================
--- trunk/pgp/seahorse-pgp-photo.h	(original)
+++ trunk/pgp/seahorse-pgp-photo.h	Tue Dec 16 02:49:26 2008
@@ -23,14 +23,9 @@
 #define __SEAHORSE_PGP_PHOTO_H__
 
 #include <glib-object.h>
-
-#include <gpgme.h>
-
-#include "pgp/seahorse-pgp-module.h"
-#include "pgp/seahorse-gpgmex.h"
+#include <gtk/gtk.h>
 
 #define SEAHORSE_TYPE_PGP_PHOTO            (seahorse_pgp_photo_get_type ())
-
 #define SEAHORSE_PGP_PHOTO(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), SEAHORSE_TYPE_PGP_PHOTO, SeahorsePgpPhoto))
 #define SEAHORSE_PGP_PHOTO_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), SEAHORSE_TYPE_PGP_PHOTO, SeahorsePgpPhotoClass))
 #define SEAHORSE_IS_PGP_PHOTO(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SEAHORSE_TYPE_PGP_PHOTO))
@@ -52,20 +47,11 @@
 
 GType               seahorse_pgp_photo_get_type          (void);
 
-SeahorsePgpPhoto*   seahorse_pgp_photo_new               (gpgme_key_t key,
-                                                          GdkPixbuf *pixbuf,
-                                                          guint index);
-
-gpgme_key_t         seahorse_pgp_photo_get_pubkey        (SeahorsePgpPhoto *self);
+SeahorsePgpPhoto*   seahorse_pgp_photo_new               (GdkPixbuf *pixbuf);
 
 GdkPixbuf*          seahorse_pgp_photo_get_pixbuf        (SeahorsePgpPhoto *self);
 
 void                seahorse_pgp_photo_set_pixbuf        (SeahorsePgpPhoto *self,
                                                           GdkPixbuf *pixbuf);
 
-guint               seahorse_pgp_photo_get_index         (SeahorsePgpPhoto *self);
-
-void                seahorse_pgp_photo_set_index         (SeahorsePgpPhoto *self,
-                                                          guint index);
-
 #endif /* __SEAHORSE_PGP_PHOTO_H__ */

Added: trunk/pgp/seahorse-pgp-signature.c
==============================================================================
--- (empty file)
+++ trunk/pgp/seahorse-pgp-signature.c	Tue Dec 16 02:49:26 2008
@@ -0,0 +1,203 @@
+/*
+ * Seahorse
+ *
+ * Copyright (C) 2008 Stefan Walter
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details.
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the
+ * Free Software Foundation, Inc.,
+ * 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#include "config.h"
+
+#include "seahorse-pgp.h"
+#include "seahorse-pgp-key.h"
+#include "seahorse-pgp-signature.h"
+
+#include "seahorse-context.h"
+#include "seahorse-object.h"
+
+#include <string.h>
+
+#include <glib/gi18n.h>
+
+enum {
+	PROP_0,
+	PROP_KEYID,
+	PROP_FLAGS,
+	PROP_SIGTYPE
+};
+
+G_DEFINE_TYPE (SeahorsePgpSignature, seahorse_pgp_signature, G_TYPE_OBJECT);
+
+struct _SeahorsePgpSignaturePrivate {
+	guint flags;
+	gchar *keyid;
+};
+
+/* -----------------------------------------------------------------------------
+ * OBJECT 
+ */
+
+static void
+seahorse_pgp_signature_init (SeahorsePgpSignature *self)
+{
+	self->pv = G_TYPE_INSTANCE_GET_PRIVATE (self, SEAHORSE_TYPE_PGP_SIGNATURE, SeahorsePgpSignaturePrivate);
+}
+
+static void
+seahorse_pgp_signature_get_property (GObject *object, guint prop_id,
+                                  GValue *value, GParamSpec *pspec)
+{
+	SeahorsePgpSignature *self = SEAHORSE_PGP_SIGNATURE (object);
+	
+	switch (prop_id) {
+	case PROP_KEYID:
+		g_value_set_string (value, seahorse_pgp_signature_get_keyid (self));
+		break;
+	case PROP_FLAGS:
+		g_value_set_uint (value, seahorse_pgp_signature_get_flags (self));
+		break;
+	case PROP_SIGTYPE:
+		g_value_set_uint (value, seahorse_pgp_signature_get_sigtype (self));
+		break;
+	}
+}
+
+static void
+seahorse_pgp_signature_set_property (GObject *object, guint prop_id, const GValue *value, 
+                                  GParamSpec *pspec)
+{
+	SeahorsePgpSignature *self = SEAHORSE_PGP_SIGNATURE (object);
+	
+	switch (prop_id) {
+	case PROP_KEYID:
+		seahorse_pgp_signature_set_keyid (self, g_value_get_string (value));
+		break;
+	case PROP_FLAGS:
+		seahorse_pgp_signature_set_flags (self, g_value_get_uint (value));
+		break;
+	}
+}
+
+static void
+seahorse_pgp_signature_finalize (GObject *gobject)
+{
+	SeahorsePgpSignature *self = SEAHORSE_PGP_SIGNATURE (gobject);
+
+	g_free (self->pv->keyid);
+	self->pv->keyid = NULL;
+    
+	G_OBJECT_CLASS (seahorse_pgp_signature_parent_class)->finalize (gobject);
+}
+
+static void
+seahorse_pgp_signature_class_init (SeahorsePgpSignatureClass *klass)
+{
+	GObjectClass *gobject_class = G_OBJECT_CLASS (klass);    
+
+	seahorse_pgp_signature_parent_class = g_type_class_peek_parent (klass);
+
+	gobject_class->finalize = seahorse_pgp_signature_finalize;
+	gobject_class->set_property = seahorse_pgp_signature_set_property;
+	gobject_class->get_property = seahorse_pgp_signature_get_property;
+
+        g_object_class_install_property (gobject_class, PROP_KEYID,
+                g_param_spec_string ("keyid", "Key ID", "GPG Key ID",
+                                     "", G_PARAM_READWRITE));
+
+	g_object_class_install_property (gobject_class, PROP_FLAGS,
+	        g_param_spec_uint ("flags", "Flags", "PGP signature flags",
+	                           0, G_MAXUINT, 0, G_PARAM_READWRITE));
+
+	g_object_class_install_property (gobject_class, PROP_SIGTYPE,
+	        g_param_spec_uint ("sigtype", "Sig Type", "PGP signature type",
+	                           0, G_MAXUINT, 0, G_PARAM_READABLE));
+}
+
+/* -----------------------------------------------------------------------------
+ * PUBLIC 
+ */
+
+SeahorsePgpSignature*
+seahorse_pgp_signature_new (const gchar *keyid)
+{
+	return g_object_new (SEAHORSE_TYPE_PGP_SIGNATURE, "keyid", keyid, NULL);
+}
+ 
+guint
+seahorse_pgp_signature_get_flags (SeahorsePgpSignature *self)
+{
+	g_return_val_if_fail (SEAHORSE_IS_PGP_SIGNATURE (self), 0);
+	return self->pv->flags;
+}
+
+void
+seahorse_pgp_signature_set_flags (SeahorsePgpSignature *self, guint flags)
+{
+	GObject *obj;
+	
+	g_return_if_fail (SEAHORSE_IS_PGP_SIGNATURE (self));
+	self->pv->flags = flags;
+
+	obj = G_OBJECT (self);
+	g_object_freeze_notify (obj);
+	g_object_notify (obj, "flags");
+	g_object_notify (obj, "sigtype");
+	g_object_thaw_notify (obj);
+}
+
+const gchar*
+seahorse_pgp_signature_get_keyid (SeahorsePgpSignature *self)
+{
+	g_return_val_if_fail (SEAHORSE_IS_PGP_SIGNATURE (self), NULL);
+	return self->pv->keyid;
+}
+
+void
+seahorse_pgp_signature_set_keyid (SeahorsePgpSignature *self, const gchar *keyid)
+{
+	GObject *obj;
+	
+	g_return_if_fail (SEAHORSE_IS_PGP_SIGNATURE (self));
+	g_free (self->pv->keyid);
+	self->pv->keyid = g_strdup (keyid);
+	
+	obj = G_OBJECT (self);
+	g_object_freeze_notify (obj);
+	g_object_notify (obj, "keyid");
+	g_object_notify (obj, "sigtype");
+	g_object_thaw_notify (obj);
+}
+
+guint
+seahorse_pgp_signature_get_sigtype (SeahorsePgpSignature *self)
+{
+	SeahorseObject *sobj;
+	GQuark id;
+
+	g_return_val_if_fail (SEAHORSE_IS_PGP_SIGNATURE (self), 0);
+    
+	id = seahorse_pgp_key_get_cannonical_id (self->pv->keyid);
+	sobj = seahorse_context_find_object (SCTX_APP (), id, SEAHORSE_LOCATION_LOCAL);
+    
+	if (sobj) {
+		if (seahorse_object_get_usage (sobj) == SEAHORSE_USAGE_PRIVATE_KEY) 
+			return SKEY_PGPSIG_TRUSTED | SKEY_PGPSIG_PERSONAL;
+		if (seahorse_object_get_flags (sobj) & SEAHORSE_FLAG_TRUSTED)
+			return SKEY_PGPSIG_TRUSTED;
+	}
+
+	return 0;
+}

Added: trunk/pgp/seahorse-pgp-signature.h
==============================================================================
--- (empty file)
+++ trunk/pgp/seahorse-pgp-signature.h	Tue Dec 16 02:49:26 2008
@@ -0,0 +1,68 @@
+/*
+ * Seahorse
+ *
+ * Copyright (C) 2008 Stefan Walter
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details.
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the
+ * Free Software Foundation, Inc.,
+ * 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __SEAHORSE_PGP_SIGNATURE_H__
+#define __SEAHORSE_PGP_SIGNATURE_H__
+
+#include <glib-object.h>
+
+#include "pgp/seahorse-pgp-module.h"
+
+#include "seahorse-validity.h"
+
+#define SEAHORSE_TYPE_PGP_SIGNATURE            (seahorse_pgp_signature_get_type ())
+
+#define SEAHORSE_PGP_SIGNATURE(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), SEAHORSE_TYPE_PGP_SIGNATURE, SeahorsePgpSignature))
+#define SEAHORSE_PGP_SIGNATURE_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), SEAHORSE_TYPE_PGP_SIGNATURE, SeahorsePgpSignatureClass))
+#define SEAHORSE_IS_PGP_SIGNATURE(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SEAHORSE_TYPE_PGP_SIGNATURE))
+#define SEAHORSE_IS_PGP_SIGNATURE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SEAHORSE_TYPE_PGP_SIGNATURE))
+#define SEAHORSE_PGP_SIGNATURE_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), SEAHORSE_TYPE_PGP_SIGNATURE, SeahorsePgpSignatureClass))
+
+typedef struct _SeahorsePgpSignature SeahorsePgpSignature;
+typedef struct _SeahorsePgpSignatureClass SeahorsePgpSignatureClass;
+typedef struct _SeahorsePgpSignaturePrivate SeahorsePgpSignaturePrivate;
+
+struct _SeahorsePgpSignature {
+	GObject parent;
+	SeahorsePgpSignaturePrivate *pv;
+};
+
+struct _SeahorsePgpSignatureClass {
+	GObjectClass parent_class;
+};
+
+GType                  seahorse_pgp_signature_get_type       (void);
+
+SeahorsePgpSignature*  seahorse_pgp_signature_new            (const gchar *keyid);
+
+const gchar*           seahorse_pgp_signature_get_keyid      (SeahorsePgpSignature *self);
+
+void                   seahorse_pgp_signature_set_keyid      (SeahorsePgpSignature *self,
+                                                              const gchar *keyid);
+
+guint                  seahorse_pgp_signature_get_flags      (SeahorsePgpSignature *self);
+
+void                   seahorse_pgp_signature_set_flags      (SeahorsePgpSignature *self,
+                                                              guint flags);
+
+guint                  seahorse_pgp_signature_get_sigtype    (SeahorsePgpSignature *self);
+
+#endif /* __SEAHORSE_PGP_SIGNATURE_H__ */

Modified: trunk/pgp/seahorse-pgp-subkey.c
==============================================================================
--- trunk/pgp/seahorse-pgp-subkey.c	(original)
+++ trunk/pgp/seahorse-pgp-subkey.c	Tue Dec 16 02:49:26 2008
@@ -22,7 +22,7 @@
 #include "config.h"
 
 #include "seahorse-pgp.h"
-#include "seahorse-gpgmex.h"
+#include "seahorse-gpgme.h"
 #include "seahorse-pgp-subkey.h"
 #include "seahorse-pgp-uid.h"
 
@@ -32,20 +32,29 @@
 
 enum {
 	PROP_0,
-	PROP_PUBKEY,
-	PROP_SUBKEY,
 	PROP_INDEX,
 	PROP_KEYID,
+	PROP_VALIDITY,
+	PROP_LENGTH,
 	PROP_ALGORITHM,
-	PROP_EXPIRES
+	PROP_CREATED,
+	PROP_EXPIRES,
+	PROP_DESCRIPTION,
+	PROP_FINGERPRINT
 };
 
 G_DEFINE_TYPE (SeahorsePgpSubkey, seahorse_pgp_subkey, G_TYPE_OBJECT);
 
 struct _SeahorsePgpSubkeyPrivate {
-	gpgme_key_t pubkey;         /* The public key that this subkey is part of */
-	gpgme_subkey_t subkey;      /* The subkey referred to */
-	guint index;                /* The GPGME index of the subkey */
+	guint index;
+	gchar *keyid;
+	SeahorseValidity validity;
+	guint length;
+	gchar *algorithm;
+	gulong created;
+	gulong expires;
+	gchar *description;
+	gchar *fingerprint;
 };
 
 /* -----------------------------------------------------------------------------
@@ -56,21 +65,6 @@
 seahorse_pgp_subkey_init (SeahorsePgpSubkey *self)
 {
 	self->pv = G_TYPE_INSTANCE_GET_PRIVATE (self, SEAHORSE_TYPE_PGP_SUBKEY, SeahorsePgpSubkeyPrivate);
-	self->pv->index = 0;
-}
-
-static GObject*
-seahorse_pgp_subkey_constructor (GType type, guint n_props, GObjectConstructParam *props)
-{
-	GObject *obj = G_OBJECT_CLASS (seahorse_pgp_subkey_parent_class)->constructor (type, n_props, props);
-	SeahorsePgpSubkey *self = NULL;
-	
-	if (obj) {
-		self = SEAHORSE_PGP_SUBKEY (obj);
-		g_return_val_if_fail (self->pv->pubkey, NULL);
-	}
-	
-	return obj;
 }
 
 static void
@@ -80,24 +74,33 @@
 	SeahorsePgpSubkey *self = SEAHORSE_PGP_SUBKEY (object);
 	
 	switch (prop_id) {
-	case PROP_PUBKEY:
-		g_value_set_boxed (value, seahorse_pgp_subkey_get_pubkey (self));
-		break;
-	case PROP_SUBKEY:
-		g_value_set_pointer (value, seahorse_pgp_subkey_get_subkey (self));
-		break;
 	case PROP_INDEX:
 		g_value_set_uint (value, seahorse_pgp_subkey_get_index (self));
 		break;
 	case PROP_KEYID:
 		g_value_set_string (value, seahorse_pgp_subkey_get_keyid (self));
 		break;
+	case PROP_VALIDITY:
+		g_value_set_uint (value, seahorse_pgp_subkey_get_validity (self));
+		break;
+	case PROP_LENGTH:
+		g_value_set_uint (value, seahorse_pgp_subkey_get_length (self));
+		break;
 	case PROP_ALGORITHM:
 		g_value_set_string (value, seahorse_pgp_subkey_get_algorithm (self));
 		break;
+	case PROP_CREATED:
+		g_value_set_ulong (value, seahorse_pgp_subkey_get_created (self));
+		break;
 	case PROP_EXPIRES:
 		g_value_set_ulong (value, seahorse_pgp_subkey_get_expires (self));
 		break;
+	case PROP_DESCRIPTION:
+		g_value_set_string (value, seahorse_pgp_subkey_get_description (self));
+		break;
+	case PROP_FINGERPRINT:
+		g_value_set_string (value, seahorse_pgp_subkey_get_fingerprint (self));
+		break;
 	}
 }
 
@@ -106,16 +109,34 @@
                                   GParamSpec *pspec)
 {
 	SeahorsePgpSubkey *self = SEAHORSE_PGP_SUBKEY (object);
-
+	
 	switch (prop_id) {
-	case PROP_PUBKEY:
-		g_return_if_fail (!self->pv->pubkey);
-		self->pv->pubkey = g_value_get_boxed (value);
-		if (self->pv->pubkey)
-			gpgmex_key_ref (self->pv->pubkey);
+	case PROP_INDEX:
+		seahorse_pgp_subkey_set_index (self, g_value_get_uint (value));
 		break;
-	case PROP_SUBKEY:
-		seahorse_pgp_subkey_set_subkey (self, g_value_get_pointer (value));
+	case PROP_KEYID:
+		seahorse_pgp_subkey_set_keyid (self, g_value_get_string (value));
+		break;
+	case PROP_VALIDITY:
+		seahorse_pgp_subkey_set_validity (self, g_value_get_uint (value));
+		break;
+	case PROP_LENGTH:
+		seahorse_pgp_subkey_set_length (self, g_value_get_uint (value));
+		break;
+	case PROP_ALGORITHM:
+		seahorse_pgp_subkey_set_algorithm (self, g_value_get_string (value));
+		break;
+	case PROP_CREATED:
+		seahorse_pgp_subkey_set_created (self, g_value_get_ulong (value));
+		break;
+	case PROP_EXPIRES:
+		seahorse_pgp_subkey_set_expires (self, g_value_get_ulong (value));
+		break;
+	case PROP_FINGERPRINT:
+		seahorse_pgp_subkey_set_fingerprint (self, g_value_get_string (value));
+		break;
+	case PROP_DESCRIPTION:
+		seahorse_pgp_subkey_set_description (self, g_value_get_string (value));
 		break;
 	}
 }
@@ -125,11 +146,17 @@
 {
 	SeahorsePgpSubkey *self = SEAHORSE_PGP_SUBKEY (gobject);
 
-	/* Unref the key */
-	if (self->pv->pubkey)
-		gpgmex_key_unref (self->pv->pubkey);
-	self->pv->pubkey = NULL;
-	self->pv->subkey = NULL;
+	g_free (self->pv->algorithm);
+	self->pv->algorithm = NULL;
+	
+	g_free (self->pv->fingerprint);
+	self->pv->fingerprint = NULL;
+
+	g_free (self->pv->description);
+	self->pv->description = NULL;
+	
+	g_free (self->pv->keyid);
+	self->pv->keyid = NULL;
     
 	G_OBJECT_CLASS (seahorse_pgp_subkey_parent_class)->finalize (gobject);
 }
@@ -140,161 +167,232 @@
 	GObjectClass *gobject_class = G_OBJECT_CLASS (klass);    
 
 	seahorse_pgp_subkey_parent_class = g_type_class_peek_parent (klass);
-	g_type_class_add_private (klass, sizeof (SeahorsePgpSubkeyPrivate));
 
-	gobject_class->constructor = seahorse_pgp_subkey_constructor;
 	gobject_class->finalize = seahorse_pgp_subkey_finalize;
 	gobject_class->set_property = seahorse_pgp_subkey_set_property;
 	gobject_class->get_property = seahorse_pgp_subkey_get_property;
-    
-	g_object_class_install_property (gobject_class, PROP_PUBKEY,
-	        g_param_spec_boxed ("pubkey", "Public Key", "GPGME Public Key that this subkey is on",
-	                            SEAHORSE_PGP_BOXED_KEY, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
-
-	g_object_class_install_property (gobject_class, PROP_SUBKEY,
-	        g_param_spec_pointer ("subkey", "Subkey", "GPGME Subkey",
-	                              G_PARAM_READWRITE));
-                      
+	g_type_class_add_private (gobject_class, sizeof (SeahorsePgpSubkeyPrivate));
+
 	g_object_class_install_property (gobject_class, PROP_INDEX,
-	        g_param_spec_uint ("index", "GPGME Index", "GPGME Subkey Index",
+	        g_param_spec_uint ("index", "Index", "PGP subkey index",
 	                           0, G_MAXUINT, 0, G_PARAM_READWRITE));
-	
+
         g_object_class_install_property (gobject_class, PROP_KEYID,
                 g_param_spec_string ("keyid", "Key ID", "GPG Key ID",
-                                     "", G_PARAM_READABLE));
-        
+                                     "", G_PARAM_READWRITE));
+
+        g_object_class_install_property (gobject_class, PROP_VALIDITY,
+	        g_param_spec_uint ("validity", "Validity", "PGP subkey validity",
+	                           0, G_MAXUINT, 0, G_PARAM_READWRITE));
+
+	g_object_class_install_property (gobject_class, PROP_LENGTH,
+	        g_param_spec_uint ("length", "Length", "PGP key length",
+	                           0, G_MAXUINT, 0, G_PARAM_READWRITE));
+
         g_object_class_install_property (gobject_class, PROP_ALGORITHM,
                 g_param_spec_string ("algorithm", "Algorithm", "GPG Algorithm",
-                                     "", G_PARAM_READABLE));
+                                     "", G_PARAM_READWRITE));
+        
+        g_object_class_install_property (gobject_class, PROP_CREATED,
+                g_param_spec_ulong ("created", "Created On", "Date this key was created on",
+                                    0, G_MAXULONG, 0, G_PARAM_READWRITE));
         
         g_object_class_install_property (gobject_class, PROP_EXPIRES,
                 g_param_spec_ulong ("expires", "Expires On", "Date this key expires on",
-                                    0, G_MAXULONG, 0, G_PARAM_READABLE));
+                                    0, G_MAXULONG, 0, G_PARAM_READWRITE));
+
+        g_object_class_install_property (gobject_class, PROP_DESCRIPTION,
+                g_param_spec_string ("description", "Description", "Key Description",
+                                     "", G_PARAM_READWRITE));
+
+        g_object_class_install_property (gobject_class, PROP_FINGERPRINT,
+                g_param_spec_string ("fingerprint", "Fingerprint", "PGP Key Fingerprint",
+                                     "", G_PARAM_READWRITE));
 }
 
 /* -----------------------------------------------------------------------------
  * PUBLIC 
  */
 
-SeahorsePgpSubkey* 
-seahorse_pgp_subkey_new (gpgme_key_t pubkey, gpgme_subkey_t subkey) 
+SeahorsePgpSubkey*
+seahorse_pgp_subkey_new (void)
 {
-	return g_object_new (SEAHORSE_TYPE_PGP_SUBKEY, 
-	                     "pubkey", pubkey, 
-	                     "subkey", subkey, NULL);
+	return g_object_new (SEAHORSE_TYPE_PGP_SUBKEY, NULL);
 }
 
+guint
+seahorse_pgp_subkey_get_index (SeahorsePgpSubkey *self)
+{
+	g_return_val_if_fail (SEAHORSE_IS_PGP_SUBKEY (self), 0);
+	return self->pv->index;
+}
 
-gpgme_key_t
-seahorse_pgp_subkey_get_pubkey (SeahorsePgpSubkey *self)
+void
+seahorse_pgp_subkey_set_index (SeahorsePgpSubkey *self, guint index)
 {
-	g_return_val_if_fail (SEAHORSE_IS_PGP_SUBKEY (self), NULL);
-	g_return_val_if_fail (self->pv->pubkey, NULL);
-	return self->pv->pubkey;
+	g_return_if_fail (SEAHORSE_IS_PGP_SUBKEY (self));
+	self->pv->index = index;
+	g_object_notify (G_OBJECT (self), "index");
 }
 
-gpgme_subkey_t
-seahorse_pgp_subkey_get_subkey (SeahorsePgpSubkey *self)
+const gchar*
+seahorse_pgp_subkey_get_keyid (SeahorsePgpSubkey *self)
 {
 	g_return_val_if_fail (SEAHORSE_IS_PGP_SUBKEY (self), NULL);
-	g_return_val_if_fail (self->pv->subkey, NULL);
-	return self->pv->subkey;
+	return self->pv->keyid;
 }
 
 void
-seahorse_pgp_subkey_set_subkey (SeahorsePgpSubkey *self, gpgme_subkey_t subkey)
+seahorse_pgp_subkey_set_keyid (SeahorsePgpSubkey *self, const gchar *keyid)
 {
-	GObject *obj;
-	gpgme_subkey_t sub;
-	gint i, index;
-	
 	g_return_if_fail (SEAHORSE_IS_PGP_SUBKEY (self));
-	g_return_if_fail (subkey);
-	
-	/* Make sure that this userid is in the pubkey */
-	index = -1;
-	for (i = 0, sub = self->pv->pubkey->subkeys; sub; ++i, sub = sub->next) {
-		if(sub == subkey) {
-			index = i;
-			break;
-		}
-	}
-	
-	g_return_if_fail (index >= 0);
-	
-	self->pv->subkey = subkey;
-	self->pv->index = index;
-	
-	obj = G_OBJECT (self);
-	g_object_freeze_notify (obj);
-	g_object_notify (obj, "subkey");
-	g_object_notify (obj, "index");
-	g_object_notify (obj, "keyid");
-	g_object_notify (obj, "algorithm");
-	g_object_notify (obj, "expires");
-	g_object_thaw_notify (obj);
+	g_free (self->pv->keyid);
+	self->pv->keyid = g_strdup (keyid);
+	g_object_notify (G_OBJECT (self), "keyid");
+}
+
+SeahorseValidity
+seahorse_pgp_subkey_get_validity (SeahorsePgpSubkey *self)
+{
+	g_return_val_if_fail (SEAHORSE_IS_PGP_SUBKEY (self), 0);
+	return self->pv->validity;
+}
+
+void
+seahorse_pgp_subkey_set_validity (SeahorsePgpSubkey *self, SeahorseValidity validity)
+{
+	g_return_if_fail (SEAHORSE_IS_PGP_SUBKEY (self));
+	self->pv->validity = validity;
+	g_object_notify (G_OBJECT (self), "validity");
 }
 
 guint
-seahorse_pgp_subkey_get_index (SeahorsePgpSubkey *self)
+seahorse_pgp_subkey_get_length (SeahorsePgpSubkey *self)
 {
 	g_return_val_if_fail (SEAHORSE_IS_PGP_SUBKEY (self), 0);
-	return self->pv->index;
+	return self->pv->length;
 }
 
-const gchar*
-seahorse_pgp_subkey_get_keyid (SeahorsePgpSubkey *self)
+void
+seahorse_pgp_subkey_set_length (SeahorsePgpSubkey *self, guint length)
 {
-	g_return_val_if_fail (SEAHORSE_IS_PGP_SUBKEY (self), NULL);
-	g_return_val_if_fail (self->pv->subkey, NULL);
-	return self->pv->subkey->keyid;
+	g_return_if_fail (SEAHORSE_IS_PGP_SUBKEY (self));
+	self->pv->length = length;
+	g_object_notify (G_OBJECT (self), "length");
 }
 
 const gchar*
 seahorse_pgp_subkey_get_algorithm (SeahorsePgpSubkey *self)
 {
-	const gchar* algo_type;
-
 	g_return_val_if_fail (SEAHORSE_IS_PGP_SUBKEY (self), NULL);
-	g_return_val_if_fail (self->pv->subkey, NULL);
-	
-	algo_type = gpgme_pubkey_algo_name (self->pv->subkey->pubkey_algo);
+	return self->pv->algorithm;
+}
 
-	if (algo_type == NULL)
-		algo_type = _("Unknown");
-	else if (g_str_equal ("Elg", algo_type) || g_str_equal("ELG-E", algo_type))
-		algo_type = _("ElGamal");
-	
-	return algo_type;
+void
+seahorse_pgp_subkey_set_algorithm (SeahorsePgpSubkey *self, const gchar *algorithm)
+{
+	g_return_if_fail (SEAHORSE_IS_PGP_SUBKEY (self));
+	g_free (self->pv->algorithm);
+	self->pv->algorithm = g_strdup (algorithm);
+	g_object_notify (G_OBJECT (self), "algorithm");
+}
+
+gulong
+seahorse_pgp_subkey_get_created (SeahorsePgpSubkey *self)
+{
+	g_return_val_if_fail (SEAHORSE_IS_PGP_SUBKEY (self), 0);
+	return self->pv->created;
+}
+
+void
+seahorse_pgp_subkey_set_created (SeahorsePgpSubkey *self, gulong created)
+{
+	g_return_if_fail (SEAHORSE_IS_PGP_SUBKEY (self));
+	self->pv->created = created;
+	g_object_notify (G_OBJECT (self), "created");
 }
 
 gulong
 seahorse_pgp_subkey_get_expires (SeahorsePgpSubkey *self)
 {
 	g_return_val_if_fail (SEAHORSE_IS_PGP_SUBKEY (self), 0);
-	g_return_val_if_fail (self->pv->subkey, 0);
-	return self->pv->subkey->expires;
+	return self->pv->expires;
 }
 
-gchar*
+void
+seahorse_pgp_subkey_set_expires (SeahorsePgpSubkey *self, gulong expires)
+{
+	g_return_if_fail (SEAHORSE_IS_PGP_SUBKEY (self));
+	self->pv->expires = expires;
+	g_object_notify (G_OBJECT (self), "expires");
+}
+
+const gchar*
+seahorse_pgp_subkey_get_fingerprint (SeahorsePgpSubkey *self)
+{
+	g_return_val_if_fail (SEAHORSE_IS_PGP_SUBKEY (self), NULL);
+	return self->pv->fingerprint;
+}
+
+void
+seahorse_pgp_subkey_set_fingerprint (SeahorsePgpSubkey *self, const gchar *fingerprint)
+{
+	g_return_if_fail (SEAHORSE_IS_PGP_SUBKEY (self));
+	g_free (self->pv->fingerprint);
+	self->pv->fingerprint = g_strdup (fingerprint);
+	g_object_notify (G_OBJECT (self), "fingerprint");
+}
+
+const gchar*
 seahorse_pgp_subkey_get_description (SeahorsePgpSubkey *self)
 {
-	gchar *label;
-	gchar *description;
-	
 	g_return_val_if_fail (SEAHORSE_IS_PGP_SUBKEY (self), NULL);
-	g_return_val_if_fail (self->pv->pubkey, NULL);
-	
-	if (self->pv->pubkey->uids)
-		label = seahorse_pgp_uid_calc_name (self->pv->pubkey->uids);
-	else
-		label = g_strdup (_("Key"));
-	
-	if (self->pv->index == 0)
-		return label;
+	return self->pv->description;
+}
+
+void
+seahorse_pgp_subkey_set_description (SeahorsePgpSubkey *self, const gchar *description)
+{
+	g_return_if_fail (SEAHORSE_IS_PGP_SUBKEY (self));
+	g_free (self->pv->description);
+	self->pv->description = g_strdup (description);
+	g_object_notify (G_OBJECT (self), "description");
+}
+
+gchar*
+seahorse_pgp_subkey_calc_description (const gchar *name, guint index)
+{
+	if (name == NULL)
+		name = _("Key");
 	
-	description = g_strdup_printf (_("Subkey %d of %s"), self->pv->index, label);
-	g_free (label);
+	if (index == 0)
+		return g_strdup (name);
 	
-	return description;
+	return g_strdup_printf (_("Subkey %d of %s"), index, name);
+}
+
+gchar*
+seahorse_pgp_subkey_calc_fingerprint (const gchar *raw_fingerprint)
+{
+	const gchar *raw;
+	GString *string;
+	guint index, len;
+	gchar *fpr;
+	    
+	raw = raw_fingerprint;
+	g_return_val_if_fail (raw != NULL, NULL);
+
+	string = g_string_new ("");
+	len = strlen (raw);
+	    
+	for (index = 0; index < len; index++) {
+		if (index > 0 && index % 4 == 0)
+			g_string_append (string, " ");
+		g_string_append_c (string, raw[index]);
+	}
+	    
+	fpr = string->str;
+	g_string_free (string, FALSE);
+	    
+	return fpr;
 }

Modified: trunk/pgp/seahorse-pgp-subkey.h
==============================================================================
--- trunk/pgp/seahorse-pgp-subkey.h	(original)
+++ trunk/pgp/seahorse-pgp-subkey.h	Tue Dec 16 02:49:26 2008
@@ -24,10 +24,9 @@
 
 #include <glib-object.h>
 
-#include <gpgme.h>
+#include "seahorse-object.h"
 
-#include "pgp/seahorse-pgp-module.h"
-#include "pgp/seahorse-gpgmex.h"
+#include "seahorse-validity.h"
 
 #define SEAHORSE_TYPE_PGP_SUBKEY            (seahorse_pgp_subkey_get_type ())
 
@@ -52,24 +51,57 @@
 
 GType               seahorse_pgp_subkey_get_type          (void);
 
-SeahorsePgpSubkey*  seahorse_pgp_subkey_new               (gpgme_key_t pubkey,
-                                                           gpgme_subkey_t subkey);
+SeahorsePgpSubkey*  seahorse_pgp_subkey_new               (void);
 
-gpgme_key_t         seahorse_pgp_subkey_get_pubkey        (SeahorsePgpSubkey *self);
+guint               seahorse_pgp_subkey_get_index         (SeahorsePgpSubkey *self);
 
-gpgme_subkey_t      seahorse_pgp_subkey_get_subkey        (SeahorsePgpSubkey *self);
+void                seahorse_pgp_subkey_set_index         (SeahorsePgpSubkey *self,
+                                                           guint index);
 
-void                seahorse_pgp_subkey_set_subkey        (SeahorsePgpSubkey *self,
-                                                           gpgme_subkey_t subkey);
+const gchar*        seahorse_pgp_subkey_get_keyid         (SeahorsePgpSubkey *self);
 
-guint               seahorse_pgp_subkey_get_index         (SeahorsePgpSubkey *self);
+void                seahorse_pgp_subkey_set_keyid         (SeahorsePgpSubkey *self,
+                                                           const gchar *keyid);
 
-const gchar*        seahorse_pgp_subkey_get_keyid         (SeahorsePgpSubkey *self);
+SeahorseValidity    seahorse_pgp_subkey_get_validity      (SeahorsePgpSubkey *self);
+
+void                seahorse_pgp_subkey_set_validity      (SeahorsePgpSubkey *self,
+                                                           SeahorseValidity validity);
 
 const gchar*        seahorse_pgp_subkey_get_algorithm     (SeahorsePgpSubkey *self);
 
+void                seahorse_pgp_subkey_set_algorithm     (SeahorsePgpSubkey *self,
+                                                           const gchar *algorithm);
+
+guint               seahorse_pgp_subkey_get_length        (SeahorsePgpSubkey *self);
+
+void                seahorse_pgp_subkey_set_length        (SeahorsePgpSubkey *self,
+                                                           guint index);
+
+gulong              seahorse_pgp_subkey_get_created       (SeahorsePgpSubkey *self);
+
+void                seahorse_pgp_subkey_set_created       (SeahorsePgpSubkey *self,
+                                                           gulong created);
+
 gulong              seahorse_pgp_subkey_get_expires       (SeahorsePgpSubkey *self);
 
-gchar*              seahorse_pgp_subkey_get_description   (SeahorsePgpSubkey *self);
+void                seahorse_pgp_subkey_set_expires       (SeahorsePgpSubkey *self,
+                                                           gulong expires);
+
+const gchar*        seahorse_pgp_subkey_get_description   (SeahorsePgpSubkey *self);
+
+void                seahorse_pgp_subkey_set_description   (SeahorsePgpSubkey *self,
+                                                           const gchar *description);
+
+gchar*              seahorse_pgp_subkey_calc_description  (const gchar *name, 
+                                                           guint index); 
+
+const gchar*        seahorse_pgp_subkey_get_fingerprint   (SeahorsePgpSubkey *self);
+
+void                seahorse_pgp_subkey_set_fingerprint   (SeahorsePgpSubkey *self,
+                                                           const gchar *description);
+
+gchar*              seahorse_pgp_subkey_calc_fingerprint  (const gchar *raw_fingerprint); 
+
 
 #endif /* __SEAHORSE_PGP_SUBKEY_H__ */

Modified: trunk/pgp/seahorse-pgp-uid.c
==============================================================================
--- trunk/pgp/seahorse-pgp-uid.c	(original)
+++ trunk/pgp/seahorse-pgp-uid.c	Tue Dec 16 02:49:26 2008
@@ -22,9 +22,11 @@
 #include "config.h"
 
 #include "seahorse-pgp.h"
-#include "seahorse-gpgmex.h"
 #include "seahorse-pgp-key.h"
 #include "seahorse-pgp-uid.h"
+#include "seahorse-pgp-signature.h"
+
+#include "common/seahorse-object-list.h"
 
 #include <string.h>
 
@@ -32,10 +34,7 @@
 
 enum {
 	PROP_0,
-	PROP_PUBKEY,
-	PROP_USERID,
-	PROP_GPGME_INDEX,
-	PROP_ACTUAL_INDEX,
+	PROP_SIGNATURES,
 	PROP_VALIDITY,
 	PROP_VALIDITY_STR,
 	PROP_NAME,
@@ -46,112 +45,167 @@
 G_DEFINE_TYPE (SeahorsePgpUid, seahorse_pgp_uid, SEAHORSE_TYPE_OBJECT);
 
 struct _SeahorsePgpUidPrivate {
-	gpgme_key_t pubkey;         /* The public key that this uid is part of */
-	gpgme_user_id_t userid;     /* The userid referred to */
-	guint gpgme_index;          /* The GPGME index of the UID */
-	gint actual_index;          /* The actual index of this UID */
+	GList *signatures;
+	SeahorseValidity validity;
+	gboolean realized;
+	gchar *name;
+	gchar *email;
+	gchar *comment;
 };
 
 /* -----------------------------------------------------------------------------
  * INTERNAL HELPERS
  */
 
-static gchar*
-convert_string (const gchar *str, gboolean escape)
-{
-	gchar *t, *ret;
-    
-	if (!str)
-  	      return NULL;
-    
-	/* If not utf8 valid, assume latin 1 */
- 	if (!g_utf8_validate (str, -1, NULL)) {
- 		ret = g_convert (str, -1, "UTF-8", "ISO-8859-1", NULL, NULL, NULL);
- 		if (escape) {
- 			t = ret;
- 			ret = g_markup_escape_text (t, -1);
- 			g_free (t);
- 		}
-        
- 		return ret;
- 	}
+#ifndef HAVE_STRSEP
+/* code taken from glibc-2.2.1/sysdeps/generic/strsep.c */
+char *
+strsep (char **stringp, const char *delim)
+{
+    char *begin, *end;
+
+    begin = *stringp;
+    if (begin == NULL)
+        return NULL;
+
+      /* A frequent case is when the delimiter string contains only one
+         character.  Here we don't need to call the expensive `strpbrk'
+         function and instead work using `strchr'.  */
+      if (delim[0] == '\0' || delim[1] == '\0') {
+        char ch = delim[0];
+
+        if (ch == '\0')
+            end = NULL; 
+        else {
+            if (*begin == ch)
+                end = begin;
+            else if (*begin == '\0')
+                end = NULL;
+            else
+                end = strchr (begin + 1, ch);
+        }
+    } else
+        /* Find the end of the token.  */
+        end = strpbrk (begin, delim);
+
+    if (end) {
+      /* Terminate the token and set *STRINGP past NUL character.  */
+      *end++ = '\0';
+      *stringp = end;
+    } else
+        /* No more delimiters; this is the last token.  */
+        *stringp = NULL;
 
- 	if (escape)
- 		return g_markup_escape_text (str, -1);
- 	else
- 		return g_strdup (str);
+    return begin;
 }
+#endif /*HAVE_STRSEP*/
 
+/* Copied from GPGME */
 static void
-changed_uid (SeahorsePgpUid *self)
+parse_user_id (const gchar *uid, gchar **name, gchar **email, gchar **comment)
 {
-	SeahorseObject *obj = SEAHORSE_OBJECT (self);
-	SeahorseLocation loc;
-	gchar *name, *markup;
-	
-	g_return_if_fail (self->pv->pubkey);
-	
-	if (!self->pv->userid) {
-        
-		g_object_set (self,
-		              "label", "",
-		              "usage", SEAHORSE_USAGE_NONE,
-		              "markup", "",
-		              "location", SEAHORSE_LOCATION_INVALID,
-		              "flags", SEAHORSE_FLAG_DISABLED,
-		              NULL);
-		return;
-		
-	} 
-		
-	/* The location */
-	loc = seahorse_object_get_location (obj);
-	if (self->pv->pubkey->keylist_mode & GPGME_KEYLIST_MODE_EXTERN && 
-	    loc <= SEAHORSE_LOCATION_REMOTE)
-		loc = SEAHORSE_LOCATION_REMOTE;
-
-	else if (loc <= SEAHORSE_LOCATION_LOCAL)
-		loc = SEAHORSE_LOCATION_LOCAL;
-
-	name = seahorse_pgp_uid_calc_label (self->pv->userid);
-	markup = seahorse_pgp_uid_calc_markup (self->pv->userid, 0);
-	
-	g_object_set (self,
-		      "label", name,
-		      "markup", markup,
-		      "usage", SEAHORSE_USAGE_IDENTITY,
-		      "flags", 0,
-		      NULL);
-	
-	g_free (name);
-	g_free (markup);
+    gchar *src, *tail, *x;
+    int in_name = 0;
+    int in_email = 0;
+    int in_comment = 0;
+
+    x = tail = src = g_strdup (uid);
+    
+    while (*src) {
+        if (in_email) {
+	        if (*src == '<')
+	            /* Not legal but anyway.  */
+	            in_email++;
+	        else if (*src == '>') {
+	            if (!--in_email && !*email) {
+		            *email = tail;
+                    *src = 0;
+                    tail = src + 1;
+		        }
+	        }
+	    } else if (in_comment) {
+	        if (*src == '(')
+	            in_comment++;
+	        else if (*src == ')') {
+	            if (!--in_comment && !*comment) {
+		            *comment = tail;
+                    *src = 0;
+                    tail = src + 1;
+		        }
+	        }
+	    } else if (*src == '<') {
+	        if (in_name) {
+	            if (!*name) {
+		            *name = tail;
+                    *src = 0;
+                    tail = src + 1;
+		        }
+	            in_name = 0;
+	        }
+	        in_email = 1;
+	    } else if (*src == '(') {
+	        if (in_name) {
+	            if (!*name) {
+		            *name = tail;
+                    *src = 0;
+                    tail = src + 1;
+		        }
+	            in_name = 0;
+	        }
+	        in_comment = 1;
+	    } else if (!in_name && *src != ' ' && *src != '\t') {
+	        in_name = 1;
+	    }    
+        src++;
+    }
+ 
+    if (in_name) {
+        if (!*name) {
+	        *name = tail;
+            *src = 0;
+            tail = src + 1;
+	    }
+    }
+ 
+    /* Let unused parts point to an EOS.  */
+    *name = g_strdup (*name ? *name : "");
+    *email = g_strdup (*email ? *email : "");
+    *comment = g_strdup (*comment ? *comment : "");
+    
+    g_strstrip (*name);
+    g_strstrip (*email);
+    g_strstrip (*comment);
+    
+    g_free (x);
 }
 
+
 /* -----------------------------------------------------------------------------
  * OBJECT 
  */
 
 static void
-seahorse_pgp_uid_init (SeahorsePgpUid *self)
+seahorse_pgp_uid_realize (SeahorseObject *obj)
 {
-	self->pv = G_TYPE_INSTANCE_GET_PRIVATE (self, SEAHORSE_TYPE_PGP_UID, SeahorsePgpUidPrivate);
-	self->pv->gpgme_index = 0;
-	self->pv->actual_index = -1;
-	g_object_set (self, "icon", "", NULL);
+	SeahorsePgpUid *self = SEAHORSE_PGP_UID (obj);
+	gchar *markup;
+
+	self->pv->realized = TRUE;
+	SEAHORSE_OBJECT_CLASS (seahorse_pgp_uid_parent_class)->realize (obj);
+
+	if (self->pv->name) {
+		g_object_set (self, "label", self->pv->name ? self->pv->name : "", NULL);
+		markup = seahorse_pgp_uid_calc_markup (self->pv->name, self->pv->email, self->pv->comment, 0);
+		g_object_set (self, "markup", markup, NULL);
+		g_free (markup);
+	}
 }
 
-static GObject*
-seahorse_pgp_uid_constructor (GType type, guint n_props, GObjectConstructParam *props)
+static void
+seahorse_pgp_uid_init (SeahorsePgpUid *self)
 {
-	GObject *obj = G_OBJECT_CLASS (seahorse_pgp_uid_parent_class)->constructor (type, n_props, props);
-	SeahorsePgpUid *self = NULL;
-	
-	if (obj) {
-		self = SEAHORSE_PGP_UID (obj);
-		g_return_val_if_fail (self->pv->pubkey, NULL);
-	}
-	
-	return obj;
+	self->pv = G_TYPE_INSTANCE_GET_PRIVATE (self, SEAHORSE_TYPE_PGP_UID, SeahorsePgpUidPrivate);
+	g_object_set (self, "icon", "", "usage", SEAHORSE_USAGE_IDENTITY, NULL);
 }
 
 static void
@@ -161,17 +215,8 @@
 	SeahorsePgpUid *self = SEAHORSE_PGP_UID (object);
 	
 	switch (prop_id) {
-	case PROP_PUBKEY:
-		g_value_set_boxed (value, seahorse_pgp_uid_get_pubkey (self));
-		break;
-	case PROP_USERID:
-		g_value_set_pointer (value, seahorse_pgp_uid_get_userid (self));
-		break;
-	case PROP_GPGME_INDEX:
-		g_value_set_uint (value, seahorse_pgp_uid_get_gpgme_index (self));
-		break;
-	case PROP_ACTUAL_INDEX:
-		g_value_set_uint (value, seahorse_pgp_uid_get_actual_index (self));
+	case PROP_SIGNATURES:
+		g_value_set_boxed (value, seahorse_pgp_uid_get_signatures (self));
 		break;
 	case PROP_VALIDITY:
 		g_value_set_uint (value, seahorse_pgp_uid_get_validity (self));
@@ -180,13 +225,13 @@
 		g_value_set_string (value, seahorse_pgp_uid_get_validity_str (self));
 		break;
 	case PROP_NAME:
-		g_value_take_string (value, seahorse_pgp_uid_get_name (self));
+		g_value_set_string (value, seahorse_pgp_uid_get_name (self));
 		break;
 	case PROP_EMAIL:
-		g_value_take_string (value, seahorse_pgp_uid_get_email (self));
+		g_value_set_string (value, seahorse_pgp_uid_get_email (self));
 		break;
 	case PROP_COMMENT:
-		g_value_take_string (value, seahorse_pgp_uid_get_comment (self));
+		g_value_set_string (value, seahorse_pgp_uid_get_comment (self));
 		break;
 	}
 }
@@ -198,17 +243,20 @@
 	SeahorsePgpUid *self = SEAHORSE_PGP_UID (object);
 
 	switch (prop_id) {
-	case PROP_PUBKEY:
-		g_return_if_fail (!self->pv->pubkey);
-		self->pv->pubkey = g_value_get_boxed (value);
-		if (self->pv->pubkey)
-			gpgmex_key_ref (self->pv->pubkey);
+	case PROP_SIGNATURES:
+		seahorse_pgp_uid_set_signatures (self, g_value_get_boxed (value));
 		break;
-	case PROP_ACTUAL_INDEX:
-		seahorse_pgp_uid_set_actual_index (self, g_value_get_uint (value));
+	case PROP_VALIDITY:
+		seahorse_pgp_uid_set_validity (self, g_value_get_uint (value));
 		break;
-	case PROP_USERID:
-		seahorse_pgp_uid_set_userid (self, g_value_get_pointer (value));
+	case PROP_NAME:
+		seahorse_pgp_uid_set_name (self, g_value_get_string (value));
+		break;
+	case PROP_EMAIL:
+		seahorse_pgp_uid_set_email (self, g_value_get_string (value));
+		break;
+	case PROP_COMMENT:
+		seahorse_pgp_uid_set_comment (self, g_value_get_string (value));
 		break;
 	}
 }
@@ -218,11 +266,17 @@
 {
 	SeahorsePgpUid *self = SEAHORSE_PGP_UID (gobject);
 
-	/* Unref the key */
-	if (self->pv->pubkey)
-		gpgmex_key_unref (self->pv->pubkey);
-	self->pv->pubkey = NULL;
-	self->pv->userid = NULL;
+	seahorse_object_list_free (self->pv->signatures);
+	self->pv->signatures = NULL;
+	
+	g_free (self->pv->name);
+	self->pv->name = NULL;
+	
+	g_free (self->pv->email);
+	self->pv->email = NULL;
+	
+	g_free (self->pv->comment);
+	self->pv->comment = NULL;
     
 	G_OBJECT_CLASS (seahorse_pgp_uid_parent_class)->finalize (gobject);
 }
@@ -235,30 +289,15 @@
 	seahorse_pgp_uid_parent_class = g_type_class_peek_parent (klass);
 	g_type_class_add_private (klass, sizeof (SeahorsePgpUidPrivate));
 
-	gobject_class->constructor = seahorse_pgp_uid_constructor;
 	gobject_class->finalize = seahorse_pgp_uid_object_finalize;
 	gobject_class->set_property = seahorse_pgp_uid_set_property;
 	gobject_class->get_property = seahorse_pgp_uid_get_property;
     
-	g_object_class_install_property (gobject_class, PROP_PUBKEY,
-	        g_param_spec_boxed ("pubkey", "Public Key", "GPGME Public Key that this uid is on",
-	                            SEAHORSE_PGP_BOXED_KEY, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
-
-	g_object_class_install_property (gobject_class, PROP_USERID,
-	        g_param_spec_pointer ("userid", "User ID", "GPGME User ID",
-	                              G_PARAM_READWRITE));
-                      
-	g_object_class_install_property (gobject_class, PROP_GPGME_INDEX,
-	        g_param_spec_uint ("gpgme-index", "GPGME Index", "GPGME User ID Index",
-	                           0, G_MAXUINT, 0, G_PARAM_READWRITE));
+	SEAHORSE_OBJECT_CLASS (klass)->realize = seahorse_pgp_uid_realize;
 	
-	g_object_class_install_property (gobject_class, PROP_ACTUAL_INDEX,
-	        g_param_spec_uint ("actual-index", "Actual Index", "Actual GPG Index",
-	                           0, G_MAXUINT, 0, G_PARAM_READWRITE));
-         
 	g_object_class_install_property (gobject_class, PROP_VALIDITY,
 	        g_param_spec_uint ("validity", "Validity", "Validity of this identity",
-	                           0, G_MAXUINT, 0, G_PARAM_READABLE));
+	                           0, G_MAXUINT, 0, G_PARAM_READWRITE));
 
         g_object_class_install_property (gobject_class, PROP_VALIDITY_STR,
                 g_param_spec_string ("validity-str", "Validity String", "Validity of this identity as a string",
@@ -266,113 +305,77 @@
         
         g_object_class_install_property (gobject_class, PROP_NAME,
                 g_param_spec_string ("name", "Name", "User ID name",
-                                     "", G_PARAM_READABLE));
+                                     "", G_PARAM_READWRITE));
 
         g_object_class_install_property (gobject_class, PROP_EMAIL,
                 g_param_spec_string ("email", "Email", "User ID email",
-                                     "", G_PARAM_READABLE));
+                                     "", G_PARAM_READWRITE));
 
         g_object_class_install_property (gobject_class, PROP_COMMENT,
                 g_param_spec_string ("comment", "Comment", "User ID comment",
-                                     "", G_PARAM_READABLE));
+                                     "", G_PARAM_READWRITE));
+        
+        g_object_class_install_property (gobject_class, PROP_SIGNATURES,
+                g_param_spec_boxed ("signatures", "Signatures", "Signatures on this UID",
+                                    SEAHORSE_BOXED_OBJECT_LIST, G_PARAM_READWRITE));
 }
 
 /* -----------------------------------------------------------------------------
  * PUBLIC 
  */
 
-SeahorsePgpUid* 
-seahorse_pgp_uid_new (gpgme_key_t pubkey, gpgme_user_id_t userid) 
+SeahorsePgpUid*
+seahorse_pgp_uid_new (const gchar *uid_string)
 {
-	return g_object_new (SEAHORSE_TYPE_PGP_UID, 
-	                     "pubkey", pubkey, 
-	                     "userid", userid, NULL);
-}
-
-
-gpgme_key_t
-seahorse_pgp_uid_get_pubkey (SeahorsePgpUid *self)
-{
-	g_return_val_if_fail (SEAHORSE_IS_PGP_UID (self), NULL);
-	g_return_val_if_fail (self->pv->pubkey, NULL);
-	return self->pv->pubkey;
+	SeahorsePgpUid *uid;
+	gchar *name = NULL;
+	gchar *email = NULL;
+	gchar *comment = NULL;
+	
+	if (uid_string)
+		parse_user_id (uid_string, &name, &email, &comment);
+	
+	uid = g_object_new (SEAHORSE_TYPE_PGP_UID, "name", name, "email", email, "comment", comment, NULL);
+	
+	g_free (name);
+	g_free (comment);
+	g_free (email);
+	
+	return uid;
 }
 
-gpgme_user_id_t
-seahorse_pgp_uid_get_userid (SeahorsePgpUid *self)
+GList*
+seahorse_pgp_uid_get_signatures (SeahorsePgpUid *self)
 {
 	g_return_val_if_fail (SEAHORSE_IS_PGP_UID (self), NULL);
-	g_return_val_if_fail (self->pv->userid, NULL);
-	return self->pv->userid;
+	return self->pv->signatures;
 }
 
 void
-seahorse_pgp_uid_set_userid (SeahorsePgpUid *self, gpgme_user_id_t userid)
+seahorse_pgp_uid_set_signatures (SeahorsePgpUid *self, GList *signatures)
 {
-	GObject *obj;
-	gpgme_user_id_t uid;
-	gint index, i;
-	
 	g_return_if_fail (SEAHORSE_IS_PGP_UID (self));
-	g_return_if_fail (userid);
-	
-	/* Make sure that this userid is in the pubkey */
-	index = -1;
-	for (i = 0, uid = self->pv->pubkey->uids; uid; ++i, uid = uid->next) {
-		if(userid == uid) {
-			index = i;
-			break;
-		}
-	}
-	
-	g_return_if_fail (index >= 0);
 	
-	self->pv->userid = userid;
-	self->pv->gpgme_index = index;
+	seahorse_object_list_free (self->pv->signatures);
+	self->pv->signatures = seahorse_object_list_copy (signatures);
 	
-	obj = G_OBJECT (self);
-	g_object_freeze_notify (obj);
-	changed_uid (self);
-	g_object_notify (obj, "userid");
-	g_object_notify (obj, "gpgme_index");
-	g_object_notify (obj, "name");
-	g_object_notify (obj, "email");
-	g_object_notify (obj, "comment");
-	g_object_notify (obj, "validity");
-	g_object_notify (obj, "validity-str");
-	g_object_thaw_notify (obj);
+	g_object_notify (G_OBJECT (self), "signatures");	
 }
 
-guint
-seahorse_pgp_uid_get_gpgme_index (SeahorsePgpUid *self)
-{
-	g_return_val_if_fail (SEAHORSE_IS_PGP_UID (self), 0);
-	return self->pv->gpgme_index;
-}
-
-guint
-seahorse_pgp_uid_get_actual_index (SeahorsePgpUid *self)
+SeahorseValidity
+seahorse_pgp_uid_get_validity (SeahorsePgpUid *self)
 {
-	g_return_val_if_fail (SEAHORSE_IS_PGP_UID (self), 0);
-	if(self->pv->actual_index < 0)
-		return self->pv->gpgme_index;
-	return self->pv->actual_index;
+	g_return_val_if_fail (SEAHORSE_IS_PGP_UID (self), SEAHORSE_VALIDITY_UNKNOWN);
+	return self->pv->validity;
 }
 
 void
-seahorse_pgp_uid_set_actual_index (SeahorsePgpUid *self, guint actual_index)
+seahorse_pgp_uid_set_validity (SeahorsePgpUid *self, SeahorseValidity validity)
 {
 	g_return_if_fail (SEAHORSE_IS_PGP_UID (self));
-	self->pv->actual_index = actual_index;
-	g_object_notify (G_OBJECT (self), "actual-index");
-}
-
-SeahorseValidity
-seahorse_pgp_uid_get_validity (SeahorsePgpUid *self)
-{
-	g_return_val_if_fail (SEAHORSE_IS_PGP_UID (self), SEAHORSE_VALIDITY_UNKNOWN);
-	g_return_val_if_fail (self->pv->userid, SEAHORSE_VALIDITY_UNKNOWN);
-	return gpgmex_validity_to_seahorse (self->pv->userid->validity);
+	self->pv->validity = validity;
+	g_object_notify (G_OBJECT (self), "validity");
+	g_object_notify (G_OBJECT (self), "validity-str");
 }
 
 const gchar*
@@ -381,59 +384,124 @@
 	return seahorse_validity_get_string (seahorse_pgp_uid_get_validity (self));
 }
 
-gchar*
+const gchar*
 seahorse_pgp_uid_get_name (SeahorsePgpUid *self)
 {
 	g_return_val_if_fail (SEAHORSE_IS_PGP_UID (self), NULL);
-	g_return_val_if_fail (self->pv->userid, NULL);
-	return convert_string (self->pv->userid->name, FALSE);
+	if (!self->pv->name)
+		self->pv->name = g_strdup ("");
+	return self->pv->name;
 }
 
-gchar*
+void
+seahorse_pgp_uid_set_name (SeahorsePgpUid *self, const gchar *name)
+{
+	GObject *obj;
+	
+	g_return_if_fail (SEAHORSE_IS_PGP_UID (self));
+	
+	g_free (self->pv->name);
+	self->pv->name = g_strdup (name);
+	
+	obj = G_OBJECT (self);
+	g_object_freeze_notify (obj);
+	if (self->pv->realized)
+		seahorse_pgp_uid_realize (SEAHORSE_OBJECT (self));
+	g_object_notify (obj, "name");
+	g_object_thaw_notify (obj);
+}
+
+const gchar*
 seahorse_pgp_uid_get_email (SeahorsePgpUid *self)
 {
 	g_return_val_if_fail (SEAHORSE_IS_PGP_UID (self), NULL);
-	g_return_val_if_fail (self->pv->userid, NULL);
-	return convert_string (self->pv->userid->email, FALSE);
+	if (!self->pv->email)
+		self->pv->email = g_strdup ("");
+	return self->pv->email;
 }
 
-gchar*
+void
+seahorse_pgp_uid_set_email (SeahorsePgpUid *self, const gchar *email)
+{
+	GObject *obj;
+	
+	g_return_if_fail (SEAHORSE_IS_PGP_UID (self));
+	
+	g_free (self->pv->email);
+	self->pv->email = g_strdup (email);
+	
+	obj = G_OBJECT (self);
+	g_object_freeze_notify (obj);
+	if (self->pv->realized)
+		seahorse_pgp_uid_realize (SEAHORSE_OBJECT (self));
+	g_object_notify (obj, "email");
+	g_object_thaw_notify (obj);
+}
+
+const gchar*
 seahorse_pgp_uid_get_comment (SeahorsePgpUid *self)
 {
 	g_return_val_if_fail (SEAHORSE_IS_PGP_UID (self), NULL);
-	g_return_val_if_fail (self->pv->userid, NULL);
-	return convert_string (self->pv->userid->comment, FALSE);
+	if (!self->pv->comment)
+		self->pv->comment = g_strdup ("");
+	return self->pv->comment;
 }
 
-gchar*
-seahorse_pgp_uid_calc_label (gpgme_user_id_t userid)
+void
+seahorse_pgp_uid_set_comment (SeahorsePgpUid *self, const gchar *comment)
 {
-	g_return_val_if_fail (userid, NULL);
-	return convert_string (userid->uid, FALSE);
+	GObject *obj;
+	
+	g_return_if_fail (SEAHORSE_IS_PGP_UID (self));
+	
+	g_free (self->pv->comment);
+	self->pv->comment = g_strdup (comment);
+	
+	obj = G_OBJECT (self);
+	g_object_freeze_notify (obj);
+	if (self->pv->realized)
+		seahorse_pgp_uid_realize (SEAHORSE_OBJECT (self));
+	g_object_notify (obj, "comment");
+	g_object_thaw_notify (obj);
 }
 
 gchar*
-seahorse_pgp_uid_calc_name (gpgme_user_id_t userid)
+seahorse_pgp_uid_calc_label (const gchar *name, const gchar *email, 
+                             const gchar *comment)
 {
-	g_return_val_if_fail (userid, NULL);
-	return convert_string (userid->name, FALSE);
+	GString *string;
+
+	g_return_val_if_fail (name, NULL);
+
+	string = g_string_new ("");
+	g_string_append (string, name);
+	
+	if (email && email[0]) {
+		g_string_append (string, " <");
+		g_string_append (string, email);
+		g_string_append (string, ">");
+	}
+	
+	if (comment && comment[0]) {
+		g_string_append (string, " (");
+		g_string_append (string, comment);
+		g_string_append (string, ")");
+	}
+	
+	return g_string_free (string, FALSE);
 }
 
 gchar*
-seahorse_pgp_uid_calc_markup (gpgme_user_id_t userid, guint flags)
+seahorse_pgp_uid_calc_markup (const gchar *name, const gchar *email, 
+                              const gchar *comment, guint flags)
 {
-	gchar *email, *name, *comment, *ret;
 	const gchar *format;
 	gboolean strike = FALSE;
 
-	g_return_val_if_fail (userid, NULL);
+	g_return_val_if_fail (name, NULL);
 	
-	name = convert_string (userid->name, TRUE);
-	email = convert_string (userid->email, TRUE);
-	comment = convert_string (userid->comment, TRUE);
-
-	if (userid->revoked || flags & CRYPTUI_FLAG_EXPIRED || 
-	    flags & CRYPTUI_FLAG_REVOKED || flags & CRYPTUI_FLAG_DISABLED)
+	if (flags & SEAHORSE_FLAG_EXPIRED || flags & SEAHORSE_FLAG_REVOKED || 
+	    flags & SEAHORSE_FLAG_DISABLED)
 		strike = TRUE;
 	    
 	if (strike)
@@ -441,51 +509,10 @@
 	else
 		format = "%s<span foreground='#555555' size='small' rise='0'>%s%s%s%s%s</span>";
 		
-	ret = g_markup_printf_escaped (format, name,
+	return g_markup_printf_escaped (format, name,
 	 	          email && email[0] ? "  " : "",
 	 	          email && email[0] ? email : "",
 	 	          comment && comment[0] ? "  '" : "",
 	 	          comment && comment[0] ? comment : "",
 	 	          comment && comment[0] ? "'" : "");
-	    
-	g_free (name);
-	g_free (comment);
-	g_free (email);
-	    
-	return ret;
-}
-
-void
-seahorse_pgp_uid_signature_get_text (gpgme_key_sig_t signature,
-                                     gchar **name, gchar **email, gchar **comment)
-{
-	g_return_if_fail (signature != NULL);
-    
-	if (name)
-		*name = signature->name ? convert_string (signature->name, FALSE) : NULL;
-	if (email)
-		*email = signature->email ? convert_string (signature->email, FALSE) : NULL;
-	if (comment)
-		*comment = signature->comment ? convert_string (signature->comment, FALSE) : NULL;
-}
-
-guint         
-seahorse_pgp_uid_signature_get_type (gpgme_key_sig_t signature)
-{
-	SeahorseObject *sobj;
-	GQuark id;
-
-	g_return_val_if_fail (signature != NULL, 0);
-    
-	id = seahorse_pgp_key_get_cannonical_id (signature->keyid);
-	sobj = seahorse_context_find_object (SCTX_APP (), id, SEAHORSE_LOCATION_LOCAL);
-    
-	if (sobj) {
-		if (seahorse_object_get_usage (sobj) == SEAHORSE_USAGE_PRIVATE_KEY) 
-			return SKEY_PGPSIG_TRUSTED | SKEY_PGPSIG_PERSONAL;
-		if (seahorse_object_get_flags (sobj) & SEAHORSE_FLAG_TRUSTED)
-			return SKEY_PGPSIG_TRUSTED;
-	}
-
-	return 0;
 }

Modified: trunk/pgp/seahorse-pgp-uid.h
==============================================================================
--- trunk/pgp/seahorse-pgp-uid.h	(original)
+++ trunk/pgp/seahorse-pgp-uid.h	Tue Dec 16 02:49:26 2008
@@ -22,19 +22,13 @@
 #ifndef __SEAHORSE_PGP_UID_H__
 #define __SEAHORSE_PGP_UID_H__
 
-#include <gtk/gtk.h>
-#include <gpgme.h>
+#include <glib-object.h>
 
 #include "seahorse-object.h"
-
-#include "pgp/seahorse-pgp-module.h"
-#include "pgp/seahorse-gpgmex.h"
+#include "seahorse-validity.h"
 
 #define SEAHORSE_TYPE_PGP_UID            (seahorse_pgp_uid_get_type ())
 
-/* For vala's sake */
-#define SEAHORSE_PGP_TYPE_UID 		SEAHORSE_TYPE_PGP_UID
-
 #define SEAHORSE_PGP_UID(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), SEAHORSE_TYPE_PGP_UID, SeahorsePgpUid))
 #define SEAHORSE_PGP_UID_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), SEAHORSE_TYPE_PGP_UID, SeahorsePgpUidClass))
 #define SEAHORSE_IS_PGP_UID(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SEAHORSE_TYPE_PGP_UID))
@@ -56,48 +50,43 @@
 
 GType             seahorse_pgp_uid_get_type             (void);
 
-SeahorsePgpUid*   seahorse_pgp_uid_new                  (gpgme_key_t pubkey,
-                                                         gpgme_user_id_t userid);
-
-gpgme_key_t       seahorse_pgp_uid_get_pubkey           (SeahorsePgpUid *self);
-
-gpgme_user_id_t   seahorse_pgp_uid_get_userid           (SeahorsePgpUid *self);
-
-void              seahorse_pgp_uid_set_userid           (SeahorsePgpUid *self,
-                                                         gpgme_user_id_t userid);
+SeahorsePgpUid*   seahorse_pgp_uid_new                  (const gchar *uid_string);
 
-guint             seahorse_pgp_uid_get_gpgme_index      (SeahorsePgpUid *self);
+GList*            seahorse_pgp_uid_get_signatures       (SeahorsePgpUid *self);
 
-guint             seahorse_pgp_uid_get_actual_index     (SeahorsePgpUid *self);
-
-void              seahorse_pgp_uid_set_actual_index     (SeahorsePgpUid *self,
-                                                         guint actual_index);
+void              seahorse_pgp_uid_set_signatures       (SeahorsePgpUid *self,
+                                                         GList *signatures);
 
 SeahorseValidity  seahorse_pgp_uid_get_validity         (SeahorsePgpUid *self);
 
+void              seahorse_pgp_uid_set_validity         (SeahorsePgpUid *self,
+                                                         SeahorseValidity validity);
+
 const gchar*      seahorse_pgp_uid_get_validity_str     (SeahorsePgpUid *self);
 
 
-gchar*            seahorse_pgp_uid_get_name             (SeahorsePgpUid *self);
+const gchar*      seahorse_pgp_uid_get_name             (SeahorsePgpUid *self);
 
-gchar*            seahorse_pgp_uid_get_email            (SeahorsePgpUid *self);
+void              seahorse_pgp_uid_set_name             (SeahorsePgpUid *self,
+                                                         const gchar *name);
 
-gchar*            seahorse_pgp_uid_get_comment          (SeahorsePgpUid *self);
+const gchar*      seahorse_pgp_uid_get_email            (SeahorsePgpUid *self);
 
-gchar*            seahorse_pgp_uid_calc_name            (gpgme_user_id_t userid);
+void              seahorse_pgp_uid_set_email            (SeahorsePgpUid *self,
+                                                         const gchar *comment);
 
-gchar*            seahorse_pgp_uid_calc_label           (gpgme_user_id_t userid);
+const gchar*      seahorse_pgp_uid_get_comment          (SeahorsePgpUid *self);
 
-gchar*            seahorse_pgp_uid_calc_markup          (gpgme_user_id_t userid,
-                                                         guint flags);
+void              seahorse_pgp_uid_set_comment          (SeahorsePgpUid *self,
+                                                         const gchar *comment);
 
-guint             seahorse_pgp_uid_signature_get_type   (gpgme_key_sig_t  signature);
+gchar*            seahorse_pgp_uid_calc_label           (const gchar *name,
+                                                         const gchar *email,
+                                                         const gchar *comment);
 
-void              seahorse_pgp_uid_signature_get_text   (gpgme_key_sig_t  signature,
-                                                         gchar            **name,
-                                                         gchar            **email,
-                                                         gchar            **comment);
-
-GQuark            seahorse_pgp_uid_get_cannonical_id    (const gchar *id);
+gchar*            seahorse_pgp_uid_calc_markup          (const gchar *name,
+                                                         const gchar *email,
+                                                         const gchar *comment,
+                                                         guint flags);
 
 #endif /* __SEAHORSE_PGP_UID_H__ */

Modified: trunk/pgp/seahorse-pgp.c
==============================================================================
--- trunk/pgp/seahorse-pgp.c	(original)
+++ trunk/pgp/seahorse-pgp.c	Tue Dec 16 02:49:26 2008
@@ -20,15 +20,3 @@
  */
 
 #include "seahorse-pgp.h"
-#include "seahorse-gpgmex.h"
-
-GType
-seahorse_pgp_boxed_key_type (void)
-{
-	static GType type = 0;
-	if (!type)
-		type = g_boxed_type_register_static ("gpgme_key_t", 
-		                                     (GBoxedCopyFunc)gpgmex_key_ref,
-		                                     (GBoxedFreeFunc)gpgmex_key_unref);
-	return type;
-}

Modified: trunk/pgp/seahorse-pgp.h
==============================================================================
--- trunk/pgp/seahorse-pgp.h	(original)
+++ trunk/pgp/seahorse-pgp.h	Tue Dec 16 02:49:26 2008
@@ -27,16 +27,10 @@
 
 G_BEGIN_DECLS
 
-
-
 #define SEAHORSE_PGP_TYPE_STR "openpgp"
 #define SEAHORSE_PGP_TYPE g_quark_from_string ("openpgp")
 #define SEAHORSE_PGP_STOCK_ICON "seahorse-key-personal"
 
-#define     SEAHORSE_PGP_BOXED_KEY               (seahorse_pgp_boxed_key_type ())
-
-GType       seahorse_pgp_boxed_key_type          (void);
-
 G_END_DECLS
 
 #endif

Modified: trunk/pgp/seahorse-server-source.c
==============================================================================
--- trunk/pgp/seahorse-server-source.c	(original)
+++ trunk/pgp/seahorse-server-source.c	Tue Dec 16 02:49:26 2008
@@ -26,7 +26,6 @@
 
 #include <glib/gi18n.h>
 
-#include "seahorse-gpgmex.h"
 #include "seahorse-operation.h"
 #include "seahorse-ldap-source.h"
 #include "seahorse-hkp-source.h"
@@ -216,83 +215,6 @@
  * HELPERS 
  */
 
-/* Combine information from one key and tack onto others */
-static void 
-combine_keys (SeahorseServerSource *ssrc, gpgme_key_t k, gpgme_key_t key)
-{
-    gpgme_user_id_t uid;
-    gpgme_user_id_t u;
-    gpgme_subkey_t subkey;
-    gpgme_subkey_t s;
-    gboolean found;
-    
-    g_assert (k != NULL);
-    g_assert (key != NULL);
-    
-    /* Go through user ids */
-    for (uid = key->uids; uid != NULL; uid = uid->next) {
-        g_assert (uid->uid);
-        found = FALSE;
-        
-        for (u = k->uids; u != NULL; u = u->next) {
-            g_assert (u->uid);
-            
-            if (strcmp (u->uid, uid->uid) == 0) {
-                found = TRUE;
-                break;
-            }
-        }
-        
-        if (!found)
-            gpgmex_key_copy_uid (k, uid);
-    }
-    
-    /* Go through subkeys */
-    for (subkey = key->subkeys; subkey != NULL; subkey = subkey->next) {
-        g_assert (subkey->fpr);
-        found = FALSE;
-        
-        for (s = k->subkeys; s != NULL; s = s->next) {
-            g_assert (s->fpr);
-            
-            if (strcmp (s->fpr, subkey->fpr) == 0) {
-                found = TRUE;
-                break;
-            }
-        }
-        
-        if (!found)
-            gpgmex_key_copy_subkey (k, subkey);
-    }
-}
-
-void
-seahorse_server_source_add_key (SeahorseServerSource *ssrc, gpgme_key_t key)
-{
-    SeahorseObject *prev;
-    SeahorsePgpKey *pkey;
-    GQuark keyid;
-       
-    g_return_if_fail (SEAHORSE_IS_SERVER_SOURCE (ssrc));
-    g_return_if_fail (key && key->subkeys && key->subkeys->keyid);
-
-    keyid = seahorse_pgp_key_get_cannonical_id (key->subkeys->keyid);
-    prev = seahorse_context_get_object (SCTX_APP (), SEAHORSE_SOURCE (ssrc), keyid);
-    
-    /* TODO: This function needs reworking after we get more key types */
-    if (prev != NULL) {
-        g_return_if_fail (SEAHORSE_IS_PGP_KEY (prev));
-        combine_keys (ssrc, seahorse_pgp_key_get_public (SEAHORSE_PGP_KEY (prev)), key);
-        return;
-    }
-
-    /* A public key */
-    pkey = seahorse_pgp_key_new (SEAHORSE_SOURCE (ssrc), key, NULL);
-
-    /* Add to context */ 
-    seahorse_context_add_object (SCTX_APP (), SEAHORSE_OBJECT (pkey));
-}
- 
 void
 seahorse_server_source_take_operation (SeahorseServerSource *ssrc, SeahorseOperation *op)
 {



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