[seahorse/refactor: 14/33] Load certificates from tokens



commit b4a29f5ce1d73e8a34bcb94180cf2883cf82ce14
Author: Stef Walter <stefw collabora co uk>
Date:   Fri Sep 9 15:01:52 2011 +0200

    Load certificates from tokens

 pkcs11/seahorse-pkcs11-object.c |    2 +-
 pkcs11/seahorse-pkcs11-token.c  |   17 +++++++++++++----
 2 files changed, 14 insertions(+), 5 deletions(-)
---
diff --git a/pkcs11/seahorse-pkcs11-object.c b/pkcs11/seahorse-pkcs11-object.c
index 1dd030e..46bc9fd 100644
--- a/pkcs11/seahorse-pkcs11-object.c
+++ b/pkcs11/seahorse-pkcs11-object.c
@@ -351,7 +351,7 @@ seahorse_pkcs11_object_require_attribute (SeahorsePkcs11Object *self, gulong att
 	attr = gck_attributes_find (self->pv->pkcs11_attributes, attr_type);
 	if (attr == NULL)
 		load_object_attributes (self, &attr_type, 1);
-	if (gck_attribute_is_invalid (attr))
+	else if (gck_attribute_is_invalid (attr))
 		attr = NULL;
 	
 	return attr;
diff --git a/pkcs11/seahorse-pkcs11-token.c b/pkcs11/seahorse-pkcs11-token.c
index 7d6df98..157c1cf 100644
--- a/pkcs11/seahorse-pkcs11-token.c
+++ b/pkcs11/seahorse-pkcs11-token.c
@@ -78,6 +78,16 @@ seahorse_pkcs11_token_init (SeahorsePkcs11Token *self)
 }
 
 static void
+seahorse_pkcs11_token_constructed (GObject *obj)
+{
+	SeahorsePkcs11Token *self = SEAHORSE_PKCS11_TOKEN (obj);
+
+	G_OBJECT_CLASS (seahorse_pkcs11_token_parent_class)->constructed (obj);
+
+	seahorse_pkcs11_refresh_async (self, NULL, NULL, NULL);
+}
+
+static void
 seahorse_pkcs11_token_get_property (GObject *object,
                                     guint prop_id,
                                     GValue *value,
@@ -161,12 +171,11 @@ seahorse_pkcs11_token_finalize (GObject *obj)
 static void
 seahorse_pkcs11_token_class_init (SeahorsePkcs11TokenClass *klass)
 {
-	GObjectClass *gobject_class;
+	GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
 
-	seahorse_pkcs11_token_parent_class = g_type_class_peek_parent (klass);
 	g_type_class_add_private (klass, sizeof (SeahorsePkcs11TokenPrivate));
 
-	gobject_class = G_OBJECT_CLASS (klass);
+	gobject_class->constructed = seahorse_pkcs11_token_constructed;
 	gobject_class->dispose = seahorse_pkcs11_token_dispose;
 	gobject_class->finalize = seahorse_pkcs11_token_finalize;
 	gobject_class->set_property = seahorse_pkcs11_token_set_property;
@@ -263,7 +272,7 @@ seahorse_pkcs11_token_receive_object (SeahorsePkcs11Token *self,
 	}
 
 	cert = seahorse_pkcs11_certificate_new (obj);
-	g_object_set (cert, "token", self, NULL);
+	g_object_set (cert, "source", self, NULL);
 
 	g_hash_table_insert (self->pv->objects, g_memdup (&handle, sizeof (handle)), cert);
 	gcr_collection_emit_added (GCR_COLLECTION (self), G_OBJECT (cert));



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