gnome-keyring r1481 - in trunk: . gcr gcr/tests



Author: nnielsen
Date: Thu Jan 29 01:12:43 2009
New Revision: 1481
URL: http://svn.gnome.org/viewvc/gnome-keyring?rev=1481&view=rev

Log:
	* gcr/gcr.h:
	* gcr/gcr.pc.in:
	* gcr/gcr-certificate-basics-widget.h:
	* gcr/gcr-certificate-details-widget.h:
	* gcr/gcr-importer.h:
	* gcr/gcr-parser.h:
	* gcr/gcr-types.h:
	* gcr/Makefile.am: Install appropriate header files 
	and fix the pkg-config file for the gcr library.

	* gcr/gcr-certificate.c:
	* gcr/gcr-certificate.h:
	* gcr/gcr-simple-certificate.c: (added)
	* gcr/gcr-simple-certificate.h: (added)
	* gcr/tests/ui-test-details.c:
	* gcr/tests/unit-test-certificate.c: Make GcrCertificate
	an interface so that it can more easily plug into 
	various libraries.

Added:
   trunk/gcr/gcr-simple-certificate.c
   trunk/gcr/gcr-simple-certificate.h
Modified:
   trunk/ChangeLog
   trunk/gcr/Makefile.am
   trunk/gcr/gcr-certificate-basics-widget.h
   trunk/gcr/gcr-certificate-details-widget.h
   trunk/gcr/gcr-certificate.c
   trunk/gcr/gcr-certificate.h
   trunk/gcr/gcr-importer.h
   trunk/gcr/gcr-parser.h
   trunk/gcr/gcr-types.h
   trunk/gcr/gcr.h
   trunk/gcr/gcr.pc.in
   trunk/gcr/tests/ui-test-details.c
   trunk/gcr/tests/unit-test-certificate.c

Modified: trunk/gcr/Makefile.am
==============================================================================
--- trunk/gcr/Makefile.am	(original)
+++ trunk/gcr/Makefile.am	Thu Jan 29 01:12:43 2009
@@ -14,6 +14,20 @@
 ui_DATA = $(GLADE_FILES:.glade=.ui)
 
 # ------------------------------------------------------------------
+# HEADERS
+
+incdir = $(includedir)/gcr
+
+inc_HEADERS = \
+	gcr.h \
+	gcr-certificate.h \
+	gcr-certificate-basics-widget.h \
+	gcr-certificate-details-widget.h \
+	gcr-importer.h \
+	gcr-parser.h \
+	gcr-types.h
+
+# ------------------------------------------------------------------
 # LIBRARY
 
 INCLUDES = \
@@ -39,6 +53,7 @@
 	gcr-internal.h \
 	gcr-library.c \
 	gcr-parser.c gcr-parser.h \
+	gcr-simple-certificate.c gcr-simple-certificate.h \
 	gcr-types.h \
 	$(BUILT_SOURCES)
 

Modified: trunk/gcr/gcr-certificate-basics-widget.h
==============================================================================
--- trunk/gcr/gcr-certificate-basics-widget.h	(original)
+++ trunk/gcr/gcr-certificate-basics-widget.h	Thu Jan 29 01:12:43 2009
@@ -24,6 +24,7 @@
 #include <gtk/gtk.h>
 
 #include "gcr-certificate.h"
+#include "gcr-types.h"
 
 #define GCR_TYPE_CERTIFICATE_BASICS_WIDGET               (gcr_certificate_basics_widget_get_type ())
 #define GCR_CERTIFICATE_BASICS_WIDGET(obj)               (G_TYPE_CHECK_INSTANCE_CAST ((obj), GCR_TYPE_CERTIFICATE_BASICS_WIDGET, GcrCertificateBasicsWidget))

Modified: trunk/gcr/gcr-certificate-details-widget.h
==============================================================================
--- trunk/gcr/gcr-certificate-details-widget.h	(original)
+++ trunk/gcr/gcr-certificate-details-widget.h	Thu Jan 29 01:12:43 2009
@@ -24,6 +24,7 @@
 #include <gtk/gtk.h>
 
 #include "gcr-certificate.h"
