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_INHIBITED,
        GDU_ERROR_INVALID_OPTION,
        GDU_ERROR_NOT_SUPPORTED,
        GDU_ERROR_ATA_SMART_WOULD_WAKEUP
} 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_INHIBITED

The daemon is being inhibited.

GDU_ERROR_INVALID_OPTION

An invalid option was passed

GDU_ERROR_NOT_SUPPORTED

Operation not supported.

GDU_ERROR_ATA_SMART_WOULD_WAKEUP

Getting S.M.A.R.T. data for the device would require to spin it up.

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.