MIMEDirProfile

Name

MIMEDirProfile -- 

Synopsis


#include <mimedir/mimedir-profile.h>


#define     MIMEDIR_PROFILE_ERROR
enum        MIMEDirProfileError;
#define     MIMEDIR_PROFILE_ERROR_DUPLICATE_ATTRIBUTE_STR
#define     MIMEDIR_PROFILE_ERROR_UNEXPECTED_END_STR
#define     MIMEDIR_PROFILE_ERROR_ATTRIBUTE_MISSING_STR

struct      MIMEDirProfile;

MIMEDirProfile* mimedir_profile_new         (const gchar *type);
MIMEDirProfile* mimedir_profile_new_from_channel
                                            (GIOChannel *channel,
                                             GError **error);
gboolean    mimedir_profile_read_from_channel
                                            (MIMEDirProfile *profile,
                                             GIOChannel *channel,
                                             GError **error);
gboolean    mimedir_profile_write_to_channel
                                            (MIMEDirProfile *profile,
                                             GIOChannel *channel,
                                             GError **error);
void        mimedir_profile_append_attribute
                                            (MIMEDirProfile *profile,
                                             MIMEDirAttribute *attribute);
MIMEDirAttribute* mimedir_profile_get_attribute
                                            (MIMEDirProfile *profile,
                                             const gchar *name);
GSList*     mimedir_profile_get_attribute_list
                                            (MIMEDirProfile *profile);


Description

Details

MIMEDIR_PROFILE_ERROR

#define MIMEDIR_PROFILE_ERROR mimedir_profile_error_quark ()

Error domain for MIMEDirProfile operations. Errors in this domain will be from the MIMEDirProfileError enumeration. See GError for information on error domains.


enum MIMEDirProfileError

typedef enum {
	MIMEDIR_PROFILE_ERROR_DUPLICATE_ATTRIBUTE,
	MIMEDIR_PROFILE_ERROR_UNEXPECTED_END,
	MIMEDIR_PROFILE_ERROR_ATTRIBUTE_MISSING
} MIMEDirProfileError;

Error codes returned by MIMEDirProfile operations.

MIMEDIR_PROFILE_ERROR_DUPLICATE_ATTRIBUTEAn unique attribute was specified twice.
MIMEDIR_PROFILE_ERROR_UNEXPECTED_ENDThe profile is missing a proper END attribute.
MIMEDIR_PROFILE_ERROR_ATTRIBUTE_MISSINGAn attribute that is required for a specific profile type is missing from the profile.


MIMEDIR_PROFILE_ERROR_DUPLICATE_ATTRIBUTE_STR

#define MIMEDIR_PROFILE_ERROR_DUPLICATE_ATTRIBUTE_STR	_("attribute %s defined twice")

Default string representation of the MIMEDIR_PROFILE_ERROR_DUPLICATE_ATTRIBUTE error code.


MIMEDIR_PROFILE_ERROR_UNEXPECTED_END_STR

#define MIMEDIR_PROFILE_ERROR_UNEXPECTED_END_STR	_("unexpected end of profile")

Default string representation of the MIMEDIR_PROFILE_ERROR_UNEXPECTED_END error code.


MIMEDIR_PROFILE_ERROR_ATTRIBUTE_MISSING_STR

#define MIMEDIR_PROFILE_ERROR_ATTRIBUTE_MISSING_STR	_("required attribute %s is missing")

Default string representation of the MIMEDIR_PROFILE_ERROR_MISSING_STR error code.


struct MIMEDirProfile

struct MIMEDirProfile
{
	GObject parent;

	MIMEDirProfilePriv *priv;
};

The MIMEDirProfile struct contains private data only, and should be accessed using the functions below.


mimedir_profile_new ()

MIMEDirProfile* mimedir_profile_new         (const gchar *type);

Creates a new profile of a given type.

type : the profile type
Returns : pointer to the new profile


mimedir_profile_new_from_channel ()

MIMEDirProfile* mimedir_profile_new_from_channel
                                            (GIOChannel *channel,
                                             GError **error);

Creates a new profile and reads it from the supplied I/O channel. If an error occurs during the read, error will be set and NULL will be returned.

channel : I/O channel to read from
error : error storage location or NULL
Returns : pointer to the new profile or NULL


mimedir_profile_read_from_channel ()

gboolean    mimedir_profile_read_from_channel
                                            (MIMEDirProfile *profile,
                                             GIOChannel *channel,
                                             GError **error);

Clear the supplied profile and re-initialize it with data retrieved from the supplied I/O channel. If an error occures during the read, error will be set and FALSE will be returned. Otherwise TRUE is returned.

profile : a MIMEDirProfile
channel : I/O channel to read from
error : error storage location or NULL
Returns : success indicator


mimedir_profile_write_to_channel ()

gboolean    mimedir_profile_write_to_channel
                                            (MIMEDirProfile *profile,
                                             GIOChannel *channel,
                                             GError **error);

Writes the profile to the supplied I/O channel. If an error occurs during the write, error will be set and FALSE will be returned. Otherwise TRUE is returned.

profile : a MIMEDirProfile
channel : I/O channel to write to
error : error storage location or NULL
Returns : success indicator


mimedir_profile_append_attribute ()

void        mimedir_profile_append_attribute
                                            (MIMEDirProfile *profile,
                                             MIMEDirAttribute *attribute);

Adds an attribute to the supplied profile.

profile : a MIMEDirProfile
attribute : attribute to add


mimedir_profile_get_attribute ()

MIMEDirAttribute* mimedir_profile_get_attribute
                                            (MIMEDirProfile *profile,
                                             const gchar *name);

Tries to find the first occurence of a given attribute by name and return the MIMEDirAttribute object. If no attribute with the given name is found, NULL is returned.

profile : a MIMEDirProfile
name : attribute name
Returns : the attribute or NULL


mimedir_profile_get_attribute_list ()

GSList*     mimedir_profile_get_attribute_list
                                            (MIMEDirProfile *profile);

Return the ordered list of all the profile's attributes.

profile : a MIMEDirProfile
Returns : the attribute list