+#include "gcr-types.h"
 
 #define GCR_TYPE_CERTIFICATE_DETAILS_WIDGET               (gcr_certificate_details_widget_get_type ())
 #define GCR_CERTIFICATE_DETAILS_WIDGET(obj)               (G_TYPE_CHECK_INSTANCE_CAST ((obj), GCR_TYPE_CERTIFICATE_DETAILS_WIDGET, GcrCertificateDetailsWidget))

Modified: trunk/gcr/gcr-certificate.c
==============================================================================
--- trunk/gcr/gcr-certificate.c	(original)
+++ trunk/gcr/gcr-certificate.c	Thu Jan 29 01:12:43 2009
@@ -29,56 +29,63 @@
 
 #include <string.h>
 
-struct _GcrCertificatePrivate {
-	/* Cache of data returned  from get_der_data() */ 
-	ASN1_TYPE asn1;
-	gconstpointer data;
-	gsize n_data;
-	
-	/* When initialized with gcr_certificate_new_for_data() */
-	guchar *owned_data;
-	gsize n_owned_data;
-};
-
-G_DEFINE_TYPE (GcrCertificate, gcr_certificate, G_TYPE_OBJECT);
-
 /* -----------------------------------------------------------------------------
  * INTERNAL 
  */
 
+
+typedef struct _Asn1Cache {
+	ASN1_TYPE asn1;
+	gconstpointer der;
+	gsize length;
+} Asn1Cache;
+
+static GQuark ASN1_CACHE = 0;
+
+static void
+free_asn1_cache (gpointer data)
+{
+	Asn1Cache *cache = (Asn1Cache*)data;
+	if (cache) {
+		g_assert (cache->asn1);
+		asn1_delete_structure (&cache->asn1);
+		g_free (cache);
+	}
+}
+
 static ASN1_TYPE
