GcrCertificateWidget

## GcrCertificateWidget GcrCertificateWidget — Certificate widget and renderer |

## Synopsis

    #define             GCR_CERTIFICATE_COLUMNS
                        GcrCertificateWidget;
                        GcrCertificateWidgetClass;
    struct              GcrCertificateRenderer;
    struct              GcrCertificateRendererClass;
    GcrCertificateWidget * gcr_certificate_widget_new       (GcrCertificate *certificate);
    GckAttributes *     gcr_certificate_widget_get_attributes
                                                            (GcrCertificateWidget *self);
    void                gcr_certificate_widget_set_attributes
                                                            (GcrCertificateWidget *self,
                                                             GckAttributes *attrs);
    GcrCertificate *    gcr_certificate_widget_get_certificate
                                                            (GcrCertificateWidget *self);
    void                gcr_certificate_widget_set_certificate
                                                            (GcrCertificateWidget *self,
                                                             GcrCertificate *certificate);
    GcrCertificateRenderer * gcr_certificate_renderer_new   (GcrCertificate *certificate);
    GcrCertificateRenderer * gcr_certificate_renderer_new_for_attributes
                                                            (const gchar *label,
                                                             struct _GckAttributes *attrs);
    GckAttributes *     gcr_certificate_renderer_get_attributes
                                                            (GcrCertificateRenderer *self);
    void                gcr_certificate_renderer_set_attributes
                                                            (GcrCertificateRenderer *self,
                                                             GckAttributes *attrs);
    GcrCertificate *    gcr_certificate_renderer_get_certificate
                                                            (GcrCertificateRenderer *self);
    void                gcr_certificate_renderer_set_certificate
                                                            (GcrCertificateRenderer *self,
                                                             GcrCertificate *certificate);

## Object Hierarchy

      GObject
       +----GcrCertificateRenderer

## Implemented Interfaces

GcrCertificateRenderer implements GcrRendererIface, GcrComparableIface and GcrCertificateIface.

## Description

A GcrCertificateWidget can be used to display a certificate. The widget is normally in a collapsed state showing only details, but can be expanded by the user.

Use `gcr_certificate_widget_new()` to create a new certificate widget. Only one certificate can be displayed. A GcrCertificateWidget contains a GcrViewer internally and GcrCertificateRenderer is used to render the certificate to the viewer. To show more than one certificate in a view, create the viewer and add renderers to it.

## Details

### GCR_CERTIFICATE_COLUMNS

    #define GCR_CERTIFICATE_COLUMNS                 (gcr_certificate_get_columns ())

The columns that are valid for a certificate. This is to be used with the GcrTreeSelector or GcrCollectionModel.

This is an array of GcrColumn, owned by the gcr library.

### GcrCertificateWidget

    typedef struct _GcrCertificateWidget GcrCertificateWidget;

A widget that displays a certificate.

### GcrCertificateWidgetClass

    typedef struct _GcrCertificateWidgetClass GcrCertificateWidgetClass;

The class for GcrCertificateWidget

### struct GcrCertificateRenderer

    struct GcrCertificateRenderer;

An implementation of GcrRenderer which renders certificates.

### struct GcrCertificateRendererClass

    struct GcrCertificateRendererClass {
    	GObjectClass parent_class;
    };

The class for GcrCertificateRenderer.

GObjectClass `parent_class`; | The parent class.

### gcr_certificate_widget_new ()

    GcrCertificateWidget * gcr_certificate_widget_new       (GcrCertificate *certificate);

Create a new certificate widget which displays a given certificate.

`certificate` : | Certificate to display, or `NULL`
Returns : | A newly allocated GcrCertificateWidget, which should be freed with `g_object_unref()`.

### gcr_certificate_widget_get_attributes ()

    GckAttributes *     gcr_certificate_widget_get_attributes
                                                            (GcrCertificateWidget *self);

Get the attributes displayed in the widget. The attributes should contain a certificate.

`self` : | The certificate widget
Returns : | The attributes, owned by the widget.

### gcr_certificate_widget_set_attributes ()

    void                gcr_certificate_widget_set_attributes
                                                            (GcrCertificateWidget *self,
                                                             GckAttributes *attrs);

Set the attributes displayed in the widget. The attributes should contain a certificate.

`self` : | The certificate widget
`attrs` : | The attributes to display

### gcr_certificate_widget_get_certificate ()

    GcrCertificate *    gcr_certificate_widget_get_certificate
                                                            (GcrCertificateWidget *self);

Get the certificate displayed in the widget.

`self` : | The certificate widget
Returns : | The certificate.

### gcr_certificate_widget_set_certificate ()

    void                gcr_certificate_widget_set_certificate
                                                            (GcrCertificateWidget *self,
                                                             GcrCertificate *certificate);

Set the certificate displayed in the widget

`self` : | The certificate widget
`certificate` : | The certificate to display

### gcr_certificate_renderer_new ()

    GcrCertificateRenderer * gcr_certificate_renderer_new   (GcrCertificate *certificate);

Create a new certificate renderer to display the certificate.

`certificate` : | The certificate to display
Returns : | A newly allocated GcrCertificateRenderer, which should be released with `g_object_unref()`.

### gcr_certificate_renderer_new_for_attributes ()

    GcrCertificateRenderer * gcr_certificate_renderer_new_for_attributes
                                                            (const gchar *label,
                                                             struct _GckAttributes *attrs);

Create a new certificate renderer to display the label and attributes. One of the attributes should be a CKA_VALUE type attribute containing a DER encoded certificate.

`label` : | The label to display
`attrs` : | The attributes to display
Returns : | A newly allocated GcrCertificateRenderer, which should be released with `g_object_unref()`.

### gcr_certificate_renderer_get_attributes ()

    GckAttributes *     gcr_certificate_renderer_get_attributes
                                                            (GcrCertificateRenderer *self);

Get the PKCS#11 attributes, if any, set for this renderer to display.

`self` : | The renderer
Returns : | The attributes, owned by the renderer.

### gcr_certificate_renderer_set_attributes ()

    void                gcr_certificate_renderer_set_attributes
                                                            (GcrCertificateRenderer *self,
                                                             GckAttributes *attrs);

Set the PKCS#11 attributes for this renderer to display. One of the attributes should be a CKA_VALUE type attribute containing a DER encoded certificate.

`self` : | The renderer
`attrs` : | Attributes to set

### gcr_certificate_renderer_get_certificate ()

    GcrCertificate *    gcr_certificate_renderer_get_certificate
                                                            (GcrCertificateRenderer *self);

Get the certificate displayed in the renderer. If no certificate was explicitly set, then the renderer will return itself since it acts as a valid certificate.

`self` : | The renderer
Returns : | The certificate, owned by the renderer.

### gcr_certificate_renderer_set_certificate ()

    void                gcr_certificate_renderer_set_certificate
                                                            (GcrCertificateRenderer *self,
                                                             GcrCertificate *certificate);

Set a certificate to display in the renderer.

`self` : | The renderer
`certificate` : | The certificate to display