|  |  |  | PolicyKit Reference Manual |  | 
|---|---|---|---|---|
| Top | Description | Object Hierarchy | Prerequisites | Known Implementations | ||||
Synopsis
PolkitSubject; PolkitSubjectIface; guint polkit_subject_hash (PolkitSubject *subject); gboolean polkit_subject_equal (PolkitSubject *a, PolkitSubject *b); void polkit_subject_exists (PolkitSubject *subject, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data); gboolean polkit_subject_exists_finish (PolkitSubject *subject, GAsyncResult *res, GError **error); gboolean polkit_subject_exists_sync (PolkitSubject *subject, GCancellable *cancellable, GError **error); gchar * polkit_subject_to_string (PolkitSubject *subject); PolkitSubject * polkit_subject_from_string (const gchar *str, GError **error);
Known Implementations
PolkitSubject is implemented by PolkitUnixProcess, PolkitSystemBusName and PolkitUnixSession.
Details
PolkitSubject
typedef struct _PolkitSubject PolkitSubject;
Generic type for all objects that can be used as subjects.
PolkitSubjectIface
typedef struct {
  GTypeInterface parent_iface;
  guint    (*hash)          (PolkitSubject       *subject);
  gboolean (*equal)         (PolkitSubject       *a,
                             PolkitSubject       *b);
  gchar *  (*to_string)     (PolkitSubject       *subject);
  void     (*exists)        (PolkitSubject       *subject,
                             GCancellable        *cancellable,
                             GAsyncReadyCallback  callback,
                             gpointer             user_data);
  gboolean (*exists_finish) (PolkitSubject       *subject,
                             GAsyncResult        *res,
                             GError             **error);
  gboolean (*exists_sync)   (PolkitSubject       *subject,
                             GCancellable        *cancellable,
                             GError             **error);
} PolkitSubjectIface;
An interface for subjects.
| GTypeInterface  | The parent interface. | 
| Gets a hash value for a PolkitSubject. | |
| Checks if two PolkitSubjects are equal. | |
| Serializes a PolkitSubject to a string that can be
used in polkit_subject_from_string(). | |
| Asynchronously check if a PolkitSubject exists. | |
| Finishes checking if a PolkitSubject exists. | |
| Synchronously check if a PolkitSubject exists. | 
polkit_subject_hash ()
guint polkit_subject_hash (PolkitSubject *subject);
Gets a hash code for subject that can be used with e.g. g_hash_table_new().
| 
 | A PolkitSubject. | 
| Returns : | A hash code. | 
polkit_subject_equal ()
gboolean polkit_subject_equal (PolkitSubject *a, PolkitSubject *b);
Checks if a and b are equal, ie. represent the same subject.
This function can be used in e.g. g_hash_table_new().
| 
 | A PolkitSubject. | 
| 
 | A PolkitSubject. | 
| Returns : | TRUEifaandbare equal,FALSEotherwise. | 
polkit_subject_exists ()
void polkit_subject_exists (PolkitSubject *subject, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data);
Asynchronously checks if subject exists.
When the operation is finished, callback will be invoked. You can
then call polkit_subject_exists_finish() to get the result of the
operation.
| 
 | A PolkitSubject. | 
| 
 | A GCancellable or NULL. | 
| 
 | A GAsyncReadyCallback to call when the request is satisfied | 
| 
 | The data to pass to callback. | 
polkit_subject_exists_finish ()
gboolean polkit_subject_exists_finish (PolkitSubject *subject, GAsyncResult *res, GError **error);
Finishes checking whether a subject exists.
| 
 | A PolkitSubject. | 
| 
 | A GAsyncResult obtained from the GAsyncReadyCallback passed to polkit_subject_exists(). | 
| 
 | Return location for error or NULL. | 
| Returns : | TRUEif the subject exists,FALSEif not orerroris set. | 
polkit_subject_exists_sync ()
gboolean polkit_subject_exists_sync (PolkitSubject *subject, GCancellable *cancellable, GError **error);
Checks if subject exists.
This is a synchronous blocking call, see polkit_subject_exists()
for the asynchronous version.
| 
 | A PolkitSubject. | 
| 
 | A GCancellable or NULL. | 
| 
 | Return location for error or NULL. | 
| Returns : | TRUEif the subject exists,FALSEif not orerroris set. | 
polkit_subject_to_string ()
gchar * polkit_subject_to_string (PolkitSubject *subject);
Serializes subject to a string that can be used in
polkit_subject_from_string().
| 
 | A PolkitSubject. | 
| Returns : | A string representing subject. Free withg_free(). | 
polkit_subject_from_string ()
PolkitSubject * polkit_subject_from_string (const gchar *str, GError **error);
Creates an object from str that implements the PolkitSubject
interface.
| 
 | A string obtained from polkit_subject_to_string(). | 
| 
 | Return location for error. | 
| Returns : | A PolkitSubject or NULLiferroris set. Free withg_object_unref(). | 