-parse_certificate_asn1 (GcrCertificate *self)
+parse_certificate_asn1 (GcrCertificate *cert)
 {
-	const guchar *data;
-	gsize n_data;
+	Asn1Cache *cache;
+	ASN1_TYPE asn1;
+	const guchar *der;
+	gsize n_der;
 	
-	g_assert (GCR_IS_CERTIFICATE (self));
+	g_assert (cert);
 	
-	data = gcr_certificate_get_der_data (self, &n_data);
-	g_return_val_if_fail (data, NULL);
+	der = gcr_certificate_get_der_data (cert, &n_der);
+	g_return_val_if_fail (der, NULL);
 
-	if (self->pv->asn1 && n_data == self->pv->n_data && 
-	    memcmp (data, self->pv->data, n_data) == 0)
-		return self->pv->asn1;
-	
-	if (self->pv->asn1) {
-		asn1_delete_structure (&self->pv->asn1);
-		self->pv->asn1 = NULL;
-		self->pv->data = NULL;
-		self->pv->n_data = 0;
+	cache = (Asn1Cache*)g_object_get_qdata (G_OBJECT (cert), ASN1_CACHE);
+	if (cache) {
+		if (n_der == cache->length && memcmp (der, cache->der, n_der) == 0)
+			return cache->asn1;
 	}
 	
 	/* Cache is invalid or non existent */
-	self->pv->asn1 = egg_asn1_decode ("PKIX1.Certificate", data, n_data);
-	if (self->pv->asn1 == NULL) {
-		g_warning ("encountered invalid or unparseable X509 DER certificate data.");
+	asn1 = egg_asn1_decode ("PKIX1.Certificate", der, n_der);
+	if (asn1 == NULL) {
+		g_warning ("a derived class provided an invalid or unparseable X509 DER certificate data.");
 		return NULL;
 	}
 	
-	self->pv->data = data;
-	self->pv->n_data = n_data;
-
-	return self->pv->asn1;
+	cache = g_new0 (Asn1Cache, 1);
+	cache->der = der;
+	cache->length = n_der;
+	cache->asn1 = asn1;
+	
+	g_object_set_qdata_full (G_OBJECT (cert), ASN1_CACHE, cache, free_asn1_cache);
+	return asn1;
 }
 
 static GChecksum*
@@ -100,129 +107,58 @@
 	return digest;
 }
 
-/* -----------------------------------------------------------------------------
- * OBJECT 
+/* ---------------------------------------------------------------------------------
+ * INTERFACE
  */
 
-static const guchar* 
-gcr_certificate_real_get_der_data (GcrCertificate *self, gsize *n_data)
-{
-	g_return_val_if_fail (GCR_IS_CERTIFICATE (self), NULL);
-	g_return_val_if_fail (n_data, NULL);
-	g_return_val_if_fail (self->pv->owned_data, NULL);
-	
-	/* This is called when we're not a base class */
-	*n_data = self->pv->n_owned_data;
-	return self->pv->owned_data;
-}
-
-static GObject* 
-gcr_certificate_constructor (GType type, guint n_props, GObjectConstructParam *props) 
-{
-	GcrCertificate *self = GCR_CERTIFICATE (G_OBJECT_CLASS (gcr_certificate_parent_class)->constructor(type, n_props, props));
-	g_return_val_if_fail (self, NULL);	
-	
-	return G_OBJECT (self);
-}
-
-static void
-gcr_certificate_init (GcrCertificate *self)
-{
-	self->pv = G_TYPE_INSTANCE_GET_PRIVATE (self, GCR_TYPE_CERTIFICATE, GcrCertificatePrivate);
-}
-
 static void
-gcr_certificate_dispose (GObject *obj)
+gcr_certificate_base_init (gpointer g_class)
 {
-	GcrCertificate *self = GCR_CERTIFICATE (obj);
-
-	if (self->pv->asn1) {
-		asn1_delete_structure (&self->pv->asn1);
-		self->pv->data = NULL;
-		self->pv->n_data = 0;
+	static gboolean initialized = FALSE;
+	if (!initialized) {
+		ASN1_CACHE = g_quark_from_static_string ("_gcr_certificate_asn1_cache");
+		
+		/* Add properties and signals to the interface */
+		
+		
+		initialized = TRUE;
 	}
-    
-	G_OBJECT_CLASS (gcr_certificate_parent_class)->dispose (obj);
 }
 
-static void
-gcr_certificate_finalize (GObject *obj)
+GType
+gcr_certificate_get_type (void)
 {
-	GcrCertificate *self = GCR_CERTIFICATE (obj);
-	
-	g_assert (self->pv->asn1 == NULL);
-	g_free (self->pv->owned_data);
-	self->pv->owned_data = NULL;
-	self->pv->n_owned_data = 0;
-
-	G_OBJECT_CLASS (gcr_certificate_parent_class)->finalize (obj);
-}
-
-static void
-gcr_certificate_set_property (GObject *obj, guint prop_id, const GValue *value, 
-                              GParamSpec *pspec)
-{
-	switch (prop_id) {
-	default:
-		G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, prop_id, pspec);
-		break;
-	}
-}
-
-static void
-gcr_certificate_get_property (GObject *obj, guint prop_id, GValue *value, 
-                              GParamSpec *pspec)
-{
-	switch (prop_id) {
-	default:
-		G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, prop_id, pspec);
-		break;
+	static GType type = 0;
+	if (!type) {
+		static const GTypeInfo info = {
+			sizeof (GcrCertificateIface),
+			gcr_certificate_base_init,               /* base init */
+			NULL,             /* base finalize */
+			NULL,             /* class_init */
+			NULL,             /* class finalize */
+			NULL,             /* class data */
+			0,
+			0,                /* n_preallocs */
+			NULL,             /* instance init */
+		};
+		type = g_type_register_static (G_TYPE_INTERFACE, "GcrCertificateIface", &info, 0);
+		g_type_interface_add_prerequisite (type, G_TYPE_OBJECT);
 	}
+	
+	return type;
 }
 
-static void
-gcr_certificate_class_init (GcrCertificateClass *klass)
-{
-	GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
-    
-	gobject_class->constructor = gcr_certificate_constructor;
-	gobject_class->dispose = gcr_certificate_dispose;
-	gobject_class->finalize = gcr_certificate_finalize;
-	gobject_class->set_property = gcr_certificate_set_property;
-	gobject_class->get_property = gcr_certificate_get_property;
-	
-	klass->get_der_data = gcr_certificate_real_get_der_data;
-    
-	g_type_class_add_private (gobject_class, sizeof (GcrCertificatePrivate));
-
-	_gcr_initialize ();
-}
 
 /* -----------------------------------------------------------------------------
  * PUBLIC 
  */
 
-GcrCertificate*
-gcr_certificate_new_for_data (const guchar *data, gsize n_data)
-{
-	GcrCertificate *cert;
-	
-	g_return_val_if_fail (data, NULL);
-	g_return_val_if_fail (n_data, NULL);
-	
-	cert = g_object_new (GCR_TYPE_CERTIFICATE, NULL);
-	
-	cert->pv->owned_data = g_memdup (data, n_data);
-	cert->pv->n_owned_data = n_data;
-	return cert;
-}
-
 const guchar*
 gcr_certificate_get_der_data (GcrCertificate *self, gsize *n_length)
 {
 	g_return_val_if_fail (GCR_IS_CERTIFICATE (self), NULL);
-	g_return_val_if_fail (GCR_CERTIFICATE_GET_CLASS (self)->get_der_data, NULL);
-	return GCR_CERTIFICATE_GET_CLASS (self)->get_der_data (self, n_length);
+	g_return_val_if_fail (GCR_CERTIFICATE_GET_INTERFACE (self)->get_der_data, NULL);
+	return GCR_CERTIFICATE_GET_INTERFACE (self)->get_der_data (self, n_length);
 }
 
 gchar*

Modified: trunk/gcr/gcr-certificate.h
==============================================================================
--- trunk/gcr/gcr-certificate.h	(original)
+++ trunk/gcr/gcr-certificate.h	Thu Jan 29 01:12:43 2009
@@ -22,39 +22,34 @@
 #ifndef __GCR_CERTIFICATE_H__
 #define __GCR_CERTIFICATE_H__
 
-#include "gcr.h"
+#include "gcr-types.h"
 
 #include <glib-object.h>
 
-#define GCR_TYPE_CERTIFICATE               (gcr_certificate_get_type ())
-#define GCR_CERTIFICATE(obj)               (G_TYPE_CHECK_INSTANCE_CAST ((obj), GCR_TYPE_CERTIFICATE, GcrCertificate))
-#define GCR_CERTIFICATE_CLASS(klass)       (G_TYPE_CHECK_CLASS_CAST ((klass), GCR_TYPE_CERTIFICATE, GcrCertificateClass))
-#define GCR_IS_CERTIFICATE(obj)            (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GCR_TYPE_CERTIFICATE))
-#define GCR_IS_CERTIFICATE_CLASS(klass)    (G_TYPE_CHECK_CLASS_TYPE ((klass), GCR_TYPE_CERTIFICATE))
-#define GCR_CERTIFICATE_GET_CLASS(obj)     (G_TYPE_INSTANCE_GET_CLASS ((obj), GCR_TYPE_CERTIFICATE, GcrCertificateClass))
-
-typedef struct _GcrCertificate GcrCertificate;
-typedef struct _GcrCertificateClass GcrCertificateClass;
-typedef struct _GcrCertificatePrivate GcrCertificatePrivate;
-
-struct _GcrCertificate {
-	GObject parent;
-	GcrCertificatePrivate *pv;
-};
-
-struct _GcrCertificateClass {
-	GObjectClass parent_class;
-    
-	/* virtual  */
-    
-	const guchar* (*get_der_data) (GcrCertificate *self, gsize *n_length);
+#define GCR_TYPE_CERTIFICATE                 (gcr_certificate_get_type())
+#define GCR_CERTIFICATE(obj)                 (G_TYPE_CHECK_INSTANCE_CAST ((obj), GCR_TYPE_CERTIFICATE, GcrCertificate))
+#define GCR_IS_CERTIFICATE(obj)              (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GCR_TYPE_CERTIFICATE))
+#define GCR_CERTIFICATE_GET_INTERFACE(inst)  (G_TYPE_INSTANCE_GET_INTERFACE ((inst), GCR_TYPE_CERTIFICATE, GcrCertificateIface))
+
+typedef struct _GcrCertificate      GcrCertificate;
+typedef struct _GcrCertificateIface GcrCertificateIface;
+
+struct _GcrCertificateIface {
+	GTypeInterface parent;
+	
+	const guchar* (*get_der_data)   (GcrCertificate *self, gsize *n_data);
+	
+	gpointer dummy1;
+	gpointer dummy2;
+	gpointer dummy3;
+	gpointer dummy5;
+	gpointer dummy6;
+	gpointer dummy7;
+	gpointer dummy8;
 };
 
 GType               gcr_certificate_get_type               (void);
 
-GcrCertificate*     gcr_certificate_new_for_data           (const guchar *data,
-                                                            gsize n_data);
-
 const guchar*       gcr_certificate_get_der_data           (GcrCertificate *self, 
                                                             gsize *n_data);
 

Modified: trunk/gcr/gcr-importer.h
==============================================================================
--- trunk/gcr/gcr-importer.h	(original)
+++ trunk/gcr/gcr-importer.h	Thu Jan 29 01:12:43 2009
@@ -22,8 +22,8 @@
 #ifndef __GCR_IMPORTER_H__
 #define __GCR_IMPORTER_H__
 
-#include "gcr.h"
 #include "gcr-parser.h"
+#include "gcr-types.h"
 
 #include <glib-object.h>
 
@@ -54,7 +54,7 @@
 	
 	/* signals */
 	
-	void (*imported) (GcrImporter *self, GP11Object *object);
+	void (*imported) (GcrImporter *self, struct _GP11Object *object);
 };
 
 GType                     gcr_importer_get_type               (void);

Modified: trunk/gcr/gcr-parser.h
==============================================================================
--- trunk/gcr/gcr-parser.h	(original)
+++ trunk/gcr/gcr-parser.h	Thu Jan 29 01:12:43 2009
@@ -22,8 +22,6 @@
 #ifndef __GCR_PARSER_H__
 #define __GCR_PARSER_H__
 
-#include "gcr.h"
-
 #include <glib-object.h>
 
 #include "gcr-types.h"

Added: trunk/gcr/gcr-simple-certificate.c
==============================================================================
--- (empty file)
+++ trunk/gcr/gcr-simple-certificate.c	Thu Jan 29 01:12:43 2009
@@ -0,0 +1,137 @@
+/* 
+ * gnome-keyring
+ * 
+ * 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 "gcr-certificate.h"
+#include "gcr-internal.h"
+#include "gcr-simple-certificate.h"
+
+#include "egg/egg-asn1.h"
+#include "egg/egg-hex.h"
+
+#include <string.h>
+
+struct _GcrSimpleCertificatePrivate {
+	guchar *owned_data;
+	gsize n_owned_data;
+};
+
+static void gcr_certificate_iface (GcrCertificateIface *iface); 
+G_DEFINE_TYPE_WITH_CODE (GcrSimpleCertificate, gcr_simple_certificate, G_TYPE_OBJECT, 
+                         G_IMPLEMENT_INTERFACE (GCR_TYPE_CERTIFICATE, gcr_certificate_iface));
+
+/* -----------------------------------------------------------------------------
+ * OBJECT 
+ */
+
+static void
+gcr_simple_certificate_init (GcrSimpleCertificate *self)
+{
+	self->pv = G_TYPE_INSTANCE_GET_PRIVATE (self, GCR_TYPE_CERTIFICATE, GcrSimpleCertificatePrivate);
+}
+
+static void
+gcr_simple_certificate_finalize (GObject *obj)
+{
+	GcrSimpleCertificate *self = GCR_SIMPLE_CERTIFICATE (obj);
+	
+	g_free (self->pv->owned_data);
+	self->pv->owned_data = NULL;
+	self->pv->n_owned_data = 0;
+
+	G_OBJECT_CLASS (gcr_simple_certificate_parent_class)->finalize (obj);
+}
+
+static void
+gcr_simple_certificate_set_property (GObject *obj, guint prop_id, const GValue *value, 
+                                     GParamSpec *pspec)
+{
+	switch (prop_id) {
+	default:
+		G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, prop_id, pspec);
+		break;
+	}
+}
+
+static void
+gcr_simple_certificate_get_property (GObject *obj, guint prop_id, GValue *value, 
+                                     GParamSpec *pspec)
+{
+	switch (prop_id) {
+	default:
+		G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, prop_id, pspec);
+		break;
+	}
+}
+
+static void
+gcr_simple_certificate_class_init (GcrSimpleCertificateClass *klass)
+{
+	GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
+    
+	gobject_class->finalize = gcr_simple_certificate_finalize;
+	gobject_class->set_property = gcr_simple_certificate_set_property;
+	gobject_class->get_property = gcr_simple_certificate_get_property;
+	
+	g_type_class_add_private (gobject_class, sizeof (GcrSimpleCertificatePrivate));
+
+	_gcr_initialize ();
+}
+
+static const guchar* 
+gcr_simple_certificate_real_get_der_data (GcrCertificate *base, gsize *n_data)
+{
+	GcrSimpleCertificate *self = GCR_SIMPLE_CERTIFICATE (base);
+	
+	g_return_val_if_fail (GCR_IS_CERTIFICATE (self), NULL);
+	g_return_val_if_fail (n_data, NULL);
+	g_return_val_if_fail (self->pv->owned_data, NULL);
+	
+	/* This is called when we're not a base class */
+	*n_data = self->pv->n_owned_data;
+	return self->pv->owned_data;
+}
+
+static void 
+gcr_certificate_iface (GcrCertificateIface *iface) 
+{
+	iface->get_der_data = (gpointer)gcr_simple_certificate_real_get_der_data;
+}
+
+/* -----------------------------------------------------------------------------
+ * PUBLIC 
+ */
+
+GcrCertificate*
+gcr_simple_certificate_new (const guchar *data, gsize n_data)
+{
+	GcrSimpleCertificate *cert;
+	
+	g_return_val_if_fail (data, NULL);
+	g_return_val_if_fail (n_data, NULL);
+	
+	cert = g_object_new (GCR_TYPE_SIMPLE_CERTIFICATE, NULL);
+	
+	cert->pv->owned_data = g_memdup (data, n_data);
+	cert->pv->n_owned_data = n_data;
+	return GCR_CERTIFICATE (cert);
+}

