GduError

GduError — Error helper functions

Synopsis

enum                GduError;
#define             GDU_ERROR
GQuark              gdu_error_quark                     (void);
gboolean            gdu_error_check_polkit_not_authorized
                                                        (GError *error,
                                                         PolKitAction **pk_action,
                                                         PolKitResult *pk_result);

Description

Contains helper functions for reporting errors to the user.

Details

enum GduError

typedef enum
{
        GDU_ERROR_FAILED,
        GDU_ERROR_BUSY,
        GDU_ERROR_CANCELLED,
        GDU_ERROR_INVALID_OPTION,
        GDU_ERROR_ALREADY_MOUNTED,
        GDU_ERROR_NOT_MOUNTED,
        GDU_ERROR_NOT_CANCELLABLE,
        GDU_ERROR_NOT_PARTITION,
        GDU_ERROR_NOT_PARTITION_TABLE,
        GDU_ERROR_NOT_FILESYSTEM,
        GDU_ERROR_NOT_LUKS,
        GDU_ERROR_NOT_LOCKED,
        GDU_ERROR_NOT_UNLOCKED,
        GDU_ERROR_NOT_LINUX_MD,
        GDU_ERROR_NOT_LINUX_MD_COMPONENT,
        GDU_ERROR_NOT_DRIVE,
        GDU_ERROR_NOT_SMART_CAPABLE,
        GDU_ERROR_NOT_SUPPORTED,
        GDU_ERROR_NOT_FOUND,
} GduError;

Error codes in the GDU_ERROR domain.

GDU_ERROR_FAILED

The operation failed.

GDU_ERROR_BUSY

The device is busy

GDU_ERROR_CANCELLED

The operation was cancelled

GDU_ERROR_INVALID_OPTION

An invalid option was passed

GDU_ERROR_ALREADY_MOUNTED

Device is already mounted.

GDU_ERROR_NOT_MOUNTED

Device is not mounted.

GDU_ERROR_NOT_CANCELLABLE

Operation is not cancellable.

GDU_ERROR_NOT_PARTITION

Device is not a partition.

GDU_ERROR_NOT_PARTITION_TABLE

Device is not a partition table.

GDU_ERROR_NOT_FILESYSTEM

Device is not a file system.

GDU_ERROR_NOT_LUKS

Device is not a LUKS encrypted device.

GDU_ERROR_NOT_LOCKED

Device is not locked.

GDU_ERROR_NOT_UNLOCKED

Device is not unlocked.

GDU_ERROR_NOT_LINUX_MD

Device is not a Linux md Software RAID device.

GDU_ERROR_NOT_LINUX_MD_COMPONENT

Device is not a Linux md Software RAID component.

GDU_ERROR_NOT_DRIVE

Device is not a drive.

GDU_ERROR_NOT_SMART_CAPABLE

Device is not S.M.A.R.T. capable.

GDU_ERROR_NOT_SUPPORTED

Operation not supported.

GDU_ERROR_NOT_FOUND

Given device does not exist.

GDU_ERROR

#define GDU_ERROR gdu_error_quark ()

Error domain used for errors reported from DeviceKit-disks daemon via D-Bus. Note that not all remote errors are mapped to this domain. Errors in this domain will come from the GduError enumeration. See GError for more information on error domains.


gdu_error_quark ()

GQuark              gdu_error_quark                     (void);

Gets the GduError Quark.

Returns :

a GQuark

gdu_error_check_polkit_not_authorized ()

gboolean            gdu_error_check_polkit_not_authorized
                                                        (GError *error,
                                                         PolKitAction **pk_action,
                                                         PolKitResult *pk_result);

Checks if an error from a remote method call is of type org.freedesktop.PolicyKit.Error.NotAuthorized and if so, extracts the PolicyKit action and result.

error :

A GError.

pk_action :

Return location for a PolKitAction object.

pk_result :

Return location for PolKitResult value.

Returns :

TRUE only if the error is a PolicyKit exception and pk_action (caller must free this object with polkit_action_unref()) and pk_result are set.