TnyStatus

TnyStatus — An object containing status information

Synopsis




                    TnyStatus;
#define             TNY_TYPE_STATUS_DOMAIN
#define             TNY_TYPE_STATUS_CODE
GType               tny_status_domain_get_type          (void);
GType               tny_status_code_get_type            (void);
TnyStatus*          tny_status_new                      (GQuark domain,
                                                         gint code,
                                                         guint position,
                                                         guint of_total,
                                                         const gchar *format,
                                                         ...);
TnyStatus*          tny_status_new_literal              (GQuark domain,
                                                         gint code,
                                                         guint position,
                                                         guint of_total,
                                                         const gchar *message);
void                tny_status_free                     (TnyStatus *status);
TnyStatus*          tny_status_copy                     (const TnyStatus *status);
gboolean            tny_status_matches                  (const TnyStatus *status,
                                                         GQuark domain,
                                                         gint code);
void                tny_set_status                      (TnyStatus **status,
                                                         GQuark domain,
                                                         gint code,
                                                         guint position,
                                                         guint of_total,
                                                         gchar *format,
                                                         ...);
void                tny_clear_status                    (TnyStatus **status);
void                tny_status_set_fraction             (TnyStatus *status,
                                                         gdouble fraction);
gdouble             tny_status_get_fraction             (TnyStatus *status);

Description

An object containing status information

Details

TnyStatus

typedef struct {
	GQuark domain;
	gint code;
	gchar *message;
	guint position;
	guint of_total;
} TnyStatus;

A progress status

free-function: tny_status_free


TNY_TYPE_STATUS_DOMAIN

#define TNY_TYPE_STATUS_DOMAIN (tny_status_domain_get_type())


TNY_TYPE_STATUS_CODE

#define TNY_TYPE_STATUS_CODE (tny_status_code_get_type())


tny_status_domain_get_type ()

GType               tny_status_domain_get_type          (void);

GType system helper function

Returns : a GType

tny_status_code_get_type ()

GType               tny_status_code_get_type            (void);

GType system helper function

Returns : a GType

tny_status_new ()

TnyStatus*          tny_status_new                      (GQuark domain,
                                                         gint code,
                                                         guint position,
                                                         guint of_total,
                                                         const gchar *format,
                                                         ...);

Creates a new TnyStatus with the given domain and code, and a message formatted with format.

domain : status domain
code : status code
position : the position
of_total : the total amount of events to happen
format : printf()-style format for status message
... : parameters for message format
Returns : (caller-owns): a new TnyStatus

tny_status_new_literal ()

TnyStatus*          tny_status_new_literal              (GQuark domain,
                                                         gint code,
                                                         guint position,
                                                         guint of_total,
                                                         const gchar *message);

Creates a new TnyStatus; unlike tny_status_new(), message is not a printf()-style format string. Use this function if message contains text you don't have control over, that could include printf() escape sequences.

domain : status domain
code : status code
position : the position
of_total : the total amount of events to happen
message : status message
Returns : (caller-owns): a new TnyStatus

tny_status_free ()

void                tny_status_free                     (TnyStatus *status);

Destroys a TnyStatus and associated resources.

status : a TnyStatus

Since 1.0 audience: application-developer


tny_status_copy ()

TnyStatus*          tny_status_copy                     (const TnyStatus *status);

Makes a full copy of status (not just a shallow copy).

status : a TnyStatus
Returns : (caller-owns): a new TnyStatus

Since 1.0 audience: application-developer


tny_status_matches ()

gboolean            tny_status_matches                  (const TnyStatus *status,
                                                         GQuark domain,
                                                         gint code);

Returns TRUE if status matches domain and code, FALSE otherwise.

status : a TnyStatus
domain : a status domain
code : a status code
Returns : TRUE if status has domain and code, else FALSE

Since 1.0 audience: application-developer


tny_set_status ()

void                tny_set_status                      (TnyStatus **status,
                                                         GQuark domain,
                                                         gint code,
                                                         guint position,
                                                         guint of_total,
                                                         gchar *format,
                                                         ...);

Does nothing if status is NULL; if status is non-NULL, then *status must be NULL. A new TnyStatus is created and assigned to *status.

status : a return location for a TnyStatus, or NULL
domain : status domain
code : status code
position : the position
of_total : the total amount of events to happen
format : printf()-style format
... : args for format

Since 1.0 audience: application-developer


tny_clear_status ()

void                tny_clear_status                    (TnyStatus **status);

If status is NULL, does nothing. If status is non-NULL, calls tny_status_free() on *status and sets *status to NULL.

status : a TnyStatus return location

Since 1.0 audience: application-developer


tny_status_set_fraction ()

void                tny_status_set_fraction             (TnyStatus *status,
                                                         gdouble fraction);

Set the fraction of status. The of_total member of status will be set to 100 by this method.

status : a TnyStatus
fraction : the fraction to set

Since 1.0 audience: application-developer


tny_status_get_fraction ()

gdouble             tny_status_get_fraction             (TnyStatus *status);

Get the fraction of status

status : a TnyStatus
Returns : the fraction of status

Since 1.0 audience: application-developer

See Also

TnyFolder