Added: trunk/gcr/gcr-simple-certificate.h
==============================================================================
--- (empty file)
+++ trunk/gcr/gcr-simple-certificate.h	Thu Jan 29 01:12:43 2009
@@ -0,0 +1,54 @@
+/* 
+ * gnome-keyring
+ * 
+ * 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 __GCR_SIMPLE_CERTIFICATE_H__
+#define __GCR_SIMPLE_CERTIFICATE_H__
+
+#include "gcr.h"
+
+#include <glib-object.h>
+
+#define GCR_TYPE_SIMPLE_CERTIFICATE               (gcr_simple_certificate_get_type ())
+#define GCR_SIMPLE_CERTIFICATE(obj)               (G_TYPE_CHECK_INSTANCE_CAST ((obj), GCR_TYPE_CERTIFICATE, GcrSimpleCertificate))
+#define GCR_SIMPLE_CERTIFICATE_CLASS(klass)       (G_TYPE_CHECK_CLASS_CAST ((klass), GCR_TYPE_CERTIFICATE, GcrSimpleCertificateClass))
+#define GCR_IS_SIMPLE_CERTIFICATE(obj)            (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GCR_TYPE_CERTIFICATE))
+#define GCR_IS_SIMPLE_CERTIFICATE_CLASS(klass)    (G_TYPE_CHECK_CLASS_TYPE ((klass), GCR_TYPE_CERTIFICATE))
+#define GCR_SIMPLE_CERTIFICATE_GET_CLASS(obj)     (G_TYPE_INSTANCE_GET_CLASS ((obj), GCR_TYPE_CERTIFICATE, GcrSimpleCertificateClass))
+
+typedef struct _GcrSimpleCertificate GcrSimpleCertificate;
+typedef struct _GcrSimpleCertificateClass GcrSimpleCertificateClass;
+typedef struct _GcrSimpleCertificatePrivate GcrSimpleCertificatePrivate;
+
+struct _GcrSimpleCertificate {
+	GObject parent;
+	GcrSimpleCertificatePrivate *pv;
+};
+
+struct _GcrSimpleCertificateClass {
+	GObjectClass parent_class;
+};
+
+GType               gcr_simple_certificate_get_type               (void);
+
+GcrCertificate*     gcr_simple_certificate_new                    (const guchar *data,
+                                                                   gsize n_data);
+
+#endif /* __GCR_SIMPLE_CERTIFICATE_H__ */

