seahorse r2659 - in trunk: . gkr libseahorse pgp pkcs11 ssh



Author: nnielsen
Date: Sun Dec 14 14:53:04 2008
New Revision: 2659
URL: http://svn.gnome.org/viewvc/seahorse?rev=2659&view=rev

Log:
	* gkr/seahorse-gkr-item.c:
	* gkr/seahorse-gkr-item-properties.c:
	* gkr/seahorse-gkr-keyring.c:
	* gkr/seahorse-gkr-operation.c:
	* gkr/seahorse-gkr-operation.h:
	* gkr/seahorse-gkr-source.c:
	* libseahorse/seahorse-context.c:
	* libseahorse/seahorse-object.c:
	* libseahorse/seahorse-object.h:
	* libseahorse/seahorse-prefs-keyrings.c:
	* libseahorse/seahorse-source.c:
	* libseahorse/seahorse-source.h:
	* libseahorse/seahorse-types.h:
	* libseahorse/seahorse-unknown.c:
	* libseahorse/seahorse-unknown-source.c:
	* pgp/seahorse-hkp-source.c:
	* pgp/seahorse-ldap-source.c:
	* pgp/seahorse-pgp-key.c:
	* pgp/seahorse-pgp-key-op.c:
	* pgp/seahorse-pgp-key-properties.c:
	* pgp/seahorse-pgp-source.c:
	* pkcs11/gp11.vapi: (removed)
	* pkcs11/gp11-hacks.h: (removed)
	* pkcs11/libseahorse-pkcs11-c.vapi: (removed)
	* pkcs11/Makefile.am:
	* pkcs11/p11.vapi: (removed)
	* pkcs11/seahorse-pkcs11.c:
	* pkcs11/seahorse-pkcs11.h:
	* pkcs11/seahorse-pkcs11.vala: (removed)
	* pkcs11/seahorse-pkcs11-certificate.c:
	* pkcs11/seahorse-pkcs11-certificate.h:
	* pkcs11/seahorse-pkcs11-commands.c:
	* pkcs11/seahorse-pkcs11-helpers.c: (added)
	* pkcs11/seahorse-pkcs11-helpers.h: (added)
	* pkcs11/seahorse-pkcs11-module.c:
	* pkcs11/seahorse-pkcs11-object.c: (added)
	* pkcs11/seahorse-pkcs11-object.h: (added)
	* pkcs11/seahorse-pkcs11-operations.c: (added)
	* pkcs11/seahorse-pkcs11-operations.h: (added)
	* pkcs11/seahorse-pkcs11-source.c:
	* pkcs11/seahorse-pkcs11-source.h:
	* pkcs11/seahorse-pkcs11-source.vala: (removed)
	Remove delete from the source to the object. The object now 
	knows how to delete itself (if possible). Change how refresh 
	works so that an object is always as valid as possible.
	Rework PKCS#11 objects and sources. 


Added:
   trunk/pkcs11/seahorse-pkcs11-helpers.c
   trunk/pkcs11/seahorse-pkcs11-helpers.h
   trunk/pkcs11/seahorse-pkcs11-object.c
   trunk/pkcs11/seahorse-pkcs11-object.h
   trunk/pkcs11/seahorse-pkcs11-operations.c
   trunk/pkcs11/seahorse-pkcs11-operations.h
Removed:
   trunk/pkcs11/gp11-hacks.h
   trunk/pkcs11/gp11.vapi
   trunk/pkcs11/libseahorse-pkcs11-c.vapi
   trunk/pkcs11/p11.vapi
   trunk/pkcs11/seahorse-pkcs11-source.vala
   trunk/pkcs11/seahorse-pkcs11.vala
   trunk/pkcs11/vala-build.stamp
Modified:
   trunk/ChangeLog
   trunk/gkr/seahorse-gkr-item-properties.c
   trunk/gkr/seahorse-gkr-item.c
   trunk/gkr/seahorse-gkr-keyring.c
   trunk/gkr/seahorse-gkr-operation.c
   trunk/gkr/seahorse-gkr-operation.h
   trunk/gkr/seahorse-gkr-source.c
   trunk/libseahorse/seahorse-context.c
   trunk/libseahorse/seahorse-object.c
   trunk/libseahorse/seahorse-object.h
   trunk/libseahorse/seahorse-prefs-keyrings.c
   trunk/libseahorse/seahorse-source.c
   trunk/libseahorse/seahorse-source.h
   trunk/libseahorse/seahorse-types.h
   trunk/libseahorse/seahorse-unknown-source.c
   trunk/libseahorse/seahorse-unknown.c
   trunk/pgp/seahorse-hkp-source.c
   trunk/pgp/seahorse-ldap-source.c
   trunk/pgp/seahorse-pgp-key-op.c
   trunk/pgp/seahorse-pgp-key-properties.c
   trunk/pgp/seahorse-pgp-key.c
   trunk/pgp/seahorse-pgp-source.c
   trunk/pkcs11/Makefile.am
   trunk/pkcs11/seahorse-pkcs11-certificate.c
   trunk/pkcs11/seahorse-pkcs11-certificate.h
   trunk/pkcs11/seahorse-pkcs11-commands.c
   trunk/pkcs11/seahorse-pkcs11-module.c
   trunk/pkcs11/seahorse-pkcs11-source.c
   trunk/pkcs11/seahorse-pkcs11-source.h
   trunk/pkcs11/seahorse-pkcs11.c
   trunk/pkcs11/seahorse-pkcs11.h
   trunk/ssh/seahorse-ssh-key.c
   trunk/ssh/seahorse-ssh-operation.c
   trunk/ssh/seahorse-ssh-source.c

Modified: trunk/gkr/seahorse-gkr-item-properties.c
==============================================================================
--- trunk/gkr/seahorse-gkr-item-properties.c	(original)
+++ trunk/gkr/seahorse-gkr-item-properties.c	Sun Dec 14 14:53:04 2008
@@ -320,7 +320,7 @@
     
 	/* Make sure not the same */
 	text = gtk_entry_get_text (GTK_ENTRY (entry));
-	original = gnome_keyring_item_info_get_display_name (info);
+	original = seahorse_object_get_label (object);
 	if (text != original && g_utf8_collate (text, original ? original : "") != 0) {
 		
 		info = gnome_keyring_item_info_copy (info);
@@ -745,7 +745,6 @@
 seahorse_gkr_item_properties_show (SeahorseGkrItem *git, GtkWindow *parent)
 {
     SeahorseObject *object = SEAHORSE_OBJECT (git);
-    SeahorseSource *sksrc;
     SeahorseWidget *swidget = NULL;
     GtkWidget *widget;
 
@@ -755,9 +754,7 @@
     if (swidget == NULL)
         return;
 
-    /* This causes the key source to get any specific info about the key */
-    sksrc = seahorse_object_get_source (SEAHORSE_OBJECT (git));
-    seahorse_source_load_async (sksrc, seahorse_object_get_id (object));
+    seahorse_object_refresh (object);
 
     widget = glade_xml_get_widget (swidget->xml, swidget->name);
     g_signal_connect (widget, "response", G_CALLBACK (properties_response), swidget);

Modified: trunk/gkr/seahorse-gkr-item.c
==============================================================================
--- trunk/gkr/seahorse-gkr-item.c	(original)
+++ trunk/gkr/seahorse-gkr-item.c	Sun Dec 14 14:53:04 2008
@@ -27,11 +27,13 @@
 
 #include "seahorse-context.h"
 #include "seahorse-source.h"
-#include "seahorse-gkr-item.h"
 #include "seahorse-gtkstock.h"
 #include "seahorse-util.h"
 #include "seahorse-secure-memory.h"
 
+#include "seahorse-gkr-item.h"
+#include "seahorse-gkr-operation.h"
+
 /* For gnome-keyring secret type ids */
 #ifdef WITH_PGP
 #include "pgp/seahorse-pgp.h"
@@ -137,12 +139,9 @@
 		seahorse_gkr_item_set_info (self, info);
 }
 
-static gboolean
-require_item_info (SeahorseGkrItem *self)
+static void
+load_item_info (SeahorseGkrItem *self)
 {
-	if (self->pv->item_info)
-		return TRUE;
-	
 	/* Already in progress */
 	if (!self->pv->req_info) {
 		g_object_ref (self);
@@ -152,7 +151,13 @@
 		                                                       received_item_info,
 		                                                       self, g_object_unref);
 	}
-	
+}
+
+static gboolean
+require_item_info (SeahorseGkrItem *self)
+{
+	if (!self->pv->item_info)
+		load_item_info (self);
 	return self->pv->item_info != NULL;
 }
 
@@ -168,12 +173,9 @@
 	}
 }
 
-static gboolean
-require_item_secret (SeahorseGkrItem *self)
+static void
+load_item_secret (SeahorseGkrItem *self)
 {
-	if (self->pv->item_secret)
-		return TRUE;
-	
 	/* Already in progress */
 	if (!self->pv->req_secret) {
 		g_object_ref (self);
@@ -182,8 +184,14 @@
 		                                                         GNOME_KEYRING_ITEM_INFO_SECRET,
 		                                                         received_item_secret,
 		                                                         self, g_object_unref);
-	}
-	
+	}	
+}
+
+static gboolean
+require_item_secret (SeahorseGkrItem *self)
+{
+	if (!self->pv->item_secret)
+		load_item_secret (self);
 	return self->pv->item_secret != NULL;
 }
 
@@ -196,12 +204,9 @@
 		seahorse_gkr_item_set_attributes (self, attrs);
 }
 
-static gboolean
-require_item_attrs (SeahorseGkrItem *self)
+static void
+load_item_attrs (SeahorseGkrItem *self)
 {
-	if (self->pv->item_attrs)
-		return TRUE;
-	
 	/* Already in progress */
 	if (!self->pv->req_attrs) {
 		g_object_ref (self);
@@ -209,8 +214,14 @@
 		                                                         self->pv->item_id,
 		                                                         received_item_attrs,
 		                                                         self, g_object_unref);
-	}
-	
+	}	
+}
+
+static gboolean
+require_item_attrs (SeahorseGkrItem *self)
+{
+	if (!self->pv->item_attrs)
+		load_item_attrs (self);
 	return self->pv->item_attrs != NULL;
 }
 
@@ -223,12 +234,9 @@
 		seahorse_gkr_item_set_acl (self, acl);
 }
 
-static gboolean
-require_item_acl (SeahorseGkrItem *self)
+static void
+load_item_acl (SeahorseGkrItem *self)
 {
-	if (self->pv->item_acl)
-		return TRUE;
-	
 	/* Already in progress */
 	if (!self->pv->req_acl) {
 		g_object_ref (self);
@@ -237,7 +245,13 @@
 		                                                received_item_acl,
 		                                                self, g_object_unref);
 	}
-	
+}
+
+static gboolean
+require_item_acl (SeahorseGkrItem *self)
+{
+	if (!self->pv->item_acl)
+		load_item_acl (self);
 	return self->pv->item_acl != NULL;
 }
 
@@ -499,29 +513,27 @@
 }
 
 static void
-seahorse_gkr_item_flush (SeahorseObject *obj)
+seahorse_gkr_item_refresh (SeahorseObject *obj)
 {
 	SeahorseGkrItem *self = SEAHORSE_GKR_ITEM (obj);
-
+	
 	if (self->pv->item_info)
-		gnome_keyring_item_info_free (self->pv->item_info);
-	self->pv->item_info = NULL;
-	g_assert (self->pv->req_info == NULL);
-    
+		load_item_info (self);
 	if (self->pv->item_attrs)
-		gnome_keyring_attribute_list_free (self->pv->item_attrs);
-	self->pv->item_attrs = NULL;
-	g_assert (self->pv->req_attrs == NULL);
-    
-	gnome_keyring_acl_free (self->pv->item_acl);
-	self->pv->item_acl = NULL;
-	g_assert (self->pv->req_acl == NULL);
-	
-	g_free (self->pv->item_secret);
-	self->pv->item_secret = NULL;
-	g_assert (self->pv->req_secret == NULL);
-	
-	SEAHORSE_OBJECT_CLASS (seahorse_gkr_item_parent_class)->flush (obj);
+		load_item_attrs (self);
+	if (self->pv->item_acl)
+		load_item_acl (self);
+	if (self->pv->item_secret)
+		load_item_secret (self);
+
+	SEAHORSE_OBJECT_CLASS (seahorse_gkr_item_parent_class)->refresh (obj);
+}
+
+static SeahorseOperation*
+seahorse_gkr_item_delete (SeahorseObject *obj)
+{
+	SeahorseGkrItem *self = SEAHORSE_GKR_ITEM (obj);
+	return seahorse_gkr_operation_delete_item (self);
 }
 
 static void
@@ -622,9 +634,24 @@
 	g_free (self->pv->keyring_name);
 	self->pv->keyring_name = NULL;
     
-	g_object_freeze_notify (gobject);
-	seahorse_gkr_item_flush (SEAHORSE_OBJECT (self));
+	if (self->pv->item_info)
+		gnome_keyring_item_info_free (self->pv->item_info);
+	self->pv->item_info = NULL;
+	g_assert (self->pv->req_info == NULL);
     
+	if (self->pv->item_attrs)
+		gnome_keyring_attribute_list_free (self->pv->item_attrs);
+	self->pv->item_attrs = NULL;
+	g_assert (self->pv->req_attrs == NULL);
+    
+	gnome_keyring_acl_free (self->pv->item_acl);
+	self->pv->item_acl = NULL;
+	g_assert (self->pv->req_acl == NULL);
+	
+	g_free (self->pv->item_secret);
+	self->pv->item_secret = NULL;
+	g_assert (self->pv->req_secret == NULL);
+	
 	G_OBJECT_CLASS (seahorse_gkr_item_parent_class)->finalize (gobject);
 }
 
@@ -644,7 +671,8 @@
 	
 	seahorse_class = SEAHORSE_OBJECT_CLASS (klass);
 	seahorse_class->realize = seahorse_gkr_item_realize;
-	seahorse_class->flush = seahorse_gkr_item_flush;
+	seahorse_class->refresh = seahorse_gkr_item_refresh;
+	seahorse_class->delete = seahorse_gkr_item_delete;
 	
 	g_type_class_add_private (klass, sizeof (SeahorseGkrItemPrivate));
     

Modified: trunk/gkr/seahorse-gkr-keyring.c
==============================================================================
--- trunk/gkr/seahorse-gkr-keyring.c	(original)
+++ trunk/gkr/seahorse-gkr-keyring.c	Sun Dec 14 14:53:04 2008
@@ -23,6 +23,7 @@
 
 #include "seahorse-gkr.h"
 #include "seahorse-gkr-keyring.h"
+#include "seahorse-gkr-operation.h"
 
 enum {
 	PROP_0,
@@ -74,12 +75,9 @@
 	seahorse_gkr_keyring_set_info (self, info);
 }
 
-static gboolean
-require_keyring_info (SeahorseGkrKeyring *self)
+static void
+load_keyring_info (SeahorseGkrKeyring *self)
 {
-	if (self->pv->keyring_info)
-		return TRUE;
-	
 	/* Already in progress */
 	if (!self->pv->req_info) {
 		g_object_ref (self);
@@ -87,7 +85,13 @@
 		                                             received_keyring_info,
 		                                             self, g_object_unref);
 	}
-	
+}
+
+static gboolean
+require_keyring_info (SeahorseGkrKeyring *self)
+{
+	if (!self->pv->keyring_info)
+		load_keyring_info (self);
 	return self->pv->keyring_info != NULL;
 }
 
@@ -121,16 +125,21 @@
 }
 
 static void
-seahorse_gkr_keyring_flush (SeahorseObject *obj)
+seahorse_gkr_keyring_refresh (SeahorseObject *obj)
 {
 	SeahorseGkrKeyring *self = SEAHORSE_GKR_KEYRING (obj);
 
 	if (self->pv->keyring_info)
-		gnome_keyring_info_free (self->pv->keyring_info);
-	self->pv->keyring_info = NULL;
-	g_assert (self->pv->req_info == NULL);
-    
-	SEAHORSE_OBJECT_CLASS (seahorse_gkr_keyring_parent_class)->flush (obj);
+		load_keyring_info (self);
+	
+	SEAHORSE_OBJECT_CLASS (seahorse_gkr_keyring_parent_class)->refresh (obj);
+}
+
+static SeahorseOperation*
+seahorse_gkr_keyring_delete (SeahorseObject *obj)
+{
+	SeahorseGkrKeyring *self = SEAHORSE_GKR_KEYRING (obj);
+	return seahorse_gkr_operation_delete_keyring (self);
 }
 
 
