PolkitIdentity

PolkitIdentity — Type for representing identities

Functions

Types and Values

Object Hierarchy

    GInterface
    ╰── PolkitIdentity

Prerequisites

PolkitIdentity requires GObject.

Known Implementations

PolkitIdentity is implemented by PolkitUnixGroup, PolkitUnixNetgroup and PolkitUnixUser.

Description

PolkitIdentity is an abstract type for representing one or more identities.

Functions

polkit_identity_hash ()

guint
polkit_identity_hash (PolkitIdentity *identity);

Gets a hash code for identity that can be used with e.g. g_hash_table_new().

Parameters

identity

A PolkitIdentity.

 

Returns

A hash code.


polkit_identity_equal ()

gboolean
polkit_identity_equal (PolkitIdentity *a,
                       PolkitIdentity *b);

Checks if a and b are equal, ie. represent the same identity.

This function can be used in e.g. g_hash_table_new().

Parameters

a

A PolkitIdentity.

 

b

A PolkitIdentity.

 

Returns

TRUE if a and b are equal, FALSE otherwise.


polkit_identity_to_string ()

gchar *
polkit_identity_to_string (PolkitIdentity *identity);

Serializes identity to a string that can be used in polkit_identity_from_string().

Parameters

identity

A PolkitIdentity.

 

Returns

A string representing identity . Free with g_free().


polkit_identity_from_string ()

PolkitIdentity *
polkit_identity_from_string (const gchar *str,
                             GError **error);

Creates an object from str that implements the PolkitIdentity interface.

Parameters

str

A string obtained from polkit_identity_to_string().

 

error

Return location for error.

 

Returns

A PolkitIdentity or NULL if error is set. Free with g_object_unref().

[allow-none][transfer full]

Types and Values

PolkitIdentity

typedef struct _PolkitIdentity PolkitIdentity;

Generic type for all objects that can be used as identities.


struct PolkitIdentityIface

struct PolkitIdentityIface {
  GTypeInterface parent_iface;

  guint    (*hash)      (PolkitIdentity *identity);

  gboolean (*equal)     (PolkitIdentity *a,
                         PolkitIdentity *b);

  gchar *  (*to_string) (PolkitIdentity *identity);
};

An interface for identities.

Members

GTypeInterface parent_iface;

The parent interface.

 

hash ()

Gets a hash value for a PolkitIdentity.

 

equal ()

Checks if two PolkitIdentitys are equal.

 

to_string ()

Serializes a PolkitIdentity to a string that can be used in polkit_identity_from_string().