Modified: trunk/gcr/gcr-types.h
==============================================================================
--- trunk/gcr/gcr-types.h	(original)
+++ trunk/gcr/gcr-types.h	Thu Jan 29 01:12:43 2009
@@ -1,6 +1,12 @@
 #ifndef GCRTYPES_H_
 #define GCRTYPES_H_
 
+#ifndef GCR_API_SUBJECT_TO_CHANGE
+#error "This API has not yet reached stability." 
+#endif 
+
+#include <glib.h>
+
 #define             GCR_DATA_ERROR                    (gcr_data_error_get_domain ())
 
 GQuark 	            gcr_data_error_get_domain         (void) G_GNUC_CONST;
@@ -41,6 +47,7 @@
 
 /* Forward declare some of the GP11 objects */
 struct _GP11Attributes;
+struct _GP11Object;
 struct _GP11Slot;
 
 #endif /* GCRTYPES_H_ */

Modified: trunk/gcr/gcr.h
==============================================================================
--- trunk/gcr/gcr.h	(original)
+++ trunk/gcr/gcr.h	Thu Jan 29 01:12:43 2009
@@ -24,23 +24,11 @@
 
 #include <glib.h>
 
-#ifndef GCR_API_SUBJECT_TO_CHANGE
-#error "This API has not yet reached stability." 
-#endif 
-
-struct _GP11Slot;
-
-#ifdef UNIMPLEMENTED
-enum {
-	GCR_INIT_NO_MODULES = 0x01,
-};
-
-void                 gcr_initialize                          (guint flags);
-
-void                 gcr_modules_register_loaded             (gpointer funcs);
-
-gboolean             gcr_modules_register_file               (const gchar *module_path,
-                                                              GError *error);
-#endif /* UNIMPLEMENTED */
+#include "gcr-certificate.h"
+#include "gcr-certificate-basics-widget.h"
+#include "gcr-certificate-details-widget.h"
+#include "gcr-importer.h"
+#include "gcr-parser.h"
+#include "gcr-types.h"
 
 #endif /* __GCR_H__ */