@@ -167,6 +176,11 @@
 {
 	SeahorseGkrKeyring *self = SEAHORSE_GKR_KEYRING (obj);
 	
+	if (self->pv->keyring_info)
+		gnome_keyring_info_free (self->pv->keyring_info);
+	self->pv->keyring_info = NULL;
+	g_assert (self->pv->req_info == NULL);
+    
 	g_free (self->pv->keyring_name);
 	self->pv->keyring_name = NULL;
 	
@@ -233,7 +247,8 @@
     
 	seahorse_class = SEAHORSE_OBJECT_CLASS (klass);
 	seahorse_class->realize = seahorse_gkr_keyring_realize;
-	seahorse_class->flush = seahorse_gkr_keyring_flush;
+	seahorse_class->refresh = seahorse_gkr_keyring_refresh;
+	seahorse_class->delete = seahorse_gkr_keyring_delete;
 	
 	g_object_class_install_property (gobject_class, PROP_KEYRING_NAME,
 	           g_param_spec_string ("keyring-name", "Gnome Keyring Name", "Name of keyring.", 

Modified: trunk/gkr/seahorse-gkr-operation.c
==============================================================================
--- trunk/gkr/seahorse-gkr-operation.c	(original)
+++ trunk/gkr/seahorse-gkr-operation.c	Sun Dec 14 14:53:04 2008
@@ -51,38 +51,19 @@
  * DEFINITIONS
  */
  
-typedef struct _SeahorseGkrOperationPrivate {
-    
-    gpointer request;
-    SeahorseObject *object;
-    
-} SeahorseGkrOperationPrivate;
-
-enum {
-    PROP_0,
-    PROP_KEY_SOURCE
+struct _SeahorseGkrOperationPrivate {
+	gpointer request;
+	SeahorseObject *object;   
 };
 
-#define SEAHORSE_GKR_OPERATION_GET_PRIVATE(obj)  \
-    (G_TYPE_INSTANCE_GET_PRIVATE ((obj), SEAHORSE_TYPE_GKR_OPERATION, SeahorseGkrOperationPrivate))
-
-/* TODO: This is just nasty. Gotta get rid of these weird macros */
-IMPLEMENT_OPERATION_PROPS(Gkr, gkr)
-
-    g_object_class_install_property (gobject_class, PROP_KEY_SOURCE,
-        g_param_spec_object ("source", "Gkr Source", "Key source this operation works on.", 
-                             SEAHORSE_TYPE_GKR_SOURCE, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY ));
-
-    g_type_class_add_private (gobject_class, sizeof (SeahorseGkrOperationPrivate));
-
-END_IMPLEMENT_OPERATION_PROPS
+G_DEFINE_TYPE (SeahorseGkrOperation, seahorse_gkr_operation, SEAHORSE_TYPE_OPERATION);
 
 /* -----------------------------------------------------------------------------
  * HELPERS 
  */
 
 static gboolean
-check_operation_result (SeahorseGkrOperation *gop, GnomeKeyringResult result)
+check_operation_result (SeahorseGkrOperation *self, GnomeKeyringResult result)
 {
     GError *err = NULL;
     gboolean success;
@@ -94,7 +75,7 @@
     success = seahorse_gkr_operation_parse_error (result, &err);
     g_assert (!success || !err);
     
-    seahorse_operation_mark_done (SEAHORSE_OPERATION (gop), FALSE, err);
+    seahorse_operation_mark_done (SEAHORSE_OPERATION (self), FALSE, err);
     return success;
 }
 
@@ -103,88 +84,66 @@
  */
 
 static void 
-seahorse_gkr_operation_init (SeahorseGkrOperation *sop)
+seahorse_gkr_operation_init (SeahorseGkrOperation *self)
 {
+	self->pv = G_TYPE_INSTANCE_GET_PRIVATE (self, SEAHORSE_TYPE_GKR_OPERATION, SeahorseGkrOperationPrivate);
 
 }
 
 static void 
-seahorse_gkr_operation_set_property (GObject *gobject, guint prop_id, 
-                                          const GValue *value, GParamSpec *pspec)
-{
-    SeahorseGkrOperation *gop = SEAHORSE_GKR_OPERATION (gobject);
-    
-    switch (prop_id) {
-    case PROP_KEY_SOURCE:
-        if (gop->gsrc)
-            g_object_unref (gop->gsrc);
-        gop->gsrc = SEAHORSE_GKR_SOURCE (g_object_ref (g_value_get_object (value)));
-        break;
-    }
-    
-}
-
-static void 
-seahorse_gkr_operation_get_property (GObject *gobject, guint prop_id, 
-                                     GValue *value, GParamSpec *pspec)
-{
-    SeahorseGkrOperation *gop = SEAHORSE_GKR_OPERATION (gobject);
-    
-    switch (prop_id) {
-    case PROP_KEY_SOURCE:
-        g_value_set_object (value, gop->gsrc);
-        break;
-    }
-}
-
-static void 
 seahorse_gkr_operation_dispose (GObject *gobject)
 {
-    SeahorseGkrOperation *gop = SEAHORSE_GKR_OPERATION (gobject);
-    SeahorseGkrOperationPrivate *pv = SEAHORSE_GKR_OPERATION_GET_PRIVATE (gop);
+	SeahorseGkrOperation *self = SEAHORSE_GKR_OPERATION (gobject);
 
-    if (seahorse_operation_is_running (SEAHORSE_OPERATION (gop)))
-        seahorse_gkr_operation_cancel (SEAHORSE_OPERATION (gop));
-    g_assert (!seahorse_operation_is_running (SEAHORSE_OPERATION (gop)));
-    
-    if (gop->gsrc)
-        g_object_unref (gop->gsrc);
-    gop->gsrc = NULL;
+	if (seahorse_operation_is_running (SEAHORSE_OPERATION (self)))
+		seahorse_operation_cancel (SEAHORSE_OPERATION (self));
+	g_assert (!seahorse_operation_is_running (SEAHORSE_OPERATION (self)));
     
-    if (pv->object)
-        g_object_unref (pv->object);
-    pv->object = NULL;
+	if (self->pv->object)
+		g_object_unref (self->pv->object);
+	self->pv->object = NULL;
     
-    /* The above cancel should have stopped this */
-    g_assert (pv->request == NULL);
+	/* The above cancel should have stopped this */
+	g_assert (self->pv->request == NULL);
     
-    G_OBJECT_CLASS (gkr_operation_parent_class)->dispose (gobject);  
+	G_OBJECT_CLASS (seahorse_gkr_operation_parent_class)->dispose (gobject);  
 }
 
 static void 
 seahorse_gkr_operation_finalize (GObject *gobject)
 {
-    SeahorseGkrOperation *gop = SEAHORSE_GKR_OPERATION (gobject);
-    SeahorseGkrOperationPrivate *pv = SEAHORSE_GKR_OPERATION_GET_PRIVATE (gop);
+	SeahorseGkrOperation *self = SEAHORSE_GKR_OPERATION (gobject);
     
-    g_assert (!gop->gsrc);
-    g_assert (!pv->request);
+	g_assert (!self->pv->request);
     
-    G_OBJECT_CLASS (gkr_operation_parent_class)->finalize (gobject);  
+	G_OBJECT_CLASS (seahorse_gkr_operation_parent_class)->finalize (gobject);  
 }
 
 static void 
 seahorse_gkr_operation_cancel (SeahorseOperation *operation)
 {
-    SeahorseGkrOperation *sop = SEAHORSE_GKR_OPERATION (operation);    
-    SeahorseGkrOperationPrivate *pv = SEAHORSE_GKR_OPERATION_GET_PRIVATE (sop);
+	SeahorseGkrOperation *self = SEAHORSE_GKR_OPERATION (operation);    
 
-    if (pv->request)
-        gnome_keyring_cancel_request (pv->request);
-    pv->request = NULL;
+	if (self->pv->request)
+		gnome_keyring_cancel_request (self->pv->request);
+	self->pv->request = NULL;
     
-    if (seahorse_operation_is_running (operation))
-        seahorse_operation_mark_done (operation, TRUE, NULL);    
+	if (seahorse_operation_is_running (operation))
+		seahorse_operation_mark_done (operation, TRUE, NULL);    
+}
+
+static void
+seahorse_gkr_operation_class_init (SeahorseGkrOperationClass *klass)
+{
+	GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
+    
+	seahorse_gkr_operation_parent_class = g_type_class_peek_parent (klass);
+	g_type_class_add_private (klass, sizeof (SeahorseGkrOperationPrivate));
+
+	gobject_class->dispose = seahorse_gkr_operation_dispose;
+	gobject_class->finalize = seahorse_gkr_operation_finalize;
+	
+	SEAHORSE_OPERATION_CLASS (klass)->cancel = seahorse_gkr_operation_cancel;
 }
 
 /* -----------------------------------------------------------------------------
@@ -243,83 +202,127 @@
  */
 
 static void 
-basic_operation_done (GnomeKeyringResult result, SeahorseGkrOperation *gop)
+basic_operation_done (GnomeKeyringResult result, SeahorseGkrOperation *self)
 {
-    SeahorseGkrOperationPrivate *pv;
-
-    pv = SEAHORSE_GKR_OPERATION_GET_PRIVATE (gop);
-    pv->request = NULL;
+	g_assert (SEAHORSE_IS_GKR_OPERATION (self));
+	self->pv->request = NULL;
 
-    if (!check_operation_result (gop, result))
-        return;
+	if (!check_operation_result (self, result))
+		return;
     
-    /* When operation is successful reload the key */
-    seahorse_object_refresh (SEAHORSE_OBJECT (pv->object));
+	/* When operation is successful reload the key */
+	seahorse_object_refresh (SEAHORSE_OBJECT (self->pv->object));
 }
 
 SeahorseOperation*
-seahorse_gkr_operation_update_info (SeahorseGkrItem *git, GnomeKeyringItemInfo *info)
+seahorse_gkr_operation_update_info (SeahorseGkrItem *item, GnomeKeyringItemInfo *info)
 {
-    SeahorseSource *sksrc;
-    SeahorseGkrOperation *gop;
-    SeahorseGkrOperationPrivate *pv;
+	SeahorseGkrOperation *self;
     
-    g_return_val_if_fail (SEAHORSE_IS_GKR_ITEM (git), NULL);
+	g_return_val_if_fail (SEAHORSE_IS_GKR_ITEM (item), NULL);
     
-    sksrc = seahorse_object_get_source (SEAHORSE_OBJECT (git));
-    g_return_val_if_fail (SEAHORSE_IS_GKR_SOURCE (sksrc), NULL);
+	self = g_object_new (SEAHORSE_TYPE_GKR_OPERATION, NULL);
     
-    gop = g_object_new (SEAHORSE_TYPE_GKR_OPERATION, 
-                        "source", SEAHORSE_GKR_SOURCE (sksrc), NULL);
-    pv = SEAHORSE_GKR_OPERATION_GET_PRIVATE (gop);
+	g_object_ref (item);
+	self->pv->object = SEAHORSE_OBJECT (item);
     
-    g_object_ref (git);
-    pv->object = SEAHORSE_OBJECT (git);
+	/* Start actual save request */
+	g_object_ref (self);
+	self->pv->request = gnome_keyring_item_set_info (seahorse_gkr_item_get_keyring_name (item),
+	                                                 seahorse_gkr_item_get_item_id (item), info, 
+	                                                 (GnomeKeyringOperationDoneCallback)basic_operation_done,
+	                                                 self, g_object_unref);
+	g_return_val_if_fail (self->pv->request, NULL);
     
-    /* Start actual save request */
-    g_object_ref (gop);
-    pv->request = gnome_keyring_item_set_info (seahorse_gkr_item_get_keyring_name (git),
-                                               seahorse_gkr_item_get_item_id (git), info, 
-                                               (GnomeKeyringOperationDoneCallback)basic_operation_done,
-                                               gop, g_object_unref);
-    g_return_val_if_fail (pv->request, NULL);
-    
-    seahorse_operation_mark_start (SEAHORSE_OPERATION (gop));
-    seahorse_operation_mark_progress (SEAHORSE_OPERATION (gop), _("Saving item..."), -1);
+	seahorse_operation_mark_start (SEAHORSE_OPERATION (self));
+	seahorse_operation_mark_progress (SEAHORSE_OPERATION (self), _("Saving item..."), -1);
 
-    return SEAHORSE_OPERATION (gop);
+	return SEAHORSE_OPERATION (self);
 }
 
 SeahorseOperation*
-seahorse_gkr_operation_update_acl (SeahorseGkrItem *git, GList *acl)
+seahorse_gkr_operation_update_acl (SeahorseGkrItem *item, GList *acl)
 {
-    SeahorseSource *sksrc;
-    SeahorseGkrOperation *gop;
-    SeahorseGkrOperationPrivate *pv;
-    
-    g_return_val_if_fail (SEAHORSE_IS_GKR_ITEM (git), NULL);
-    
-    sksrc = seahorse_object_get_source (SEAHORSE_OBJECT (git));
-    g_return_val_if_fail (SEAHORSE_IS_GKR_SOURCE (sksrc), NULL);
+	SeahorseGkrOperation *self;
     
-    gop = g_object_new (SEAHORSE_TYPE_GKR_OPERATION, 
-                        "source", SEAHORSE_GKR_SOURCE (sksrc), NULL);
-    pv = SEAHORSE_GKR_OPERATION_GET_PRIVATE (gop);
+	g_return_val_if_fail (SEAHORSE_IS_GKR_ITEM (item), NULL);
     
-    g_object_ref (git);
-    pv->object = SEAHORSE_OBJECT (git);
+	self = g_object_new (SEAHORSE_TYPE_GKR_OPERATION, NULL);
+
+	g_object_ref (item);
+	self->pv->object = SEAHORSE_OBJECT (item);
     
-    /* Start actual save request */
-    g_object_ref (gop);
-    pv->request = gnome_keyring_item_set_acl (seahorse_gkr_item_get_keyring_name (git), 
-                                              seahorse_gkr_item_get_item_id (git), acl, 
-                                              (GnomeKeyringOperationDoneCallback)basic_operation_done,
-                                              gop, g_object_unref);
-    g_return_val_if_fail (pv->request, NULL);
+	/* Start actual save request */
+	g_object_ref (self);
+	self->pv->request = gnome_keyring_item_set_acl (seahorse_gkr_item_get_keyring_name (item), 
+	                                                seahorse_gkr_item_get_item_id (item), acl, 
+	                                                (GnomeKeyringOperationDoneCallback)basic_operation_done,
+	                                                self, g_object_unref);
+	g_return_val_if_fail (self->pv->request, NULL);
     
-    seahorse_operation_mark_start (SEAHORSE_OPERATION (gop));
-    seahorse_operation_mark_progress (SEAHORSE_OPERATION (gop), _("Saving item..."), -1);
+	seahorse_operation_mark_start (SEAHORSE_OPERATION (self));
+	seahorse_operation_mark_progress (SEAHORSE_OPERATION (self), _("Saving item..."), -1);
+
+	return SEAHORSE_OPERATION (self);
+}
+
+static void 
+delete_operation_done (GnomeKeyringResult result, SeahorseGkrOperation *self)
+{
+	g_assert (SEAHORSE_IS_GKR_OPERATION (self));
 
-    return SEAHORSE_OPERATION (gop);
+	self->pv->request = NULL;
+	if (check_operation_result (self, result))
+		seahorse_context_remove_object (NULL, self->pv->object);
 }
 
+SeahorseOperation*
+seahorse_gkr_operation_delete_item (SeahorseGkrItem *item)
+{
+	SeahorseGkrOperation *self;
+	    
+	g_return_val_if_fail (SEAHORSE_IS_GKR_ITEM (item), NULL);
+	    
+	self = g_object_new (SEAHORSE_TYPE_GKR_OPERATION, NULL);
+	    
+	g_object_ref (item);
+	self->pv->object = SEAHORSE_OBJECT (item);
+	    
+	/* Start actual save request */
+	g_object_ref (self);
+	self->pv->request = gnome_keyring_item_delete (seahorse_gkr_item_get_keyring_name (item), 
+	                                               seahorse_gkr_item_get_item_id (item), 
+	                                               (GnomeKeyringOperationDoneCallback)delete_operation_done,
+	                                               self, g_object_unref);
+	g_return_val_if_fail (self->pv->request, NULL);
+	
+	seahorse_operation_mark_start (SEAHORSE_OPERATION (self));
+	seahorse_operation_mark_progress (SEAHORSE_OPERATION (self), _("Deleting item..."), -1);
+	
+	return SEAHORSE_OPERATION (self);
+}
+
+SeahorseOperation*
+seahorse_gkr_operation_delete_keyring (SeahorseGkrKeyring *keyring)
+{
+	SeahorseGkrOperation *self;
+	    
+	g_return_val_if_fail (SEAHORSE_IS_GKR_KEYRING (keyring), NULL);
+	    
+	self = g_object_new (SEAHORSE_TYPE_GKR_OPERATION, NULL);
+	
+	g_object_ref (keyring);
+	self->pv->object = SEAHORSE_OBJECT (keyring);
+	    
+	/* Start actual save request */
+	g_object_ref (self);
+	self->pv->request = gnome_keyring_delete (seahorse_gkr_keyring_get_name (keyring), 
+	                                          (GnomeKeyringOperationDoneCallback)delete_operation_done,
+	                                          self, g_object_unref);
+	g_return_val_if_fail (self->pv->request, NULL);
+	
+	seahorse_operation_mark_start (SEAHORSE_OPERATION (self));
+	seahorse_operation_mark_progress (SEAHORSE_OPERATION (self), _("Deleting keyring..."), -1);
+	
+	return SEAHORSE_OPERATION (self);
+}

Modified: trunk/gkr/seahorse-gkr-operation.h
==============================================================================
--- trunk/gkr/seahorse-gkr-operation.h	(original)
+++ trunk/gkr/seahorse-gkr-operation.h	Sun Dec 14 14:53:04 2008
@@ -23,9 +23,6 @@
  * SeahorseGkrOperation: Operations to be done on gnome-keyring items
  * 
  * - Derived from SeahorseOperation
- *
- * Properties:
- *  TODO: 
  */
  
 #ifndef __SEAHORSE_GKR_OPERATION_H__
@@ -34,6 +31,7 @@
 #include "seahorse-operation.h"
 #include "seahorse-gkr-source.h"
 #include "seahorse-gkr-item.h"
+#include "seahorse-gkr-keyring.h"
 
 #define SEAHORSE_TYPE_GKR_OPERATION            (seahorse_gkr_operation_get_type ())
 #define SEAHORSE_GKR_OPERATION(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), SEAHORSE_TYPE_GKR_OPERATION, SeahorseGkrOperation))
@@ -42,12 +40,21 @@
 #define SEAHORSE_IS_GKR_OPERATION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SEAHORSE_TYPE_GKR_OPERATION))
 #define SEAHORSE_GKR_OPERATION_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), SEAHORSE_TYPE_GKR_OPERATION, SeahorseGkrOperationClass))
 
-DECLARE_OPERATION (Gkr, gkr)
-
-    /*< public >*/
-    SeahorseGkrSource *gsrc;
+typedef struct _SeahorseGkrOperation SeahorseGkrOperation;
+typedef struct _SeahorseGkrOperationClass SeahorseGkrOperationClass;
+typedef struct _SeahorseGkrOperationPrivate SeahorseGkrOperationPrivate;
     
-END_DECLARE_OPERATION
+struct _SeahorseGkrOperation {
+	SeahorseOperation parent;
+	SeahorseGkrOperationPrivate *pv;
+};
+
+struct _SeahorseGkrOperationClass {
+	SeahorseOperationClass parent_class;
+};
+
+GType                seahorse_gkr_operation_get_type               (void);
+
 
 gboolean             seahorse_gkr_operation_parse_error       (GnomeKeyringResult result, 
                                                                GError **err);
@@ -60,4 +67,10 @@
 SeahorseOperation*   seahorse_gkr_operation_update_acl        (SeahorseGkrItem *git,
                                                                GList *acl);
 
+/* result: nothing */
+SeahorseOperation*   seahorse_gkr_operation_delete_item       (SeahorseGkrItem *git);
+
+/* result: nothing */
+SeahorseOperation*   seahorse_gkr_operation_delete_keyring    (SeahorseGkrKeyring *git);
+
 #endif /* __SEAHORSE_GKR_OPERATION_H__ */

Modified: trunk/gkr/seahorse-gkr-source.c
==============================================================================
--- trunk/gkr/seahorse-gkr-source.c	(original)
+++ trunk/gkr/seahorse-gkr-source.c	Sun Dec 14 14:53:04 2008
@@ -271,139 +271,7 @@
 }
 
 /* -----------------------------------------------------------------------------
- * REMOVE OPERATION 
- */
-
-#define SEAHORSE_TYPE_REMOVE_OPERATION            (seahorse_remove_operation_get_type ())
-#define SEAHORSE_REMOVE_OPERATION(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), SEAHORSE_TYPE_REMOVE_OPERATION, SeahorseRemoveOperation))
-#define SEAHORSE_REMOVE_OPERATION_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), SEAHORSE_TYPE_REMOVE_OPERATION, SeahorseRemoveOperationClass))
-#define SEAHORSE_IS_REMOVE_OPERATION(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SEAHORSE_TYPE_REMOVE_OPERATION))
-#define SEAHORSE_IS_REMOVE_OPERATION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SEAHORSE_TYPE_REMOVE_OPERATION))
-#define SEAHORSE_REMOVE_OPERATION_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), SEAHORSE_TYPE_REMOVE_OPERATION, SeahorseRemoveOperationClass))
-
-DECLARE_OPERATION (Remove, remove)
-
-	SeahorseGkrSource *gsrc;
-	SeahorseGkrItem *item;
-	gpointer request;
-
-END_DECLARE_OPERATION
-
-IMPLEMENT_OPERATION (Remove, remove)
-
-static void 
-remove_item_ready (GnomeKeyringResult result, SeahorseRemoveOperation *rop)
-{
-	GError *err = NULL;
-	if (result == GNOME_KEYRING_RESULT_CANCELLED)
-		return;
-    
-	rop->request = NULL;
-
-	if (result != GNOME_KEYRING_RESULT_OK) {
-		if (seahorse_operation_is_running (SEAHORSE_OPERATION (rop))) {
-			seahorse_gkr_operation_parse_error (result, &err);
-			g_assert (err != NULL);
-			seahorse_operation_mark_done (SEAHORSE_OPERATION (rop), FALSE, err);
-		}
-		return;
-	}
-    
-	seahorse_context_remove_object (SCTX_APP (), SEAHORSE_OBJECT (rop->item));
-	seahorse_operation_mark_done (SEAHORSE_OPERATION (rop), FALSE, NULL);
-}
-
-static SeahorseRemoveOperation*
-start_remove_operation (SeahorseGkrSource *gsrc, SeahorseGkrItem *git)
-{
-	SeahorseRemoveOperation *rop;
-
-	g_assert (SEAHORSE_IS_GKR_SOURCE (gsrc));
-	g_assert (SEAHORSE_IS_GKR_ITEM (git));
-	
-	rop = g_object_new (SEAHORSE_TYPE_REMOVE_OPERATION, NULL);
-	rop->gsrc = gsrc;
-	g_object_ref (gsrc);
-	rop->item = git;
-	g_object_ref (git);
-	
-	seahorse_operation_mark_start (SEAHORSE_OPERATION (rop));
-    
-	/* Start listing of ids */
-	seahorse_operation_mark_progress (SEAHORSE_OPERATION (rop), _("Removing item"), -1);
-	g_object_ref (rop);
-	rop->request = gnome_keyring_item_delete (seahorse_gkr_item_get_keyring_name (git), 
-	                                          seahorse_gkr_item_get_item_id (git), 
-	                                          (GnomeKeyringOperationDoneCallback)remove_item_ready, 
-	                                          rop, g_object_unref);
-    
-	return rop;
-}
-
-static void 
-seahorse_remove_operation_init (SeahorseRemoveOperation *rop)
-{
-	/* Everything already set to zero */
-}
-
-static void 
-seahorse_remove_operation_dispose (GObject *gobject)
-{
-	SeahorseRemoveOperation *rop = SEAHORSE_REMOVE_OPERATION (gobject);
-    
-	/* Cancel it if it's still running */
-	if (seahorse_operation_is_running (SEAHORSE_OPERATION (rop)))
-		seahorse_remove_operation_cancel (SEAHORSE_OPERATION (rop));
-	g_assert (!seahorse_operation_is_running (SEAHORSE_OPERATION (rop)));
-    
-	/* The above cancel should have stopped this */
-	g_assert (rop->request == NULL);
-	
-	if (rop->gsrc)
-		g_object_unref (rop->gsrc);
-	rop->gsrc = NULL;
-	
-	if (rop->item)
-		g_object_unref (rop->item);
-	rop->item = NULL;
-
-	G_OBJECT_CLASS (remove_operation_parent_class)->dispose (gobject);  
-}
-
-static void 
-seahorse_remove_operation_finalize (GObject *gobject)
-{
-	SeahorseRemoveOperation *rop = SEAHORSE_REMOVE_OPERATION (gobject);
-	g_assert (!seahorse_operation_is_running (SEAHORSE_OPERATION (rop)));
-    
-	g_assert (rop->gsrc == NULL);
-	g_assert (rop->item == NULL);
-    
-	/* The above cancel should have stopped this */
-	g_assert (rop->request == NULL);
-
-	G_OBJECT_CLASS (remove_operation_parent_class)->finalize (gobject);  
-}
-
-static void 
-seahorse_remove_operation_cancel (SeahorseOperation *operation)
-{
-	SeahorseRemoveOperation *rop = SEAHORSE_REMOVE_OPERATION (operation);    
-
-	if (rop->request)
-		gnome_keyring_cancel_request (rop->request);
-	rop->request = NULL;
-    
-	if (seahorse_operation_is_running (operation))
-		seahorse_operation_mark_done (operation, TRUE, NULL);
-}
-
-/* -----------------------------------------------------------------------------
- * INTERNAL
- */
-
-/* -----------------------------------------------------------------------------
- * OBJECT 
+ * OBJECT
  */
 
 static void
@@ -473,7 +341,7 @@
 }
 
 static SeahorseOperation*
-seahorse_gkr_source_load (SeahorseSource *src, GQuark keyid)
+seahorse_gkr_source_load (SeahorseSource *src)
 {
     SeahorseGkrSource *gsrc;
     SeahorseListOperation *lop;
@@ -481,8 +349,6 @@
     g_assert (SEAHORSE_IS_SOURCE (src));
     gsrc = SEAHORSE_GKR_SOURCE (src);
     
-    /* TODO: Loading a specific key? */
-    
     lop = start_list_operation (gsrc);
     seahorse_multi_operation_take (gsrc->pv->operations, SEAHORSE_OPERATION (lop));
     
@@ -503,34 +369,6 @@
 	return seahorse_operation_new_complete (err);   
 }
 
-static SeahorseOperation* 
-seahorse_gkr_source_export (SeahorseSource *sksrc, GList *keys, GOutputStream *output)
-{
-	GError *err = NULL;
-    
-	g_return_val_if_fail (SEAHORSE_IS_GKR_SOURCE (sksrc), NULL);
-	g_return_val_if_fail (G_IS_OUTPUT_STREAM (output), NULL);
-    
-	/* TODO: Implement properly */
-	g_set_error (&err, 0, 0, "gnome-keyring export support not implemented");
-	return seahorse_operation_new_complete (err);    
-}
-
-static SeahorseOperation*            
-seahorse_gkr_source_remove (SeahorseSource *sksrc, SeahorseObject *sobj)
-{
-    SeahorseGkrItem *git;
-    SeahorseGkrSource *gsrc;
-    
-    g_return_val_if_fail (SEAHORSE_IS_GKR_ITEM (sobj), FALSE);
-    git = SEAHORSE_GKR_ITEM (sobj);
-
-    g_return_val_if_fail (SEAHORSE_IS_GKR_SOURCE (sksrc), FALSE);
-    gsrc = SEAHORSE_GKR_SOURCE (sksrc);
-
-    return SEAHORSE_OPERATION (start_remove_operation (gsrc, git));
-}
-
 static void
 seahorse_gkr_source_dispose (GObject *gobject)
 {
@@ -597,8 +435,6 @@
     key_class = SEAHORSE_SOURCE_CLASS (klass);    
     key_class->load = seahorse_gkr_source_load;
     key_class->import = seahorse_gkr_source_import;
-    key_class->export = seahorse_gkr_source_export;
-    key_class->remove = seahorse_gkr_source_remove;
 
     g_object_class_install_property (gobject_class, PROP_KEYRING_NAME,
         g_param_spec_string ("keyring-name", "Keyring Name", "GNOME Keyring name",

Modified: trunk/libseahorse/seahorse-context.c
==============================================================================
--- trunk/libseahorse/seahorse-context.c	(original)
+++ trunk/libseahorse/seahorse-context.c	Sun Dec 14 14:53:04 2008
@@ -788,7 +788,7 @@
                 seahorse_multi_operation_take (mop, op);
             }
             
-            op = seahorse_source_load (ks, 0);
+            op = seahorse_source_load (ks);
             
             if (mop != NULL)
                 seahorse_multi_operation_take (mop, op);

Modified: trunk/libseahorse/seahorse-object.c
==============================================================================
--- trunk/libseahorse/seahorse-object.c	(original)
+++ trunk/libseahorse/seahorse-object.c	Sun Dec 14 14:53:04 2008
@@ -483,6 +483,8 @@
 		break;
 	case PROP_FLAGS:
 		flags = g_value_get_uint (value);
+		if (!SEAHORSE_OBJECT_GET_CLASS (obj)->delete)
+			flags &= ~SEAHORSE_FLAG_DELETABLE;
 		if (flags != self->pv->flags) {
 			self->pv->flags = flags;
 			g_object_notify (obj, "flags");
@@ -506,13 +508,12 @@
 }
 
 static void 
-seahorse_object_real_flush (SeahorseObject *self)
+seahorse_object_real_refresh (SeahorseObject *self)
 {
 	/* 
 	 * We do nothing by default. It's up to the derived class
-	 * to override this and flush themselves when called.
+	 * to override this and refresh themselves when called.
 	 */
-	self->pv->realized = FALSE;
 }
 
 static void
@@ -529,7 +530,7 @@
 	gobject_class->get_property = seahorse_object_get_property;
 	
 	klass->realize = seahorse_object_real_realize;
-	klass->flush = seahorse_object_real_flush;
+	klass->refresh = seahorse_object_real_refresh;
 	
 	g_object_class_install_property (gobject_class, PROP_SOURCE,
 	           g_param_spec_object ("source", "Object Source", "Source the Object came from", 
@@ -848,24 +849,23 @@
 }
 
 void
-seahorse_object_flush (SeahorseObject *self)
+seahorse_object_refresh (SeahorseObject *self)
 {
 	SeahorseObjectClass *klass;
 	g_return_if_fail (SEAHORSE_IS_OBJECT (self));
 	klass = SEAHORSE_OBJECT_GET_CLASS (self);
-	g_return_if_fail (klass->flush);
-	(klass->flush) (self);
+	g_return_if_fail (klass->refresh);
+	(klass->refresh) (self);
 }
 
-void
-seahorse_object_refresh (SeahorseObject *self)
+SeahorseOperation*
+seahorse_object_delete (SeahorseObject *self)
 {
-	g_return_if_fail (SEAHORSE_IS_OBJECT (self));
-
-	g_object_freeze_notify (G_OBJECT (self));
-	seahorse_object_flush (self);
-	seahorse_object_realize (self);
-	g_object_thaw_notify (G_OBJECT (self));
+	SeahorseObjectClass *klass;
+	g_return_val_if_fail (SEAHORSE_IS_OBJECT (self), NULL);
+	klass = SEAHORSE_OBJECT_GET_CLASS (self);
+	g_return_val_if_fail (klass->delete, NULL);
+	return (klass->delete) (self);
 }
 
 gboolean 

Modified: trunk/libseahorse/seahorse-object.h
==============================================================================
--- trunk/libseahorse/seahorse-object.h	(original)
+++ trunk/libseahorse/seahorse-object.h	Sun Dec 14 14:53:04 2008
@@ -72,7 +72,9 @@
 
 	void (*realize) (SeahorseObject *self);
 	
-	void (*flush) (SeahorseObject *self);
+	void (*refresh) (SeahorseObject *self);
+	
+	SeahorseOperation* (*delete) (SeahorseObject *self);
 };
 
 GType               seahorse_object_get_type               (void);
@@ -83,6 +85,8 @@
 
 void                seahorse_object_refresh                (SeahorseObject *self);
 
+SeahorseOperation*  seahorse_object_delete                 (SeahorseObject *self);
+
 GQuark              seahorse_object_get_id                 (SeahorseObject *self);
 
 GQuark              seahorse_object_get_tag                (SeahorseObject *self);
@@ -154,5 +158,4 @@
 gboolean           seahorse_object_predicate_match         (SeahorseObjectPredicate *self, 
                                                             SeahorseObject *obj);
 
-
 #endif /* __SEAHORSE_OBJECT_H__ */

Modified: trunk/libseahorse/seahorse-prefs-keyrings.c
==============================================================================
--- trunk/libseahorse/seahorse-prefs-keyrings.c	(original)
+++ trunk/libseahorse/seahorse-prefs-keyrings.c	Sun Dec 14 14:53:04 2008
@@ -314,7 +314,7 @@
         src = seahorse_context_find_source (SCTX_APP (), g_quark_from_static_string ("gnome-keyring"), 
                                             SEAHORSE_LOCATION_LOCAL);
         if (src)
-            seahorse_source_load_async (src, 0);
+            seahorse_source_load_async (src);
         
     /* Setting the default keyring failed */
     } else if (result != GNOME_KEYRING_RESULT_CANCELLED) {     

Modified: trunk/libseahorse/seahorse-source.c
==============================================================================
--- trunk/libseahorse/seahorse-source.c	(original)
+++ trunk/libseahorse/seahorse-source.c	Sun Dec 14 14:53:04 2008
@@ -73,14 +73,13 @@
 /**
  * seahorse_source_load
  * @sksrc: A #SeahorseSource object
- * @id: The object to refresh or 0 for all.
  * 
  * Refreshes the #SeahorseSource's internal object listing. 
  * 
  * Returns the asynchronous refresh operation. 
  **/   
 SeahorseOperation*
-seahorse_source_load (SeahorseSource *sksrc, GQuark id)
+seahorse_source_load (SeahorseSource *sksrc)
 {
     SeahorseSourceClass *klass;
     
@@ -88,20 +87,19 @@
     klass = SEAHORSE_SOURCE_GET_CLASS (sksrc);
     g_return_val_if_fail (klass->load != NULL, NULL);
     
-    return (*klass->load) (sksrc, id);
+    return (*klass->load) (sksrc);
 }
 
 /**
  * seahorse_source_load_sync
  * @sksrc: A #SeahorseSource object
- * @id: The object to refresh or 0 for all.
  * 
  * Refreshes the #SeahorseSource's internal object listing, and waits for it to complete.
  **/   
 void
-seahorse_source_load_sync (SeahorseSource *sksrc, GQuark id)
+seahorse_source_load_sync (SeahorseSource *sksrc)
 {
-    SeahorseOperation *op = seahorse_source_load (sksrc, id);
+    SeahorseOperation *op = seahorse_source_load (sksrc);
     g_return_if_fail (op != NULL);
     seahorse_operation_wait (op);
     g_object_unref (op);
@@ -110,14 +108,13 @@
 /**
  * seahorse_source_load_sync
  * @sksrc: A #SeahorseSource object
- * @id: The object to refresh or 0 for all.
  * 
  * Refreshes the #SeahorseSource's internal object listing. Completes in the background.
  **/   
 void
-seahorse_source_load_async (SeahorseSource *sksrc, GQuark id)
+seahorse_source_load_async (SeahorseSource *sksrc)
 {
-    SeahorseOperation *op = seahorse_source_load (sksrc, id);
+    SeahorseOperation *op = seahorse_source_load (sksrc);
     g_return_if_fail (op != NULL);
     g_object_unref (op);
 }
@@ -241,7 +238,6 @@
 {
 	SeahorseOperation *op = NULL;
 	SeahorseMultiOperation *mop = NULL;
-	SeahorseSource *sksrc;
 	SeahorseObject *sobj;
 	GList *l;
 
@@ -250,18 +246,13 @@
 		sobj = SEAHORSE_OBJECT (l->data);
 		g_return_val_if_fail (SEAHORSE_IS_OBJECT (sobj), NULL);;
 		
-		/* Export from this object source */        
-		sksrc = seahorse_object_get_source (sobj);
-		g_return_val_if_fail (sksrc != NULL, NULL);
-
 		if (op != NULL) {
 			if (mop == NULL)
 				mop = seahorse_multi_operation_new ();
 			seahorse_multi_operation_take (mop, op);
 		}
 
-		/* We pass our own data object, to which data is appended */
-		op = seahorse_source_remove (sksrc, l->data);
+		op = seahorse_object_delete (sobj);
 		g_return_val_if_fail (op != NULL, NULL);
 	}
     
@@ -334,23 +325,7 @@
 	g_list_free (objects);
 	return op;
 }
-
-SeahorseOperation*           
-seahorse_source_remove (SeahorseSource *src, SeahorseObject *sobj)
-{
-	SeahorseSourceClass *klass;
-
-	g_return_val_if_fail (SEAHORSE_IS_SOURCE (src), NULL);
-	g_return_val_if_fail (SEAHORSE_IS_OBJECT (sobj), NULL);
-	g_return_val_if_fail (seahorse_object_get_source (sobj) == src, NULL);
-    
-	g_return_val_if_fail (SEAHORSE_IS_SOURCE (src), FALSE);
-	klass = SEAHORSE_SOURCE_GET_CLASS (src);
-	g_return_val_if_fail (klass->remove != NULL, FALSE);
-    
-	return (*klass->remove) (src, sobj);    
-}
-                                               
+                                     
 GQuark              
 seahorse_source_get_ktype (SeahorseSource *sksrc)
 {

Modified: trunk/libseahorse/seahorse-source.h
==============================================================================
--- trunk/libseahorse/seahorse-source.h	(original)
+++ trunk/libseahorse/seahorse-source.h	Sun Dec 14 14:53:04 2008
@@ -78,13 +78,12 @@
     /**
      * load
      * @sksrc: The #SeahorseSource.
-     * @id: The object to load or 0 for all the objects.
      * 
      * Loads the requested objects, and add the objects to SeahorseContext. 
      * 
      * Returns: The load operation.
      */
-    SeahorseOperation* (*load) (SeahorseSource *sksrc, GQuark id);
+    SeahorseOperation* (*load) (SeahorseSource *sksrc);
 
     /**
      * search
@@ -137,17 +136,6 @@
      */    
     SeahorseOperation* (*export_raw) (SeahorseSource *sksrc, GSList *ids, 
                                       GOutputStream *output);
-
-    /**
-     * remove
-     * @sksrc: The #SeahorseSource to delete the object from.
-     * @object: A object to delete.
-     * 
-     * Delete the objects from the object source. 
-     *
-     * Returns: The remove operation.
-     */
-    SeahorseOperation* (*remove) (SeahorseSource *sksrc, struct _SeahorseObject *sobj);
     
 } SeahorseSourceClass;
 
@@ -156,14 +144,11 @@
 /* Method helper functions ------------------------------------------- */
 
 
-SeahorseOperation*  seahorse_source_load                  (SeahorseSource *sksrc,
-                                                           GQuark id);
+SeahorseOperation*  seahorse_source_load                  (SeahorseSource *sksrc);
                                                           
-void                seahorse_source_load_sync             (SeahorseSource *sksrc,
-                                                           GQuark keyid);
+void                seahorse_source_load_sync             (SeahorseSource *sksrc);
 
-void                seahorse_source_load_async            (SeahorseSource *sksrc,
-                                                           GQuark id);
+void                seahorse_source_load_async            (SeahorseSource *sksrc);
 
 SeahorseOperation*  seahorse_source_search                (SeahorseSource *sksrc,
                                                            const gchar *match);
@@ -190,9 +175,6 @@
                                                            GSList *ids, 
                                                            GOutputStream *output);
 
-SeahorseOperation*  seahorse_source_remove                (SeahorseSource *sksrc,
-                                                           struct _SeahorseObject *sobj);
-
 GQuark              seahorse_source_get_ktype             (SeahorseSource *sksrc);
 
 SeahorseLocation    seahorse_source_get_location          (SeahorseSource *sksrc);

Modified: trunk/libseahorse/seahorse-types.h
==============================================================================
--- trunk/libseahorse/seahorse-types.h	(original)
+++ trunk/libseahorse/seahorse-types.h	Sun Dec 14 14:53:04 2008
@@ -69,7 +69,8 @@
 	SEAHORSE_FLAG_REVOKED =     CRYPTUI_FLAG_REVOKED,
 	SEAHORSE_FLAG_DISABLED =    CRYPTUI_FLAG_DISABLED,
 	SEAHORSE_FLAG_TRUSTED =     CRYPTUI_FLAG_TRUSTED,
-	SEAHORSE_FLAG_EXPORTABLE =  CRYPTUI_FLAG_EXPORTABLE
+	SEAHORSE_FLAG_EXPORTABLE =  CRYPTUI_FLAG_EXPORTABLE,
+	SEAHORSE_FLAG_DELETABLE = 1000
 } SeahorseKeyFlags;
 
 #define SEAHORSE_TAG_INVALID               0

Modified: trunk/libseahorse/seahorse-unknown-source.c
==============================================================================
--- trunk/libseahorse/seahorse-unknown-source.c	(original)
+++ trunk/libseahorse/seahorse-unknown-source.c	Sun Dec 14 14:53:04 2008
@@ -54,42 +54,9 @@
  */
 
 static SeahorseOperation*
-seahorse_unknown_source_load (SeahorseSource *src, GQuark id)
-{
-    SeahorseUnknownSource *usrc;
-    
-    g_assert (SEAHORSE_IS_UNKNOWN_SOURCE (src));
-    usrc = SEAHORSE_UNKNOWN_SOURCE (src);
-    
-    if (id) {
-        g_return_val_if_fail (id, NULL);
-        seahorse_unknown_source_add_object (usrc, id, NULL);
-    }
-    
-    return seahorse_operation_new_complete (NULL);
-}
-
-static SeahorseOperation* 
-seahorse_unknown_source_import (SeahorseSource *sksrc, GInputStream *input)
-{
-    g_return_val_if_reached (NULL);
-    return NULL;
-}
-
-static SeahorseOperation* 
-seahorse_unknown_source_export_raw (SeahorseSource *sksrc, GSList *ids, 
-                                    GOutputStream *output)
-{
-    g_return_val_if_reached (NULL);
-    return NULL;
-}
-
-static SeahorseOperation*           
-seahorse_unknown_source_remove (SeahorseSource *sksrc, SeahorseObject *sobj)
-{
-    g_return_val_if_fail (sksrc == seahorse_object_get_source (sobj), FALSE);
-    seahorse_context_remove_object (SCTX_APP (), sobj);
-    return seahorse_operation_new_complete (NULL);
+seahorse_unknown_source_load (SeahorseSource *src)
+{ 
+	return seahorse_operation_new_complete (NULL);
 }
 
 static void 
@@ -142,9 +109,6 @@
     gobject_class->get_property = seahorse_unknown_source_get_property;
     
     parent_class->load = seahorse_unknown_source_load;
-    parent_class->import = seahorse_unknown_source_import;
-    parent_class->export_raw = seahorse_unknown_source_export_raw;
-    parent_class->remove = seahorse_unknown_source_remove;
  
     g_object_class_install_property (gobject_class, PROP_KEY_TYPE,
         g_param_spec_uint ("key-type", "Key Type", "Key type that originates from this key source.", 

Modified: trunk/libseahorse/seahorse-unknown.c
==============================================================================
--- trunk/libseahorse/seahorse-unknown.c	(original)
+++ trunk/libseahorse/seahorse-unknown.c	Sun Dec 14 14:53:04 2008
@@ -33,6 +33,14 @@
  * OBJECT 
  */
 
+
+static SeahorseOperation*           
+seahorse_unknown_delete (SeahorseObject *sobj)
+{
+    seahorse_context_remove_object (SCTX_APP (), sobj);
+    return seahorse_operation_new_complete (NULL);
+}
+
 static void
 seahorse_unknown_init (SeahorseUnknown *self)
 {
@@ -43,6 +51,7 @@
 seahorse_unknown_class_init (SeahorseUnknownClass *klass)
 {
 	seahorse_unknown_parent_class = g_type_class_peek_parent (klass);
+	SEAHORSE_OBJECT_CLASS (klass)->delete = seahorse_unknown_delete;
 }
 
 /* -----------------------------------------------------------------------------

Modified: trunk/pgp/seahorse-hkp-source.c
==============================================================================
--- trunk/pgp/seahorse-hkp-source.c	(original)
+++ trunk/pgp/seahorse-hkp-source.c	Sun Dec 14 14:53:04 2008
@@ -56,9 +56,6 @@
 #define PGP_KEY_BEGIN   "-----BEGIN PGP PUBLIC KEY BLOCK-----"
 #define PGP_KEY_END     "-----END PGP PUBLIC KEY BLOCK-----"
 
-/* Amount of keys to load in a batch */
-#define DEFAULT_LOAD_BATCH 30
-
 #define SOUP_MESSAGE_IS_ERROR(msg) \
     (SOUP_STATUS_IS_TRANSPORT_ERROR((msg)->status_code) || \
      SOUP_STATUS_IS_CLIENT_ERROR((msg)->status_code) || \
@@ -779,26 +776,6 @@
     return SEAHORSE_OPERATION (hop);
 }
 
-static SeahorseOperation*
-seahorse_hkp_source_load (SeahorseSource *src, GQuark keyid)
-{
-    SeahorseOperation *op;
-    
-    g_assert (SEAHORSE_IS_SOURCE (src));
-    g_assert (SEAHORSE_IS_HKP_SOURCE (src));
-    
-    op = SEAHORSE_SOURCE_CLASS (seahorse_hkp_source_parent_class)->load (src, keyid);
-    if (op != NULL)
-        return op;
-
-    /* No way to find new all or new keys */
-    if (!keyid)
-        return seahorse_operation_new_complete (NULL);
-
-    /* TODO: Does this actually work? */
-    return seahorse_hkp_source_search (src, seahorse_pgp_key_get_rawid (keyid));
-}
-
 static SeahorseOperation* 
 seahorse_hkp_source_import (SeahorseSource *sksrc, GInputStream *input)
 {
@@ -957,7 +934,6 @@
 
 	key_class = SEAHORSE_SOURCE_CLASS (klass);
 	key_class->canonize_id = seahorse_pgp_key_get_cannonical_id;
-	key_class->load = seahorse_hkp_source_load;
 	key_class->search = seahorse_hkp_source_search;
 	key_class->import = seahorse_hkp_source_import;
 	key_class->export_raw = seahorse_hkp_source_export_raw;

Modified: trunk/pgp/seahorse-ldap-source.c
==============================================================================
--- trunk/pgp/seahorse-ldap-source.c	(original)
+++ trunk/pgp/seahorse-ldap-source.c	Sun Dec 14 14:53:04 2008
@@ -1280,33 +1280,6 @@
 }
 
 static SeahorseOperation*
-seahorse_ldap_source_load (SeahorseSource *src, GQuark keyid)
-{
-    SeahorseOperation *op;
-    SeahorseLDAPOperation *lop = NULL;
-
-    g_assert (SEAHORSE_IS_SOURCE (src));
-    g_assert (SEAHORSE_IS_LDAP_SOURCE (src));
-
-    op = SEAHORSE_SOURCE_CLASS (seahorse_ldap_source_parent_class)->load (src, keyid);
-    if (op != NULL)
-        return op;
-    
-    /* No way to find new or all keys */
-    if (!keyid) 
-        return seahorse_operation_new_complete (NULL);
-
-    lop = start_search_operation_fpr (SEAHORSE_LDAP_SOURCE (src), 
-                                      seahorse_pgp_key_get_rawid (keyid));
-    g_return_val_if_fail (lop != NULL, NULL);
-
-    seahorse_server_source_take_operation (SEAHORSE_SERVER_SOURCE (src),
-                                           SEAHORSE_OPERATION (lop));
-    g_object_ref (lop);
-    return SEAHORSE_OPERATION (lop);
-}
-
-static SeahorseOperation*
 seahorse_ldap_source_search (SeahorseSource *src, const gchar *match)
 {
     SeahorseLDAPOperation *lop = NULL;
@@ -1398,7 +1371,6 @@
    
 	key_class = SEAHORSE_SOURCE_CLASS (klass);
 	key_class->canonize_id = seahorse_pgp_key_get_cannonical_id;
-	key_class->load = seahorse_ldap_source_load;
 	key_class->search = seahorse_ldap_source_search;
 	key_class->import = seahorse_ldap_source_import;
 	key_class->export_raw = seahorse_ldap_source_export_raw;

Modified: trunk/pgp/seahorse-pgp-key-op.c
==============================================================================
--- trunk/pgp/seahorse-pgp-key-op.c	(original)
+++ trunk/pgp/seahorse-pgp-key-op.c	Sun Dec 14 14:53:04 2008
@@ -1088,7 +1088,6 @@
 	ExpireParm exp_parm;
 	SeahorseEditParm *parms;
 	gpgme_key_t key;
-	gpgme_error_t gerr;
 	
 	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));

Modified: trunk/pgp/seahorse-pgp-key-properties.c
==============================================================================
--- trunk/pgp/seahorse-pgp-key-properties.c	(original)
+++ trunk/pgp/seahorse-pgp-key-properties.c	Sun Dec 14 14:53:04 2008
@@ -1885,7 +1885,7 @@
     /* Don't trigger the import of remote keys if possible */
     if (!remote) {
         /* This causes the key source to get any specific info about the key */
-        seahorse_source_load_sync (sksrc, seahorse_object_get_id (sobj));
+        seahorse_object_refresh (SEAHORSE_OBJECT (pkey));
         sobj = seahorse_context_get_object (SCTX_APP(), sksrc, seahorse_object_get_id (sobj));
         g_return_if_fail (sobj != NULL);
     }

Modified: trunk/pgp/seahorse-pgp-key.c
==============================================================================
--- trunk/pgp/seahorse-pgp-key.c	(original)
+++ trunk/pgp/seahorse-pgp-key.c	Sun Dec 14 14:53:04 2008
@@ -100,55 +100,60 @@
 	return TRUE;
 }
 
-static gboolean
-require_key_public (SeahorsePgpKey *self, int list_mode)
+static void
+load_key_public (SeahorsePgpKey *self, int list_mode)
 {
 	gpgme_key_t key = NULL;
 	gboolean ret;
 	GQuark id;
 	
-	if (self->pv->pubkey && (self->pv->list_mode & list_mode) == list_mode)
-		return TRUE;
-	
 	list_mode |= self->pv->list_mode;
 	
 	id = seahorse_object_get_id (SEAHORSE_OBJECT (self));
-	g_return_val_if_fail (id, FALSE);
+	g_return_if_fail (id);
 	
 	ret = load_gpgme_key (id, list_mode, FALSE, &key);
-	if (!ret)
-		return FALSE;
-	
-	self->pv->list_mode = list_mode;
-	seahorse_pgp_key_set_public (self, key);
-	gpgmex_key_unref (key);
-	
-	return TRUE;
+	if (ret) {
+		self->pv->list_mode = list_mode;
+		seahorse_pgp_key_set_public (self, key);
+		gpgmex_key_unref (key);
+	}
 }
 
 static gboolean
-require_key_private (SeahorsePgpKey *self)
+require_key_public (SeahorsePgpKey *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 (SeahorsePgpKey *self)
 {
 	gpgme_key_t key = NULL;
 	gboolean ret;
 	GQuark id;
 	
-	if (self->pv->seckey)
-		return TRUE;
 	if (!self->pv->has_secret)
-		return FALSE;
+		return;
 	
 	id = seahorse_object_get_id (SEAHORSE_OBJECT (self));
-	g_return_val_if_fail (id, FALSE);
+	g_return_if_fail (id);
 	
 	ret = load_gpgme_key (id, GPGME_KEYLIST_MODE_LOCAL, TRUE, &key);
-	if (!ret)
-		return FALSE;
-	
-	seahorse_pgp_key_set_private (self, key);
-	gpgmex_key_unref (key);
-	
-	return TRUE;
+	if (ret) {
+		seahorse_pgp_key_set_private (self, key);
+		gpgmex_key_unref (key);
+	}
+}
+
+static gboolean
+require_key_private (SeahorsePgpKey *self)
+{
+	if (!self->pv->seckey)
+		load_key_private (self);
+	return self->pv->seckey != NULL;
 }
 
 static gboolean
@@ -163,22 +168,23 @@
 	return require_key_public (self, GPGME_KEYLIST_MODE_LOCAL);
 }
 
-static gboolean
-require_key_photos (SeahorsePgpKey *self)
+static void
+load_key_photos (SeahorsePgpKey *self)
 {
 	gpgme_error_t gerr;
-	
-	if (self->pv->photos_loaded)
-		return TRUE;
-	
 	gerr = seahorse_pgp_key_op_photos_load (self);
-	if (!GPG_IS_OK (gerr)) {
+	if (!GPG_IS_OK (gerr)) 
 		g_warning ("couldn't load key photos: %s", gpgme_strerror (gerr));
-		return FALSE;
-	}
-	
-	self->pv->photos_loaded = TRUE;
-	return TRUE;
+	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* 
@@ -408,33 +414,36 @@
 }
 
 static void
-seahorse_pgp_key_flush (SeahorseObject *obj)
+seahorse_pgp_key_refresh (SeahorseObject *obj)
 {
 	SeahorsePgpKey *self = SEAHORSE_PGP_KEY (obj);
-	GList *l;
 	
-	/* Free all the attached UIDs */
-	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 = NULL;
-
-	/* 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);
+		load_key_public (self, self->pv->list_mode);
 	if (self->pv->seckey)
-		gpgmex_key_unref (self->pv->seckey);
-	self->pv->pubkey = self->pv->seckey = NULL;
+		load_key_private (self);
+	if (self->pv->photos_loaded)
+		load_key_photos (self);
 
-	SEAHORSE_OBJECT_CLASS (seahorse_pgp_key_parent_class)->flush (obj);
+	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);
 }
 
 static void
@@ -514,7 +523,30 @@
 static void
 seahorse_pgp_key_object_dispose (GObject *obj)
 {
-	seahorse_pgp_key_flush (SEAHORSE_OBJECT (obj));
+	SeahorsePgpKey *self = SEAHORSE_PGP_KEY (obj);
+	GList *l;
+	
+	/* Free all the attached UIDs */
+	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 = NULL;
+
+	/* 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);
 }
 
@@ -546,9 +578,10 @@
 	gobject_class->set_property = seahorse_pgp_key_set_property;
 	gobject_class->get_property = seahorse_pgp_key_get_property;
 	
-	seahorse_class->flush = seahorse_pgp_key_flush;
+	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));
@@ -653,17 +686,6 @@
 	return rawid ? rawid + 1 : id;
 }
 
-void
-seahorse_pgp_key_reload (SeahorsePgpKey *pkey)
-{
-	SeahorseSource *src;
-	
-	g_return_if_fail (SEAHORSE_IS_PGP_KEY (pkey));
-	src = seahorse_object_get_source (SEAHORSE_OBJECT (pkey));
-	g_return_if_fail (SEAHORSE_IS_PGP_SOURCE (src));
-	seahorse_source_load_async (src, seahorse_object_get_id (SEAHORSE_OBJECT (pkey)));
-}
-
 gpgme_key_t
 seahorse_pgp_key_get_public (SeahorsePgpKey *self)
 {

Modified: trunk/pgp/seahorse-pgp-source.c
==============================================================================
--- trunk/pgp/seahorse-pgp-source.c	(original)
+++ trunk/pgp/seahorse-pgp-source.c	Sun Dec 14 14:53:04 2008
@@ -262,15 +262,13 @@
                                                  GValue *value, GParamSpec *pspec);
 
 /* SeahorseSource methods */
-static SeahorseOperation*  seahorse_pgp_source_load             (SeahorseSource *src,
-                                                                 GQuark keyid);
+static SeahorseOperation*  seahorse_pgp_source_load             (SeahorseSource *src);
+
 static SeahorseOperation*  seahorse_pgp_source_import           (SeahorseSource *sksrc, 
                                                                  GInputStream *input);
 static SeahorseOperation*  seahorse_pgp_source_export           (SeahorseSource *sksrc, 
                                                                  GList *keys,
                                                                  GOutputStream *output);
-static SeahorseOperation*  seahorse_pgp_source_remove           (SeahorseSource *sksrc, 
-                                                                 SeahorseObject *sobj);
 
 /* Other forward decls */
 static void                monitor_gpg_homedir                  (GFileMonitor *handle, 
@@ -308,7 +306,6 @@
     key_class->load = seahorse_pgp_source_load;
     key_class->import = seahorse_pgp_source_import;
     key_class->export = seahorse_pgp_source_export;
-    key_class->remove = seahorse_pgp_source_remove;
  
     g_object_class_install_property (gobject_class, PROP_KEY_TYPE,
         g_param_spec_uint ("key-type", "Key Type", "Key type that originates from this key source.", 
@@ -548,7 +545,7 @@
 
     DEBUG_REFRESH ("scheduled refresh event ocurring now\n");
     cancel_scheduled_refresh (psrc);
-    seahorse_source_load_async (SEAHORSE_SOURCE (psrc), 0);
+    seahorse_source_load_async (SEAHORSE_SOURCE (psrc));
     
     return FALSE; /* don't run again */
 }
@@ -877,12 +874,10 @@
  */
 
 static SeahorseOperation*
-seahorse_pgp_source_load (SeahorseSource *src, GQuark keyid)
+seahorse_pgp_source_load (SeahorseSource *src)
 {
     SeahorsePGPSource *psrc;
     SeahorseLoadOperation *lop;
-    const gchar *match = NULL;
-    const gchar *patterns[2];
     
     g_assert (SEAHORSE_IS_SOURCE (src));
     psrc = SEAHORSE_PGP_SOURCE (src);
@@ -892,22 +887,14 @@
     psrc->pv->scheduled_refresh = g_timeout_add (500, scheduled_dummy, psrc);
     DEBUG_REFRESH ("scheduled a dummy refresh\n");
  
-    if (keyid)
-        match = seahorse_pgp_key_get_rawid (keyid);
-    
-    patterns[0] = match;
-    patterns[1] = NULL;
-
     DEBUG_REFRESH ("refreshing keys...\n");
 
     /* Secret keys */
-    lop = seahorse_load_operation_start (psrc, match ? patterns : NULL, 
-                                         match ? LOAD_FULL | LOAD_PHOTOS : 0, FALSE);
+    lop = seahorse_load_operation_start (psrc, NULL, 0, FALSE);
     seahorse_multi_operation_take (psrc->pv->operations, SEAHORSE_OPERATION (lop));
 
     /* Public keys */
-    lop = seahorse_load_operation_start (psrc, match ? patterns : NULL, 
-                                         match ? LOAD_FULL | LOAD_PHOTOS : 0, TRUE);
+    lop = seahorse_load_operation_start (psrc, NULL, 0, TRUE);
     seahorse_multi_operation_take (psrc->pv->operations, SEAHORSE_OPERATION (lop));
 
     g_object_ref (psrc->pv->operations);
@@ -1006,32 +993,6 @@
         return SEAHORSE_OPERATION (pop);
 }
 
-static SeahorseOperation*          
-seahorse_pgp_source_remove (SeahorseSource *sksrc, SeahorseObject *sobj)
-{
-	GError *error = NULL;
-	gpgme_error_t gerr;
-    
-	g_return_val_if_fail (SEAHORSE_IS_SOURCE (sksrc), NULL);
-	g_return_val_if_fail (SEAHORSE_IS_OBJECT (sobj), NULL);
-	g_return_val_if_fail (seahorse_object_get_source (sobj) == sksrc, NULL);
-
-	if (SEAHORSE_IS_PGP_UID (sobj)) {
-		gerr = seahorse_pgp_key_op_del_uid (SEAHORSE_PGP_UID (sobj));
-	} else if (SEAHORSE_IS_PGP_KEY (sobj)) {
-		if (seahorse_object_get_usage (sobj) == SEAHORSE_USAGE_PRIVATE_KEY) 
-			gerr = seahorse_pgp_key_op_delete_pair (SEAHORSE_PGP_KEY (sobj));
-		else 
-			gerr = seahorse_pgp_key_op_delete (SEAHORSE_PGP_KEY (sobj));
-	} else {
-		g_return_val_if_reached (NULL);
-	}
-    
-	if (!GPG_IS_OK (gerr)) 
-		seahorse_gpgme_to_error (gerr, &error);
-	return seahorse_operation_new_complete (error);
-}
-
 /* -------------------------------------------------------------------------- 
  * FUNCTIONS
  */

Modified: trunk/pkcs11/Makefile.am
==============================================================================
--- trunk/pkcs11/Makefile.am	(original)
+++ trunk/pkcs11/Makefile.am	Sun Dec 14 14:53:04 2008
@@ -15,38 +15,16 @@
 	-DLIBCRYPTUI_API_SUBJECT_TO_CHANGE \
 	-DGETTEXT_PACKAGE=\""seahorse\""
 
-VALA_SRCS = \
-	seahorse-pkcs11.vala \
-	seahorse-pkcs11-source.vala
-	
-VALA_VAPIS = \
-	p11.vapi \
-	gp11.vapi \
-	libseahorse-pkcs11-c.vapi \
-	$(top_srcdir)/bugs.vapi \
-	$(top_srcdir)/config.vapi \
-	$(top_srcdir)/libseahorse/libseahorse-c.vapi \
-	$(top_srcdir)/libseahorse/libseahorse.vapi
-
-VALA_CFILES = $(VALA_SRCS:.vala=.c)
-VALA_HFILES = $(VALA_SRCS:.vala=.h)
-
-SUFFIXES = .vala .c .h
-
-vala-build.stamp: $(VALA_SRCS) $(VALA_VAPIS)
-	$(VALAC) -C $(VALA_PKGS) $(VALA_VAPIS) $(VALA_SRCS)
-	date +'%s' > $@
-
-BUILT_SOURCES = \
-	vala-build.stamp
-	
 noinst_LTLIBRARIES = libseahorse-pkcs11.la
 
 libseahorse_pkcs11_la_SOURCES = \
 	seahorse-pkcs11-certificate.c seahorse-pkcs11-certificate.h \
 	seahorse-pkcs11-commands.c seahorse-pkcs11-commands.h \
 	seahorse-pkcs11-module.c seahorse-pkcs11-module.h \
-	$(VALA_CFILES) $(VALA_HFILES)
+	seahorse-pkcs11-helpers.c seahorse-pkcs11-helpers.h \
+	seahorse-pkcs11-object.c seahorse-pkcs11-object.h \
+	seahorse-pkcs11-operations.c seahorse-pkcs11-operations.h \
+	seahorse-pkcs11-source.c seahorse-pkcs11-source.h
 
 libseahorse_pkcs11_la_LIBADD = \
 	$(top_builddir)/libseahorse/libseahorse.la \
@@ -55,15 +33,4 @@
 glade_DATA = 
 
 EXTRA_DIST = \
-	gp11.vapi \
-	p11.vapi \
-	gp11-hacks.h \
-	$(glade_DATA) \
-	vala-build.stamp \
-	libseahorse-pkcs11-c.vapi \
-	$(VALA_CFILES) $(VALA_HFILES) \
-	$(VALA_SRCS)
-
-vala-clean:
-	rm -f vala-build.stamp $(VALA_CFILES) $(VALA_HFILES)
-
+	$(glade_DATA) 

Modified: trunk/pkcs11/seahorse-pkcs11-certificate.c
==============================================================================
--- trunk/pkcs11/seahorse-pkcs11-certificate.c	(original)
+++ trunk/pkcs11/seahorse-pkcs11-certificate.c	Sun Dec 14 14:53:04 2008
@@ -22,6 +22,7 @@
 #include "config.h"
 
 #include "seahorse-pkcs11-certificate.h"
+#include "seahorse-pkcs11-helpers.h"
 
 #include "seahorse-object.h"
 #include "seahorse-pkcs11.h"
@@ -35,10 +36,15 @@
 
 #include <glib/gi18n-lib.h>
 
+static const gulong REQUIRED_ATTRS[] = {
+	CKA_VALUE,
+	CKA_ID,
+	CKA_GNOME_USER_TRUST,
+	CKA_END_DATE
+};
+
 enum {
 	PROP_0,
-	PROP_PKCS11_OBJECT,
-	PROP_PKCS11_ATTRIBUTES,
 	PROP_FINGERPRINT,
 	PROP_VALIDITY,
 	PROP_VALIDITY_STR,
@@ -49,39 +55,19 @@
 };
 
 struct _SeahorsePkcs11CertificatePrivate {
-	GP11Object* pkcs11_object;
-	GP11Attributes* pkcs11_attributes;
 	GP11Attribute der_value;
 };
 
 static void seahorse_pkcs11_certificate_iface (CruiX509CertIface *iface);
 
-G_DEFINE_TYPE_EXTENDED (SeahorsePkcs11Certificate, seahorse_pkcs11_certificate, SEAHORSE_TYPE_OBJECT, 0,
+G_DEFINE_TYPE_EXTENDED (SeahorsePkcs11Certificate, seahorse_pkcs11_certificate, SEAHORSE_PKCS11_TYPE_OBJECT, 0,
                         G_IMPLEMENT_INTERFACE (CRUI_TYPE_X509_CERT, seahorse_pkcs11_certificate_iface));
 
-#define SEAHORSE_PKCS11_CERTIFICATE_GET_PRIVATE(o) \
-	(G_TYPE_INSTANCE_GET_PRIVATE ((o), SEAHORSE_PKCS11_TYPE_CERTIFICATE, SeahorsePkcs11CertificatePrivate))
-
 /* -----------------------------------------------------------------------------
  * INTERNAL 
  */
 
 static gchar* 
-calc_display_name (SeahorsePkcs11Certificate *self) 
-{
-	SeahorsePkcs11CertificatePrivate *pv = SEAHORSE_PKCS11_CERTIFICATE_GET_PRIVATE (self);
-	gchar *label = NULL;
-	
-	if (pv->pkcs11_attributes != NULL) {
-		if (gp11_attributes_find_string (pv->pkcs11_attributes, CKA_LABEL, &label))
-			return label;
-	}
-	
-	/* TODO: Calculate something from the subject? */
-	return g_strdup (_("Certificate"));
-}
-
-static gchar* 
 calc_display_id (SeahorsePkcs11Certificate* self) 
 {
 	gsize len;
@@ -101,97 +87,85 @@
 	return ret;
 }
 
-static void 
-certificate_rebuild (SeahorsePkcs11Certificate* self) 
+/* -----------------------------------------------------------------------------
+ * OBJECT 
+ */
+
+static void
+seahorse_pkcs11_certificate_realize (SeahorseObject *obj)
 {
-	SeahorsePkcs11CertificatePrivate *pv;
-	gboolean exportable;
-	gchar *name, *identifier;
+	SeahorsePkcs11Certificate *self = SEAHORSE_PKCS11_CERTIFICATE (obj);
+	gchar *identifier = NULL;
 	guint flags;
+
+	SEAHORSE_OBJECT_CLASS (seahorse_pkcs11_certificate_parent_class)->realize (obj);
+
+	seahorse_pkcs11_object_require_attributes (SEAHORSE_PKCS11_OBJECT (self), 
+	                                           REQUIRED_ATTRS, G_N_ELEMENTS (REQUIRED_ATTRS));
 	
-	g_assert (SEAHORSE_PKCS11_IS_CERTIFICATE (self));
-	pv = SEAHORSE_PKCS11_CERTIFICATE_GET_PRIVATE (self);
+	if (!seahorse_object_get_label (obj))
+		g_object_set (self, "label", _("Certificate"), NULL);
 	
-	if (pv->pkcs11_attributes == NULL) {
-		
-		g_object_set (self,
-		              "id", 0,
-		              "label", "",
-		              "icon", NULL,
-		              "usage", SEAHORSE_USAGE_NONE,
-		              "description", "",
-		              "identifier", "",
-		              "location", SEAHORSE_LOCATION_INVALID,
-		              "flags", SEAHORSE_FLAG_DISABLED,
-		              NULL);
-		return;
-		
-	} 
-
-	flags = 0;
-	if (gp11_attributes_find_boolean (pv->pkcs11_attributes, CKA_EXTRACTABLE, &exportable) && exportable)
-		flags |= SEAHORSE_FLAG_EXPORTABLE;
+	flags = seahorse_object_get_flags (obj);
 
 	/* TODO: Expiry, revoked, disabled etc... */
 	if (seahorse_pkcs11_certificate_get_trust (self) >= SEAHORSE_VALIDITY_MARGINAL)
 		flags |= SEAHORSE_FLAG_TRUSTED;
 
-	name = calc_display_name (self);
 	identifier = calc_display_id (self);
-	
+
 	g_object_set (self,
-		      "id", seahorse_pkcs11_id_from_attributes (pv->pkcs11_attributes),
-		      "label", name,
-		      "icon", "",
+		      "location", SEAHORSE_LOCATION_LOCAL,
 		      "usage", SEAHORSE_USAGE_PUBLIC_KEY,
-		      "description", _("Certificate"),
+		      "flags", flags,
 		      "identifier", identifier,
-		      "location", SEAHORSE_LOCATION_LOCAL,
-		      "flags", 0,
 		      NULL);
 
-	g_free (name);
 	g_free (identifier);
 }
 
+static GObject* 
+seahorse_pkcs11_certificate_constructor (GType type, guint n_props, GObjectConstructParam *props) 
+{
+	SeahorsePkcs11Certificate *self = SEAHORSE_PKCS11_CERTIFICATE (G_OBJECT_CLASS (seahorse_pkcs11_certificate_parent_class)->constructor(type, n_props, props));
+	
+	g_return_val_if_fail (self, NULL);	
 
-/* -----------------------------------------------------------------------------
- * OBJECT 
- */
+	return G_OBJECT (self);
+}
 
 static void
 seahorse_pkcs11_certificate_init (SeahorsePkcs11Certificate *self)
 {
-	SeahorsePkcs11CertificatePrivate *pv = SEAHORSE_PKCS11_CERTIFICATE_GET_PRIVATE (self);
-	gp11_attribute_init_invalid (&pv->der_value, CKA_VALUE);
+	self->pv = (G_TYPE_INSTANCE_GET_PRIVATE (self, SEAHORSE_PKCS11_TYPE_CERTIFICATE, SeahorsePkcs11CertificatePrivate));
+	gp11_attribute_init_invalid (&self->pv->der_value, CKA_VALUE);
 }
 
 static void
-seahorse_pkcs11_certificate_dispose (GObject *obj)
+seahorse_pkcs11_certificate_notify (GObject *obj, GParamSpec *pspec)
 {
-	SeahorsePkcs11Certificate *self = SEAHORSE_PKCS11_CERTIFICATE (obj);
-	SeahorsePkcs11CertificatePrivate *pv = SEAHORSE_PKCS11_CERTIFICATE_GET_PRIVATE (self);
-    
-	if (pv->pkcs11_object)
-		g_object_unref (pv->pkcs11_object);
-	pv->pkcs11_object = NULL;
+	/* When the base class pkcs11-attributes changes, it can affects lots */
+	if (g_str_equal (pspec->name, "pkcs11-attributes")) {
+		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_CLASS (seahorse_pkcs11_certificate_parent_class)->dispose (obj);
+	if (G_OBJECT_CLASS (seahorse_pkcs11_certificate_parent_class)->notify)
+		G_OBJECT_CLASS (seahorse_pkcs11_certificate_parent_class)->notify (obj, pspec);
 }
 
+
 static void
 seahorse_pkcs11_certificate_finalize (GObject *obj)
 {
 	SeahorsePkcs11Certificate *self = SEAHORSE_PKCS11_CERTIFICATE (obj);
-	SeahorsePkcs11CertificatePrivate *pv = SEAHORSE_PKCS11_CERTIFICATE_GET_PRIVATE (self);
 
-	g_assert (pv->pkcs11_object == NULL);
-	
-	if (pv->pkcs11_attributes)
-		gp11_attributes_unref (pv->pkcs11_attributes);
-	pv->pkcs11_attributes = NULL;
-	
-	gp11_attribute_clear (&pv->der_value);
+	gp11_attribute_clear (&self->pv->der_value);
 	
 	G_OBJECT_CLASS (seahorse_pkcs11_certificate_parent_class)->finalize (obj);
 }
@@ -203,12 +177,6 @@
 	SeahorsePkcs11Certificate *self = SEAHORSE_PKCS11_CERTIFICATE (obj);
 	
 	switch (prop_id) {
-	case PROP_PKCS11_OBJECT:
-		g_value_set_object (value, seahorse_pkcs11_certificate_get_pkcs11_object (self));
-		break;
-	case PROP_PKCS11_ATTRIBUTES:
-		g_value_set_boxed (value, seahorse_pkcs11_certificate_get_pkcs11_attributes (self));
-		break;
 	case PROP_FINGERPRINT:
 		g_value_take_string (value, seahorse_pkcs11_certificate_get_fingerprint (self));
 		break;
@@ -240,15 +208,7 @@
 seahorse_pkcs11_certificate_set_property (GObject *obj, guint prop_id, const GValue *value, 
                                           GParamSpec *pspec)
 {
-	SeahorsePkcs11Certificate *self = SEAHORSE_PKCS11_CERTIFICATE (obj);
-	
 	switch (prop_id) {
-	case PROP_PKCS11_OBJECT:
-		seahorse_pkcs11_certificate_set_pkcs11_object (self, g_value_get_object (value));
-		break;
-	case PROP_PKCS11_ATTRIBUTES:
-		seahorse_pkcs11_certificate_set_pkcs11_attributes (self, g_value_get_boxed (value));
-		break;
 	default:
 		G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, prop_id, pspec);
 		break;
@@ -259,22 +219,18 @@
 seahorse_pkcs11_certificate_class_init (SeahorsePkcs11CertificateClass *klass)
 {
 	GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
+	SeahorseObjectClass *seahorse_class = SEAHORSE_OBJECT_CLASS (klass);
 	
 	seahorse_pkcs11_certificate_parent_class = g_type_class_peek_parent (klass);
 	g_type_class_add_private (klass, sizeof (SeahorsePkcs11CertificatePrivate));
 
-	gobject_class->dispose = seahorse_pkcs11_certificate_dispose;
+	gobject_class->constructor = seahorse_pkcs11_certificate_constructor;
 	gobject_class->finalize = seahorse_pkcs11_certificate_finalize;
 	gobject_class->set_property = seahorse_pkcs11_certificate_set_property;
 	gobject_class->get_property = seahorse_pkcs11_certificate_get_property;
+	gobject_class->notify = seahorse_pkcs11_certificate_notify;
 
-	g_object_class_install_property (gobject_class, PROP_PKCS11_OBJECT, 
-	         g_param_spec_object ("pkcs11-object", "pkcs11-object", "pkcs11-object", GP11_TYPE_OBJECT, 
-	                              G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE));
-	
-	g_object_class_install_property (gobject_class, PROP_PKCS11_ATTRIBUTES, 
-	         g_param_spec_boxed ("pkcs11-attributes", "pkcs11-attributes", "pkcs11-attributes", GP11_TYPE_ATTRIBUTES, 
-	                             G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE));
+	seahorse_class->realize = seahorse_pkcs11_certificate_realize;
 	
 	g_object_class_install_property (gobject_class, PROP_FINGERPRINT, 
 	         g_param_spec_string ("fingerprint", "fingerprint", "fingerprint", NULL, 
@@ -306,25 +262,33 @@
 }
 
 const guchar*
-seahorse_pkcs11_certificate_get_der_data (CruiX509Cert *self, gsize *n_length)
+seahorse_pkcs11_certificate_get_der_data (CruiX509Cert *cert, gsize *n_length)
 {
-	SeahorsePkcs11CertificatePrivate *pv;
+	SeahorsePkcs11Object *obj = SEAHORSE_PKCS11_OBJECT (cert);
+	SeahorsePkcs11Certificate *self = SEAHORSE_PKCS11_CERTIFICATE (cert);
+	GP11Attributes *attrs;
+	GP11Attribute *attr;
 	
-	g_return_val_if_fail (SEAHORSE_PKCS11_IS_CERTIFICATE (self), NULL);
+	g_return_val_if_fail (SEAHORSE_PKCS11_IS_CERTIFICATE (cert), NULL);
 	
-	pv = SEAHORSE_PKCS11_CERTIFICATE_GET_PRIVATE (self);
-	g_return_val_if_fail (pv->pkcs11_attributes, NULL);
+	if (!seahorse_pkcs11_object_require_attributes (obj, REQUIRED_ATTRS, 
+	                                                G_N_ELEMENTS (REQUIRED_ATTRS)))
+		return NULL;
 	
-	if (gp11_attribute_is_invalid (&pv->der_value)) {
-		GP11Attribute *attr = gp11_attributes_find (pv->pkcs11_attributes, CKA_VALUE);
+	/* TODO: This whole copying and possibly freeing memory in use is risky */
+
+	if (gp11_attribute_is_invalid (&self->pv->der_value)) {
+		attrs = seahorse_pkcs11_object_get_pkcs11_attributes (obj);
+		g_return_val_if_fail (attrs, NULL);
+		attr = gp11_attributes_find (attrs, CKA_VALUE);
 		g_return_val_if_fail (attr, NULL);
-		gp11_attribute_clear (&pv->der_value);
-		gp11_attribute_init_copy (&pv->der_value, attr);
+		gp11_attribute_clear (&self->pv->der_value);
+		gp11_attribute_init_copy (&self->pv->der_value, attr);
 	}
 	
-	g_return_val_if_fail (!gp11_attribute_is_invalid (&pv->der_value), NULL);
-	*n_length = pv->der_value.length;
-	return pv->der_value.value;
+	g_return_val_if_fail (!gp11_attribute_is_invalid (&self->pv->der_value), NULL);
+	*n_length = self->pv->der_value.length;
+	return self->pv->der_value.value;
 }
 
 static void 
@@ -338,78 +302,19 @@
  */
 
 SeahorsePkcs11Certificate*
-seahorse_pkcs11_certificate_new (GP11Object* object, GP11Attributes* attributes)
+seahorse_pkcs11_certificate_new (GP11Object* object)
 {
 	return g_object_new (SEAHORSE_PKCS11_TYPE_CERTIFICATE, 
-	                     "pkcs11-object", object, 
-	                     "pkcs11-attributes", attributes, NULL);
-}
-
-GP11Object* 
-seahorse_pkcs11_certificate_get_pkcs11_object (SeahorsePkcs11Certificate* self) 
-{
-	g_return_val_if_fail (SEAHORSE_PKCS11_IS_CERTIFICATE (self), NULL);
-	return SEAHORSE_PKCS11_CERTIFICATE_GET_PRIVATE (self)->pkcs11_object;
-}
-
-void 
-seahorse_pkcs11_certificate_set_pkcs11_object (SeahorsePkcs11Certificate* self, GP11Object* value) 
-{
-	SeahorsePkcs11CertificatePrivate *pv;
-	
-	g_return_if_fail (SEAHORSE_PKCS11_IS_CERTIFICATE (self));
-	pv = SEAHORSE_PKCS11_CERTIFICATE_GET_PRIVATE (self);
-	
-	if (pv->pkcs11_object)
-		g_object_unref (pv->pkcs11_object);
-	pv->pkcs11_object = value;
-	if (pv->pkcs11_object)
-		g_object_ref (pv->pkcs11_object);
-	
-	certificate_rebuild (self);
-	g_object_notify (G_OBJECT (self), "pkcs11-object");
-}
-
-GP11Attributes* 
-seahorse_pkcs11_certificate_get_pkcs11_attributes (SeahorsePkcs11Certificate* self) 
-{
-	g_return_val_if_fail (SEAHORSE_PKCS11_IS_CERTIFICATE (self), NULL);
-	return SEAHORSE_PKCS11_CERTIFICATE_GET_PRIVATE (self)->pkcs11_attributes;
-}
-
-
-void 
-seahorse_pkcs11_certificate_set_pkcs11_attributes (SeahorsePkcs11Certificate* self, GP11Attributes* value) 
-{
-	SeahorsePkcs11CertificatePrivate *pv;
-	
-	g_return_if_fail (SEAHORSE_PKCS11_IS_CERTIFICATE (self));
-	pv = SEAHORSE_PKCS11_CERTIFICATE_GET_PRIVATE (self);
-	
-	if (pv->pkcs11_attributes)
-		gp11_attributes_unref (pv->pkcs11_attributes);
-	pv->pkcs11_attributes = value;
-	if (pv->pkcs11_attributes)
-		gp11_attributes_ref (pv->pkcs11_attributes);
-	
-	certificate_rebuild (self);
-	g_object_notify (G_OBJECT (self), "pkcs11-attributes");
+	                     "pkcs11-object", object, NULL);
 }
 
-char* 
+gchar* 
 seahorse_pkcs11_certificate_get_fingerprint (SeahorsePkcs11Certificate* self) 
 {
-	SeahorsePkcs11CertificatePrivate *pv;
 	GP11Attribute* attr;
 	
-	g_return_val_if_fail (SEAHORSE_PKCS11_IS_CERTIFICATE (self), NULL);
-	pv = SEAHORSE_PKCS11_CERTIFICATE_GET_PRIVATE (self);
-	
-	/* TODO: We should be using the fingerprint off the key */
-	if (pv->pkcs11_attributes == NULL) 
-		return g_strdup ("");
-
-	attr = gp11_attributes_find (pv->pkcs11_attributes, CKA_ID);
+	/* TODO: We should be using the fingerprint off the DER */
+	attr = seahorse_pkcs11_object_require_attribute (SEAHORSE_PKCS11_OBJECT (self), CKA_ID);
 	if (attr == NULL)
 		return g_strdup ("");
 
@@ -435,23 +340,23 @@
 guint 
 seahorse_pkcs11_certificate_get_trust (SeahorsePkcs11Certificate* self) 
 {
-	SeahorsePkcs11CertificatePrivate *pv;
-	gulong trust;
-	
-	g_return_val_if_fail (SEAHORSE_PKCS11_IS_CERTIFICATE (self), 0U);
-	pv = SEAHORSE_PKCS11_CERTIFICATE_GET_PRIVATE (self);
-	
-	trust = 0UL;
-	if (pv->pkcs11_attributes == NULL || 
-	    !gp11_attributes_find_ulong (pv->pkcs11_attributes, CKA_GNOME_USER_TRUST, &trust)) 
+	GP11Attribute *attr;
+
+	g_return_val_if_fail (SEAHORSE_PKCS11_IS_CERTIFICATE (self), 0);
+
+	attr = seahorse_pkcs11_object_require_attribute (SEAHORSE_PKCS11_OBJECT (self), CKA_GNOME_USER_TRUST);
+	if (!attr)
 		return SEAHORSE_VALIDITY_UNKNOWN;
-	
-	if (trust == CKT_GNOME_TRUSTED)
+
+	switch (gp11_attribute_get_ulong (attr)) 
+	{
+	case CKT_GNOME_TRUSTED:
 		return SEAHORSE_VALIDITY_FULL;
-	else if (trust == CKT_GNOME_UNTRUSTED)
+	case CKT_GNOME_UNTRUSTED:
 		return SEAHORSE_VALIDITY_NEVER;
-	else
+	default:
 		return SEAHORSE_VALIDITY_UNKNOWN;
+	}
 }
 
 const char* 
@@ -465,18 +370,17 @@
 gulong
 seahorse_pkcs11_certificate_get_expires (SeahorsePkcs11Certificate* self) 
 {
-	SeahorsePkcs11CertificatePrivate *pv;
-
-	GDate date = {0};
-	struct tm time = {0};
+	GP11Attribute *attr;
+	GDate date = { 0 };
+	struct tm time = { 0 };
 
-	g_return_val_if_fail (SEAHORSE_PKCS11_IS_CERTIFICATE (self), 0UL);
-	pv = SEAHORSE_PKCS11_CERTIFICATE_GET_PRIVATE (self);
+	g_return_val_if_fail (SEAHORSE_PKCS11_IS_CERTIFICATE (self), 0);
 	
-	if (pv->pkcs11_attributes == NULL || 
-	    !gp11_attributes_find_date (pv->pkcs11_attributes, CKA_END_DATE, &date))
+	attr = seahorse_pkcs11_object_require_attribute (SEAHORSE_PKCS11_OBJECT (self), CKA_END_DATE);
+	if (attr == NULL)
 		return 0;
-
+	
+	gp11_attribute_get_date (attr, &date);
 	g_date_to_struct_tm (&date, &time);
 	return (gulong)(mktime (&time));
 }

Modified: trunk/pkcs11/seahorse-pkcs11-certificate.h
==============================================================================
--- trunk/pkcs11/seahorse-pkcs11-certificate.h	(original)
+++ trunk/pkcs11/seahorse-pkcs11-certificate.h	Sun Dec 14 14:53:04 2008
@@ -26,7 +26,7 @@
 
 #include <glib-object.h>
 
-#include "seahorse-object.h"
+#include "seahorse-pkcs11-object.h"
 
 #define SEAHORSE_PKCS11_TYPE_CERTIFICATE               (seahorse_pkcs11_certificate_get_type ())
 #define SEAHORSE_PKCS11_CERTIFICATE(obj)               (G_TYPE_CHECK_INSTANCE_CAST ((obj), SEAHORSE_PKCS11_TYPE_CERTIFICATE, SeahorsePkcs11Certificate))
@@ -40,27 +40,17 @@
 typedef struct _SeahorsePkcs11CertificatePrivate SeahorsePkcs11CertificatePrivate;
     
 struct _SeahorsePkcs11Certificate {
-	SeahorseObject parent;
+	SeahorsePkcs11Object parent;
+	SeahorsePkcs11CertificatePrivate *pv;
 };
 
 struct _SeahorsePkcs11CertificateClass {
-	SeahorseObjectClass parent_class;
+	SeahorsePkcs11ObjectClass parent_class;
 };
 
 GType                       seahorse_pkcs11_certificate_get_type               (void);
 
-SeahorsePkcs11Certificate*  seahorse_pkcs11_certificate_new                    (GP11Object* object, 
-                                                                                GP11Attributes* attributes);
-
-GP11Object*                 seahorse_pkcs11_certificate_get_pkcs11_object      (SeahorsePkcs11Certificate* self);
-
-void                        seahorse_pkcs11_certificate_set_pkcs11_object      (SeahorsePkcs11Certificate* self, 
-                                                                                GP11Object* value);
-
-GP11Attributes*             seahorse_pkcs11_certificate_get_pkcs11_attributes  (SeahorsePkcs11Certificate* self);
-
-void                        seahorse_pkcs11_certificate_set_pkcs11_attributes  (SeahorsePkcs11Certificate* self, 
-                                                                                GP11Attributes* value);
+SeahorsePkcs11Certificate*  seahorse_pkcs11_certificate_new                    (GP11Object* object);
 
 gchar*                      seahorse_pkcs11_certificate_get_fingerprint        (SeahorsePkcs11Certificate* self);
 

Modified: trunk/pkcs11/seahorse-pkcs11-commands.c
==============================================================================
--- trunk/pkcs11/seahorse-pkcs11-commands.c	(original)
+++ trunk/pkcs11/seahorse-pkcs11-commands.c	Sun Dec 14 14:53:04 2008
@@ -128,7 +128,7 @@
 	SeahorseView *view;
 	
 	if (obj) {
-		pv = SEAHORSE_PKCS11_COMMANDS_GET_PRIVATE (self);
+		pv = SEAHORSE_PKCS11_COMMANDS_GET_PRIVATE (obj);
 		self = SEAHORSE_PKCS11_COMMANDS (obj);
 		base = SEAHORSE_COMMANDS (self);
 	
@@ -204,6 +204,7 @@
 	seahorse_pkcs11_commands_parent_class = g_type_class_peek_parent (klass);
 	g_type_class_add_private (klass, sizeof (SeahorsePkcs11CommandsPrivate));
 
+	gobject_class->constructor = seahorse_pkcs11_commands_constructor;
 	gobject_class->dispose = seahorse_pkcs11_commands_dispose;
 	gobject_class->finalize = seahorse_pkcs11_commands_finalize;
 	gobject_class->set_property = seahorse_pkcs11_commands_set_property;

Added: trunk/pkcs11/seahorse-pkcs11-helpers.c
==============================================================================
--- (empty file)
+++ trunk/pkcs11/seahorse-pkcs11-helpers.c	Sun Dec 14 14:53:04 2008
@@ -0,0 +1,153 @@
+/* 
+ * 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 "seahorse-pkcs11.h"
+#include "seahorse-pkcs11-helpers.h"
+
+#include <stdlib.h>
+#include <string.h>
+#include <pkcs11.h>
+#include <pkcs11g.h>
+
+static char* 
+seahorse_pkcs11_klass_to_string (gulong klass) 
+{
+	switch (klass)
+	{
+	case CKO_DATA:
+		return g_strdup ("data");
+	case CKO_CERTIFICATE:
+		return g_strdup ("certificate");
+	case CKO_PRIVATE_KEY:
+		return g_strdup ("private-key");
+	case CKO_PUBLIC_KEY:
+		return g_strdup ("public-key");
+	default:
+		return g_strdup_printf ("%lu", klass);
+	}
+}
+
+static gulong 
+seahorse_pkcs11_string_to_klass (const char* str) 
+{
+	gulong klass;
+	gchar *end;
+	
+	g_return_val_if_fail (str != NULL, 0UL);
+	
+	if (g_str_equal (str, "data"))
+		return CKO_DATA;
+	if (g_str_equal (str, "certificate"))
+		return CKO_CERTIFICATE;
+	if (g_str_equal (str, "private-key"))
+		return CKO_PRIVATE_KEY;
+	if (g_str_equal (str, "public-key"))
+		return CKO_PUBLIC_KEY;
+	
+	klass = strtoul (str, &end, 10);
+	if (!*end) {
+		g_warning ("unrecognized and unparsable PKCS#11 class: %s", str);
+		return (gulong)-1;
+	}
+	
+	return klass;
+}
+
+GQuark 
+seahorse_pkcs11_id_from_attributes (GP11Attributes* attrs) 
+{
+	gulong klass;
+	GP11Attribute* attr;
+	gchar *id, *encoded, *klass_str;
+	GQuark quark;
+	
+	g_return_val_if_fail (attrs != NULL, 0U);
+	
+	/* These cases should have been covered by the programmer */
+
+	klass = 0;
+	if (!gp11_attributes_find_ulong (attrs, CKA_CLASS, &klass)) {
+		g_warning ("Cannot create object id. PKCS#11 attribute set did not contain CKA_CLASS.");
+		return 0;
+	}
+	
+	attr = gp11_attributes_find (attrs, CKA_ID);
+	if (attr == NULL) {
+		g_warning ("Cannot create object id. PKCS#11 attribute set did not contain CKA_ID");
+		return 0;
+	}
+	
+	encoded = g_base64_encode (attr->value, attr->length);
+	klass_str = seahorse_pkcs11_klass_to_string (klass);
+	id = g_strdup_printf ("%s:%s/%s", SEAHORSE_PKCS11_TYPE_STR, klass_str, encoded);
+	g_free (encoded);
+	g_free (klass_str);
+	
+	quark = g_quark_from_string (id);
+	g_free (id);
+	
+	return quark;
+}
+
+
+gboolean 
+seahorse_pkcs11_id_to_attributes (GQuark id, GP11Attributes* attrs) 
+{
+	const gchar* value;
+	guchar *ckid;
+	gsize n_ckid;
+	gulong klass;
+	gchar **parts;
+
+	g_return_val_if_fail (attrs != NULL, FALSE);
+	
+	if (id == 0)
+		return FALSE;
+
+	value = g_quark_to_string (id);
+	
+	parts = g_strsplit_set (value, ":/", 3);
+	if (!parts[0] || !g_str_equal (parts[0], SEAHORSE_PKCS11_TYPE_STR) ||
+	    !parts[1] || !parts[2]) {
+		g_strfreev (parts);
+		return FALSE;
+	}
+	
+	klass = seahorse_pkcs11_string_to_klass (parts[1]);
+	if (klass == -1) {
+		g_strfreev (parts);
+		return FALSE;
+	}
+
+	ckid = g_base64_decode (parts[2], &n_ckid);
+	g_strfreev (parts);
+
+	if (!id) 
+		return FALSE;
+		
+	gp11_attributes_add_ulong (attrs, CKA_CLASS, klass);
+	gp11_attributes_add_data (attrs, CKA_ID, ckid, n_ckid);
+	g_free (ckid);
+	
+	return TRUE;
+}
+
+

Added: trunk/pkcs11/seahorse-pkcs11-helpers.h
==============================================================================
--- (empty file)
+++ trunk/pkcs11/seahorse-pkcs11-helpers.h	Sun Dec 14 14:53:04 2008
@@ -0,0 +1,32 @@
+/* 
+ * 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 __SEAHORSE_PKCS11_HELPERS_H__
+#define __SEAHORSE_PKCS11_HELPERS_H__
+
+#include <glib.h>
+#include <gp11.h>
+
+GQuark seahorse_pkcs11_id_from_attributes (GP11Attributes* attrs);
+gboolean seahorse_pkcs11_id_to_attributes (GQuark id, GP11Attributes* attrs);
+
+
+#endif

Modified: trunk/pkcs11/seahorse-pkcs11-module.c
==============================================================================
--- trunk/pkcs11/seahorse-pkcs11-module.c	(original)
+++ trunk/pkcs11/seahorse-pkcs11-module.c	Sun Dec 14 14:53:04 2008
@@ -55,6 +55,7 @@
 		slots = gp11_module_get_slots (module, FALSE);
 		for (s = slots; s; s = g_list_next (s)) {
 			
+			gp11_slot_set_reuse_sessions (s->data, TRUE);
 			source = SEAHORSE_SOURCE (seahorse_pkcs11_source_new (s->data));
 			seahorse_context_take_source (NULL, source);
 		}
@@ -67,6 +68,6 @@
 	seahorse_util_string_slist_free (module_paths);
 
 	/* Let these register themselves */
-	g_type_class_unref (g_type_class_ref (SEAHORSE_PKCS11_TYPE_SOURCE));
+	g_type_class_unref (g_type_class_ref (SEAHORSE_TYPE_PKCS11_SOURCE));
 	g_type_class_unref (g_type_class_ref (SEAHORSE_PKCS11_TYPE_COMMANDS));
 }

Added: trunk/pkcs11/seahorse-pkcs11-object.c
==============================================================================
--- (empty file)
+++ trunk/pkcs11/seahorse-pkcs11-object.c	Sun Dec 14 14:53:04 2008
@@ -0,0 +1,419 @@
+/* 
+ * 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-pkcs11-object.h"
+#include "seahorse-pkcs11-operations.h"
+
+#include "seahorse-object.h"
+#include "seahorse-pkcs11.h"
+#include "seahorse-util.h"
+
+#include <pkcs11.h>
+#include <pkcs11g.h>
+
+#include <glib/gi18n-lib.h>
+
+static const gulong REQUIRED_ATTRS[] = {
+	CKA_LABEL,
+	CKA_ID
+};
+
+enum {
+	PROP_0,
+	PROP_PKCS11_HANDLE,
+	PROP_PKCS11_OBJECT,
+	PROP_PKCS11_ATTRIBUTES
+};
+
+struct _SeahorsePkcs11ObjectPrivate {
+	GP11Object *pkcs11_object;
+	GP11Attributes* pkcs11_attributes;
+	GCancellable *request_attributes;
+	
+};
+
+G_DEFINE_TYPE (SeahorsePkcs11Object, seahorse_pkcs11_object, SEAHORSE_TYPE_OBJECT);
+
+/* -----------------------------------------------------------------------------
+ * INTERNAL 
+ */
+
+static void
+received_object_attributes (GObject *object, GAsyncResult *result, gpointer user_data)
+{
+	SeahorsePkcs11Object *self = SEAHORSE_PKCS11_OBJECT (user_data);
+	GP11Attributes *attrs;
+	GError *err = NULL;
+	
+	attrs = gp11_object_get_finish (GP11_OBJECT (object), result, &err);
+	if (err && err->code == CKR_FUNCTION_CANCELED)
+		return;
+
+	g_object_unref (self->pv->request_attributes);
+	self->pv->request_attributes = NULL;
+
+	if (attrs == NULL) {
+		g_message ("couldn't load attributes for pkcs#11 object: %s",
+		           err && err->message ? err->message : "");
+	} else {
+		seahorse_pkcs11_object_set_pkcs11_attributes (self, attrs);
+		gp11_attributes_unref (attrs);
+	}
+
+	g_object_unref (self);
+}
+
+static void
+load_object_attributes (SeahorsePkcs11Object *self, const gulong *attr_types, 
+                        gsize n_attr_types)
+{
+	gboolean added = FALSE;
+	GP11Attribute *attr;
+	GArray *array;
+	gsize i;
+	
+	g_assert (SEAHORSE_PKCS11_IS_OBJECT (self));
+	g_assert (self->pv->pkcs11_attributes);
+	g_assert (self->pv->pkcs11_object);
+
+	/* Add in any attirbutes not found, as invalid */
+	for (i = 0; i < n_attr_types; ++i) {
+		attr = gp11_attributes_find (self->pv->pkcs11_attributes, attr_types[i]);
+		if (attr == NULL) {
+			gp11_attributes_add_invalid (self->pv->pkcs11_attributes, attr_types[i]);
+			added = TRUE;
+		}
+			
+	}
+
+	/* Already a request happening */
+	if (self->pv->request_attributes) {
+		if (added) {
+			/* Need to restart the request, our attributes not covered */
+			g_cancellable_cancel (self->pv->request_attributes);
+			g_object_unref (self->pv->request_attributes);
+			self->pv->request_attributes = NULL;
+		} else {
+			/* The current request works for us */
+			return;
+		}
+	}
+
+	/* 
+	 * Build up an array of attribute types to load, from the 
+	 * ones that we alrady have plus the ones that are requested.
+	 */
+	
+	array = g_array_new (FALSE, TRUE, sizeof (gulong));
+	for (i = 0; i < gp11_attributes_count (self->pv->pkcs11_attributes); ++i) {
+		attr = gp11_attributes_at (self->pv->pkcs11_attributes, i);
+		g_return_if_fail (attr);
+		g_array_append_val (array, attr->type);
+	}
+
+	/* Off we go to load them all */
+	self->pv->request_attributes = g_cancellable_new ();
+	gp11_object_get_async (self->pv->pkcs11_object, (gulong*)array->data, array->len, 
+	                       self->pv->request_attributes, received_object_attributes, g_object_ref (self));
+	
+	g_array_free (array, TRUE);
+}
+
+/* -----------------------------------------------------------------------------
+ * OBJECT 
+ */
+
+static void
+seahorse_pkcs11_object_realize (SeahorseObject *obj)
+{
+	SeahorsePkcs11Object *self = SEAHORSE_PKCS11_OBJECT (obj);
+	gboolean exportable;
+	gchar *label = NULL;
+	guint flags;
+
+	SEAHORSE_OBJECT_CLASS (seahorse_pkcs11_object_parent_class)->realize (obj);
+
+	seahorse_pkcs11_object_require_attributes (self, REQUIRED_ATTRS, G_N_ELEMENTS (REQUIRED_ATTRS));
+	
+	g_assert (SEAHORSE_PKCS11_IS_OBJECT (obj));
+
+	flags = 0;
+	if (gp11_attributes_find_boolean (self->pv->pkcs11_attributes, CKA_EXTRACTABLE, &exportable) && exportable)
+		flags |= SEAHORSE_FLAG_EXPORTABLE;
+
+	gp11_attributes_find_string (self->pv->pkcs11_attributes, CKA_LABEL, &label);
+	g_object_set (self,
+		      "label", label,
+		      "location", SEAHORSE_LOCATION_LOCAL,
+		      "flags", flags,
+		      NULL);
+
+	g_free (label);
+}
+
+static void
+seahorse_pkcs11_object_refresh (SeahorseObject *obj)
+{
+	/* Reload the same attributes */
+	load_object_attributes (SEAHORSE_PKCS11_OBJECT (obj), NULL, 0);
+	SEAHORSE_OBJECT_CLASS (seahorse_pkcs11_object_parent_class)->refresh (obj);
+}
+
+static SeahorseOperation*
+seahorse_pkcs11_object_delete (SeahorseObject *obj)
+{
+	return seahorse_pkcs11_deleter_new (SEAHORSE_PKCS11_OBJECT (obj));
+}
+
+static GObject* 
+seahorse_pkcs11_object_constructor (GType type, guint n_props, GObjectConstructParam *props) 
+{
+	SeahorsePkcs11Object *self = SEAHORSE_PKCS11_OBJECT (G_OBJECT_CLASS (seahorse_pkcs11_object_parent_class)->constructor(type, n_props, props));
+	
+	g_return_val_if_fail (self, NULL);	
+
+	g_return_val_if_fail (self->pv->pkcs11_object, NULL);
+	g_object_set (self, "id", seahorse_pkcs11_object_cannonical_id (self->pv->pkcs11_object), NULL);
+	
+	return G_OBJECT (self);
+}
+
+static void
+seahorse_pkcs11_object_init (SeahorsePkcs11Object *self)
+{
+	self->pv = (G_TYPE_INSTANCE_GET_PRIVATE (self, SEAHORSE_PKCS11_TYPE_OBJECT, SeahorsePkcs11ObjectPrivate));
+	self->pv->pkcs11_attributes = gp11_attributes_new ();
+}
+
+static void
+seahorse_pkcs11_object_dispose (GObject *obj)
+{
+	SeahorsePkcs11Object *self = SEAHORSE_PKCS11_OBJECT (obj);
+    
+	if (self->pv->pkcs11_object)
+		g_object_unref (self->pv->pkcs11_object);
+	self->pv->pkcs11_object = NULL;
+	
+	G_OBJECT_CLASS (seahorse_pkcs11_object_parent_class)->dispose (obj);
+}
+
+static void
+seahorse_pkcs11_object_finalize (GObject *obj)
+{
+	SeahorsePkcs11Object *self = SEAHORSE_PKCS11_OBJECT (obj);
+
+	g_assert (self->pv->pkcs11_object == NULL);
+	
+	if (self->pv->pkcs11_attributes)
+		gp11_attributes_unref (self->pv->pkcs11_attributes);
+	self->pv->pkcs11_attributes = NULL;
+	
+	G_OBJECT_CLASS (seahorse_pkcs11_object_parent_class)->finalize (obj);
+}
+
+static void
+seahorse_pkcs11_object_get_property (GObject *obj, guint prop_id, GValue *value, 
+                                     GParamSpec *pspec)
+{
+	SeahorsePkcs11Object *self = SEAHORSE_PKCS11_OBJECT (obj);
+	
+	switch (prop_id) {
+	case PROP_PKCS11_OBJECT:
+		g_value_set_object (value, seahorse_pkcs11_object_get_pkcs11_object (self));
+		break;
+	case PROP_PKCS11_ATTRIBUTES:
+		g_value_set_boxed (value, seahorse_pkcs11_object_get_pkcs11_attributes (self));
+		break;
+	case PROP_PKCS11_HANDLE:
+		g_value_set_ulong (value, seahorse_pkcs11_object_get_pkcs11_handle (self));
+		break;
+	default:
+		G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, prop_id, pspec);
+		break;
+	}
+}
+
+static void
+seahorse_pkcs11_object_set_property (GObject *obj, guint prop_id, const GValue *value, 
+                                     GParamSpec *pspec)
+{
+	SeahorsePkcs11Object *self = SEAHORSE_PKCS11_OBJECT (obj);
+	
+	switch (prop_id) {
+	case PROP_PKCS11_OBJECT:
+		g_return_if_fail (!self->pv->pkcs11_object);
+		self->pv->pkcs11_object = g_value_get_object (value);
+		g_return_if_fail (self->pv->pkcs11_object);
+		g_object_ref (self->pv->pkcs11_object);
+		break;
+	case PROP_PKCS11_ATTRIBUTES:
+		seahorse_pkcs11_object_set_pkcs11_attributes (self, g_value_get_boxed (value));
+		break;
+	default:
+		G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, prop_id, pspec);
+		break;
+	}
+}
+
+static void
+seahorse_pkcs11_object_class_init (SeahorsePkcs11ObjectClass *klass)
+{
+	GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
+	SeahorseObjectClass *seahorse_class = SEAHORSE_OBJECT_CLASS (klass);
+	
+	seahorse_pkcs11_object_parent_class = g_type_class_peek_parent (klass);
+	g_type_class_add_private (klass, sizeof (SeahorsePkcs11ObjectPrivate));
+
+	gobject_class->constructor = seahorse_pkcs11_object_constructor;
+	gobject_class->dispose = seahorse_pkcs11_object_dispose;
+	gobject_class->finalize = seahorse_pkcs11_object_finalize;
+	gobject_class->set_property = seahorse_pkcs11_object_set_property;
+	gobject_class->get_property = seahorse_pkcs11_object_get_property;
+
+	seahorse_class->realize = seahorse_pkcs11_object_realize;
+	seahorse_class->refresh = seahorse_pkcs11_object_refresh;
+	seahorse_class->delete = seahorse_pkcs11_object_delete;
+	
+	g_object_class_install_property (gobject_class, PROP_PKCS11_OBJECT, 
+	         g_param_spec_object ("pkcs11-object", "pkcs11-object", "pkcs11-object", GP11_TYPE_OBJECT, 
+	                              G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
+	
+	g_object_class_install_property (gobject_class, PROP_PKCS11_ATTRIBUTES, 
+	         g_param_spec_boxed ("pkcs11-attributes", "pkcs11-attributes", "pkcs11-attributes", GP11_TYPE_ATTRIBUTES, 
+	                             G_PARAM_READABLE | G_PARAM_WRITABLE));
+	
+	g_object_class_install_property (gobject_class, PROP_PKCS11_HANDLE, 
+	         g_param_spec_ulong ("pkcs11-handle", "pkcs11-handle", "pkcs11-handle", 
+	                             0, G_MAXULONG, 0, G_PARAM_READABLE));
+}
+
+/* -----------------------------------------------------------------------------
+ * PUBLIC 
+ */
+
+SeahorsePkcs11Object*
+seahorse_pkcs11_object_new (GP11Object* object)
+{
+	return g_object_new (SEAHORSE_PKCS11_TYPE_OBJECT, 
+	                     "pkcs11-object", object, NULL);
+}
+
+GP11Object* 
+seahorse_pkcs11_object_get_pkcs11_object (SeahorsePkcs11Object* self) 
+{
+	g_return_val_if_fail (SEAHORSE_PKCS11_IS_OBJECT (self), NULL);
+	return self->pv->pkcs11_object;
+}
+
+GP11Attributes* 
+seahorse_pkcs11_object_get_pkcs11_attributes (SeahorsePkcs11Object* self) 
+{
+	g_return_val_if_fail (SEAHORSE_PKCS11_IS_OBJECT (self), NULL);
+	return self->pv->pkcs11_attributes;
+}
+
+
+void 
+seahorse_pkcs11_object_set_pkcs11_attributes (SeahorsePkcs11Object* self, GP11Attributes* value) 
+{
+	GObject *obj;
+	
+	g_return_if_fail (SEAHORSE_PKCS11_IS_OBJECT (self));
+	g_return_if_fail (value);
+	
+	if (self->pv->pkcs11_attributes)
+		gp11_attributes_unref (self->pv->pkcs11_attributes);
+	self->pv->pkcs11_attributes = value;
+	if (self->pv->pkcs11_attributes)
+		gp11_attributes_ref (self->pv->pkcs11_attributes);
+	
+	obj = G_OBJECT (self);
+	g_object_freeze_notify (obj);
+	seahorse_pkcs11_object_realize (SEAHORSE_OBJECT (obj));
+	g_object_notify (obj, "pkcs11-attributes");
+	g_object_thaw_notify (obj);
+}
+
+gulong
+seahorse_pkcs11_object_get_pkcs11_handle (SeahorsePkcs11Object* self)
+{
+	g_return_val_if_fail (SEAHORSE_PKCS11_IS_OBJECT (self), 0);
+	if (self->pv->pkcs11_object)
+		return gp11_object_get_handle (self->pv->pkcs11_object);
+	return GP11_INVALID;
+}
+
+GP11Attribute*
+seahorse_pkcs11_object_require_attribute (SeahorsePkcs11Object *self, gulong attr_type)
+{
+	GP11Attribute* attr;
+	
+	g_return_val_if_fail (SEAHORSE_PKCS11_IS_OBJECT (self), NULL);
+	
+	attr = gp11_attributes_find (self->pv->pkcs11_attributes, attr_type);
+	if (attr == NULL)
+		load_object_attributes (self, &attr_type, 1);
+	if (gp11_attribute_is_invalid (attr))
+		attr = NULL;
+	
+	return attr;
+}
+
+gboolean
+seahorse_pkcs11_object_require_attributes (SeahorsePkcs11Object *self, const gulong *attr_types,
+                                           gsize n_attr_types)
+{
+	gsize i;
+	
+	g_return_val_if_fail (SEAHORSE_PKCS11_IS_OBJECT (self), FALSE);
+	
+	/* See if we have these attributes loaded */
+	for (i = 0; i < n_attr_types; ++i) {
+		if (!gp11_attributes_find (self->pv->pkcs11_attributes, attr_types[i]))
+			break;
+	}
+		
+	if (i == n_attr_types)
+		return TRUE;
+	
+	/* Go ahead and load these attributes */
+	load_object_attributes (self, attr_types, n_attr_types);
+	return FALSE;
+}
+
+GQuark
+seahorse_pkcs11_object_cannonical_id (GP11Object *object)
+{
+	GQuark quark;
+	gchar *text;
+	
+	/* TODO: This whole ID thing needs rethinking */
+	
+	text = g_strdup_printf("%s:%lu/%lu", SEAHORSE_PKCS11_TYPE_STR, 
+	                       gp11_slot_get_handle (object->slot),
+	                       gp11_object_get_handle (object));
+	
+	quark = g_quark_from_string (text);
+	g_free (text);
+	return quark;	
+}

Added: trunk/pkcs11/seahorse-pkcs11-object.h
==============================================================================
--- (empty file)
+++ trunk/pkcs11/seahorse-pkcs11-object.h	Sun Dec 14 14:53:04 2008
@@ -0,0 +1,73 @@
+/* 
+ * 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 __SEAHORSE_PKCS11_OBJECT_H__
+#define __SEAHORSE_PKCS11_OBJECT_H__
+
+#include <gp11.h>
+
+#include <glib-object.h>
+
+#include "seahorse-object.h"
+
+#define SEAHORSE_PKCS11_TYPE_OBJECT               (seahorse_pkcs11_object_get_type ())
+#define SEAHORSE_PKCS11_OBJECT(obj)               (G_TYPE_CHECK_INSTANCE_CAST ((obj), SEAHORSE_PKCS11_TYPE_OBJECT, SeahorsePkcs11Object))
+#define SEAHORSE_PKCS11_OBJECT_CLASS(klass)       (G_TYPE_CHECK_CLASS_CAST ((klass), SEAHORSE_PKCS11_TYPE_OBJECT, SeahorsePkcs11ObjectClass))
+#define SEAHORSE_PKCS11_IS_OBJECT(obj)            (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SEAHORSE_PKCS11_TYPE_OBJECT))
+#define SEAHORSE_PKCS11_IS_OBJECT_CLASS(klass)    (G_TYPE_CHECK_CLASS_TYPE ((klass), SEAHORSE_PKCS11_TYPE_OBJECT))
+#define SEAHORSE_PKCS11_OBJECT_GET_CLASS(obj)     (G_TYPE_INSTANCE_GET_CLASS ((obj), SEAHORSE_PKCS11_TYPE_OBJECT, SeahorsePkcs11ObjectClass))
+
+typedef struct _SeahorsePkcs11Object SeahorsePkcs11Object;
+typedef struct _SeahorsePkcs11ObjectClass SeahorsePkcs11ObjectClass;
+typedef struct _SeahorsePkcs11ObjectPrivate SeahorsePkcs11ObjectPrivate;
+    
+struct _SeahorsePkcs11Object {
+	SeahorseObject parent;
+	SeahorsePkcs11ObjectPrivate *pv;
+};
+
+struct _SeahorsePkcs11ObjectClass {
+	SeahorseObjectClass parent_class;
+};
+
+GType                       seahorse_pkcs11_object_get_type               (void);
+
+SeahorsePkcs11Object*       seahorse_pkcs11_object_new                    (GP11Object* object);
+
+gulong                      seahorse_pkcs11_object_get_pkcs11_handle      (SeahorsePkcs11Object* self);
+
+GP11Object*                 seahorse_pkcs11_object_get_pkcs11_object      (SeahorsePkcs11Object* self);
+
+GP11Attributes*             seahorse_pkcs11_object_get_pkcs11_attributes  (SeahorsePkcs11Object* self);
+
+void                        seahorse_pkcs11_object_set_pkcs11_attributes  (SeahorsePkcs11Object* self, 
+                                                                           GP11Attributes* value);
+
+GP11Attribute*              seahorse_pkcs11_object_require_attribute      (SeahorsePkcs11Object *self,
+                                                                           gulong attr_type);
+
+gboolean                    seahorse_pkcs11_object_require_attributes     (SeahorsePkcs11Object *self,
+                                                                           const gulong *attr_types,
+                                                                           gsize n_attr_types);
+
+GQuark                      seahorse_pkcs11_object_cannonical_id          (GP11Object *object);
+
+#endif /* __SEAHORSE_PKCS11_OBJECT_H__ */

Added: trunk/pkcs11/seahorse-pkcs11-operations.c
==============================================================================
--- (empty file)
+++ trunk/pkcs11/seahorse-pkcs11-operations.c	Sun Dec 14 14:53:04 2008
@@ -0,0 +1,442 @@
+/* 
+ * 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-pkcs11-object.h"
+#include "seahorse-pkcs11-operations.h"
+#include "seahorse-pkcs11-source.h"
+
+#include "common/seahorse-object-list.h"
+
+#include <pkcs11.h>
+#include <pkcs11g.h>
+#include <gp11.h>
+
+#include <glib/gi18n.h>
+
+static void 
+seahorse_pkcs11_mark_complete (SeahorseOperation *self, GError *error) 
+{
+	SeahorseOperation *operation = SEAHORSE_OPERATION (self);
+	if (error == NULL) 
+		seahorse_operation_mark_done (operation, FALSE, NULL);
+	else if (error->code == CKR_FUNCTION_CANCELED)
+		seahorse_operation_mark_done (operation, TRUE, NULL);
+	else 	
+		seahorse_operation_mark_done (operation, FALSE, error);
+	g_clear_error (&error);
+}
+
+/* -----------------------------------------------------------------------------
+ * REFRESHER OPERATION
+ */
+
+#define SEAHORSE_TYPE_PKCS11_REFRESHER               (seahorse_pkcs11_refresher_get_type ())
+#define SEAHORSE_PKCS11_REFRESHER(obj)               (G_TYPE_CHECK_INSTANCE_CAST ((obj), SEAHORSE_TYPE_PKCS11_REFRESHER, SeahorsePkcs11Refresher))
+#define SEAHORSE_PKCS11_REFRESHER_CLASS(klass)       (G_TYPE_CHECK_CLASS_CAST ((klass), SEAHORSE_TYPE_PKCS11_REFRESHER, SeahorsePkcs11RefresherClass))
+#define SEAHORSE_IS_PKCS11_REFRESHER(obj)            (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SEAHORSE_TYPE_PKCS11_REFRESHER))
+#define SEAHORSE_IS_PKCS11_REFRESHER_CLASS(klass)    (G_TYPE_CHECK_CLASS_TYPE ((klass), SEAHORSE_TYPE_PKCS11_REFRESHER))
+#define SEAHORSE_PKCS11_REFRESHER_GET_CLASS(obj)     (G_TYPE_INSTANCE_GET_CLASS ((obj), SEAHORSE_TYPE_PKCS11_REFRESHER, SeahorsePkcs11RefresherClass))
+
+typedef struct _SeahorsePkcs11Refresher SeahorsePkcs11Refresher;
+typedef struct _SeahorsePkcs11RefresherClass SeahorsePkcs11RefresherClass;
+    
+struct _SeahorsePkcs11Refresher {
+	SeahorseOperation parent;
+	GCancellable *cancellable;
+	SeahorsePkcs11Source *source;
+	GP11Session *session;
+	GHashTable *checks;
+};
+
+struct _SeahorsePkcs11RefresherClass {
+	SeahorseOperationClass parent_class;
+};
+
+enum {
+	PROP_0,
+	PROP_SOURCE
+};
+
+G_DEFINE_TYPE (SeahorsePkcs11Refresher, seahorse_pkcs11_refresher, SEAHORSE_TYPE_OPERATION);
+
+static guint
+ulong_hash (gconstpointer k)
+{
+	return (guint)*((gulong*)k); 
+}
+
+static gboolean
+ulong_equal (gconstpointer a, gconstpointer b)
+{
+	return *((gulong*)a) == *((gulong*)b); 
+}
+
+static gboolean
+remove_each_object (gpointer key, gpointer value, gpointer data)
+{
+	seahorse_context_remove_object (NULL, value);
+	return TRUE;
+}
+
+static void 
+on_find_objects(GP11Session *session, GAsyncResult *result, SeahorsePkcs11Refresher *self)
+{
+	GList *objects, *l;
+	GError *err = NULL;
+	gulong handle;
+	
+	g_assert (SEAHORSE_IS_PKCS11_REFRESHER (self));
+	
+	objects = gp11_session_find_objects_finish (session, result, &err);
+	if (err != NULL) {
+		seahorse_pkcs11_mark_complete (SEAHORSE_OPERATION (self), err);
+		return;
+	}
+
+	/* Remove all objects that were found, from the check table */
+	for (l = objects; l; l = g_list_next (l)) {
+		seahorse_pkcs11_source_receive_object (self->source, l->data);
+		g_hash_table_remove (self->checks, &handle);
+	}
+
+	/* Remove everything not found from the context */
+	g_hash_table_foreach_remove (self->checks, remove_each_object, NULL);
+
+	seahorse_pkcs11_mark_complete (SEAHORSE_OPERATION (self), NULL);
+}
+
+static void 
+on_open_session(GP11Slot *slot, GAsyncResult *result, SeahorsePkcs11Refresher *self) 
+{
+	GError *err = NULL;
+	GP11Attributes *attrs;
+	
+	g_return_if_fail (SEAHORSE_IS_PKCS11_REFRESHER (self));
+	
+	self->session = gp11_slot_open_session_finish (slot, result, &err);
+	if (!self->session) {
+		seahorse_pkcs11_mark_complete (SEAHORSE_OPERATION (self), err);
+		return;
+	}
+	
+	/* Step 2. Load all the objects that we want */
+	attrs = gp11_attributes_new ();
+	gp11_attributes_add_boolean (attrs, CKA_TOKEN, TRUE);
+	gp11_attributes_add_ulong (attrs, CKA_CLASS, CKO_CERTIFICATE);
+	gp11_session_find_objects_async (self->session, attrs, self->cancellable, 
+	                                 (GAsyncReadyCallback)on_find_objects, self);
+	gp11_attributes_unref (attrs);
+}
+
+static void
+seahorse_pkcs11_refresher_cancel (SeahorseOperation *operation) 
+{
+	SeahorsePkcs11Refresher *self = SEAHORSE_PKCS11_REFRESHER (operation);
+	g_return_if_fail (SEAHORSE_IS_PKCS11_REFRESHER (self));
+	g_cancellable_cancel (self->cancellable);
+}
+
+static GObject* 
+seahorse_pkcs11_refresher_constructor (GType type, guint n_props, GObjectConstructParam *props) 
+{
+	SeahorsePkcs11Refresher *self = SEAHORSE_PKCS11_REFRESHER (G_OBJECT_CLASS (seahorse_pkcs11_refresher_parent_class)->constructor(type, n_props, props));
+	GP11Slot *slot;
+	GList *objects, *l;
+	gulong handle;
+
+	g_return_val_if_fail (self, NULL);	
+	g_return_val_if_fail (self->source, NULL);	
+
+	objects = seahorse_context_get_objects (NULL, SEAHORSE_SOURCE (self->source));
+	for (l = objects; l; l = g_list_next (l)) {
+		if (g_object_class_find_property (G_OBJECT_GET_CLASS (l->data), "pkcs11-handle")) {
+			g_object_get (l->data, "pkcs11-handle", &handle, NULL);
+			g_hash_table_insert (self->checks, g_memdup (&handle, sizeof (handle)), g_object_ref (l->data));
+		}
+		
+	}
+
+	g_list_free (objects);
+
+	/* Step 1. Load the session */
+	slot = seahorse_pkcs11_source_get_slot (self->source);
+	gp11_slot_open_session_async (slot, CKF_RW_SESSION, self->cancellable, 
+	                              (GAsyncReadyCallback)on_open_session, self);
+	seahorse_operation_mark_start (SEAHORSE_OPERATION (self));
+	
+	return G_OBJECT (self);
+}
+
+static void
+seahorse_pkcs11_refresher_init (SeahorsePkcs11Refresher *self)
+{
+	self->cancellable = g_cancellable_new ();
+	self->checks = g_hash_table_new_full (ulong_hash, ulong_equal, g_free, g_object_unref);
+}
+
+static void
+seahorse_pkcs11_refresher_finalize (GObject *obj)
+{
+	SeahorsePkcs11Refresher *self = SEAHORSE_PKCS11_REFRESHER (obj);
+	
+	if (self->cancellable)
+		g_object_unref (self->cancellable);
+	self->cancellable = NULL;
+	
+	if (self->source)
+		g_object_unref (self->source);
+	self->source = NULL;
+
+	if (self->session)
+		g_object_unref (self->session);
+	self->session = NULL;
+
+	g_hash_table_destroy (self->checks);
+
+	G_OBJECT_CLASS (seahorse_pkcs11_refresher_parent_class)->finalize (obj);
+}
+
+static void
+seahorse_pkcs11_refresher_set_property (GObject *obj, guint prop_id, const GValue *value, 
+                                      GParamSpec *pspec)
+{
+	SeahorsePkcs11Refresher *self = SEAHORSE_PKCS11_REFRESHER (obj);
+	
+	switch (prop_id) {
+	case PROP_SOURCE:
+		g_return_if_fail (!self->source);
+		self->source = g_value_get_object (value);
+		g_return_if_fail (self->source);
+		g_object_ref (self->source);
+		break;
+	default:
+		G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, prop_id, pspec);
+		break;
+	}
+}
+
+static void
+seahorse_pkcs11_refresher_get_property (GObject *obj, guint prop_id, GValue *value, 
+                                      GParamSpec *pspec)
+{
+	SeahorsePkcs11Refresher *self = SEAHORSE_PKCS11_REFRESHER (obj);
+	
+	switch (prop_id) {
+	case PROP_SOURCE:
+		g_value_set_object (value, self->source);
+		break;
+	default:
+		G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, prop_id, pspec);
+		break;
+	}
+}
+
+static void
+seahorse_pkcs11_refresher_class_init (SeahorsePkcs11RefresherClass *klass)
+{
+	GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
+	SeahorseOperationClass *operation_class = SEAHORSE_OPERATION_CLASS (klass);
+	
+	seahorse_pkcs11_refresher_parent_class = g_type_class_peek_parent (klass);
+
+	gobject_class->constructor = seahorse_pkcs11_refresher_constructor;
+	gobject_class->finalize = seahorse_pkcs11_refresher_finalize;
+	gobject_class->set_property = seahorse_pkcs11_refresher_set_property;
+	gobject_class->get_property = seahorse_pkcs11_refresher_get_property;
+	
+	operation_class->cancel = seahorse_pkcs11_refresher_cancel;
+	
+	g_object_class_install_property (gobject_class, PROP_SOURCE,
+	           g_param_spec_object ("source", "Source", "Source", 
+	                                SEAHORSE_TYPE_SOURCE, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
+    
+}
+
+SeahorseOperation*
+seahorse_pkcs11_refresher_new (SeahorsePkcs11Source *source)
+{
+	return g_object_new (SEAHORSE_TYPE_PKCS11_REFRESHER, "source", source, NULL);
+}
+
+
+/* -----------------------------------------------------------------------------
+ * DELETER OPERATION
+ */
+
+#define SEAHORSE_TYPE_PKCS11_DELETER               (seahorse_pkcs11_deleter_get_type ())
+#define SEAHORSE_PKCS11_DELETER(obj)               (G_TYPE_CHECK_INSTANCE_CAST ((obj), SEAHORSE_TYPE_PKCS11_DELETER, SeahorsePkcs11Deleter))
+#define SEAHORSE_PKCS11_DELETER_CLASS(klass)       (G_TYPE_CHECK_CLASS_CAST ((klass), SEAHORSE_TYPE_PKCS11_DELETER, SeahorsePkcs11DeleterClass))
+#define SEAHORSE_IS_PKCS11_DELETER(obj)            (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SEAHORSE_TYPE_PKCS11_DELETER))
+#define SEAHORSE_IS_PKCS11_DELETER_CLASS(klass)    (G_TYPE_CHECK_CLASS_TYPE ((klass), SEAHORSE_TYPE_PKCS11_DELETER))
+#define SEAHORSE_PKCS11_DELETER_GET_CLASS(obj)     (G_TYPE_INSTANCE_GET_CLASS ((obj), SEAHORSE_TYPE_PKCS11_DELETER, SeahorsePkcs11DeleterClass))
+
+typedef struct _SeahorsePkcs11Deleter SeahorsePkcs11Deleter;
+typedef struct _SeahorsePkcs11DeleterClass SeahorsePkcs11DeleterClass;
+    
+struct _SeahorsePkcs11Deleter {
+	SeahorseOperation parent;
+	SeahorsePkcs11Object *object;
+	GCancellable *cancellable;
+};
+
+struct _SeahorsePkcs11DeleterClass {
+	SeahorseOperationClass parent_class;
+};
+
+enum {
+	PROP_D0,
+	PROP_OBJECT
+};
+
+G_DEFINE_TYPE (SeahorsePkcs11Deleter, seahorse_pkcs11_deleter, SEAHORSE_TYPE_OPERATION);
+
+static void 
+on_deleted (GP11Object *object, GAsyncResult *result, SeahorsePkcs11Deleter *self) 
+{
+	GError *err = NULL;
+	
+	g_return_if_fail (SEAHORSE_IS_PKCS11_DELETER (self));
+	
+	if (!gp11_object_destroy_finish (object, result, &err)) {
+
+		/* Ignore objects that have gone away */
+		if (err->code != CKR_OBJECT_HANDLE_INVALID) { 
+			seahorse_pkcs11_mark_complete (SEAHORSE_OPERATION (self), err);
+			return;
+		}
+		
+		g_error_free (err);
+	}
+	
+	seahorse_context_remove_object (NULL, SEAHORSE_OBJECT (self->object));
+	seahorse_pkcs11_mark_complete (SEAHORSE_OPERATION (self), NULL);
+}
+			
+static void
+seahorse_pkcs11_deleter_cancel (SeahorseOperation *operation) 
+{
+	SeahorsePkcs11Deleter *self = SEAHORSE_PKCS11_DELETER (operation);
+	g_return_if_fail (SEAHORSE_IS_PKCS11_DELETER (self));
+	g_cancellable_cancel (self->cancellable);
+}
+
+static GObject* 
+seahorse_pkcs11_deleter_constructor (GType type, guint n_props, GObjectConstructParam *props) 
+{
+	SeahorsePkcs11Deleter *self = SEAHORSE_PKCS11_DELETER (G_OBJECT_CLASS (seahorse_pkcs11_deleter_parent_class)->constructor(type, n_props, props));
+	
+	g_return_val_if_fail (self, NULL);
+	g_return_val_if_fail (self->object, NULL);
+
+	/* Start the delete */
+	gp11_object_destroy_async (seahorse_pkcs11_object_get_pkcs11_object (self->object),
+	                           self->cancellable, (GAsyncReadyCallback)on_deleted, self);
+	seahorse_operation_mark_start (SEAHORSE_OPERATION (self));
+	
+	return G_OBJECT (self);
+}
+
+static void
+seahorse_pkcs11_deleter_init (SeahorsePkcs11Deleter *self)
+{
+	self->cancellable = g_cancellable_new ();
+}
+
+static void
+seahorse_pkcs11_deleter_finalize (GObject *obj)
+{
+	SeahorsePkcs11Deleter *self = SEAHORSE_PKCS11_DELETER (obj);
+	
+	if (self->cancellable)
+		g_object_unref (self->cancellable);
+	self->cancellable = NULL;
+	
+	if (self->object)
+		g_object_unref (self->object);
+	self->object = NULL;
+
+	G_OBJECT_CLASS (seahorse_pkcs11_deleter_parent_class)->finalize (obj);
+}
+
+static void
+seahorse_pkcs11_deleter_set_property (GObject *obj, guint prop_id, const GValue *value, 
+                                      GParamSpec *pspec)
+{
+	SeahorsePkcs11Deleter *self = SEAHORSE_PKCS11_DELETER (obj);
+	
+	switch (prop_id) {
+	case PROP_OBJECT:
+		g_return_if_fail (!self->object);
+		self->object = g_value_get_object (value);
+		g_return_if_fail (self->object);
+		g_object_ref (self->object);
+		break;
+	default:
+		G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, prop_id, pspec);
+		break;
+	}
+}
+
+static void
+seahorse_pkcs11_deleter_get_property (GObject *obj, guint prop_id, GValue *value, 
+                                      GParamSpec *pspec)
+{
+	SeahorsePkcs11Deleter *self = SEAHORSE_PKCS11_DELETER (obj);
+	
+	switch (prop_id) {
+	case PROP_OBJECT:
+		g_value_set_object (value, self->object);
+		break;
+	default:
+		G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, prop_id, pspec);
+		break;
+	}
+}
+
+static void
+seahorse_pkcs11_deleter_class_init (SeahorsePkcs11DeleterClass *klass)
+{
+	GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
+	SeahorseOperationClass *operation_class = SEAHORSE_OPERATION_CLASS (klass);
+	
+	seahorse_pkcs11_deleter_parent_class = g_type_class_peek_parent (klass);
+
+	gobject_class->constructor = seahorse_pkcs11_deleter_constructor;
+	gobject_class->finalize = seahorse_pkcs11_deleter_finalize;
+	gobject_class->set_property = seahorse_pkcs11_deleter_set_property;
+	gobject_class->get_property = seahorse_pkcs11_deleter_get_property;
+	
+	operation_class->cancel = seahorse_pkcs11_deleter_cancel;
+	
+	g_object_class_install_property (gobject_class, PROP_OBJECT,
+	           g_param_spec_object ("object", "Object", "Deleting Object", 
+	                                SEAHORSE_PKCS11_TYPE_OBJECT, 
+	                                G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
+    
+}
+
+SeahorseOperation*
+seahorse_pkcs11_deleter_new (SeahorsePkcs11Object *object)
+{
+	return g_object_new (SEAHORSE_TYPE_PKCS11_DELETER, "object", object, NULL);
+}

Added: trunk/pkcs11/seahorse-pkcs11-operations.h
==============================================================================
--- (empty file)
+++ trunk/pkcs11/seahorse-pkcs11-operations.h	Sun Dec 14 14:53:04 2008
@@ -0,0 +1,36 @@
+/* 
+ * 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 __SEAHORSE_PKCS11_OPERATIONS_H__
+#define __SEAHORSE_PKCS11_OPERATIONS_H__
+
+#include <glib-object.h>
+
+#include "seahorse-operation.h"
+
+#include "seahorse-pkcs11-object.h"
+#include "seahorse-pkcs11-source.h"
+
+SeahorseOperation*         seahorse_pkcs11_refresher_new   (SeahorsePkcs11Source *source);
+
+SeahorseOperation*         seahorse_pkcs11_deleter_new     (SeahorsePkcs11Object *object);
+
+#endif /* __SEAHORSE_PKCS11_OPERATIONS_H__ */

Modified: trunk/pkcs11/seahorse-pkcs11-source.c
==============================================================================
--- trunk/pkcs11/seahorse-pkcs11-source.c	(original)
+++ trunk/pkcs11/seahorse-pkcs11-source.c	Sun Dec 14 14:53:04 2008
@@ -1,1561 +1,233 @@
+/*
+ * Seahorse
+ *
+ * Copyright (C) 2006 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 <stdlib.h>
+#include <string.h>
+#include <libintl.h>
+
+#include <glib/gi18n.h>
+
+#include "seahorse-operation.h"
+#include "seahorse-util.h"
+#include "seahorse-secure-memory.h"
+#include "seahorse-passphrase.h"
 
-#include "seahorse-pkcs11-source.h"
-#include <pkcs11.h>
-#include <pkcs11g.h>
-#include <seahorse-util.h>
-#include <glib/gi18n-lib.h>
-#include <seahorse-pkcs11-certificate.h>
-#include <seahorse-context.h>
 #include "seahorse-pkcs11.h"
+#include "seahorse-pkcs11-certificate.h"
+#include "seahorse-pkcs11-object.h"
+#include "seahorse-pkcs11-operations.h"
+#include "seahorse-pkcs11-source.h"
 
+#include "common/seahorse-registry.h"
 
-#define SEAHORSE_PKCS11_SOURCE_TYPE_UPDATER (seahorse_pkcs11_source_updater_get_type ())
-#define SEAHORSE_PKCS11_SOURCE_UPDATER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SEAHORSE_PKCS11_SOURCE_TYPE_UPDATER, SeahorsePkcs11SourceUpdater))
-#define SEAHORSE_PKCS11_SOURCE_UPDATER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SEAHORSE_PKCS11_SOURCE_TYPE_UPDATER, SeahorsePkcs11SourceUpdaterClass))
-#define SEAHORSE_PKCS11_SOURCE_IS_UPDATER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SEAHORSE_PKCS11_SOURCE_TYPE_UPDATER))
-#define SEAHORSE_PKCS11_SOURCE_IS_UPDATER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SEAHORSE_PKCS11_SOURCE_TYPE_UPDATER))
-#define SEAHORSE_PKCS11_SOURCE_UPDATER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), SEAHORSE_PKCS11_SOURCE_TYPE_UPDATER, SeahorsePkcs11SourceUpdaterClass))
-
-typedef struct _SeahorsePkcs11SourceUpdater SeahorsePkcs11SourceUpdater;
-typedef struct _SeahorsePkcs11SourceUpdaterClass SeahorsePkcs11SourceUpdaterClass;
-typedef struct _SeahorsePkcs11SourceUpdaterPrivate SeahorsePkcs11SourceUpdaterPrivate;
-
-#define SEAHORSE_PKCS11_SOURCE_TYPE_REFRESHER (seahorse_pkcs11_source_refresher_get_type ())
-#define SEAHORSE_PKCS11_SOURCE_REFRESHER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SEAHORSE_PKCS11_SOURCE_TYPE_REFRESHER, SeahorsePkcs11SourceRefresher))
-#define SEAHORSE_PKCS11_SOURCE_REFRESHER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SEAHORSE_PKCS11_SOURCE_TYPE_REFRESHER, SeahorsePkcs11SourceRefresherClass))
-#define SEAHORSE_PKCS11_SOURCE_IS_REFRESHER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SEAHORSE_PKCS11_SOURCE_TYPE_REFRESHER))
-#define SEAHORSE_PKCS11_SOURCE_IS_REFRESHER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SEAHORSE_PKCS11_SOURCE_TYPE_REFRESHER))
-#define SEAHORSE_PKCS11_SOURCE_REFRESHER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), SEAHORSE_PKCS11_SOURCE_TYPE_REFRESHER, SeahorsePkcs11SourceRefresherClass))
-
-typedef struct _SeahorsePkcs11SourceRefresher SeahorsePkcs11SourceRefresher;
-typedef struct _SeahorsePkcs11SourceRefresherClass SeahorsePkcs11SourceRefresherClass;
-typedef struct _SeahorsePkcs11SourceRefresherPrivate SeahorsePkcs11SourceRefresherPrivate;
-
-#define SEAHORSE_PKCS11_SOURCE_TYPE_LOADER (seahorse_pkcs11_source_loader_get_type ())
-#define SEAHORSE_PKCS11_SOURCE_LOADER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SEAHORSE_PKCS11_SOURCE_TYPE_LOADER, SeahorsePkcs11SourceLoader))
-#define SEAHORSE_PKCS11_SOURCE_LOADER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SEAHORSE_PKCS11_SOURCE_TYPE_LOADER, SeahorsePkcs11SourceLoaderClass))
-#define SEAHORSE_PKCS11_SOURCE_IS_LOADER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SEAHORSE_PKCS11_SOURCE_TYPE_LOADER))
-#define SEAHORSE_PKCS11_SOURCE_IS_LOADER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SEAHORSE_PKCS11_SOURCE_TYPE_LOADER))
-#define SEAHORSE_PKCS11_SOURCE_LOADER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), SEAHORSE_PKCS11_SOURCE_TYPE_LOADER, SeahorsePkcs11SourceLoaderClass))
-
-typedef struct _SeahorsePkcs11SourceLoader SeahorsePkcs11SourceLoader;
-typedef struct _SeahorsePkcs11SourceLoaderClass SeahorsePkcs11SourceLoaderClass;
-typedef struct _SeahorsePkcs11SourceLoaderPrivate SeahorsePkcs11SourceLoaderPrivate;
-
-#define SEAHORSE_PKCS11_SOURCE_TYPE_IMPORTER (seahorse_pkcs11_source_importer_get_type ())
-#define SEAHORSE_PKCS11_SOURCE_IMPORTER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SEAHORSE_PKCS11_SOURCE_TYPE_IMPORTER, SeahorsePkcs11SourceImporter))
-#define SEAHORSE_PKCS11_SOURCE_IMPORTER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SEAHORSE_PKCS11_SOURCE_TYPE_IMPORTER, SeahorsePkcs11SourceImporterClass))
-#define SEAHORSE_PKCS11_SOURCE_IS_IMPORTER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SEAHORSE_PKCS11_SOURCE_TYPE_IMPORTER))
-#define SEAHORSE_PKCS11_SOURCE_IS_IMPORTER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SEAHORSE_PKCS11_SOURCE_TYPE_IMPORTER))
-#define SEAHORSE_PKCS11_SOURCE_IMPORTER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), SEAHORSE_PKCS11_SOURCE_TYPE_IMPORTER, SeahorsePkcs11SourceImporterClass))
-
-typedef struct _SeahorsePkcs11SourceImporter SeahorsePkcs11SourceImporter;
-typedef struct _SeahorsePkcs11SourceImporterClass SeahorsePkcs11SourceImporterClass;
-typedef struct _SeahorsePkcs11SourceImporterPrivate SeahorsePkcs11SourceImporterPrivate;
-
-#define SEAHORSE_PKCS11_SOURCE_TYPE_REMOVER (seahorse_pkcs11_source_remover_get_type ())
-#define SEAHORSE_PKCS11_SOURCE_REMOVER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SEAHORSE_PKCS11_SOURCE_TYPE_REMOVER, SeahorsePkcs11SourceRemover))
-#define SEAHORSE_PKCS11_SOURCE_REMOVER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SEAHORSE_PKCS11_SOURCE_TYPE_REMOVER, SeahorsePkcs11SourceRemoverClass))
-#define SEAHORSE_PKCS11_SOURCE_IS_REMOVER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SEAHORSE_PKCS11_SOURCE_TYPE_REMOVER))
-#define SEAHORSE_PKCS11_SOURCE_IS_REMOVER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SEAHORSE_PKCS11_SOURCE_TYPE_REMOVER))
-#define SEAHORSE_PKCS11_SOURCE_REMOVER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), SEAHORSE_PKCS11_SOURCE_TYPE_REMOVER, SeahorsePkcs11SourceRemoverClass))
-
-typedef struct _SeahorsePkcs11SourceRemover SeahorsePkcs11SourceRemover;
-typedef struct _SeahorsePkcs11SourceRemoverClass SeahorsePkcs11SourceRemoverClass;
-typedef struct _SeahorsePkcs11SourceRemoverPrivate SeahorsePkcs11SourceRemoverPrivate;
-
-/* ------------------------------------------------------------------------------
- * Base class for several operations that all load objects (refresh, load, import)
- */
-struct _SeahorsePkcs11SourceUpdater {
-	SeahorseOperation parent_instance;
-	SeahorsePkcs11SourceUpdaterPrivate * priv;
-	SeahorsePkcs11Source* _source;
-	GP11Session* _session;
-};
-
-struct _SeahorsePkcs11SourceUpdaterClass {
-	SeahorseOperationClass parent_class;
-	void (*load_objects) (SeahorsePkcs11SourceUpdater* self);
-};
-
-/* ------------------------------------------------------------------------------- 
- * REFRESH OPREATION
- */
-struct _SeahorsePkcs11SourceRefresher {
-	SeahorsePkcs11SourceUpdater parent_instance;
-	SeahorsePkcs11SourceRefresherPrivate * priv;
-};
-
-struct _SeahorsePkcs11SourceRefresherClass {
-	SeahorsePkcs11SourceUpdaterClass parent_class;
-};
-
-/* ------------------------------------------------------------------------------- 
- * LOAD OPREATION
- */
-struct _SeahorsePkcs11SourceLoader {
-	SeahorsePkcs11SourceUpdater parent_instance;
-	SeahorsePkcs11SourceLoaderPrivate * priv;
-};
-
-struct _SeahorsePkcs11SourceLoaderClass {
-	SeahorsePkcs11SourceUpdaterClass parent_class;
-};
-
-/* ------------------------------------------------------------------------------- 
- * IMPORT OPREATION
- */
-struct _SeahorsePkcs11SourceImporter {
-	SeahorsePkcs11SourceUpdater parent_instance;
-	SeahorsePkcs11SourceImporterPrivate * priv;
-};
-
-struct _SeahorsePkcs11SourceImporterClass {
-	SeahorsePkcs11SourceUpdaterClass parent_class;
-};
-
-/* ------------------------------------------------------------------------------- 
- * REMOVE OPREATION
- */
-struct _SeahorsePkcs11SourceRemover {
-	SeahorseOperation parent_instance;
-	SeahorsePkcs11SourceRemoverPrivate * priv;
+enum {
+    PROP_0,
+    PROP_SLOT,
+    PROP_KEY_TYPE,
+    PROP_FLAGS,
+    PROP_KEY_DESC,
+    PROP_LOCATION
 };
 
-struct _SeahorsePkcs11SourceRemoverClass {
-	SeahorseOperationClass parent_class;
-};
-
-
-
 struct _SeahorsePkcs11SourcePrivate {
-	GP11Slot* _slot;
-};
-
-#define SEAHORSE_PKCS11_SOURCE_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), SEAHORSE_PKCS11_TYPE_SOURCE, SeahorsePkcs11SourcePrivate))
-enum  {
-	SEAHORSE_PKCS11_SOURCE_DUMMY_PROPERTY,
-	SEAHORSE_PKCS11_SOURCE_SLOT,
-	SEAHORSE_PKCS11_SOURCE_LOCATION,
-	SEAHORSE_PKCS11_SOURCE_KEY_TYPE,
-	SEAHORSE_PKCS11_SOURCE_KEY_DESC
-};
-static SeahorseOperation* seahorse_pkcs11_source_real_load (SeahorseSource* base, GQuark id);
-static SeahorseOperation* seahorse_pkcs11_source_real_import (SeahorsePkcs11Source* self, GInputStream* input);
-static SeahorseOperation* seahorse_pkcs11_source_real_export (SeahorsePkcs11Source* self, GList* objects, GOutputStream* output);
-static SeahorseOperation* seahorse_pkcs11_source_real_remove (SeahorsePkcs11Source* self, SeahorseObject* object);
-static void seahorse_pkcs11_source_receive_object (SeahorsePkcs11Source* self, GP11Object* object, GP11Attributes* attrs);
-static void seahorse_pkcs11_source_set_slot (SeahorsePkcs11Source* self, GP11Slot* value);
-struct _SeahorsePkcs11SourceUpdaterPrivate {
-	GCancellable* _cancellable;
-	GList* _objects;
-	gint _total;
-};
-
-#define SEAHORSE_PKCS11_SOURCE_UPDATER_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), SEAHORSE_PKCS11_SOURCE_TYPE_UPDATER, SeahorsePkcs11SourceUpdaterPrivate))
-enum  {
-	SEAHORSE_PKCS11_SOURCE_UPDATER_DUMMY_PROPERTY,
-	SEAHORSE_PKCS11_SOURCE_UPDATER_CANCELLABLE,
-	SEAHORSE_PKCS11_SOURCE_UPDATER_SOURCE
-};
-static void _g_list_free_g_object_unref (GList* self);
-static void seahorse_pkcs11_source_updater_complete (SeahorsePkcs11SourceUpdater* self, GError* err);
-static void seahorse_pkcs11_source_updater_on_open_session (SeahorsePkcs11SourceUpdater* self, GObject* obj, GAsyncResult* result);
-static void seahorse_pkcs11_source_updater_real_load_objects (SeahorsePkcs11SourceUpdater* self);
-static void seahorse_pkcs11_source_updater_load_objects (SeahorsePkcs11SourceUpdater* self);
-static void seahorse_pkcs11_source_updater_loaded_objects (SeahorsePkcs11SourceUpdater* self, GList* objects);
-static void _seahorse_pkcs11_source_updater_on_get_attributes_gasync_ready_callback (GObject* source_object, GAsyncResult* res, gpointer self);
-static void seahorse_pkcs11_source_updater_do_get_attributes (SeahorsePkcs11SourceUpdater* self);
-static void seahorse_pkcs11_source_updater_on_get_attributes (SeahorsePkcs11SourceUpdater* self, GObject* obj, GAsyncResult* result);
-static void seahorse_pkcs11_source_updater_real_cancel (SeahorseOperation* base);
-static GCancellable* seahorse_pkcs11_source_updater_get_cancellable (SeahorsePkcs11SourceUpdater* self);
-static SeahorsePkcs11Source* seahorse_pkcs11_source_updater_get_source (SeahorsePkcs11SourceUpdater* self);
-static void seahorse_pkcs11_source_updater_set_source (SeahorsePkcs11SourceUpdater* self, SeahorsePkcs11Source* value);
-static void _seahorse_pkcs11_source_updater_on_open_session_gasync_ready_callback (GObject* source_object, GAsyncResult* res, gpointer self);
-static GObject * seahorse_pkcs11_source_updater_constructor (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties);
-static gpointer seahorse_pkcs11_source_updater_parent_class = NULL;
-static void seahorse_pkcs11_source_updater_finalize (GObject * obj);
-static GType seahorse_pkcs11_source_updater_get_type (void);
-struct _SeahorsePkcs11SourceRefresherPrivate {
-	GHashTable* _checks;
-};
-
-#define SEAHORSE_PKCS11_SOURCE_REFRESHER_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), SEAHORSE_PKCS11_SOURCE_TYPE_REFRESHER, SeahorsePkcs11SourceRefresherPrivate))
-enum  {
-	SEAHORSE_PKCS11_SOURCE_REFRESHER_DUMMY_PROPERTY
+	GP11Slot *slot;    
 };
-static SeahorsePkcs11SourceRefresher* seahorse_pkcs11_source_refresher_new (SeahorsePkcs11Source* source);
-static void _seahorse_pkcs11_source_refresher_on_find_objects_gasync_ready_callback (GObject* source_object, GAsyncResult* res, gpointer self);
-static void seahorse_pkcs11_source_refresher_real_load_objects (SeahorsePkcs11SourceUpdater* base);
-static void __lambda0 (void* k, void* v, SeahorsePkcs11SourceRefresher* self);
-static void ___lambda0_gh_func (void* key, void* value, gpointer self);
-static void seahorse_pkcs11_source_refresher_on_find_objects (SeahorsePkcs11SourceRefresher* self, GObject* obj, GAsyncResult* result);
-static GObject * seahorse_pkcs11_source_refresher_constructor (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties);
-static gpointer seahorse_pkcs11_source_refresher_parent_class = NULL;
-static void seahorse_pkcs11_source_refresher_finalize (GObject * obj);
-static GType seahorse_pkcs11_source_refresher_get_type (void);
-struct _SeahorsePkcs11SourceLoaderPrivate {
-	GP11Attributes* _unique_attrs;
-};
-
-#define SEAHORSE_PKCS11_SOURCE_LOADER_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), SEAHORSE_PKCS11_SOURCE_TYPE_LOADER, SeahorsePkcs11SourceLoaderPrivate))
-enum  {
-	SEAHORSE_PKCS11_SOURCE_LOADER_DUMMY_PROPERTY,
-	SEAHORSE_PKCS11_SOURCE_LOADER_UNIQUE_ATTRS
-};
-static SeahorsePkcs11SourceLoader* seahorse_pkcs11_source_loader_new (SeahorsePkcs11Source* source, GP11Attributes* unique_attrs);
-static void _seahorse_pkcs11_source_loader_on_find_objects_gasync_ready_callback (GObject* source_object, GAsyncResult* res, gpointer self);
-static void seahorse_pkcs11_source_loader_real_load_objects (SeahorsePkcs11SourceUpdater* base);
-static void seahorse_pkcs11_source_loader_on_find_objects (SeahorsePkcs11SourceLoader* self, GObject* obj, GAsyncResult* result);
-static GP11Attributes* seahorse_pkcs11_source_loader_get_unique_attrs (SeahorsePkcs11SourceLoader* self);
-static void seahorse_pkcs11_source_loader_set_unique_attrs (SeahorsePkcs11SourceLoader* self, GP11Attributes* value);
-static gpointer seahorse_pkcs11_source_loader_parent_class = NULL;
-static void seahorse_pkcs11_source_loader_finalize (GObject * obj);
-static GType seahorse_pkcs11_source_loader_get_type (void);
-struct _SeahorsePkcs11SourceImporterPrivate {
-	GP11Attributes* _import_data;
-};
-
-#define SEAHORSE_PKCS11_SOURCE_IMPORTER_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), SEAHORSE_PKCS11_SOURCE_TYPE_IMPORTER, SeahorsePkcs11SourceImporterPrivate))
-enum  {
-	SEAHORSE_PKCS11_SOURCE_IMPORTER_DUMMY_PROPERTY,
-	SEAHORSE_PKCS11_SOURCE_IMPORTER_IMPORT_DATA
-};
-static SeahorsePkcs11SourceImporter* seahorse_pkcs11_source_importer_new (SeahorsePkcs11Source* source, GP11Attributes* import);
-static void _seahorse_pkcs11_source_importer_on_create_object_gasync_ready_callback (GObject* source_object, GAsyncResult* res, gpointer self);
-static void seahorse_pkcs11_source_importer_real_load_objects (SeahorsePkcs11SourceUpdater* base);
-static void _seahorse_pkcs11_source_importer_on_get_attribute_gasync_ready_callback (GObject* source_object, GAsyncResult* res, gpointer self);
-static void seahorse_pkcs11_source_importer_on_create_object (SeahorsePkcs11SourceImporter* self, GObject* obj, GAsyncResult* result);
-static void seahorse_pkcs11_source_importer_on_get_attribute (SeahorsePkcs11SourceImporter* self, GObject* obj, GAsyncResult* result);
-static GP11Attributes* seahorse_pkcs11_source_importer_get_import_data (SeahorsePkcs11SourceImporter* self);
-static gpointer seahorse_pkcs11_source_importer_parent_class = NULL;
-static void seahorse_pkcs11_source_importer_finalize (GObject * obj);
-static GType seahorse_pkcs11_source_importer_get_type (void);
-struct _SeahorsePkcs11SourceRemoverPrivate {
-	GCancellable* _cancellable;
-	SeahorsePkcs11Source* _source;
-	SeahorsePkcs11Certificate* _certificate;
-};
-
-#define SEAHORSE_PKCS11_SOURCE_REMOVER_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), SEAHORSE_PKCS11_SOURCE_TYPE_REMOVER, SeahorsePkcs11SourceRemoverPrivate))
-enum  {
-	SEAHORSE_PKCS11_SOURCE_REMOVER_DUMMY_PROPERTY,
-	SEAHORSE_PKCS11_SOURCE_REMOVER_CANCELLABLE,
-	SEAHORSE_PKCS11_SOURCE_REMOVER_SOURCE,
-	SEAHORSE_PKCS11_SOURCE_REMOVER_CERTIFICATE
-};
-static SeahorsePkcs11SourceRemover* seahorse_pkcs11_source_remover_new (SeahorsePkcs11Certificate* certificate);
-static void seahorse_pkcs11_source_remover_on_destroy_object (SeahorsePkcs11SourceRemover* self, GObject* obj, GAsyncResult* result);
-static void seahorse_pkcs11_source_remover_real_cancel (SeahorseOperation* base);
-static GCancellable* seahorse_pkcs11_source_remover_get_cancellable (SeahorsePkcs11SourceRemover* self);
-static SeahorsePkcs11Source* seahorse_pkcs11_source_remover_get_source (SeahorsePkcs11SourceRemover* self);
-static void seahorse_pkcs11_source_remover_set_source (SeahorsePkcs11SourceRemover* self, SeahorsePkcs11Source* value);
-static SeahorsePkcs11Certificate* seahorse_pkcs11_source_remover_get_certificate (SeahorsePkcs11SourceRemover* self);
-static void seahorse_pkcs11_source_remover_set_certificate (SeahorsePkcs11SourceRemover* self, SeahorsePkcs11Certificate* value);
-static void _seahorse_pkcs11_source_remover_on_destroy_object_gasync_ready_callback (GObject* source_object, GAsyncResult* res, gpointer self);
-static GObject * seahorse_pkcs11_source_remover_constructor (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties);
-static gpointer seahorse_pkcs11_source_remover_parent_class = NULL;
-static void seahorse_pkcs11_source_remover_finalize (GObject * obj);
-static GType seahorse_pkcs11_source_remover_get_type (void);
-static gpointer seahorse_pkcs11_source_parent_class = NULL;
-static void seahorse_pkcs11_source_finalize (GObject * obj);
-
-static const gulong SEAHORSE_PKCS11_ATTRIBUTE_TYPES[] = {CKA_LABEL, CKA_ID, CKA_CLASS, CKA_TOKEN, CKA_GNOME_USER_TRUST, CKA_START_DATE, CKA_END_DATE, CKA_EXTRACTABLE, CKA_VALUE};
-
 
-/* ---------------------------------------------------------------------------------
- * PUBLIC STUFF
- */
-SeahorsePkcs11Source* seahorse_pkcs11_source_new (GP11Slot* slot) {
-	GParameter * __params;
-	GParameter * __params_it;
-	SeahorsePkcs11Source * self;
-	g_return_val_if_fail (GP11_IS_SLOT (slot), NULL);
-	__params = g_new0 (GParameter, 1);
-	__params_it = __params;
-	__params_it->name = "slot";
-	g_value_init (&__params_it->value, GP11_TYPE_SLOT);
-	g_value_set_object (&__params_it->value, slot);
-	__params_it++;
-	self = g_object_newv (SEAHORSE_PKCS11_TYPE_SOURCE, __params_it - __params, __params);
-	while (__params_it > __params) {
-		--__params_it;
-		g_value_unset (&__params_it->value);
-	}
-	g_free (__params);
-	return self;
-}
+G_DEFINE_TYPE (SeahorsePkcs11Source, seahorse_pkcs11_source, SEAHORSE_TYPE_SOURCE);
 
 
-/* ---------------------------------------------------------------------------------
- * VIRTUAL METHODS
+/* -----------------------------------------------------------------------------
+ * OBJECT
  */
-static SeahorseOperation* seahorse_pkcs11_source_real_load (SeahorseSource* base, GQuark id) {
-	SeahorsePkcs11Source * self;
-	GP11Attributes* attrs;
-	self = SEAHORSE_PKCS11_SOURCE (base);
-	/* Load all objects */
-	if (id == 0) {
-		return SEAHORSE_OPERATION (seahorse_pkcs11_source_refresher_new (self));
-	}
-	/* Load only objects described by the id */
-	attrs = gp11_attributes_new ();
-	if (!seahorse_pkcs11_id_to_attributes (id, attrs)) {
-		SeahorseOperation* _tmp1;
-		_tmp1 = NULL;
-		return (_tmp1 = seahorse_operation_new_complete (g_error_new (SEAHORSE_ERROR, 0, "%s", _ ("Invalid or unrecognized object."), NULL)), (attrs == NULL ? NULL : (attrs = (gp11_attributes_unref (attrs), NULL))), _tmp1);
-	} else {
-		SeahorseOperation* _tmp2;
-		_tmp2 = NULL;
-		return (_tmp2 = SEAHORSE_OPERATION (seahorse_pkcs11_source_loader_new (self, attrs)), (attrs == NULL ? NULL : (attrs = (gp11_attributes_unref (attrs), NULL))), _tmp2);
-	}
-	(attrs == NULL ? NULL : (attrs = (gp11_attributes_unref (attrs), NULL)));
-}
-
-
-static SeahorseOperation* seahorse_pkcs11_source_real_import (SeahorsePkcs11Source* self, GInputStream* input) {
-	guchar* _tmp1;
-	gint data_length1;
-	gint _tmp0;
-	guchar* data;
-	GP11Attributes* attrs;
-	SeahorseOperation* _tmp2;
-	g_return_val_if_fail (SEAHORSE_PKCS11_IS_SOURCE (self), NULL);
-	g_return_val_if_fail (G_IS_INPUT_STREAM (input), NULL);
-	_tmp1 = NULL;
-	data = (_tmp1 = seahorse_util_read_to_memory (input, &_tmp0), data_length1 = _tmp0, _tmp1);
-	attrs = gp11_attributes_new ();
-	gp11_attributes_add_boolean (attrs, CKA_GNOME_IMPORT_TOKEN, TRUE);
-	gp11_attributes_add_data (attrs, CKA_VALUE, data, data_length1);
-	_tmp2 = NULL;
-	return (_tmp2 = SEAHORSE_OPERATION (seahorse_pkcs11_source_importer_new (self, attrs)), (data = (g_free (data), NULL)), (attrs == NULL ? NULL : (attrs = (gp11_attributes_unref (attrs), NULL))), _tmp2);
-}
-
-
-SeahorseOperation* seahorse_pkcs11_source_import (SeahorsePkcs11Source* self, GInputStream* input) {
-	return SEAHORSE_PKCS11_SOURCE_GET_CLASS (self)->import (self, input);
-}
 
-
-static SeahorseOperation* seahorse_pkcs11_source_real_export (SeahorsePkcs11Source* self, GList* objects, GOutputStream* output) {
-	g_return_val_if_fail (SEAHORSE_PKCS11_IS_SOURCE (self), NULL);
-	g_return_val_if_fail (objects != NULL, NULL);
-	g_return_val_if_fail (G_IS_OUTPUT_STREAM (output), NULL);
-	return seahorse_operation_new_complete (g_error_new (SEAHORSE_ERROR, 0, "%s", _ ("Exporting is not yet supported."), NULL));
-}
-
-
-SeahorseOperation* seahorse_pkcs11_source_export (SeahorsePkcs11Source* self, GList* objects, GOutputStream* output) {
-	return SEAHORSE_PKCS11_SOURCE_GET_CLASS (self)->export (self, objects, output);
-}
-
-
-static SeahorseOperation* seahorse_pkcs11_source_real_remove (SeahorsePkcs11Source* self, SeahorseObject* object) {
-	g_return_val_if_fail (SEAHORSE_PKCS11_IS_SOURCE (self), NULL);
-	g_return_val_if_fail (SEAHORSE_IS_OBJECT (object), NULL);
-	return SEAHORSE_OPERATION (seahorse_pkcs11_source_remover_new (SEAHORSE_PKCS11_CERTIFICATE (object)));
-}
-
-
-SeahorseOperation* seahorse_pkcs11_source_remove (SeahorsePkcs11Source* self, SeahorseObject* object) {
-	return SEAHORSE_PKCS11_SOURCE_GET_CLASS (self)->remove (self, object);
+static void
+seahorse_pkcs11_source_init (SeahorsePkcs11Source *self)
+{
+	self->pv = (G_TYPE_INSTANCE_GET_PRIVATE (self, SEAHORSE_TYPE_PKCS11_SOURCE, SeahorsePkcs11SourcePrivate));
 }
 
-
-/* --------------------------------------------------------------------------------
- * HELPER METHODS
- */
-static void seahorse_pkcs11_source_receive_object (SeahorsePkcs11Source* self, GP11Object* object, GP11Attributes* attrs) {
-	GQuark id;
-	gboolean created;
-	SeahorsePkcs11Certificate* cert;
-	SeahorseObject* _tmp0;
-	SeahorseObject* prev;
-	SeahorsePkcs11Certificate* _tmp3;
-	g_return_if_fail (SEAHORSE_PKCS11_IS_SOURCE (self));
-	g_return_if_fail (GP11_IS_OBJECT (object));
-	g_return_if_fail (attrs != NULL);
-	/* Build up an identifier for this object */
-	id = seahorse_pkcs11_id_from_attributes (attrs);
-	g_return_if_fail (id != 0);
-	created = FALSE;
-	cert = NULL;
-	/* Look for an already present object */
-	_tmp0 = NULL;
-	prev = (_tmp0 = seahorse_context_get_object (seahorse_context_for_app (), SEAHORSE_SOURCE (self), id), (_tmp0 == NULL ? NULL : g_object_ref (_tmp0)));
-	if (prev != NULL && G_TYPE_FROM_INSTANCE (G_OBJECT (prev)) == SEAHORSE_PKCS11_TYPE_CERTIFICATE) {
-		SeahorsePkcs11Certificate* _tmp2;
-		SeahorsePkcs11Certificate* _tmp1;
-		_tmp2 = NULL;
-		_tmp1 = NULL;
-		cert = (_tmp2 = (_tmp1 = SEAHORSE_PKCS11_CERTIFICATE (prev), (_tmp1 == NULL ? NULL : g_object_ref (_tmp1))), (cert == NULL ? NULL : (cert = (g_object_unref (cert), NULL))), _tmp2);
-		seahorse_pkcs11_certificate_set_pkcs11_object (cert, object);
-		seahorse_pkcs11_certificate_set_pkcs11_attributes (cert, attrs);
-		(cert == NULL ? NULL : (cert = (g_object_unref (cert), NULL)));
-		(prev == NULL ? NULL : (prev = (g_object_unref (prev), NULL)));
-		return;
-	}
-	/* Create a new object */
-	_tmp3 = NULL;
-	cert = (_tmp3 = seahorse_pkcs11_certificate_new (object, attrs), (cert == NULL ? NULL : (cert = (g_object_unref (cert), NULL))), _tmp3);
-	seahorse_object_set_source (SEAHORSE_OBJECT (cert), SEAHORSE_SOURCE (self));
-	seahorse_context_add_object (seahorse_context_for_app (), SEAHORSE_OBJECT (cert));
-	(cert == NULL ? NULL : (cert = (g_object_unref (cert), NULL)));
-	(prev == NULL ? NULL : (prev = (g_object_unref (prev), NULL)));
-}
-
-
-GP11Slot* seahorse_pkcs11_source_get_slot (SeahorsePkcs11Source* self) {
-	g_return_val_if_fail (SEAHORSE_PKCS11_IS_SOURCE (self), NULL);
-	return self->priv->_slot;
-}
-
-
-static void seahorse_pkcs11_source_set_slot (SeahorsePkcs11Source* self, GP11Slot* value) {
-	GP11Slot* _tmp2;
-	GP11Slot* _tmp1;
-	g_return_if_fail (SEAHORSE_PKCS11_IS_SOURCE (self));
-	_tmp2 = NULL;
-	_tmp1 = NULL;
-	self->priv->_slot = (_tmp2 = (_tmp1 = value, (_tmp1 == NULL ? NULL : g_object_ref (_tmp1))), (self->priv->_slot == NULL ? NULL : (self->priv->_slot = (g_object_unref (self->priv->_slot), NULL))), _tmp2);
-	g_object_notify (((GObject *) (self)), "slot");
-}
-
-
-SeahorseLocation seahorse_pkcs11_source_get_location (SeahorsePkcs11Source* self) {
-	g_return_val_if_fail (SEAHORSE_PKCS11_IS_SOURCE (self), 0);
-	return SEAHORSE_LOCATION_LOCAL;
-}
-
-
-GQuark seahorse_pkcs11_source_get_key_type (SeahorsePkcs11Source* self) {
-	g_return_val_if_fail (SEAHORSE_PKCS11_IS_SOURCE (self), 0U);
-	return SEAHORSE_PKCS11_TYPE;
-}
-
-
-const char* seahorse_pkcs11_source_get_key_desc (SeahorsePkcs11Source* self) {
-	g_return_val_if_fail (SEAHORSE_PKCS11_IS_SOURCE (self), NULL);
-	return _ ("X509 Certificate");
-}
-
-
-static void _g_list_free_g_object_unref (GList* self) {
-	g_list_foreach (self, ((GFunc) (g_object_unref)), NULL);
-	g_list_free (self);
-}
-
-
-static void seahorse_pkcs11_source_updater_complete (SeahorsePkcs11SourceUpdater* self, GError* err) {
-	g_return_if_fail (SEAHORSE_PKCS11_SOURCE_IS_UPDATER (self));
-	if (err == NULL) {
-		seahorse_operation_mark_done (SEAHORSE_OPERATION (self), FALSE, NULL);
-	} else {
-		if (err->code == CKR_FUNCTION_CANCELED) {
-			seahorse_operation_mark_done (SEAHORSE_OPERATION (self), TRUE, NULL);
-		} else {
-			GError* _tmp0;
-			_tmp0 = NULL;
-			seahorse_operation_mark_done (SEAHORSE_OPERATION (self), FALSE, (_tmp0 = err, (_tmp0 == NULL || g_error_copy == NULL ? ((gpointer) (_tmp0)) : g_error_copy (((gpointer) (_tmp0))))));
-		}
-	}
-}
-
-
-static void seahorse_pkcs11_source_updater_on_open_session (SeahorsePkcs11SourceUpdater* self, GObject* obj, GAsyncResult* result) {
-	GError * inner_error;
-	GP11Slot* _tmp0;
-	GP11Slot* slot;
-	g_return_if_fail (SEAHORSE_PKCS11_SOURCE_IS_UPDATER (self));
-	g_return_if_fail (G_IS_OBJECT (obj));
-	g_return_if_fail (G_IS_ASYNC_RESULT (result));
-	inner_error = NULL;
-	_tmp0 = NULL;
-	slot = (_tmp0 = GP11_SLOT (obj), (_tmp0 == NULL ? NULL : g_object_ref (_tmp0)));
-	{
-		GP11Session* _tmp1;
-		_tmp1 = NULL;
-		self->_session = (_tmp1 = gp11_slot_open_session_finish (slot, result, &inner_error), (self->_session == NULL ? NULL : (self->_session = (g_object_unref (self->_session), NULL))), _tmp1);
-		if (inner_error != NULL) {
-			goto __catch0_g_error;
-		}
-	}
-	goto __finally0;
-	__catch0_g_error:
-	{
-		GError * err;
-		err = inner_error;
-		inner_error = NULL;
-		{
-			seahorse_pkcs11_source_updater_complete (self, err);
-			(err == NULL ? NULL : (err = (g_error_free (err), NULL)));
-			(slot == NULL ? NULL : (slot = (g_object_unref (slot), NULL)));
-			return;
-		}
-	}
-	__finally0:
-	;
-	/* Step 2. Load all the objects that we want */
-	seahorse_pkcs11_source_updater_load_objects (self);
-	(slot == NULL ? NULL : (slot = (g_object_unref (slot), NULL)));
-}
-
-
-static void seahorse_pkcs11_source_updater_real_load_objects (SeahorsePkcs11SourceUpdater* self) {
-	g_return_if_fail (SEAHORSE_PKCS11_SOURCE_IS_UPDATER (self));
-	g_critical ("Type `%s' does not implement abstract method `seahorse_pkcs11_source_updater_load_objects'", g_type_name (G_TYPE_FROM_INSTANCE (self)));
-	return;
-}
-
-
-static void seahorse_pkcs11_source_updater_load_objects (SeahorsePkcs11SourceUpdater* self) {
-	SEAHORSE_PKCS11_SOURCE_UPDATER_GET_CLASS (self)->load_objects (self);
-}
-
-
-static void seahorse_pkcs11_source_updater_loaded_objects (SeahorsePkcs11SourceUpdater* self, GList* objects) {
-	GList* _tmp0;
-	g_return_if_fail (SEAHORSE_PKCS11_SOURCE_IS_UPDATER (self));
-	g_return_if_fail (objects != NULL);
-	_tmp0 = NULL;
-	self->priv->_objects = (_tmp0 = NULL, (self->priv->_objects == NULL ? NULL : (self->priv->_objects = (_g_list_free_g_object_unref (self->priv->_objects), NULL))), _tmp0);
-	{
-		GList* object_collection;
-		GList* object_it;
-		object_collection = objects;
-		for (object_it = object_collection; object_it != NULL; object_it = object_it->next) {
-			GP11Object* _tmp2;
-			GP11Object* object;
-			_tmp2 = NULL;
-			object = (_tmp2 = ((GP11Object*) (object_it->data)), (_tmp2 == NULL ? NULL : g_object_ref (_tmp2)));
-			{
-				GP11Object* _tmp1;
-				_tmp1 = NULL;
-				self->priv->_objects = g_list_append (self->priv->_objects, (_tmp1 = object, (_tmp1 == NULL ? NULL : g_object_ref (_tmp1))));
-				(object == NULL ? NULL : (object = (g_object_unref (object), NULL)));
-			}
-		}
-	}
-	self->priv->_total = ((gint) (g_list_length (self->priv->_objects)));
-	/* Step 3. Load information for each object */
-	seahorse_pkcs11_source_updater_do_get_attributes (self);
-}
-
-
-static void _seahorse_pkcs11_source_updater_on_get_attributes_gasync_ready_callback (GObject* source_object, GAsyncResult* res, gpointer self) {
-	seahorse_pkcs11_source_updater_on_get_attributes (self, source_object, res);
-}
-
-
-static void seahorse_pkcs11_source_updater_do_get_attributes (SeahorsePkcs11SourceUpdater* self) {
-	g_return_if_fail (SEAHORSE_PKCS11_SOURCE_IS_UPDATER (self));
-	/* No more objects to load? */
-	if (g_list_length (self->priv->_objects) == 0) {
-		seahorse_pkcs11_source_updater_complete (self, NULL);
-	} else {
-		GP11Object* _tmp0;
-		GP11Object* object;
-		/* Load the next object */
-		seahorse_operation_mark_progress_full (SEAHORSE_OPERATION (self), _ ("Loading..."), ((gint) (g_list_length (self->priv->_objects))) - self->priv->_total, self->priv->_total);
-		_tmp0 = NULL;
-		object = (_tmp0 = ((GP11Object*) (((GP11Object*) (self->priv->_objects->data)))), (_tmp0 == NULL ? NULL : g_object_ref (_tmp0)));
-		self->priv->_objects = g_list_remove (self->priv->_objects, object);
-		gp11_object_get_async (object, SEAHORSE_PKCS11_ATTRIBUTE_TYPES, G_N_ELEMENTS (SEAHORSE_PKCS11_ATTRIBUTE_TYPES), self->priv->_cancellable, _seahorse_pkcs11_source_updater_on_get_attributes_gasync_ready_callback, self);
-		(object == NULL ? NULL : (object = (g_object_unref (object), NULL)));
-	}
-}
-
-
-static void seahorse_pkcs11_source_updater_on_get_attributes (SeahorsePkcs11SourceUpdater* self, GObject* obj, GAsyncResult* result) {
-	GError * inner_error;
-	GP11Object* _tmp0;
-	GP11Object* object;
-	GP11Attributes* attrs;
-	g_return_if_fail (SEAHORSE_PKCS11_SOURCE_IS_UPDATER (self));
-	g_return_if_fail (G_IS_OBJECT (obj));
-	g_return_if_fail (G_IS_ASYNC_RESULT (result));
-	inner_error = NULL;
-	_tmp0 = NULL;
-	object = (_tmp0 = GP11_OBJECT (obj), (_tmp0 == NULL ? NULL : g_object_ref (_tmp0)));
-	attrs = NULL;
-	{
-		GP11Attributes* _tmp1;
-		_tmp1 = NULL;
-		attrs = (_tmp1 = gp11_object_get_finish (object, result, &inner_error), (attrs == NULL ? NULL : (attrs = (gp11_attributes_unref (attrs), NULL))), _tmp1);
-		if (inner_error != NULL) {
-			goto __catch1_g_error;
-		}
-	}
-	goto __finally1;
-	__catch1_g_error:
-	{
-		GError * err;
-		err = inner_error;
-		inner_error = NULL;
-		{
-			/* Ignore objects that have gone away */
-			if (err->code != CKR_OBJECT_HANDLE_INVALID) {
-				seahorse_pkcs11_source_updater_complete (self, err);
-				(err == NULL ? NULL : (err = (g_error_free (err), NULL)));
-				(object == NULL ? NULL : (object = (g_object_unref (object), NULL)));
-				(attrs == NULL ? NULL : (attrs = (gp11_attributes_unref (attrs), NULL)));
-				return;
-			}
-			(err == NULL ? NULL : (err = (g_error_free (err), NULL)));
-		}
-	}
-	__finally1:
-	;
-	/* Process this object */
-	seahorse_pkcs11_source_receive_object (self->_source, object, attrs);
-	/* Do the next object */
-	seahorse_pkcs11_source_updater_do_get_attributes (self);
-	(object == NULL ? NULL : (object = (g_object_unref (object), NULL)));
-	(attrs == NULL ? NULL : (attrs = (gp11_attributes_unref (attrs), NULL)));
-}
-
-
-/* Cancel the operation */
-static void seahorse_pkcs11_source_updater_real_cancel (SeahorseOperation* base) {
-	SeahorsePkcs11SourceUpdater * self;
-	self = SEAHORSE_PKCS11_SOURCE_UPDATER (base);
-	g_cancellable_cancel (self->priv->_cancellable);
-}
-
-
-static GCancellable* seahorse_pkcs11_source_updater_get_cancellable (SeahorsePkcs11SourceUpdater* self) {
-	g_return_val_if_fail (SEAHORSE_PKCS11_SOURCE_IS_UPDATER (self), NULL);
-	return self->priv->_cancellable;
-}
-
-
-static SeahorsePkcs11Source* seahorse_pkcs11_source_updater_get_source (SeahorsePkcs11SourceUpdater* self) {
-	g_return_val_if_fail (SEAHORSE_PKCS11_SOURCE_IS_UPDATER (self), NULL);
-	return self->_source;
-}
-
-
-static void seahorse_pkcs11_source_updater_set_source (SeahorsePkcs11SourceUpdater* self, SeahorsePkcs11Source* value) {
-	SeahorsePkcs11Source* _tmp2;
-	SeahorsePkcs11Source* _tmp1;
-	g_return_if_fail (SEAHORSE_PKCS11_SOURCE_IS_UPDATER (self));
-	_tmp2 = NULL;
-	_tmp1 = NULL;
-	self->_source = (_tmp2 = (_tmp1 = value, (_tmp1 == NULL ? NULL : g_object_ref (_tmp1))), (self->_source == NULL ? NULL : (self->_source = (g_object_unref (self->_source), NULL))), _tmp2);
-	g_object_notify (((GObject *) (self)), "source");
-}
-
-
-static void _seahorse_pkcs11_source_updater_on_open_session_gasync_ready_callback (GObject* source_object, GAsyncResult* res, gpointer self) {
-	seahorse_pkcs11_source_updater_on_open_session (self, source_object, res);
-}
-
-
-static GObject * seahorse_pkcs11_source_updater_constructor (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties) {
-	GObject * obj;
-	SeahorsePkcs11SourceUpdaterClass * klass;
-	GObjectClass * parent_class;
-	SeahorsePkcs11SourceUpdater * self;
-	klass = SEAHORSE_PKCS11_SOURCE_UPDATER_CLASS (g_type_class_peek (SEAHORSE_PKCS11_SOURCE_TYPE_UPDATER));
-	parent_class = G_OBJECT_CLASS (g_type_class_peek_parent (klass));
-	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
-	self = SEAHORSE_PKCS11_SOURCE_UPDATER (obj);
-	{
-		GCancellable* _tmp0;
-		GP11Session* _tmp1;
-		_tmp0 = NULL;
-		self->priv->_cancellable = (_tmp0 = g_cancellable_new (), (self->priv->_cancellable == NULL ? NULL : (self->priv->_cancellable = (g_object_unref (self->priv->_cancellable), NULL))), _tmp0);
-		_tmp1 = NULL;
-		self->_session = (_tmp1 = NULL, (self->_session == NULL ? NULL : (self->_session = (g_object_unref (self->_session), NULL))), _tmp1);
-		/* Step 1. Load the session */
-		gp11_slot_open_session_async (seahorse_pkcs11_source_get_slot (self->_source), CKF_RW_SESSION, self->priv->_cancellable, _seahorse_pkcs11_source_updater_on_open_session_gasync_ready_callback, self);
-		seahorse_operation_mark_start (SEAHORSE_OPERATION (self));
+static GObject*  
+seahorse_pkcs11_source_constructor (GType type, guint n_props, GObjectConstructParam* props)
+{
+	GObject* obj = G_OBJECT_CLASS (seahorse_pkcs11_source_parent_class)->constructor (type, n_props, props);
+	SeahorsePkcs11Source *self = NULL;
+	
+	if (obj) {
+		self = SEAHORSE_PKCS11_SOURCE (obj);
+		g_return_val_if_fail (self->pv->slot, NULL);
 	}
+	
 	return obj;
 }
 
+static void 
+seahorse_pkcs11_source_get_property (GObject *object, guint prop_id, GValue *value, 
+                                       GParamSpec *pspec)
+{
+	SeahorsePkcs11Source *self = SEAHORSE_PKCS11_SOURCE (object);
 
-static void seahorse_pkcs11_source_updater_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) {
-	SeahorsePkcs11SourceUpdater * self;
-	self = SEAHORSE_PKCS11_SOURCE_UPDATER (object);
-	switch (property_id) {
-		case SEAHORSE_PKCS11_SOURCE_UPDATER_CANCELLABLE:
-		g_value_set_object (value, seahorse_pkcs11_source_updater_get_cancellable (self));
+	switch (prop_id) {
+	case PROP_SLOT:
+		g_value_set_object (value, self->pv->slot);
 		break;
-		case SEAHORSE_PKCS11_SOURCE_UPDATER_SOURCE:
-		g_value_set_object (value, seahorse_pkcs11_source_updater_get_source (self));
+	case PROP_KEY_TYPE:
+		g_value_set_uint (value, SEAHORSE_PKCS11_TYPE);
 		break;
-		default:
-		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+	case PROP_FLAGS:
+		g_value_set_uint (value, 0);
 		break;
-	}
-}
-
-
-static void seahorse_pkcs11_source_updater_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec) {
-	SeahorsePkcs11SourceUpdater * self;
-	self = SEAHORSE_PKCS11_SOURCE_UPDATER (object);
-	switch (property_id) {
-		case SEAHORSE_PKCS11_SOURCE_UPDATER_SOURCE:
-		seahorse_pkcs11_source_updater_set_source (self, g_value_get_object (value));
+	case PROP_KEY_DESC:
+		g_value_set_string (value, _("X509 Certificates"));
 		break;
-		default:
-		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+	case PROP_LOCATION:
+		g_value_set_uint (value, SEAHORSE_LOCATION_LOCAL);
 		break;
 	}
 }
 
+static void 
+seahorse_pkcs11_source_set_property (GObject *object, guint prop_id, const GValue *value, 
+                                     GParamSpec *pspec)
+{
+	SeahorsePkcs11Source *self = SEAHORSE_PKCS11_SOURCE (object);
 
-static void seahorse_pkcs11_source_updater_class_init (SeahorsePkcs11SourceUpdaterClass * klass) {
-	seahorse_pkcs11_source_updater_parent_class = g_type_class_peek_parent (klass);
-	g_type_class_add_private (klass, sizeof (SeahorsePkcs11SourceUpdaterPrivate));
-	G_OBJECT_CLASS (klass)->get_property = seahorse_pkcs11_source_updater_get_property;
-	G_OBJECT_CLASS (klass)->set_property = seahorse_pkcs11_source_updater_set_property;
-	G_OBJECT_CLASS (klass)->constructor = seahorse_pkcs11_source_updater_constructor;
-	G_OBJECT_CLASS (klass)->finalize = seahorse_pkcs11_source_updater_finalize;
-	SEAHORSE_PKCS11_SOURCE_UPDATER_CLASS (klass)->load_objects = seahorse_pkcs11_source_updater_real_load_objects;
-	SEAHORSE_OPERATION_CLASS (klass)->cancel = seahorse_pkcs11_source_updater_real_cancel;
-	g_object_class_install_property (G_OBJECT_CLASS (klass), SEAHORSE_PKCS11_SOURCE_UPDATER_CANCELLABLE, g_param_spec_object ("cancellable", "cancellable", "cancellable", G_TYPE_CANCELLABLE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE));
-	g_object_class_install_property (G_OBJECT_CLASS (klass), SEAHORSE_PKCS11_SOURCE_UPDATER_SOURCE, g_param_spec_object ("source", "source", "source", SEAHORSE_PKCS11_TYPE_SOURCE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
-}
-
-
-static void seahorse_pkcs11_source_updater_instance_init (SeahorsePkcs11SourceUpdater * self) {
-	self->priv = SEAHORSE_PKCS11_SOURCE_UPDATER_GET_PRIVATE (self);
-}
-
-
-static void seahorse_pkcs11_source_updater_finalize (GObject * obj) {
-	SeahorsePkcs11SourceUpdater * self;
-	self = SEAHORSE_PKCS11_SOURCE_UPDATER (obj);
-	(self->priv->_cancellable == NULL ? NULL : (self->priv->_cancellable = (g_object_unref (self->priv->_cancellable), NULL)));
-	(self->_source == NULL ? NULL : (self->_source = (g_object_unref (self->_source), NULL)));
-	(self->_session == NULL ? NULL : (self->_session = (g_object_unref (self->_session), NULL)));
-	(self->priv->_objects == NULL ? NULL : (self->priv->_objects = (_g_list_free_g_object_unref (self->priv->_objects), NULL)));
-	G_OBJECT_CLASS (seahorse_pkcs11_source_updater_parent_class)->finalize (obj);
-}
-
-
-static GType seahorse_pkcs11_source_updater_get_type (void) {
-	static GType seahorse_pkcs11_source_updater_type_id = 0;
-	if (seahorse_pkcs11_source_updater_type_id == 0) {
-		static const GTypeInfo g_define_type_info = { sizeof (SeahorsePkcs11SourceUpdaterClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) seahorse_pkcs11_source_updater_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (SeahorsePkcs11SourceUpdater), 0, (GInstanceInitFunc) seahorse_pkcs11_source_updater_instance_init };
-		seahorse_pkcs11_source_updater_type_id = g_type_register_static (SEAHORSE_TYPE_OPERATION, "SeahorsePkcs11SourceUpdater", &g_define_type_info, G_TYPE_FLAG_ABSTRACT);
-	}
-	return seahorse_pkcs11_source_updater_type_id;
-}
-
-
-static SeahorsePkcs11SourceRefresher* seahorse_pkcs11_source_refresher_new (SeahorsePkcs11Source* source) {
-	GParameter * __params;
-	GParameter * __params_it;
-	SeahorsePkcs11SourceRefresher * self;
-	g_return_val_if_fail (SEAHORSE_PKCS11_IS_SOURCE (source), NULL);
-	__params = g_new0 (GParameter, 1);
-	__params_it = __params;
-	__params_it->name = "source";
-	g_value_init (&__params_it->value, SEAHORSE_PKCS11_TYPE_SOURCE);
-	g_value_set_object (&__params_it->value, source);
-	__params_it++;
-	self = g_object_newv (SEAHORSE_PKCS11_SOURCE_TYPE_REFRESHER, __params_it - __params, __params);
-	while (__params_it > __params) {
-		--__params_it;
-		g_value_unset (&__params_it->value);
-	}
-	g_free (__params);
-	return self;
-}
-
-
-static void _seahorse_pkcs11_source_refresher_on_find_objects_gasync_ready_callback (GObject* source_object, GAsyncResult* res, gpointer self) {
-	seahorse_pkcs11_source_refresher_on_find_objects (self, source_object, res);
-}
-
-
-/* Search for all token objects */
-static void seahorse_pkcs11_source_refresher_real_load_objects (SeahorsePkcs11SourceUpdater* base) {
-	SeahorsePkcs11SourceRefresher * self;
-	GP11Attributes* attrs;
-	self = SEAHORSE_PKCS11_SOURCE_REFRESHER (base);
-	attrs = gp11_attributes_new ();
-	gp11_attributes_add_boolean (attrs, CKA_TOKEN, TRUE);
-	gp11_attributes_add_ulong (attrs, CKA_CLASS, CKO_CERTIFICATE);
-	gp11_session_find_objects_async (SEAHORSE_PKCS11_SOURCE_UPDATER (self)->_session, attrs, seahorse_pkcs11_source_updater_get_cancellable (SEAHORSE_PKCS11_SOURCE_UPDATER (self)), _seahorse_pkcs11_source_refresher_on_find_objects_gasync_ready_callback, self);
-	(attrs == NULL ? NULL : (attrs = (gp11_attributes_unref (attrs), NULL)));
-}
-
-
-static void __lambda0 (void* k, void* v, SeahorsePkcs11SourceRefresher* self) {
-	seahorse_context_remove_object (seahorse_context_for_app (), SEAHORSE_OBJECT (v));
-}
-
-
-static void ___lambda0_gh_func (void* key, void* value, gpointer self) {
-	__lambda0 (key, value, self);
-}
-
-
-static void seahorse_pkcs11_source_refresher_on_find_objects (SeahorsePkcs11SourceRefresher* self, GObject* obj, GAsyncResult* result) {
-	GError * inner_error;
-	GP11Session* _tmp0;
-	GP11Session* session;
-	GList* objects;
-	g_return_if_fail (SEAHORSE_PKCS11_SOURCE_IS_REFRESHER (self));
-	g_return_if_fail (G_IS_OBJECT (obj));
-	g_return_if_fail (G_IS_ASYNC_RESULT (result));
-	inner_error = NULL;
-	_tmp0 = NULL;
-	session = (_tmp0 = GP11_SESSION (obj), (_tmp0 == NULL ? NULL : g_object_ref (_tmp0)));
-	objects = NULL;
-	{
-		GList* _tmp1;
-		_tmp1 = NULL;
-		objects = (_tmp1 = gp11_session_find_objects_finish (session, result, &inner_error), (objects == NULL ? NULL : (objects = (_g_list_free_g_object_unref (objects), NULL))), _tmp1);
-		if (inner_error != NULL) {
-			goto __catch2_g_error;
-		}
-	}
-	goto __finally2;
-	__catch2_g_error:
-	{
-		GError * err;
-		err = inner_error;
-		inner_error = NULL;
-		{
-			seahorse_pkcs11_source_updater_complete (SEAHORSE_PKCS11_SOURCE_UPDATER (self), err);
-			(err == NULL ? NULL : (err = (g_error_free (err), NULL)));
-			(session == NULL ? NULL : (session = (g_object_unref (session), NULL)));
-			(objects == NULL ? NULL : (objects = (_g_list_free_g_object_unref (objects), NULL)));
-			return;
-		}
-	}
-	__finally2:
-	;
-	/* Remove all objects that were found, from the check table */
-	{
-		GList* object_collection;
-		GList* object_it;
-		object_collection = objects;
-		for (object_it = object_collection; object_it != NULL; object_it = object_it->next) {
-			GP11Object* _tmp2;
-			GP11Object* object;
-			_tmp2 = NULL;
-			object = (_tmp2 = ((GP11Object*) (object_it->data)), (_tmp2 == NULL ? NULL : g_object_ref (_tmp2)));
-			{
-				g_hash_table_remove (self->priv->_checks, GUINT_TO_POINTER (gp11_object_get_handle (object)));
-				(object == NULL ? NULL : (object = (g_object_unref (object), NULL)));
-			}
-		}
-	}
-	g_hash_table_foreach (self->priv->_checks, ___lambda0_gh_func, self);
-	seahorse_pkcs11_source_updater_loaded_objects (SEAHORSE_PKCS11_SOURCE_UPDATER (self), objects);
-	(session == NULL ? NULL : (session = (g_object_unref (session), NULL)));
-	(objects == NULL ? NULL : (objects = (_g_list_free_g_object_unref (objects), NULL)));
-}
-
-
-static GObject * seahorse_pkcs11_source_refresher_constructor (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties) {
-	GObject * obj;
-	SeahorsePkcs11SourceRefresherClass * klass;
-	GObjectClass * parent_class;
-	SeahorsePkcs11SourceRefresher * self;
-	klass = SEAHORSE_PKCS11_SOURCE_REFRESHER_CLASS (g_type_class_peek (SEAHORSE_PKCS11_SOURCE_TYPE_REFRESHER));
-	parent_class = G_OBJECT_CLASS (g_type_class_peek_parent (klass));
-	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
-	self = SEAHORSE_PKCS11_SOURCE_REFRESHER (obj);
-	{
-		GHashTable* _tmp2;
-		/* Load all the current item into the check table */
-		_tmp2 = NULL;
-		self->priv->_checks = (_tmp2 = g_hash_table_new (g_direct_hash, g_direct_equal), (self->priv->_checks == NULL ? NULL : (self->priv->_checks = (g_hash_table_unref (self->priv->_checks), NULL))), _tmp2);
-		{
-			GList* object_collection;
-			GList* object_it;
-			object_collection = seahorse_context_get_objects (seahorse_context_for_app (), SEAHORSE_SOURCE (SEAHORSE_PKCS11_SOURCE_UPDATER (self)->_source));
-			for (object_it = object_collection; object_it != NULL; object_it = object_it->next) {
-				SeahorseObject* object;
-				object = ((SeahorseObject*) (object_it->data));
-				{
-					if (G_TYPE_FROM_INSTANCE (G_OBJECT (object)) == SEAHORSE_PKCS11_TYPE_CERTIFICATE) {
-						SeahorsePkcs11Certificate* _tmp3;
-						SeahorsePkcs11Certificate* certificate;
-						_tmp3 = NULL;
-						certificate = (_tmp3 = SEAHORSE_PKCS11_CERTIFICATE (object), (_tmp3 == NULL ? NULL : g_object_ref (_tmp3)));
-						if (seahorse_pkcs11_certificate_get_pkcs11_object (certificate) != NULL) {
-							SeahorseObject* _tmp4;
-							_tmp4 = NULL;
-							g_hash_table_insert (self->priv->_checks, GUINT_TO_POINTER (gp11_object_get_handle (seahorse_pkcs11_certificate_get_pkcs11_object (certificate))), (_tmp4 = object, (_tmp4 == NULL ? NULL : g_object_ref (_tmp4))));
-						}
-						(certificate == NULL ? NULL : (certificate = (g_object_unref (certificate), NULL)));
-					}
-				}
-			}
-			(object_collection == NULL ? NULL : (object_collection = (g_list_free (object_collection), NULL)));
-		}
-	}
-	return obj;
-}
-
-
-static void seahorse_pkcs11_source_refresher_class_init (SeahorsePkcs11SourceRefresherClass * klass) {
-	seahorse_pkcs11_source_refresher_parent_class = g_type_class_peek_parent (klass);
-	g_type_class_add_private (klass, sizeof (SeahorsePkcs11SourceRefresherPrivate));
-	G_OBJECT_CLASS (klass)->constructor = seahorse_pkcs11_source_refresher_constructor;
-	G_OBJECT_CLASS (klass)->finalize = seahorse_pkcs11_source_refresher_finalize;
-	SEAHORSE_PKCS11_SOURCE_UPDATER_CLASS (klass)->load_objects = seahorse_pkcs11_source_refresher_real_load_objects;
-}
-
-
-static void seahorse_pkcs11_source_refresher_instance_init (SeahorsePkcs11SourceRefresher * self) {
-	self->priv = SEAHORSE_PKCS11_SOURCE_REFRESHER_GET_PRIVATE (self);
-}
-
-
-static void seahorse_pkcs11_source_refresher_finalize (GObject * obj) {
-	SeahorsePkcs11SourceRefresher * self;
-	self = SEAHORSE_PKCS11_SOURCE_REFRESHER (obj);
-	(self->priv->_checks == NULL ? NULL : (self->priv->_checks = (g_hash_table_unref (self->priv->_checks), NULL)));
-	G_OBJECT_CLASS (seahorse_pkcs11_source_refresher_parent_class)->finalize (obj);
-}
-
-
-static GType seahorse_pkcs11_source_refresher_get_type (void) {
-	static GType seahorse_pkcs11_source_refresher_type_id = 0;
-	if (seahorse_pkcs11_source_refresher_type_id == 0) {
-		static const GTypeInfo g_define_type_info = { sizeof (SeahorsePkcs11SourceRefresherClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) seahorse_pkcs11_source_refresher_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (SeahorsePkcs11SourceRefresher), 0, (GInstanceInitFunc) seahorse_pkcs11_source_refresher_instance_init };
-		seahorse_pkcs11_source_refresher_type_id = g_type_register_static (SEAHORSE_PKCS11_SOURCE_TYPE_UPDATER, "SeahorsePkcs11SourceRefresher", &g_define_type_info, 0);
-	}
-	return seahorse_pkcs11_source_refresher_type_id;
-}
-
-
-static SeahorsePkcs11SourceLoader* seahorse_pkcs11_source_loader_new (SeahorsePkcs11Source* source, GP11Attributes* unique_attrs) {
-	GParameter * __params;
-	GParameter * __params_it;
-	SeahorsePkcs11SourceLoader * self;
-	g_return_val_if_fail (SEAHORSE_PKCS11_IS_SOURCE (source), NULL);
-	g_return_val_if_fail (unique_attrs != NULL, NULL);
-	__params = g_new0 (GParameter, 2);
-	__params_it = __params;
-	__params_it->name = "source";
-	g_value_init (&__params_it->value, SEAHORSE_PKCS11_TYPE_SOURCE);
-	g_value_set_object (&__params_it->value, source);
-	__params_it++;
-	__params_it->name = "unique-attrs";
-	g_value_init (&__params_it->value, G_TYPE_POINTER);
-	g_value_set_pointer (&__params_it->value, unique_attrs);
-	__params_it++;
-	self = g_object_newv (SEAHORSE_PKCS11_SOURCE_TYPE_LOADER, __params_it - __params, __params);
-	while (__params_it > __params) {
-		--__params_it;
-		g_value_unset (&__params_it->value);
-	}
-	g_free (__params);
-	return self;
-}
-
-
-static void _seahorse_pkcs11_source_loader_on_find_objects_gasync_ready_callback (GObject* source_object, GAsyncResult* res, gpointer self) {
-	seahorse_pkcs11_source_loader_on_find_objects (self, source_object, res);
-}
-
-
-/* Search for the object to load */
-static void seahorse_pkcs11_source_loader_real_load_objects (SeahorsePkcs11SourceUpdater* base) {
-	SeahorsePkcs11SourceLoader * self;
-	self = SEAHORSE_PKCS11_SOURCE_LOADER (base);
-	gp11_session_find_objects_async (SEAHORSE_PKCS11_SOURCE_UPDATER (self)->_session, self->priv->_unique_attrs, seahorse_pkcs11_source_updater_get_cancellable (SEAHORSE_PKCS11_SOURCE_UPDATER (self)), _seahorse_pkcs11_source_loader_on_find_objects_gasync_ready_callback, self);
-}
-
-
-static void seahorse_pkcs11_source_loader_on_find_objects (SeahorsePkcs11SourceLoader* self, GObject* obj, GAsyncResult* result) {
-	GError * inner_error;
-	GP11Session* _tmp0;
-	GP11Session* session;
-	g_return_if_fail (SEAHORSE_PKCS11_SOURCE_IS_LOADER (self));
-	g_return_if_fail (G_IS_OBJECT (obj));
-	g_return_if_fail (G_IS_ASYNC_RESULT (result));
-	inner_error = NULL;
-	_tmp0 = NULL;
-	session = (_tmp0 = GP11_SESSION (obj), (_tmp0 == NULL ? NULL : g_object_ref (_tmp0)));
-	{
-		GList* objects;
-		objects = gp11_session_find_objects_finish (session, result, &inner_error);
-		if (inner_error != NULL) {
-			goto __catch3_g_error;
-		}
-		seahorse_pkcs11_source_updater_loaded_objects (SEAHORSE_PKCS11_SOURCE_UPDATER (self), objects);
-		(objects == NULL ? NULL : (objects = (_g_list_free_g_object_unref (objects), NULL)));
-	}
-	goto __finally3;
-	__catch3_g_error:
-	{
-		GError * err;
-		err = inner_error;
-		inner_error = NULL;
-		{
-			seahorse_pkcs11_source_updater_complete (SEAHORSE_PKCS11_SOURCE_UPDATER (self), err);
-			(err == NULL ? NULL : (err = (g_error_free (err), NULL)));
-			(session == NULL ? NULL : (session = (g_object_unref (session), NULL)));
-			return;
-		}
-	}
-	__finally3:
-	;
-	(session == NULL ? NULL : (session = (g_object_unref (session), NULL)));
-}
-
-
-static GP11Attributes* seahorse_pkcs11_source_loader_get_unique_attrs (SeahorsePkcs11SourceLoader* self) {
-	g_return_val_if_fail (SEAHORSE_PKCS11_SOURCE_IS_LOADER (self), NULL);
-	return self->priv->_unique_attrs;
-}
-
-
-static void seahorse_pkcs11_source_loader_set_unique_attrs (SeahorsePkcs11SourceLoader* self, GP11Attributes* value) {
-	GP11Attributes* _tmp2;
-	GP11Attributes* _tmp1;
-	g_return_if_fail (SEAHORSE_PKCS11_SOURCE_IS_LOADER (self));
-	_tmp2 = NULL;
-	_tmp1 = NULL;
-	self->priv->_unique_attrs = (_tmp2 = (_tmp1 = value, (_tmp1 == NULL ? NULL : gp11_attributes_ref (_tmp1))), (self->priv->_unique_attrs == NULL ? NULL : (self->priv->_unique_attrs = (gp11_attributes_unref (self->priv->_unique_attrs), NULL))), _tmp2);
-	g_object_notify (((GObject *) (self)), "unique-attrs");
-}
-
-
-static void seahorse_pkcs11_source_loader_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) {
-	SeahorsePkcs11SourceLoader * self;
-	self = SEAHORSE_PKCS11_SOURCE_LOADER (object);
-	switch (property_id) {
-		case SEAHORSE_PKCS11_SOURCE_LOADER_UNIQUE_ATTRS:
-		g_value_set_pointer (value, seahorse_pkcs11_source_loader_get_unique_attrs (self));
-		break;
-		default:
-		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
-		break;
-	}
-}
-
-
-static void seahorse_pkcs11_source_loader_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec) {
-	SeahorsePkcs11SourceLoader * self;
-	self = SEAHORSE_PKCS11_SOURCE_LOADER (object);
-	switch (property_id) {
-		case SEAHORSE_PKCS11_SOURCE_LOADER_UNIQUE_ATTRS:
-		seahorse_pkcs11_source_loader_set_unique_attrs (self, g_value_get_pointer (value));
-		break;
-		default:
-		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
-		break;
-	}
-}
-
-
-static void seahorse_pkcs11_source_loader_class_init (SeahorsePkcs11SourceLoaderClass * klass) {
-	seahorse_pkcs11_source_loader_parent_class = g_type_class_peek_parent (klass);
-	g_type_class_add_private (klass, sizeof (SeahorsePkcs11SourceLoaderPrivate));
-	G_OBJECT_CLASS (klass)->get_property = seahorse_pkcs11_source_loader_get_property;
-	G_OBJECT_CLASS (klass)->set_property = seahorse_pkcs11_source_loader_set_property;
-	G_OBJECT_CLASS (klass)->finalize = seahorse_pkcs11_source_loader_finalize;
-	SEAHORSE_PKCS11_SOURCE_UPDATER_CLASS (klass)->load_objects = seahorse_pkcs11_source_loader_real_load_objects;
-	g_object_class_install_property (G_OBJECT_CLASS (klass), SEAHORSE_PKCS11_SOURCE_LOADER_UNIQUE_ATTRS, g_param_spec_pointer ("unique-attrs", "unique-attrs", "unique-attrs", G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
-}
-
-
-static void seahorse_pkcs11_source_loader_instance_init (SeahorsePkcs11SourceLoader * self) {
-	self->priv = SEAHORSE_PKCS11_SOURCE_LOADER_GET_PRIVATE (self);
-}
-
-
-static void seahorse_pkcs11_source_loader_finalize (GObject * obj) {
-	SeahorsePkcs11SourceLoader * self;
-	self = SEAHORSE_PKCS11_SOURCE_LOADER (obj);
-	(self->priv->_unique_attrs == NULL ? NULL : (self->priv->_unique_attrs = (gp11_attributes_unref (self->priv->_unique_attrs), NULL)));
-	G_OBJECT_CLASS (seahorse_pkcs11_source_loader_parent_class)->finalize (obj);
-}
-
-
-static GType seahorse_pkcs11_source_loader_get_type (void) {
-	static GType seahorse_pkcs11_source_loader_type_id = 0;
-	if (seahorse_pkcs11_source_loader_type_id == 0) {
-		static const GTypeInfo g_define_type_info = { sizeof (SeahorsePkcs11SourceLoaderClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) seahorse_pkcs11_source_loader_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (SeahorsePkcs11SourceLoader), 0, (GInstanceInitFunc) seahorse_pkcs11_source_loader_instance_init };
-		seahorse_pkcs11_source_loader_type_id = g_type_register_static (SEAHORSE_PKCS11_SOURCE_TYPE_UPDATER, "SeahorsePkcs11SourceLoader", &g_define_type_info, 0);
-	}
-	return seahorse_pkcs11_source_loader_type_id;
-}
-
-
-static SeahorsePkcs11SourceImporter* seahorse_pkcs11_source_importer_new (SeahorsePkcs11Source* source, GP11Attributes* import) {
-	GParameter * __params;
-	GParameter * __params_it;
-	SeahorsePkcs11SourceImporter * self;
-	g_return_val_if_fail (SEAHORSE_PKCS11_IS_SOURCE (source), NULL);
-	g_return_val_if_fail (import != NULL, NULL);
-	__params = g_new0 (GParameter, 1);
-	__params_it = __params;
-	__params_it->name = "source";
-	g_value_init (&__params_it->value, SEAHORSE_PKCS11_TYPE_SOURCE);
-	g_value_set_object (&__params_it->value, source);
-	__params_it++;
-	self = g_object_newv (SEAHORSE_PKCS11_SOURCE_TYPE_IMPORTER, __params_it - __params, __params);
-	while (__params_it > __params) {
-		--__params_it;
-		g_value_unset (&__params_it->value);
-	}
-	g_free (__params);
-	return self;
-}
-
-
-static void _seahorse_pkcs11_source_importer_on_create_object_gasync_ready_callback (GObject* source_object, GAsyncResult* res, gpointer self) {
-	seahorse_pkcs11_source_importer_on_create_object (self, source_object, res);
-}
-
-
-/* Search for the object to load */
-static void seahorse_pkcs11_source_importer_real_load_objects (SeahorsePkcs11SourceUpdater* base) {
-	SeahorsePkcs11SourceImporter * self;
-	self = SEAHORSE_PKCS11_SOURCE_IMPORTER (base);
-	gp11_session_create_object_async (SEAHORSE_PKCS11_SOURCE_UPDATER (self)->_session, self->priv->_import_data, seahorse_pkcs11_source_updater_get_cancellable (SEAHORSE_PKCS11_SOURCE_UPDATER (self)), _seahorse_pkcs11_source_importer_on_create_object_gasync_ready_callback, self);
-}
-
-
-static void _seahorse_pkcs11_source_importer_on_get_attribute_gasync_ready_callback (GObject* source_object, GAsyncResult* res, gpointer self) {
-	seahorse_pkcs11_source_importer_on_get_attribute (self, source_object, res);
-}
-
-
-static void seahorse_pkcs11_source_importer_on_create_object (SeahorsePkcs11SourceImporter* self, GObject* obj, GAsyncResult* result) {
-	GError * inner_error;
-	GP11Session* _tmp0;
-	GP11Session* session;
-	GP11Object* import;
-	g_return_if_fail (SEAHORSE_PKCS11_SOURCE_IS_IMPORTER (self));
-	g_return_if_fail (G_IS_OBJECT (obj));
-	g_return_if_fail (G_IS_ASYNC_RESULT (result));
-	inner_error = NULL;
-	_tmp0 = NULL;
-	session = (_tmp0 = GP11_SESSION (obj), (_tmp0 == NULL ? NULL : g_object_ref (_tmp0)));
-	import = NULL;
-	{
-		GP11Object* _tmp1;
-		_tmp1 = NULL;
-		import = (_tmp1 = gp11_session_create_object_finish (session, result, &inner_error), (import == NULL ? NULL : (import = (g_object_unref (import), NULL))), _tmp1);
-		if (inner_error != NULL) {
-			goto __catch4_g_error;
-		}
-	}
-	goto __finally4;
-	__catch4_g_error:
-	{
-		GError * err;
-		err = inner_error;
-		inner_error = NULL;
-		{
-			seahorse_pkcs11_source_updater_complete (SEAHORSE_PKCS11_SOURCE_UPDATER (self), err);
-			(err == NULL ? NULL : (err = (g_error_free (err), NULL)));
-			(session == NULL ? NULL : (session = (g_object_unref (session), NULL)));
-			(import == NULL ? NULL : (import = (g_object_unref (import), NULL)));
-			return;
-		}
-	}
-	__finally4:
-	;
-	/* Get the list of objects imported */
-	gp11_object_get_one_async (import, CKA_GNOME_IMPORT_OBJECTS, seahorse_pkcs11_source_updater_get_cancellable (SEAHORSE_PKCS11_SOURCE_UPDATER (self)), _seahorse_pkcs11_source_importer_on_get_attribute_gasync_ready_callback, self);
-	(session == NULL ? NULL : (session = (g_object_unref (session), NULL)));
-	(import == NULL ? NULL : (import = (g_object_unref (import), NULL)));
-}
-
-
-static void seahorse_pkcs11_source_importer_on_get_attribute (SeahorsePkcs11SourceImporter* self, GObject* obj, GAsyncResult* result) {
-	GError * inner_error;
-	GP11Object* _tmp0;
-	GP11Object* import;
-	GP11Attribute* imported_handles;
-	GList* _tmp2;
-	g_return_if_fail (SEAHORSE_PKCS11_SOURCE_IS_IMPORTER (self));
-	g_return_if_fail (G_IS_OBJECT (obj));
-	g_return_if_fail (G_IS_ASYNC_RESULT (result));
-	inner_error = NULL;
-	_tmp0 = NULL;
-	import = (_tmp0 = GP11_OBJECT (obj), (_tmp0 == NULL ? NULL : g_object_ref (_tmp0)));
-	imported_handles = NULL;
-	{
-		GP11Attribute* _tmp1;
-		_tmp1 = NULL;
-		imported_handles = (_tmp1 = gp11_object_get_one_finish (import, result, &inner_error), (imported_handles == NULL ? NULL : (imported_handles = (gp11_attribute_free (imported_handles), NULL))), _tmp1);
-		if (inner_error != NULL) {
-			goto __catch5_g_error;
-		}
-	}
-	goto __finally5;
-	__catch5_g_error:
-	{
-		GError * err;
-		err = inner_error;
-		inner_error = NULL;
-		{
-			seahorse_pkcs11_source_updater_complete (SEAHORSE_PKCS11_SOURCE_UPDATER (self), err);
-			(err == NULL ? NULL : (err = (g_error_free (err), NULL)));
-			(import == NULL ? NULL : (import = (g_object_unref (import), NULL)));
-			(imported_handles == NULL ? NULL : (imported_handles = (gp11_attribute_free (imported_handles), NULL)));
-			return;
-		}
-	}
-	__finally5:
-	;
-	_tmp2 = NULL;
-	seahorse_pkcs11_source_updater_loaded_objects (SEAHORSE_PKCS11_SOURCE_UPDATER (self), (_tmp2 = gp11_objects_from_handle_array (SEAHORSE_PKCS11_SOURCE_UPDATER (self)->_session, imported_handles)));
-	(_tmp2 == NULL ? NULL : (_tmp2 = (_g_list_free_g_object_unref (_tmp2), NULL)));
-	(import == NULL ? NULL : (import = (g_object_unref (import), NULL)));
-	(imported_handles == NULL ? NULL : (imported_handles = (gp11_attribute_free (imported_handles), NULL)));
-}
-
-
-static GP11Attributes* seahorse_pkcs11_source_importer_get_import_data (SeahorsePkcs11SourceImporter* self) {
-	g_return_val_if_fail (SEAHORSE_PKCS11_SOURCE_IS_IMPORTER (self), NULL);
-	return self->priv->_import_data;
-}
-
-
-static void seahorse_pkcs11_source_importer_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) {
-	SeahorsePkcs11SourceImporter * self;
-	self = SEAHORSE_PKCS11_SOURCE_IMPORTER (object);
-	switch (property_id) {
-		case SEAHORSE_PKCS11_SOURCE_IMPORTER_IMPORT_DATA:
-		g_value_set_pointer (value, seahorse_pkcs11_source_importer_get_import_data (self));
-		break;
-		default:
-		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
-		break;
-	}
-}
-
-
-static void seahorse_pkcs11_source_importer_class_init (SeahorsePkcs11SourceImporterClass * klass) {
-	seahorse_pkcs11_source_importer_parent_class = g_type_class_peek_parent (klass);
-	g_type_class_add_private (klass, sizeof (SeahorsePkcs11SourceImporterPrivate));
-	G_OBJECT_CLASS (klass)->get_property = seahorse_pkcs11_source_importer_get_property;
-	G_OBJECT_CLASS (klass)->finalize = seahorse_pkcs11_source_importer_finalize;
-	SEAHORSE_PKCS11_SOURCE_UPDATER_CLASS (klass)->load_objects = seahorse_pkcs11_source_importer_real_load_objects;
-	g_object_class_install_property (G_OBJECT_CLASS (klass), SEAHORSE_PKCS11_SOURCE_IMPORTER_IMPORT_DATA, g_param_spec_pointer ("import-data", "import-data", "import-data", G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE));
-}
-
-
-static void seahorse_pkcs11_source_importer_instance_init (SeahorsePkcs11SourceImporter * self) {
-	self->priv = SEAHORSE_PKCS11_SOURCE_IMPORTER_GET_PRIVATE (self);
-}
-
-
-static void seahorse_pkcs11_source_importer_finalize (GObject * obj) {
-	SeahorsePkcs11SourceImporter * self;
-	self = SEAHORSE_PKCS11_SOURCE_IMPORTER (obj);
-	(self->priv->_import_data == NULL ? NULL : (self->priv->_import_data = (gp11_attributes_unref (self->priv->_import_data), NULL)));
-	G_OBJECT_CLASS (seahorse_pkcs11_source_importer_parent_class)->finalize (obj);
-}
-
-
-static GType seahorse_pkcs11_source_importer_get_type (void) {
-	static GType seahorse_pkcs11_source_importer_type_id = 0;
-	if (seahorse_pkcs11_source_importer_type_id == 0) {
-		static const GTypeInfo g_define_type_info = { sizeof (SeahorsePkcs11SourceImporterClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) seahorse_pkcs11_source_importer_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (SeahorsePkcs11SourceImporter), 0, (GInstanceInitFunc) seahorse_pkcs11_source_importer_instance_init };
-		seahorse_pkcs11_source_importer_type_id = g_type_register_static (SEAHORSE_PKCS11_SOURCE_TYPE_UPDATER, "SeahorsePkcs11SourceImporter", &g_define_type_info, 0);
-	}
-	return seahorse_pkcs11_source_importer_type_id;
-}
-
-
-static SeahorsePkcs11SourceRemover* seahorse_pkcs11_source_remover_new (SeahorsePkcs11Certificate* certificate) {
-	GParameter * __params;
-	GParameter * __params_it;
-	SeahorsePkcs11SourceRemover * self;
-	g_return_val_if_fail (SEAHORSE_PKCS11_IS_CERTIFICATE (certificate), NULL);
-	__params = g_new0 (GParameter, 1);
-	__params_it = __params;
-	__params_it->name = "certificate";
-	g_value_init (&__params_it->value, SEAHORSE_PKCS11_TYPE_CERTIFICATE);
-	g_value_set_object (&__params_it->value, certificate);
-	__params_it++;
-	self = g_object_newv (SEAHORSE_PKCS11_SOURCE_TYPE_REMOVER, __params_it - __params, __params);
-	while (__params_it > __params) {
-		--__params_it;
-		g_value_unset (&__params_it->value);
-	}
-	g_free (__params);
-	return self;
-}
-
-
-static void seahorse_pkcs11_source_remover_on_destroy_object (SeahorsePkcs11SourceRemover* self, GObject* obj, GAsyncResult* result) {
-	GError * inner_error;
-	GP11Object* _tmp0;
-	GP11Object* object;
-	g_return_if_fail (SEAHORSE_PKCS11_SOURCE_IS_REMOVER (self));
-	g_return_if_fail (G_IS_OBJECT (obj));
-	g_return_if_fail (G_IS_ASYNC_RESULT (result));
-	inner_error = NULL;
-	_tmp0 = NULL;
-	object = (_tmp0 = GP11_OBJECT (obj), (_tmp0 == NULL ? NULL : g_object_ref (_tmp0)));
-	{
-		gp11_object_destroy_finish (object, result, &inner_error);
-		if (inner_error != NULL) {
-			goto __catch6_g_error;
-		}
-	}
-	goto __finally6;
-	__catch6_g_error:
-	{
-		GError * err;
-		err = inner_error;
-		inner_error = NULL;
-		{
-			if (err->code == CKR_FUNCTION_CANCELED) {
-				seahorse_operation_mark_done (SEAHORSE_OPERATION (self), TRUE, NULL);
-			} else {
-				GError* _tmp1;
-				_tmp1 = NULL;
-				seahorse_operation_mark_done (SEAHORSE_OPERATION (self), FALSE, (_tmp1 = err, (_tmp1 == NULL || g_error_copy == NULL ? ((gpointer) (_tmp1)) : g_error_copy (((gpointer) (_tmp1))))));
-			}
-			(err == NULL ? NULL : (err = (g_error_free (err), NULL)));
-			(object == NULL ? NULL : (object = (g_object_unref (object), NULL)));
-			return;
-		}
-	}
-	__finally6:
-	;
-	seahorse_context_remove_object (seahorse_context_for_app (), SEAHORSE_OBJECT (seahorse_pkcs11_source_remover_get_certificate (self)));
-	seahorse_operation_mark_done (SEAHORSE_OPERATION (self), FALSE, NULL);
-	(object == NULL ? NULL : (object = (g_object_unref (object), NULL)));
-}
-
-
-/* Cancel the operation */
-static void seahorse_pkcs11_source_remover_real_cancel (SeahorseOperation* base) {
-	SeahorsePkcs11SourceRemover * self;
-	self = SEAHORSE_PKCS11_SOURCE_REMOVER (base);
-	g_cancellable_cancel (self->priv->_cancellable);
-}
-
-
-static GCancellable* seahorse_pkcs11_source_remover_get_cancellable (SeahorsePkcs11SourceRemover* self) {
-	g_return_val_if_fail (SEAHORSE_PKCS11_SOURCE_IS_REMOVER (self), NULL);
-	return self->priv->_cancellable;
-}
-
-
-static SeahorsePkcs11Source* seahorse_pkcs11_source_remover_get_source (SeahorsePkcs11SourceRemover* self) {
-	g_return_val_if_fail (SEAHORSE_PKCS11_SOURCE_IS_REMOVER (self), NULL);
-	return self->priv->_source;
-}
-
-
-static void seahorse_pkcs11_source_remover_set_source (SeahorsePkcs11SourceRemover* self, SeahorsePkcs11Source* value) {
-	SeahorsePkcs11Source* _tmp2;
-	SeahorsePkcs11Source* _tmp1;
-	g_return_if_fail (SEAHORSE_PKCS11_SOURCE_IS_REMOVER (self));
-	_tmp2 = NULL;
-	_tmp1 = NULL;
-	self->priv->_source = (_tmp2 = (_tmp1 = value, (_tmp1 == NULL ? NULL : g_object_ref (_tmp1))), (self->priv->_source == NULL ? NULL : (self->priv->_source = (g_object_unref (self->priv->_source), NULL))), _tmp2);
-	g_object_notify (((GObject *) (self)), "source");
-}
-
-
-static SeahorsePkcs11Certificate* seahorse_pkcs11_source_remover_get_certificate (SeahorsePkcs11SourceRemover* self) {
-	g_return_val_if_fail (SEAHORSE_PKCS11_SOURCE_IS_REMOVER (self), NULL);
-	return self->priv->_certificate;
-}
-
-
-static void seahorse_pkcs11_source_remover_set_certificate (SeahorsePkcs11SourceRemover* self, SeahorsePkcs11Certificate* value) {
-	SeahorsePkcs11Certificate* _tmp2;
-	SeahorsePkcs11Certificate* _tmp1;
-	g_return_if_fail (SEAHORSE_PKCS11_SOURCE_IS_REMOVER (self));
-	_tmp2 = NULL;
-	_tmp1 = NULL;
-	self->priv->_certificate = (_tmp2 = (_tmp1 = value, (_tmp1 == NULL ? NULL : g_object_ref (_tmp1))), (self->priv->_certificate == NULL ? NULL : (self->priv->_certificate = (g_object_unref (self->priv->_certificate), NULL))), _tmp2);
-	g_object_notify (((GObject *) (self)), "certificate");
-}
-
-
-static void _seahorse_pkcs11_source_remover_on_destroy_object_gasync_ready_callback (GObject* source_object, GAsyncResult* res, gpointer self) {
-	seahorse_pkcs11_source_remover_on_destroy_object (self, source_object, res);
-}
-
-
-static GObject * seahorse_pkcs11_source_remover_constructor (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties) {
-	GObject * obj;
-	SeahorsePkcs11SourceRemoverClass * klass;
-	GObjectClass * parent_class;
-	SeahorsePkcs11SourceRemover * self;
-	klass = SEAHORSE_PKCS11_SOURCE_REMOVER_CLASS (g_type_class_peek (SEAHORSE_PKCS11_SOURCE_TYPE_REMOVER));
-	parent_class = G_OBJECT_CLASS (g_type_class_peek_parent (klass));
-	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
-	self = SEAHORSE_PKCS11_SOURCE_REMOVER (obj);
-	{
-		GCancellable* _tmp5;
-		_tmp5 = NULL;
-		self->priv->_cancellable = (_tmp5 = g_cancellable_new (), (self->priv->_cancellable == NULL ? NULL : (self->priv->_cancellable = (g_object_unref (self->priv->_cancellable), NULL))), _tmp5);
-		gp11_object_destroy_async (seahorse_pkcs11_certificate_get_pkcs11_object (self->priv->_certificate), self->priv->_cancellable, _seahorse_pkcs11_source_remover_on_destroy_object_gasync_ready_callback, self);
-		seahorse_operation_mark_start (SEAHORSE_OPERATION (self));
-	}
-	return obj;
-}
-
-
-static void seahorse_pkcs11_source_remover_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) {
-	SeahorsePkcs11SourceRemover * self;
-	self = SEAHORSE_PKCS11_SOURCE_REMOVER (object);
-	switch (property_id) {
-		case SEAHORSE_PKCS11_SOURCE_REMOVER_CANCELLABLE:
-		g_value_set_object (value, seahorse_pkcs11_source_remover_get_cancellable (self));
-		break;
-		case SEAHORSE_PKCS11_SOURCE_REMOVER_SOURCE:
-		g_value_set_object (value, seahorse_pkcs11_source_remover_get_source (self));
-		break;
-		case SEAHORSE_PKCS11_SOURCE_REMOVER_CERTIFICATE:
-		g_value_set_object (value, seahorse_pkcs11_source_remover_get_certificate (self));
+	switch (prop_id) {
+	case PROP_SLOT:
+		g_return_if_fail (!self->pv->slot);
+		self->pv->slot = g_value_get_object (value);
+		g_return_if_fail (self->pv->slot);
+		g_object_ref (self->pv->slot);
 		break;
-		default:
-		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
-		break;
-	}
+	};
 }
 
-
-static void seahorse_pkcs11_source_remover_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec) {
-	SeahorsePkcs11SourceRemover * self;
-	self = SEAHORSE_PKCS11_SOURCE_REMOVER (object);
-	switch (property_id) {
-		case SEAHORSE_PKCS11_SOURCE_REMOVER_SOURCE:
-		seahorse_pkcs11_source_remover_set_source (self, g_value_get_object (value));
-		break;
-		case SEAHORSE_PKCS11_SOURCE_REMOVER_CERTIFICATE:
-		seahorse_pkcs11_source_remover_set_certificate (self, g_value_get_object (value));
-		break;
-		default:
-		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
-		break;
-	}
-}
-
-
-static void seahorse_pkcs11_source_remover_class_init (SeahorsePkcs11SourceRemoverClass * klass) {
-	seahorse_pkcs11_source_remover_parent_class = g_type_class_peek_parent (klass);
-	g_type_class_add_private (klass, sizeof (SeahorsePkcs11SourceRemoverPrivate));
-	G_OBJECT_CLASS (klass)->get_property = seahorse_pkcs11_source_remover_get_property;
-	G_OBJECT_CLASS (klass)->set_property = seahorse_pkcs11_source_remover_set_property;
-	G_OBJECT_CLASS (klass)->constructor = seahorse_pkcs11_source_remover_constructor;
-	G_OBJECT_CLASS (klass)->finalize = seahorse_pkcs11_source_remover_finalize;
-	SEAHORSE_OPERATION_CLASS (klass)->cancel = seahorse_pkcs11_source_remover_real_cancel;
-	g_object_class_install_property (G_OBJECT_CLASS (klass), SEAHORSE_PKCS11_SOURCE_REMOVER_CANCELLABLE, g_param_spec_object ("cancellable", "cancellable", "cancellable", G_TYPE_CANCELLABLE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE));
-	g_object_class_install_property (G_OBJECT_CLASS (klass), SEAHORSE_PKCS11_SOURCE_REMOVER_SOURCE, g_param_spec_object ("source", "source", "source", SEAHORSE_PKCS11_TYPE_SOURCE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
-	g_object_class_install_property (G_OBJECT_CLASS (klass), SEAHORSE_PKCS11_SOURCE_REMOVER_CERTIFICATE, g_param_spec_object ("certificate", "certificate", "certificate", SEAHORSE_PKCS11_TYPE_CERTIFICATE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
-}
-
-
-static void seahorse_pkcs11_source_remover_instance_init (SeahorsePkcs11SourceRemover * self) {
-	self->priv = SEAHORSE_PKCS11_SOURCE_REMOVER_GET_PRIVATE (self);
+static SeahorseOperation*
+seahorse_pkcs11_source_load (SeahorseSource *src)
+{
+	return seahorse_pkcs11_refresher_new (SEAHORSE_PKCS11_SOURCE (src));
 }
 
+static void
+seahorse_pkcs11_source_dispose (GObject *obj)
+{
+	SeahorsePkcs11Source *self = SEAHORSE_PKCS11_SOURCE (obj);
+    
+	/* The keyring object */
+	if (self->pv->slot)
+		g_object_unref (self->pv->slot);
+	self->pv->slot = NULL;
 
-static void seahorse_pkcs11_source_remover_finalize (GObject * obj) {
-	SeahorsePkcs11SourceRemover * self;
-	self = SEAHORSE_PKCS11_SOURCE_REMOVER (obj);
-	(self->priv->_cancellable == NULL ? NULL : (self->priv->_cancellable = (g_object_unref (self->priv->_cancellable), NULL)));
-	(self->priv->_source == NULL ? NULL : (self->priv->_source = (g_object_unref (self->priv->_source), NULL)));
-	(self->priv->_certificate == NULL ? NULL : (self->priv->_certificate = (g_object_unref (self->priv->_certificate), NULL)));
-	G_OBJECT_CLASS (seahorse_pkcs11_source_remover_parent_class)->finalize (obj);
-}
-
-
-static GType seahorse_pkcs11_source_remover_get_type (void) {
-	static GType seahorse_pkcs11_source_remover_type_id = 0;
-	if (seahorse_pkcs11_source_remover_type_id == 0) {
-		static const GTypeInfo g_define_type_info = { sizeof (SeahorsePkcs11SourceRemoverClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) seahorse_pkcs11_source_remover_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (SeahorsePkcs11SourceRemover), 0, (GInstanceInitFunc) seahorse_pkcs11_source_remover_instance_init };
-		seahorse_pkcs11_source_remover_type_id = g_type_register_static (SEAHORSE_TYPE_OPERATION, "SeahorsePkcs11SourceRemover", &g_define_type_info, 0);
-	}
-	return seahorse_pkcs11_source_remover_type_id;
-}
-
-
-static void seahorse_pkcs11_source_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) {
-	SeahorsePkcs11Source * self;
-	self = SEAHORSE_PKCS11_SOURCE (object);
-	switch (property_id) {
-		case SEAHORSE_PKCS11_SOURCE_SLOT:
-		g_value_set_object (value, seahorse_pkcs11_source_get_slot (self));
-		break;
-		case SEAHORSE_PKCS11_SOURCE_LOCATION:
-		g_value_set_enum (value, seahorse_pkcs11_source_get_location (self));
-		break;
-		case SEAHORSE_PKCS11_SOURCE_KEY_TYPE:
-		g_value_set_uint (value, seahorse_pkcs11_source_get_key_type (self));
-		break;
-		case SEAHORSE_PKCS11_SOURCE_KEY_DESC:
-		g_value_set_string (value, seahorse_pkcs11_source_get_key_desc (self));
-		break;
-		default:
-		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
-		break;
-	}
+	G_OBJECT_CLASS (seahorse_pkcs11_source_parent_class)->dispose (obj);
 }
 
-
-static void seahorse_pkcs11_source_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec) {
-	SeahorsePkcs11Source * self;
-	self = SEAHORSE_PKCS11_SOURCE (object);
-	switch (property_id) {
-		case SEAHORSE_PKCS11_SOURCE_SLOT:
-		seahorse_pkcs11_source_set_slot (self, g_value_get_object (value));
-		break;
-		default:
-		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
-		break;
-	}
+static void
+seahorse_pkcs11_source_finalize (GObject *obj)
+{
+	SeahorsePkcs11Source *self = SEAHORSE_PKCS11_SOURCE (obj);
+  
+	g_assert (self->pv->slot == NULL);
+    
+	G_OBJECT_CLASS (seahorse_pkcs11_source_parent_class)->finalize (obj);
 }
 
-
-static void seahorse_pkcs11_source_class_init (SeahorsePkcs11SourceClass * klass) {
+static void
+seahorse_pkcs11_source_class_init (SeahorsePkcs11SourceClass *klass)
+{
+	GObjectClass *gobject_class;
+	SeahorseSourceClass *key_class;
+    
 	seahorse_pkcs11_source_parent_class = g_type_class_peek_parent (klass);
 	g_type_class_add_private (klass, sizeof (SeahorsePkcs11SourcePrivate));
-	G_OBJECT_CLASS (klass)->get_property = seahorse_pkcs11_source_get_property;
-	G_OBJECT_CLASS (klass)->set_property = seahorse_pkcs11_source_set_property;
-	G_OBJECT_CLASS (klass)->finalize = seahorse_pkcs11_source_finalize;
-	SEAHORSE_SOURCE_CLASS (klass)->load = seahorse_pkcs11_source_real_load;
-	SEAHORSE_PKCS11_SOURCE_CLASS (klass)->import = seahorse_pkcs11_source_real_import;
-	SEAHORSE_PKCS11_SOURCE_CLASS (klass)->export = seahorse_pkcs11_source_real_export;
-	SEAHORSE_PKCS11_SOURCE_CLASS (klass)->remove = seahorse_pkcs11_source_real_remove;
-	g_object_class_install_property (G_OBJECT_CLASS (klass), SEAHORSE_PKCS11_SOURCE_SLOT, g_param_spec_object ("slot", "slot", "slot", GP11_TYPE_SLOT, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
-	g_object_class_install_property (G_OBJECT_CLASS (klass), SEAHORSE_PKCS11_SOURCE_LOCATION, g_param_spec_enum ("location", "location", "location", SEAHORSE_TYPE_LOCATION, 0, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE));
-	g_object_class_install_property (G_OBJECT_CLASS (klass), SEAHORSE_PKCS11_SOURCE_KEY_TYPE, g_param_spec_uint ("key-type", "key-type", "key-type", 0, G_MAXUINT, 0U, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE));
-	g_object_class_install_property (G_OBJECT_CLASS (klass), SEAHORSE_PKCS11_SOURCE_KEY_DESC, g_param_spec_string ("key-desc", "key-desc", "key-desc", NULL, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE));
-}
-
-
-static void seahorse_pkcs11_source_instance_init (SeahorsePkcs11Source * self) {
-	self->priv = SEAHORSE_PKCS11_SOURCE_GET_PRIVATE (self);
-}
-
-
-static void seahorse_pkcs11_source_finalize (GObject * obj) {
-	SeahorsePkcs11Source * self;
-	self = SEAHORSE_PKCS11_SOURCE (obj);
-	(self->priv->_slot == NULL ? NULL : (self->priv->_slot = (g_object_unref (self->priv->_slot), NULL)));
-	G_OBJECT_CLASS (seahorse_pkcs11_source_parent_class)->finalize (obj);
-}
-
-
-GType seahorse_pkcs11_source_get_type (void) {
-	static GType seahorse_pkcs11_source_type_id = 0;
-	if (seahorse_pkcs11_source_type_id == 0) {
-		static const GTypeInfo g_define_type_info = { sizeof (SeahorsePkcs11SourceClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) seahorse_pkcs11_source_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (SeahorsePkcs11Source), 0, (GInstanceInitFunc) seahorse_pkcs11_source_instance_init };
-		seahorse_pkcs11_source_type_id = g_type_register_static (SEAHORSE_TYPE_SOURCE, "SeahorsePkcs11Source", &g_define_type_info, 0);
+	
+	gobject_class = G_OBJECT_CLASS (klass);
+	gobject_class->constructor = seahorse_pkcs11_source_constructor;
+	gobject_class->dispose = seahorse_pkcs11_source_dispose;
+	gobject_class->finalize = seahorse_pkcs11_source_finalize;
+	gobject_class->set_property = seahorse_pkcs11_source_set_property;
+	gobject_class->get_property = seahorse_pkcs11_source_get_property;
+    
+	key_class = SEAHORSE_SOURCE_CLASS (klass);    
+	key_class->load = seahorse_pkcs11_source_load;
+
+	g_object_class_install_property (gobject_class, PROP_SLOT,
+	         g_param_spec_object ("slot", "Slot", "Pkcs#11 SLOT",
+	                              GP11_TYPE_SLOT, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
+    
+	g_object_class_install_property (gobject_class, PROP_KEY_TYPE,
+	         g_param_spec_uint ("key-type", "Key Type", "Key type that originates from this key source.", 
+	                            0, G_MAXUINT, SEAHORSE_TAG_INVALID, G_PARAM_READABLE));
+    
+	g_object_class_install_property (gobject_class, PROP_FLAGS,
+	         g_param_spec_uint ("flags", "Flags", "Object Source flags.", 
+	                            0, G_MAXUINT, 0, G_PARAM_READABLE));
+
+	g_object_class_install_property (gobject_class, PROP_KEY_DESC,
+	         g_param_spec_string ("key-desc", "Key Desc", "Description for keys that originate here.",
+	                              NULL, G_PARAM_READABLE));
+
+	g_object_class_install_property (gobject_class, PROP_LOCATION,
+	         g_param_spec_uint ("location", "Key Location", "Where the key is stored. See SeahorseLocation", 
+	                            0, G_MAXUINT, SEAHORSE_LOCATION_INVALID, G_PARAM_READABLE));    
+    
+	seahorse_registry_register_type (NULL, SEAHORSE_TYPE_PKCS11_SOURCE, "source", "local", SEAHORSE_PKCS11_TYPE_STR, NULL);
+}
+
+/* -------------------------------------------------------------------------- 
+ * PUBLIC
+ */
+
+SeahorsePkcs11Source*
+seahorse_pkcs11_source_new (GP11Slot *slot)
+{
+	return g_object_new (SEAHORSE_TYPE_PKCS11_SOURCE, "slot", slot, NULL);
+}   
+
+GP11Slot*
+seahorse_pkcs11_source_get_slot (SeahorsePkcs11Source *self)
+{
+	g_return_val_if_fail (SEAHORSE_IS_PKCS11_SOURCE (self), NULL);
+	return self->pv->slot;
+}
+
+void
+seahorse_pkcs11_source_receive_object (SeahorsePkcs11Source *self, GP11Object *obj)
+{
+	GQuark id = seahorse_pkcs11_object_cannonical_id (obj);
+	SeahorsePkcs11Certificate *cert;
+	SeahorseObject *prev;
+	
+	g_return_if_fail (SEAHORSE_IS_PKCS11_SOURCE (self));
+	
+	/* TODO: This will need to change once we get other kinds of objects */
+	
+	prev = seahorse_context_get_object (NULL, SEAHORSE_SOURCE (self), id);
+	if (prev) {
+		seahorse_object_refresh (prev);
+		g_object_unref (obj);
+		return;
 	}
-	return seahorse_pkcs11_source_type_id;
-}
-
-
-
 
+	cert = seahorse_pkcs11_certificate_new (obj);
+	g_object_set (cert, "source", self, NULL);
+	seahorse_context_add_object (NULL, SEAHORSE_OBJECT (cert));
+}

Modified: trunk/pkcs11/seahorse-pkcs11-source.h
==============================================================================
--- trunk/pkcs11/seahorse-pkcs11-source.h	(original)
+++ trunk/pkcs11/seahorse-pkcs11-source.h	Sun Dec 14 14:53:04 2008
@@ -1,57 +1,58 @@
+/*
+ * 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_PKCS11_SOURCE_H__
 #define __SEAHORSE_PKCS11_SOURCE_H__
 
-#include <glib.h>
-#include <glib-object.h>
-#include <seahorse-source.h>
+#include "seahorse-source.h"
+
 #include <gp11.h>
-#include <gp11-hacks.h>
-#include <seahorse-operation.h>
-#include <gio/gio.h>
-#include <seahorse-object.h>
-#include <seahorse-types.h>
-#include <stdlib.h>
-#include <string.h>
-
-G_BEGIN_DECLS
-
-
-#define SEAHORSE_PKCS11_TYPE_SOURCE (seahorse_pkcs11_source_get_type ())
-#define SEAHORSE_PKCS11_SOURCE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SEAHORSE_PKCS11_TYPE_SOURCE, SeahorsePkcs11Source))
-#define SEAHORSE_PKCS11_SOURCE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SEAHORSE_PKCS11_TYPE_SOURCE, SeahorsePkcs11SourceClass))
-#define SEAHORSE_PKCS11_IS_SOURCE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SEAHORSE_PKCS11_TYPE_SOURCE))
-#define SEAHORSE_PKCS11_IS_SOURCE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SEAHORSE_PKCS11_TYPE_SOURCE))
-#define SEAHORSE_PKCS11_SOURCE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), SEAHORSE_PKCS11_TYPE_SOURCE, SeahorsePkcs11SourceClass))
+
+#define SEAHORSE_TYPE_PKCS11_SOURCE            (seahorse_pkcs11_source_get_type ())
+#define SEAHORSE_PKCS11_SOURCE(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), SEAHORSE_TYPE_PKCS11_SOURCE, SeahorsePkcs11Source))
+#define SEAHORSE_PKCS11_SOURCE_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), SEAHORSE_TYPE_PKCS11_SOURCE, SeahorsePkcs11SourceClass))
+#define SEAHORSE_IS_PKCS11_SOURCE(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SEAHORSE_TYPE_PKCS11_SOURCE))
+#define SEAHORSE_IS_PKCS11_SOURCE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SEAHORSE_TYPE_PKCS11_SOURCE))
+#define SEAHORSE_PKCS11_SOURCE_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), SEAHORSE_TYPE_PKCS11_SOURCE, SeahorsePkcs11SourceClass))
 
 typedef struct _SeahorsePkcs11Source SeahorsePkcs11Source;
 typedef struct _SeahorsePkcs11SourceClass SeahorsePkcs11SourceClass;
 typedef struct _SeahorsePkcs11SourcePrivate SeahorsePkcs11SourcePrivate;
 
 struct _SeahorsePkcs11Source {
-	SeahorseSource parent_instance;
-	SeahorsePkcs11SourcePrivate * priv;
+	SeahorseSource parent;
+	SeahorsePkcs11SourcePrivate *pv;
 };
 
 struct _SeahorsePkcs11SourceClass {
 	SeahorseSourceClass parent_class;
-	SeahorseOperation* (*import) (SeahorsePkcs11Source* self, GInputStream* input);
-	SeahorseOperation* (*export) (SeahorsePkcs11Source* self, GList* objects, GOutputStream* output);
-	SeahorseOperation* (*remove) (SeahorsePkcs11Source* self, SeahorseObject* object);
 };
 
+GType                  seahorse_pkcs11_source_get_type          (void);
 
-SeahorsePkcs11Source* seahorse_pkcs11_source_new (GP11Slot* slot);
-SeahorseOperation* seahorse_pkcs11_source_import (SeahorsePkcs11Source* self, GInputStream* input);
-SeahorseOperation* seahorse_pkcs11_source_export (SeahorsePkcs11Source* self, GList* objects, GOutputStream* output);
-SeahorseOperation* seahorse_pkcs11_source_remove (SeahorsePkcs11Source* self, SeahorseObject* object);
-GP11Slot* seahorse_pkcs11_source_get_slot (SeahorsePkcs11Source* self);
-SeahorseLocation seahorse_pkcs11_source_get_location (SeahorsePkcs11Source* self);
-GQuark seahorse_pkcs11_source_get_key_type (SeahorsePkcs11Source* self);
-const char* seahorse_pkcs11_source_get_key_desc (SeahorsePkcs11Source* self);
-GType seahorse_pkcs11_source_get_type (void);
+SeahorsePkcs11Source*  seahorse_pkcs11_source_new               (GP11Slot *slot);
 
+GP11Slot*              seahorse_pkcs11_source_get_slot          (SeahorsePkcs11Source *self);
 
-G_END_DECLS
+void                   seahorse_pkcs11_source_receive_object    (SeahorsePkcs11Source *self, GP11Object *obj);
 
-#endif
+#endif /* __SEAHORSE_PKCS11_SOURCE_H__ */

Modified: trunk/pkcs11/seahorse-pkcs11.c
==============================================================================
--- trunk/pkcs11/seahorse-pkcs11.c	(original)
+++ trunk/pkcs11/seahorse-pkcs11.c	Sun Dec 14 14:53:04 2008
@@ -20,175 +20,4 @@
  */
 
 #include "seahorse-pkcs11.h"
-#include <stdlib.h>
-#include <string.h>
-#include <pkcs11.h>
-#include <pkcs11g.h>
-
-
-
-
-static char* seahorse_pkcs11_klass_to_string (gulong klass);
-static gulong seahorse_pkcs11_string_to_klass (const char* str);
-static void _vala_array_free (gpointer array, gint array_length, GDestroyNotify destroy_func);
-static int _vala_strcmp0 (const char * str1, const char * str2);
-
-
-
-GQuark seahorse_pkcs11_id_from_attributes (GP11Attributes* attrs) {
-	gulong klass;
-	GP11Attribute* attr;
-	char* _tmp3;
-	char* _tmp2;
-	char* _tmp4;
-	char* value;
-	GQuark _tmp5;
-	g_return_val_if_fail (attrs != NULL, 0U);
-	/* These cases should have been covered by the programmer */
-	klass = 0UL;
-	if (!gp11_attributes_find_ulong (attrs, CKA_CLASS, &klass)) {
-		g_warning ("seahorse-pkcs11.vala:36: Cannot create object id. PKCS#11 attribute set did not contain CKA_CLASS.");
-		return ((GQuark) (0));
-	}
-	attr = gp11_attributes_find (attrs, CKA_ID);
-	if (attr == NULL) {
-		g_warning ("seahorse-pkcs11.vala:42: Cannot create object id. PKCS#11 attribute set did not contain CKA_ID");
-		return ((GQuark) (0));
-	}
-	_tmp3 = NULL;
-	_tmp2 = NULL;
-	_tmp4 = NULL;
-	value = (_tmp4 = g_strdup_printf ("%s:%s/%s", SEAHORSE_PKCS11_TYPE_STR, (_tmp2 = seahorse_pkcs11_klass_to_string (klass)), (_tmp3 = g_base64_encode (attr->value, ((gsize) (attr->length))))), (_tmp3 = (g_free (_tmp3), NULL)), (_tmp2 = (g_free (_tmp2), NULL)), _tmp4);
-	return (_tmp5 = g_quark_from_string (value), (value = (g_free (value), NULL)), _tmp5);
-}
-
-
-gboolean seahorse_pkcs11_id_to_attributes (GQuark id, GP11Attributes* attrs) {
-	const char* value;
-	char** _tmp1;
-	gint parts_length1;
-	char** parts;
-	gulong klass;
-	gsize len;
-	guchar* _tmp4;
-	gint ckid_length1;
-	guchar* ckid;
-	gboolean _tmp6;
-	g_return_val_if_fail (attrs != NULL, FALSE);
-	if (id == 0) {
-		return FALSE;
-	}
-	value = g_quark_to_string (id);
-	_tmp1 = NULL;
-	parts = (_tmp1 = g_strsplit_set (value, ":/", 3), parts_length1 = -1, _tmp1);
-	if (parts_length1 != 3 || _vala_strcmp0 (parts[0], SEAHORSE_PKCS11_TYPE_STR) != 0) {
-		gboolean _tmp2;
-		return (_tmp2 = FALSE, (parts = (_vala_array_free (parts, parts_length1, ((GDestroyNotify) (g_free))), NULL)), _tmp2);
-	}
-	klass = seahorse_pkcs11_string_to_klass (parts[1]);
-	if (klass == -1) {
-		gboolean _tmp3;
-		return (_tmp3 = FALSE, (parts = (_vala_array_free (parts, parts_length1, ((GDestroyNotify) (g_free))), NULL)), _tmp3);
-	}
-	len = 0UL;
-	_tmp4 = NULL;
-	ckid = (_tmp4 = g_base64_decode (parts[2], &len), ckid_length1 = -1, _tmp4);
-	if (ckid == NULL) {
-		gboolean _tmp5;
-		return (_tmp5 = FALSE, (parts = (_vala_array_free (parts, parts_length1, ((GDestroyNotify) (g_free))), NULL)), (ckid = (g_free (ckid), NULL)), _tmp5);
-	}
-	gp11_attributes_add_data (attrs, CKA_ID, ckid, ckid_length1);
-	gp11_attributes_add_ulong (attrs, CKA_CLASS, klass);
-	return (_tmp6 = TRUE, (parts = (_vala_array_free (parts, parts_length1, ((GDestroyNotify) (g_free))), NULL)), (ckid = (g_free (ckid), NULL)), _tmp6);
-}
-
-
-static char* seahorse_pkcs11_klass_to_string (gulong klass) {
-	gulong _tmp5;
-	_tmp5 = klass;
-	if (_tmp5 == CKO_DATA)
-	do {
-		return g_strdup ("data");
-	} while (0); else if (_tmp5 == CKO_CERTIFICATE)
-	do {
-		return g_strdup ("certificate");
-	} while (0); else if (_tmp5 == CKO_PRIVATE_KEY)
-	do {
-		return g_strdup ("private-key");
-	} while (0); else if (_tmp5 == CKO_PUBLIC_KEY)
-	do {
-		return g_strdup ("public-key");
-	} while (0); else
-	do {
-		return g_strdup_printf ("%lu", klass);
-	} while (0);
-}
-
-
-static gulong seahorse_pkcs11_string_to_klass (const char* str) {
-	g_return_val_if_fail (str != NULL, 0UL);
-	if (_vala_strcmp0 (str, "data") == 0) {
-		return CKO_DATA;
-	} else {
-		if (_vala_strcmp0 (str, "certificate") == 0) {
-			return CKO_CERTIFICATE;
-		} else {
-			if (_vala_strcmp0 (str, "private-key") == 0) {
-				return CKO_PRIVATE_KEY;
-			} else {
-				if (_vala_strcmp0 (str, "public-key") == 0) {
-					return CKO_PUBLIC_KEY;
-				} else {
-					char* end;
-					char* _tmp6;
-					gulong _tmp5;
-					char* _tmp4;
-					gulong ret;
-					gulong _tmp8;
-					end = NULL;
-					_tmp6 = NULL;
-					_tmp4 = NULL;
-					ret = (_tmp5 = strtoul (str, &_tmp4, 0), end = (_tmp6 = _tmp4, (end = (g_free (end), NULL)), _tmp6), _tmp5);
-					if (g_utf8_strlen (end, -1) > 0) {
-						gulong _tmp7;
-						g_warning ("seahorse-pkcs11.vala:101: unrecognized and unparsable PKCS#11 class: %s", str);
-						return (_tmp7 = ((gulong) (-1)), (end = (g_free (end), NULL)), _tmp7);
-					}
-					return (_tmp8 = ret, (end = (g_free (end), NULL)), _tmp8);
-				}
-			}
-		}
-	}
-}
-
-
-static void _vala_array_free (gpointer array, gint array_length, GDestroyNotify destroy_func) {
-	if (array != NULL && destroy_func != NULL) {
-		int i;
-		if (array_length >= 0)
-		for (i = 0; i < array_length; i = i + 1) {
-			if (((gpointer*) (array))[i] != NULL)
-			destroy_func (((gpointer*) (array))[i]);
-		}
-		else
-		for (i = 0; ((gpointer*) (array))[i] != NULL; i = i + 1) {
-			destroy_func (((gpointer*) (array))[i]);
-		}
-	}
-	g_free (array);
-}
-
-
-static int _vala_strcmp0 (const char * str1, const char * str2) {
-	if (str1 == NULL) {
-		return -(str1 != str2);
-	}
-	if (str2 == NULL) {
-		return (str1 != str2);
-	}
-	return strcmp (str1, str2);
-}
-
-
-
 

Modified: trunk/pkcs11/seahorse-pkcs11.h
==============================================================================
--- trunk/pkcs11/seahorse-pkcs11.h	(original)
+++ trunk/pkcs11/seahorse-pkcs11.h	Sun Dec 14 14:53:04 2008
@@ -23,20 +23,8 @@
 #define __SEAHORSE_PKCS11_H__
 
 #include <glib.h>
-#include <glib-object.h>
-#include <gp11.h>
-#include <gp11-hacks.h>
-
-G_BEGIN_DECLS
-
-
 
 #define SEAHORSE_PKCS11_TYPE_STR "pkcs11"
 #define SEAHORSE_PKCS11_TYPE g_quark_from_string ("pkcs11")
-GQuark seahorse_pkcs11_id_from_attributes (GP11Attributes* attrs);
-gboolean seahorse_pkcs11_id_to_attributes (GQuark id, GP11Attributes* attrs);
-
-
-G_END_DECLS
 
 #endif

Modified: trunk/ssh/seahorse-ssh-key.c
==============================================================================
--- trunk/ssh/seahorse-ssh-key.c	(original)
+++ trunk/ssh/seahorse-ssh-key.c	Sun Dec 14 14:53:04 2008
@@ -24,7 +24,11 @@
 #include <string.h>
 
 #include <glib.h>
+
 #include <glib/gi18n.h>
+#include <glib/gstdio.h>
+
+#include <errno.h>
 
 #include "seahorse-context.h"
 #include "seahorse-source.h"
@@ -147,6 +151,56 @@
  */
 
 static void
+seahorse_ssh_key_refresh (SeahorseObject *sobj)
+{
+	/* TODO: Need to work on key refreshing */
+	SEAHORSE_OBJECT_CLASS (seahorse_ssh_key_parent_class)->refresh (sobj);
+}
+
+static SeahorseOperation*
+seahorse_ssh_key_delete (SeahorseObject *sobj)
+{
+	SeahorseSSHKeyData *keydata = NULL;
+	gboolean ret = TRUE;
+	GError *err = NULL;
+    
+	g_return_val_if_fail (SEAHORSE_IS_SSH_KEY (sobj), NULL);
+
+	g_object_get (sobj, "key-data", &keydata, NULL);
+	g_return_val_if_fail (keydata, FALSE);
+    
+	/* Just part of a file for this key */
+	if (keydata->partial) {
+	
+		/* Take just that line out of the file */
+		if (keydata->pubfile)
+			seahorse_ssh_key_data_filter_file (keydata->pubfile, NULL, keydata, &err);
+	
+	/* A full file for this key */
+	} else {
+	
+		if (keydata->pubfile) {
+			if (g_unlink (keydata->pubfile) == -1) {
+				g_set_error (&err, G_FILE_ERROR, g_file_error_from_errno (errno), 
+				             "%s", g_strerror (errno));
+			}
+		}
+
+		if (ret && keydata->privfile) {
+			if (g_unlink (keydata->privfile) == -1) {
+				g_set_error (&err, G_FILE_ERROR, g_file_error_from_errno (errno), 
+				             "%s", g_strerror (errno));
+			}
+		}
+	}
+
+	if (err == NULL)
+		seahorse_context_remove_object (SCTX_APP (), sobj);
+
+	return seahorse_operation_new_complete (err);
+}
+
+static void
 seahorse_ssh_key_get_property (GObject *object, guint prop_id,
                                GValue *value, GParamSpec *pspec)
 {
@@ -214,6 +268,7 @@
 seahorse_ssh_key_class_init (SeahorseSSHKeyClass *klass)
 {
     GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
+    SeahorseObjectClass *seahorse_class = SEAHORSE_OBJECT_CLASS (klass);
     
     seahorse_ssh_key_parent_class = g_type_class_peek_parent (klass);
     
@@ -221,6 +276,9 @@
     gobject_class->set_property = seahorse_ssh_key_set_property;
     gobject_class->get_property = seahorse_ssh_key_get_property;
     
+    seahorse_class->delete = seahorse_ssh_key_delete;
+    seahorse_class->refresh = seahorse_ssh_key_refresh;
+    
     g_object_class_install_property (gobject_class, PROP_KEY_DATA,
         g_param_spec_pointer ("key-data", "SSH Key Data", "SSH key data pointer",
                               G_PARAM_READWRITE));

Modified: trunk/ssh/seahorse-ssh-operation.c
==============================================================================
--- trunk/ssh/seahorse-ssh-operation.c	(original)
+++ trunk/ssh/seahorse-ssh-operation.c	Sun Dec 14 14:53:04 2008
@@ -870,10 +870,9 @@
 static void
 change_result_cb (SeahorseSSHOperation *sop)
 {
-    SeahorseSSHOperationPrivate *pv = SEAHORSE_SSH_OPERATION_GET_PRIVATE (sop);
-    if (pv->prompt_skey)
-        seahorse_source_load_async (SEAHORSE_SOURCE (sop->sksrc), 
-                                        seahorse_object_get_id (pv->prompt_skey));
+	SeahorseSSHOperationPrivate *pv = SEAHORSE_SSH_OPERATION_GET_PRIVATE (sop);
+	if (pv->prompt_skey)
+		seahorse_object_refresh (SEAHORSE_OBJECT (pv->prompt_skey));
 }
 
 SeahorseOperation*
@@ -1140,8 +1139,7 @@
     
     /* Just reload that one key */
     if (!err)
-        seahorse_source_load (SEAHORSE_SOURCE (ssrc), 
-                                  seahorse_object_get_id (SEAHORSE_OBJECT (skey)));
+        seahorse_object_refresh (SEAHORSE_OBJECT (skey));
     
     return seahorse_operation_new_complete (err);
 }

Modified: trunk/ssh/seahorse-ssh-source.c
==============================================================================
--- trunk/ssh/seahorse-ssh-source.c	(original)
+++ trunk/ssh/seahorse-ssh-source.c	Sun Dec 14 14:53:04 2008
@@ -77,8 +77,6 @@
     SeahorseSSHSource *ssrc;
     GHashTable *loaded;
     GHashTable *checks;
-    GQuark match;
-    gboolean matched;
     gchar *pubfile;
     gchar *privfile;
 } LoadContext;
@@ -168,7 +166,7 @@
 {
     DEBUG_REFRESH ("scheduled refresh event ocurring now\n");
     cancel_scheduled_refresh (ssrc);
-    seahorse_source_load_async (SEAHORSE_SOURCE (ssrc), 0);
+    seahorse_source_load_async (SEAHORSE_SOURCE (ssrc));
     return FALSE; /* don't run again */    
 }
 
@@ -284,16 +282,7 @@
         g_hash_table_insert (ctx->loaded, GUINT_TO_POINTER (keyid), 
                                           GUINT_TO_POINTER (TRUE));
     }
-
-    /* Looking for a specific key */
-    if (ctx->match) {
-        if(ctx->match != keyid) {
-            seahorse_ssh_key_data_free (keydata);
-            return NULL;
-        }
-        ctx->matched = TRUE;
-    }
-        
+     
     /* If we already have this key then just transfer ownership of keydata */
     if (prev) {
         g_object_set (prev, "key-data", keydata, NULL);
@@ -323,9 +312,6 @@
     /* Check and register thet key with the context, frees keydata */
     ssh_key_from_data (ctx->ssrc, ctx, data);
     
-    if (ctx->matched)
-        return FALSE;
-    
     return TRUE;
 }
 
@@ -344,9 +330,6 @@
     /* Check and register thet key with the context, frees keydata */
     ssh_key_from_data (ctx->ssrc, ctx, data);
     
-    if (ctx->matched)
-        return FALSE;
-    
     return TRUE;
 }
 
@@ -365,9 +348,6 @@
     /* Check and register thet key with the context, frees keydata */
     ssh_key_from_data (ctx->ssrc, ctx, data);
     
-    if (ctx->matched)
-        return FALSE;
-    
     return TRUE;
 }
 
@@ -424,7 +404,7 @@
  */
 
 static SeahorseOperation*
-seahorse_ssh_source_load (SeahorseSource *sksrc, GQuark keymatch)
+seahorse_ssh_source_load (SeahorseSource *sksrc)
 {
     SeahorseSSHSource *ssrc;
     GError *err = NULL;
@@ -446,16 +426,13 @@
         return seahorse_operation_new_complete (err);
 
     memset (&ctx, 0, sizeof (ctx));
-    ctx.match = keymatch;
-    ctx.matched = FALSE;
     ctx.ssrc = ssrc;
     
     /* Since we can find duplicate keys, limit them with this hash */
     ctx.loaded = g_hash_table_new_full (g_direct_hash, g_direct_equal, NULL, NULL);
     
     /* Keys that currently exist, so we can remove any that disappeared */
-    if (!keymatch)
-        ctx.checks = load_present_keys (sksrc);
+    ctx.checks = load_present_keys (sksrc);
 
     /* For each private key file */
     for(;;) {
@@ -481,60 +458,47 @@
         g_free (ctx.privfile);
         g_free (ctx.pubfile);
         ctx.privfile = ctx.pubfile = NULL;
-
-        if (ctx.matched)
-            break;
     }
 
     g_dir_close (dir);
     
     /* Now load the authorized file */
-    if (!ctx.matched) {
-        
-        ctx.privfile = NULL;
-        ctx.pubfile = seahorse_ssh_source_file_for_public (ssrc, TRUE);
+    ctx.privfile = NULL;
+    ctx.pubfile = seahorse_ssh_source_file_for_public (ssrc, TRUE);
         
-        if (g_file_test (ctx.pubfile, G_FILE_TEST_EXISTS)) {
-            seahorse_ssh_key_data_parse_file (ctx.pubfile, parsed_authorized_key, NULL, &ctx, &err);
-            if (err != NULL) {
-                g_warning ("couldn't read SSH file: %s (%s)", ctx.pubfile, err->message);
-                g_clear_error (&err);
-            }
+    if (g_file_test (ctx.pubfile, G_FILE_TEST_EXISTS)) {
+        seahorse_ssh_key_data_parse_file (ctx.pubfile, parsed_authorized_key, NULL, &ctx, &err);
+        if (err != NULL) {
+            g_warning ("couldn't read SSH file: %s (%s)", ctx.pubfile, err->message);
+            g_clear_error (&err);
         }
-        
-        g_free (ctx.pubfile);
-		ctx.pubfile = NULL;
     }
+        
+    g_free (ctx.pubfile);
+    ctx.pubfile = NULL;
     
     /* Load the other keys file */
-    if (!ctx.matched) {
-        
-        ctx.privfile = NULL;
-        ctx.pubfile = seahorse_ssh_source_file_for_public (ssrc, FALSE);
-        if (g_file_test (ctx.pubfile, G_FILE_TEST_EXISTS)) {
-            seahorse_ssh_key_data_parse_file (ctx.pubfile, parsed_other_key, NULL, &ctx, &err);
-            if (err != NULL) {
-                g_warning ("couldn't read SSH file: %s (%s)", ctx.pubfile, err->message);
-                g_clear_error (&err);
-            }
+    ctx.privfile = NULL;
+    ctx.pubfile = seahorse_ssh_source_file_for_public (ssrc, FALSE);
+    if (g_file_test (ctx.pubfile, G_FILE_TEST_EXISTS)) {
+        seahorse_ssh_key_data_parse_file (ctx.pubfile, parsed_other_key, NULL, &ctx, &err);
+        if (err != NULL) {
+            g_warning ("couldn't read SSH file: %s (%s)", ctx.pubfile, err->message);
+            g_clear_error (&err);
         }
-        
-        g_free (ctx.pubfile);
-		ctx.pubfile = NULL;
     }
+        
+    g_free (ctx.pubfile);
+    ctx.pubfile = NULL;
 
     /* Clean up and done */
     if (ctx.checks) {
-        g_assert (!ctx.matched);
         g_hash_table_foreach (ctx.checks, (GHFunc)remove_key_from_context, ssrc);
         g_hash_table_destroy (ctx.checks);
     }
     
     g_hash_table_destroy (ctx.loaded);
 
-    /* Just a double check of our logic */
-    g_assert (!ctx.matched || keymatch);
-    
     return seahorse_operation_new_complete (NULL);
 }
 
@@ -628,62 +592,6 @@
     	return op;
 }
 
-static SeahorseOperation*
-seahorse_ssh_source_remove (SeahorseSource *sksrc, SeahorseObject *sobj)
-{
-    SeahorseSSHKeyData *keydata = NULL;
-    SeahorseSSHSource *ssrc = SEAHORSE_SSH_SOURCE (sksrc);
-    gboolean ret = TRUE;
-    GError *err = NULL;
-    gchar *fullpath;
-    
-    g_return_val_if_fail (SEAHORSE_IS_SSH_SOURCE (sksrc), NULL);
-    g_return_val_if_fail (SEAHORSE_IS_SSH_KEY (sobj), NULL);
-    g_return_val_if_fail (seahorse_object_get_source (sobj) == sksrc, NULL);
-
-    g_object_get (sobj, "key-data", &keydata, NULL);
-    g_return_val_if_fail (keydata, FALSE);
-    
-    /* Just part of a file for this key */
-    if (keydata->partial) {
-        
-        /* Take just that line out of the file */
-        if (keydata->pubfile) {
-            seahorse_ssh_key_data_filter_file (keydata->pubfile, NULL, keydata, &err);
-        }
-        
-        /* Make sure to take it out of any other files too */
-        if (ret && keydata->authorized) {
-            fullpath = seahorse_ssh_source_file_for_public (ssrc, FALSE);
-            seahorse_ssh_key_data_filter_file (fullpath, NULL, keydata, &err);
-            g_free (fullpath);
-        }
-        
-        
-    /* A full full for this key */
-    } else {
-        
-        if (keydata->pubfile) {
-            if (g_unlink (keydata->pubfile) == -1) {
-                g_set_error (&err, G_FILE_ERROR, g_file_error_from_errno (errno), 
-                             "%s", g_strerror (errno));
-            }
-        }
-
-        if (ret && keydata->privfile) {
-            if (g_unlink (keydata->privfile) == -1) {
-                g_set_error (&err, G_FILE_ERROR, g_file_error_from_errno (errno), 
-                             "%s", g_strerror (errno));
-            }
-        }
-    }
-
-    if (err == NULL)
-        seahorse_context_remove_object (SCTX_APP (), sobj);
-
-    return seahorse_operation_new_complete (err);
-}
-
 static void 
 seahorse_ssh_source_set_property (GObject *object, guint prop_id, const GValue *value, 
                                   GParamSpec *pspec)
@@ -797,7 +705,6 @@
     parent_class->load = seahorse_ssh_source_load;
     parent_class->import = seahorse_ssh_source_import;
     parent_class->export = seahorse_ssh_source_export;
-    parent_class->remove = seahorse_ssh_source_remove;
  
     g_object_class_install_property (gobject_class, PROP_KEY_TYPE,
         g_param_spec_uint ("key-type", "Key Type", "Key type that originates from this key source.", 
@@ -854,7 +761,7 @@
         
         /* Force loading of all new keys */
         if (!i) {
-            seahorse_source_load_sync (SEAHORSE_SOURCE (ssrc), 0);
+            seahorse_source_load_sync (SEAHORSE_SOURCE (ssrc));
         }
     }
     



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