## GcrRenderer

GcrRenderer — An interface implemented by renderers.

## Synopsis

                        GcrRenderer;
    struct              GcrRendererIface;
    GcrRenderer *       gcr_renderer_create                 (const gchar *label,
                                                             GckAttributes *attrs);
    void                gcr_renderer_register               (GType renderer_type,
                                                             GckAttributes *attrs);
    void                gcr_renderer_popuplate_popup        (GcrRenderer *self,
                                                             GcrViewer *viewer,
                                                             GtkMenu *menu);
    void                gcr_renderer_render_view            (GcrRenderer *self,
                                                             GcrViewer *viewer);
    void                gcr_renderer_emit_data_changed      (GcrRenderer *self);
    void                gcr_renderer_register_well_known    (void);

## Object Hierarchy

      GInterface
       +----GcrRenderer

## Prerequisites

GcrRenderer requires GObject.

## Known Implementations

GcrRenderer is implemented by GcrCertificateRenderer and GcrKeyRenderer.

## Properties

      "attributes"               GckAttributes*        : Read / Write
      "label"                    gchar*                : Read / Write

## Signals

      "data-changed"                                   : Run Last

## Description

A GcrRenderer is an interface that's implemented by renderers which wish to render data to a GcrViewer.

The interaction between GcrRenderer and GcrViewer is not stable yet, and so new renderers cannot be implemented outside the Gcr library at this time.

To lookup a renderer for a given set of attributes, use the `gcr_renderer_create()` function. This will create and initialize a renderer that's capable of viewing the data in those attributes.

## Details

### GcrRenderer

    typedef struct _GcrRenderer GcrRenderer;

A renderer.

### struct GcrRendererIface

    struct GcrRendererIface {
    	GTypeInterface parent;

    	/* signals */
    	void (*data_changed) (GcrRenderer *self);

    	/* virtual */
    	void (*render_view) (GcrRenderer *self, GcrViewer *viewer);

    	void (*populate_popup) (GcrRenderer *self, GcrViewer *viewer, GtkMenu *menu);
    };

The interface for GcrRenderer

GTypeInterface `parent`; | the parent interface type
`data_changed` () | signal emitted when data being rendered changes
`render_view` () | method invoked to render the data into a viewer
`populate_popup` () | method invoked to populate a popup menu with additional renderer options

### gcr_renderer_create ()

    GcrRenderer *       gcr_renderer_create                 (const gchar *label,
                                                             GckAttributes *attrs);

Create and initialize a renderer for the given attributes and label. These renderers should have been preregistered via `gcr_renderer_register()`.

`label` : | The label for the renderer. [allow-none]
`attrs` : | The attributes to render
Returns : | a new renderer, or `NULL` if no renderer matched the attributes; the render should be released with `g_object_unref()`. [transfer full][allow-none]

### gcr_renderer_register ()

    void                gcr_renderer_register               (GType renderer_type,
                                                             GckAttributes *attrs);

Register a renderer to be created when matching attributes are passed to `gcr_renderer_create()`.

`renderer_type` : | The renderer class type
`attrs` : | The attributes to match

### gcr_renderer_popuplate_popup ()

    void                gcr_renderer_popuplate_popup        (GcrRenderer *self,
                                                             GcrViewer *viewer,
                                                             GtkMenu *menu);

Called by GcrViewer when about to display a popup menu for the content displayed by the renderer. The renderer can add a menu item if desired.

`self` : | The renderer
`viewer` : | The viewer that is displaying a popup
`menu` : | The popup menu being displayed

### gcr_renderer_render_view ()

    void                gcr_renderer_render_view            (GcrRenderer *self,
                                                             GcrViewer *viewer);

Render the contents of the renderer to the given viewer.

`self` : | The renderer
`viewer` : | The viewer to render to.

### gcr_renderer_emit_data_changed ()

    void                gcr_renderer_emit_data_changed      (GcrRenderer *self);

Emit the GcrRenderer::data-changed signal on the renderer. This is used by renderer implementations.

`self` : | The renderer

### gcr_renderer_register_well_known ()

    void                gcr_renderer_register_well_known    (void);

Register all the well known renderers for certificates and keys known to the Gcr library.

## Property Details

### The `"attributes"` property

      "attributes"               GckAttributes*        : Read / Write

The attributes to display.

### The `"label"` property

      "label"                    gchar*                : Read / Write

The label to display.

Default value: ""

## Signal Details

### The `"data-changed"` signal

    void                user_function                      (GcrRenderer *arg0,
                                                            gpointer     user_data)      : Run Last

A signal that is emitted by the renderer when it's data changed and should be rerendered.

`user_data` : | user data set when the signal handler was connected.