GcrRenderer: Gcr Library Reference Manual

## GcrRenderer GcrRenderer — An interface implemented by renderers. |

## Functions

GcrRenderer * | gcr_renderer_create ()
void | gcr_renderer_register ()
GckAttributes * | gcr_renderer_get_attributes ()
void | gcr_renderer_set_attributes ()
void | gcr_renderer_popuplate_popup ()
void | gcr_renderer_render_view ()
void | gcr_renderer_emit_data_changed ()
void | gcr_renderer_register_well_known ()

## Properties

GckAttributes * | attributes | Read / Write
gchar * | label | Read / Write

## Signals

void | data-changed | Run Last

## Types and Values

| GcrRenderer
struct | GcrRendererIface

## Object Hierarchy

        GInterface
        ╰── GcrRenderer

## Prerequisites

GcrRenderer requires GObject.

## Known Implementations

GcrRenderer is implemented by GcrCertificateRenderer and GcrKeyRenderer.

## 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.

## Functions

### 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()`.

#### Parameters

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()`.

#### Parameters

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

### gcr_renderer_get_attributes ()

    GckAttributes *
    gcr_renderer_get_attributes (GcrRenderer *self);

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

#### Parameters

self | The renderer |

#### Returns

the attributes, owned by the renderer.

[allow-none][transfer none]

### gcr_renderer_set_attributes ()

    void
    gcr_renderer_set_attributes (GcrRenderer *self,
                                 GckAttributes *attrs);

Set the PKCS#11 attributes for this renderer to display.

#### Parameters

self | The renderer |
attrs | attributes to set. | [allow-none]

### 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.

#### Parameters

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.

#### Parameters

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

### gcr_renderer_emit_data_changed ()

    void
    gcr_renderer_emit_data_changed (GcrRenderer *self);

Emit the “data-changed” signal on the renderer. This is used by renderer implementations.

#### Parameters

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.

## Types and Values

### 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

#### Members

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 |

## Property Details

### The `“attributes”` property

      “attributes”               GckAttributes *

The attributes to display.

Flags: Read / Write

### The `“label”` property

      “label”                    gchar *

The label to display.

Flags: Read / Write

Default value: ""

## Signal Details

### The `“data-changed”` signal

    void
    user_function (GcrRenderer *arg0,
                   gpointer     user_data)

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

#### Parameters

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

Flags: Run Last