## SnapdPlug SnapdPlug — Snap plugs |

## Functions

const gchar * | snapd_plug_get_name ()
const gchar * | snapd_plug_get_snap ()
const gchar * | snapd_plug_get_interface ()
GStrv | snapd_plug_get_attribute_names ()
gboolean | snapd_plug_has_attribute ()
GVariant * | snapd_plug_get_attribute ()
const gchar * | snapd_plug_get_label ()
GPtrArray * | snapd_plug_get_connections ()
GPtrArray * | snapd_plug_get_connected_slots ()

## Properties

GHashTable * | attributes | Read / Write / Construct Only
GPtrArray * | connections | Read / Write / Construct Only
char * | interface | Read / Write / Construct Only
char * | label | Read / Write / Construct Only
char * | name | Read / Write / Construct Only
char * | snap | Read / Write / Construct Only

## Types and Values

| SnapdPlug

## Object Hierarchy

        GObject
        ╰── SnapdPlug

## Includes

    #include <snapd-glib/snapd-glib.h>

## Description

A SnapdPlug represents a part of a snap that can be connected to a SnapdSlot on another snap. Available plugs can be queried using `snapd_client_get_interfaces_sync()`. Plugs can be connected / disconnected using `snapd_client_connect_interface_sync()` and `snapd_client_disconnect_interface_sync()`.

## Functions

### snapd_plug_get_name ()

    const gchar *
    snapd_plug_get_name (SnapdPlug *plug);

Get the name of this plug.

#### Parameters

plug | a SnapdPlug. |

#### Returns

a name.

Since: 1.0

### snapd_plug_get_snap ()

    const gchar *
    snapd_plug_get_snap (SnapdPlug *plug);

Get the snap this plug is on.

#### Parameters

plug | a SnapdPlug. |

#### Returns

a snap name.

Since: 1.0

### snapd_plug_get_interface ()

    const gchar *
    snapd_plug_get_interface (SnapdPlug *plug);

Get the name of the interface this plug provides.

#### Parameters

plug | a SnapdPlug. |

#### Returns

an interface name.

Since: 1.0

### snapd_plug_get_attribute_names ()

    GStrv
    snapd_plug_get_attribute_names (SnapdPlug *plug,
                                    guint *length);

Get the names of the attributes this plug has.

#### Parameters

plug | a SnapdPlug. |
length | location to write number of attributes or `NULL` if not required. | [out][allow-none]

#### Returns

a string array of attribute names. Free with `g_strfreev()`.

[transfer full][array zero-terminated=1]

Since: 1.3

### snapd_plug_has_attribute ()

    gboolean
    snapd_plug_has_attribute (SnapdPlug *plug,
                              const gchar *name);

Check if this plug has an attribute.

#### Parameters

plug | a SnapdPlug. |
name | an attribute name. |

#### Returns

`TRUE` if this attribute exists.

Since: 1.3

### snapd_plug_get_attribute ()

    GVariant *
    snapd_plug_get_attribute (SnapdPlug *plug,
                              const gchar *name);

Get an attribute for this interface.

#### Parameters

plug | a SnapdPlug. |
name | an attribute name. |

#### Returns

an attribute value or `NULL` if not set.

[transfer none][allow-none]

Since: 1.3

### snapd_plug_get_label ()

    const gchar *
    snapd_plug_get_label (SnapdPlug *plug);

Get a human readable label for this plug.

#### Parameters

plug | a SnapdPlug. |

#### Returns

a label.

Since: 1.0

### snapd_plug_get_connections ()

    GPtrArray *
    snapd_plug_get_connections (SnapdPlug *plug);

`snapd_plug_get_connections` has been deprecated since version 1.48 and should not be used in newly-written code.

Use `snapd_plug_get_connected_slots()`

Get the connections being made with this plug.

#### Parameters

plug | a SnapdPlug. |

#### Returns

an array of SnapdConnection.

[transfer none][element-type SnapdConnection]

Since: 1.0

### snapd_plug_get_connected_slots ()

    GPtrArray *
    snapd_plug_get_connected_slots (SnapdPlug *plug);

Get the slots connected to this plug.

#### Parameters

plug | a SnapdPlug. |

#### Returns

an array of SnapdSlotRef.

[transfer none][element-type SnapdSlotRef]

Since: 1.48

## Types and Values

### SnapdPlug

    typedef struct _SnapdPlug SnapdPlug;

SnapdPlug contains information about a Snap plug.

Since: 1.0

## Property Details

### The `“attributes”` property

      “attributes”               GHashTable *

Attributes for this plug.

Owner: SnapdPlug

Flags: Read / Write / Construct Only

### The `“connections”` property

      “connections”              GPtrArray *

Connections with this plug.

Owner: SnapdPlug

Flags: Read / Write / Construct Only

### The `“interface”` property

      “interface”                char *

Interface this plug provides.

Owner: SnapdPlug

Flags: Read / Write / Construct Only

Default value: NULL

### The `“label”` property

      “label”                    char *

Short description of this plug.

Owner: SnapdPlug

Flags: Read / Write / Construct Only

Default value: NULL

### The `“name”` property

      “name”                     char *

Plug name.

Owner: SnapdPlug

Flags: Read / Write / Construct Only

Default value: NULL

### The `“snap”` property

      “snap”                     char *

Snap this plug is on.

Owner: SnapdPlug

Flags: Read / Write / Construct Only

Default value: NULL