## GcrViewerWidget

GcrViewerWidget — A widget which shows certificates or keys

## Functions

GcrViewerWidget * | gcr_viewer_widget_new ()
void | gcr_viewer_widget_load_bytes ()
void | gcr_viewer_widget_load_data ()
void | gcr_viewer_widget_load_file ()
GcrParser * | gcr_viewer_widget_get_parser ()
GcrViewer * | gcr_viewer_widget_get_viewer ()
void | gcr_viewer_widget_show_error ()
void | gcr_viewer_widget_clear_error ()
const gchar * | gcr_viewer_widget_get_display_name ()
void | gcr_viewer_widget_set_display_name ()

## Properties

gchar * | display-name | Read / Write
GcrParser * | parser | Read

## Signals

void | added | Run Last

## Types and Values

| GcrViewerWidget

## Object Hierarchy

        GObject
        ╰── GInitiallyUnowned
            ╰── GtkWidget
                ╰── GtkContainer
                    ╰── GtkBox
                        ╰── GcrViewerWidget

## Implemented Interfaces

GcrViewerWidget implements AtkImplementorIface, GtkBuildable and GtkOrientable.

## Description

A viewer widget which can display certificates and keys that are located in files.

## Functions

### gcr_viewer_widget_new ()

    GcrViewerWidget *
    gcr_viewer_widget_new (void);

Create a new viewer widget.

#### Returns

A new GcrViewerWidget object.

[transfer full]

### gcr_viewer_widget_load_bytes ()

    void
    gcr_viewer_widget_load_bytes (GcrViewerWidget *self,
                                  const gchar *display_name,
                                  GBytes *data);

Parse and load some data to be displayed into the viewer widgets. The data may contain multiple parseable items if the format can contain multiple items.

#### Parameters

self | a viewer widget |
display_name | label for the loaded data. | [nullable]
data | data to load |

### gcr_viewer_widget_load_data ()

    void
    gcr_viewer_widget_load_data (GcrViewerWidget *self,
                                 const gchar *display_name,
                                 const guchar *data,
                                 gsize n_data);

Parse and load some data to be displayed into the viewer widgets. The data may contain multiple parseable items if the format can contain multiple items.

This function will copy the data. Use `gcr_viewer_widget_load_bytes()` to avoid copying the data.

#### Parameters

self | a viewer widget |
display_name | label for the loaded data. | [nullable]
data | data to load. | [array length=n_data]
n_data | length of data to load |

### gcr_viewer_widget_load_file ()

    void
    gcr_viewer_widget_load_file (GcrViewerWidget *self,
                                 GFile *file);

Display contents of a file in the viewer widget. Multiple files can be loaded.

#### Parameters

self | a viewer widget |
file | a file to load |

### gcr_viewer_widget_get_parser ()

    GcrParser *
    gcr_viewer_widget_get_parser (GcrViewerWidget *self);

Get the parser used to parse loaded data into viewable items.

#### Parameters

self | a viewer widget |

#### Returns

the parser.

[transfer none]

### gcr_viewer_widget_get_viewer ()

    GcrViewer *
    gcr_viewer_widget_get_viewer (GcrViewerWidget *self);

Get the viewer used to display the viewable items.

#### Parameters

self | a viewer widget |

#### Returns

the viewer.

[transfer none]

### gcr_viewer_widget_show_error ()

    void
    gcr_viewer_widget_show_error (GcrViewerWidget *self,
                                  const gchar *message,
                                  GError *error);

Show an error on the viewer widget. This is displayed on a info bar near the edge of the widget.

#### Parameters

self | a viewer widget |
message | descriptive error message |
error | detailed error. | [nullable]

### gcr_viewer_widget_clear_error ()

    void
    gcr_viewer_widget_clear_error (GcrViewerWidget *self);

Clear the error displayed on the viewer widget.

#### Parameters

self | a viewer widget |

### gcr_viewer_widget_get_display_name ()

    const gchar *
    gcr_viewer_widget_get_display_name (GcrViewerWidget *self);

Get the display name for data being displayed. This is automatically calculated from a loaded file, or can be explicitly set.

Used as a hint when displaying a title for the data, but may be overridden by the parsed data.

#### Parameters

self | a viewer widget |

#### Returns

the display name

### gcr_viewer_widget_set_display_name ()

    void
    gcr_viewer_widget_set_display_name (GcrViewerWidget *self,
                                        const gchar *display_name);

Set the display name for data being displayed. Once explicitly set it will no longer be calculated automatically by loading data.

Used as a hint when displaying a title for the data, but may be overridden by the parsed data.

#### Parameters

self | a viewer widget |
display_name | the display name |

## Types and Values

### GcrViewerWidget

    typedef struct _GcrViewerWidget GcrViewerWidget;

A viewer widget object.

## Property Details

### The `“display-name”` property

      “display-name”             gchar *

Display name for data being displayed. This is automatically calculated from a loaded file, or can be explicitly set.

Used as a hint when displaying a title for the data, but may be overridden by the parsed data.

Owner: GcrViewerWidget

Flags: Read / Write

Default value: NULL

### The `“parser”` property

      “parser”                   GcrParser *

The parser used to parse loaded data into viewable items.

Owner: GcrViewerWidget

Flags: Read

## Signal Details

### The `“added”` signal

    void
    user_function (GcrViewerWidget *self,
                   GObject         *renderer,
                   GcrParsed       *parsed,
                   gpointer         user_data)

This signal is emitted when an item is added to the viewer widget.

#### Parameters

self | the viewer widget |
renderer | the renderer that was added. | [type GcrUi.Renderer]
parsed | the parsed item that was added. | [type Gcr.Parsed]
user_data | user data set when the signal handler was connected. |

Flags: Run Last