Install appropriate header files and fix the pkg-config file for the gcr
authorStefan Walter <stefw@src.gnome.org>
Thu, 29 Jan 2009 01:12:43 +0000 (01:12 +0000)
committerStefan Walter <stefw@src.gnome.org>
Thu, 29 Jan 2009 01:12:43 +0000 (01:12 +0000)
* 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.

svn path=/trunk/; revision=1481

14 files changed:
gcr/Makefile.am
gcr/gcr-certificate-basics-widget.h
gcr/gcr-certificate-details-widget.h
gcr/gcr-certificate.c
gcr/gcr-certificate.h
gcr/gcr-importer.h
gcr/gcr-parser.h
gcr/gcr-simple-certificate.c [new file with mode: 0644]
gcr/gcr-simple-certificate.h [new file with mode: 0644]
gcr/gcr-types.h
gcr/gcr.h
gcr/gcr.pc.in
gcr/tests/ui-test-details.c
gcr/tests/unit-test-certificate.c

index 5ad2012..21bd980 100644 (file)
@@ -14,6 +14,20 @@ GLADE_FILES = \
 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 @@ libgcr_la_SOURCES = \
        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)
 
index b64959d..28179fd 100644 (file)
@@ -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))
index bee716d..b71acb6 100644 (file)
@@ -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))
index dca5a10..46d2440 100644 (file)
 
 #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
  */
 
-static ASN1_TYPE
-parse_certificate_asn1 (GcrCertificate *self)
+
+typedef struct _Asn1Cache {
+       ASN1_TYPE asn1;
+       gconstpointer der;
+       gsize length;
+} Asn1Cache;
+
+static GQuark ASN1_CACHE = 0;
+
+static void
+free_asn1_cache (gpointer data)
 {
-       const guchar *data;
-       gsize n_data;
+       Asn1Cache *cache = (Asn1Cache*)data;
+       if (cache) {
+               g_assert (cache->asn1);
+               asn1_delete_structure (&cache->asn1);
+               g_free (cache);
+       }
+}
 
-       g_assert (GCR_IS_CERTIFICATE (self));
+static ASN1_TYPE
+parse_certificate_asn1 (GcrCertificate *cert)
+{
+       Asn1Cache *cache;
+       ASN1_TYPE asn1;
+       const guchar *der;
+       gsize n_der;
 
-       data = gcr_certificate_get_der_data (self, &n_data);
-       g_return_val_if_fail (data, NULL);
+       g_assert (cert);
 
-       if (self->pv->asn1 && n_data == self->pv->n_data &&
-           memcmp (data, self->pv->data, n_data) == 0)
-               return self->pv->asn1;
+       der = gcr_certificate_get_der_data (cert, &n_der);
+       g_return_val_if_fail (der, NULL);
 
-       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;
+       cache = g_new0 (Asn1Cache, 1);
+       cache->der = der;
+       cache->length = n_der;
+       cache->asn1 = asn1;
 
-       return self->pv->asn1;
+       g_object_set_qdata_full (G_OBJECT (cert), ASN1_CACHE, cache, free_asn1_cache);
+       return asn1;
 }
 
 static GChecksum*
@@ -100,129 +107,58 @@ digest_certificate (GcrCertificate *self, GChecksumType type)
        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)
+gcr_certificate_base_init (gpointer g_class)
 {
-       self->pv = G_TYPE_INSTANCE_GET_PRIVATE (self, GCR_TYPE_CERTIFICATE, GcrCertificatePrivate);
-}
-
-static void
-gcr_certificate_dispose (GObject *obj)
-{
-       GcrCertificate *self = GCR_CERTIFICATE (obj);
+       static gboolean initialized = FALSE;
+       if (!initialized) {
+               ASN1_CACHE = g_quark_from_static_string ("_gcr_certificate_asn1_cache");
 
-       if (self->pv->asn1) {
-               asn1_delete_structure (&self->pv->asn1);
-               self->pv->data = NULL;
-               self->pv->n_data = 0;
-       }
+               /* Add properties and signals to the interface */
 
-       G_OBJECT_CLASS (gcr_certificate_parent_class)->dispose (obj);
-}
 
-static void
-gcr_certificate_finalize (GObject *obj)
-{
-       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;
+               initialized = TRUE;
        }
 }
 
-static void
-gcr_certificate_get_property (GObject *obj, guint prop_id, GValue *value,
-                              GParamSpec *pspec)
+GType
+gcr_certificate_get_type (void)
 {
-       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);
        }
-}
-
-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 ();
+       return type;
 }
 
+
 /* -----------------------------------------------------------------------------
  * 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*
index f9f69ae..280b197 100644 (file)
 #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))
+#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 _GcrCertificateClass GcrCertificateClass;
-typedef struct _GcrCertificatePrivate GcrCertificatePrivate;
+typedef struct _GcrCertificate      GcrCertificate;
+typedef struct _GcrCertificateIface GcrCertificateIface;
 
-struct _GcrCertificate {
-       GObject parent;
-       GcrCertificatePrivate *pv;
-};
-
-struct _GcrCertificateClass {
-       GObjectClass parent_class;
+struct _GcrCertificateIface {
+       GTypeInterface parent;
 
-       /* virtual  */
+       const guchar* (*get_der_data)   (GcrCertificate *self, gsize *n_data);
 
-       const guchar* (*get_der_data) (GcrCertificate *self, gsize *n_length);
+       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);
 
index ed366f3..bde3808 100644 (file)
@@ -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 @@ struct _GcrImporterClass {
 
        /* signals */
 
-       void (*imported) (GcrImporter *self, GP11Object *object);
+       void (*imported) (GcrImporter *self, struct _GP11Object *object);
 };
 
 GType                     gcr_importer_get_type               (void);
index 2f5be35..6a7bb93 100644 (file)
@@ -22,8 +22,6 @@
 #ifndef __GCR_PARSER_H__
 #define __GCR_PARSER_H__
 
-#include "gcr.h"
-
 #include <glib-object.h>
 
 #include "gcr-types.h"
diff --git a/gcr/gcr-simple-certificate.c b/gcr/gcr-simple-certificate.c
new file mode 100644 (file)
index 0000000..def7943
--- /dev/null
@@ -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);
+}
diff --git a/gcr/gcr-simple-certificate.h b/gcr/gcr-simple-certificate.h
new file mode 100644 (file)
index 0000000..3a0e894
--- /dev/null
@@ -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__ */
index ca2ed91..3de84db 100644 (file)
@@ -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 @@ enum {
 
 /* Forward declare some of the GP11 objects */
 struct _GP11Attributes;
+struct _GP11Object;
 struct _GP11Slot;
 
 #endif /* GCRTYPES_H_ */
index 4cf2f23..a11470f 100644 (file)
--- a/gcr/gcr.h
+++ b/gcr/gcr.h
 
 #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__ */
index b0a812d..0783efd 100644 (file)
@@ -6,9 +6,9 @@ datarootdir=@datarootdir@
 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
index 154a51b..2d034d3 100644 (file)
@@ -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 @@ test_details (void)
        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);
 
index 420dfe4..8b97603 100644 (file)
@@ -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 @@ DEFINE_SETUP(certificate)
                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);
 }