Modified: trunk/gcr/gcr.pc.in
==============================================================================
--- trunk/gcr/gcr.pc.in	(original)
+++ trunk/gcr/gcr.pc.in	Thu Jan 29 01:12:43 2009
@@ -6,9 +6,9 @@
 datadir= datadir@
 sysconfdir= sysconfdir@
 
-Name: gp11
-Description: GObject bindings for PKCS#11
+Name: gcr
+Description: GObject and GUI library for high level crypto parsing and display
 Version: @VERSION@
-Requires: glib-2.0
-Libs: -L${libdir} -lgp11
-Cflags: -I${includedir}/gp11
+Requires: glib-2.0 gtk+-2.0 libtasn1 gp11
+Libs: -L${libdir} -lgcr
+Cflags: -I${includedir}/gcr

Modified: trunk/gcr/tests/ui-test-details.c
==============================================================================
--- trunk/gcr/tests/ui-test-details.c	(original)
+++ trunk/gcr/tests/ui-test-details.c	Thu Jan 29 01:12:43 2009
@@ -2,6 +2,7 @@
 #include "config.h"
 
 #include "gcr-certificate-details-widget.h"
+#include "gcr-simple-certificate.h"
 
 #include <gtk/gtk.h>
 
@@ -17,7 +18,7 @@
 	if (!g_file_get_contents ("test-data/der-certificate.crt", (gchar**)&data, &n_data, NULL))
 		g_assert_not_reached ();
 	
-	certificate = gcr_certificate_new_for_data (data, n_data);
+	certificate = gcr_simple_certificate_new (data, n_data);
 	g_assert (certificate);
 	g_free (data);
 	

Modified: trunk/gcr/tests/unit-test-certificate.c
==============================================================================
--- trunk/gcr/tests/unit-test-certificate.c	(original)
+++ trunk/gcr/tests/unit-test-certificate.c	Thu Jan 29 01:12:43 2009
@@ -3,6 +3,7 @@
 #include "run-auto-test.h"
 
 #include "gcr-certificate.h"
+#include "gcr-simple-certificate.h"
 
 #include <glib.h>
 
@@ -21,7 +22,7 @@
 		return;
 	}
 
-	certificate = gcr_certificate_new_for_data ((const guchar*)contents, n_contents);
+	certificate = gcr_simple_certificate_new ((const guchar*)contents, n_contents);
 	g_assert (certificate);
 	g_free (contents);
 }



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