ezfc_config_t

ezfc_config_t — A class for managing the configuration file.

Synopsis

gboolean            ezfc_config_add_alias               (ezfc_config_t *config,
                                                         const gchar *language,
                                                         ezfc_alias_t *alias);
gboolean            ezfc_config_add_font                (ezfc_config_t *config,
                                                         ezfc_font_t *font);
void                ezfc_config_dump                    (ezfc_config_t *config);
const GList *       ezfc_config_get_aliases             (ezfc_config_t *config,
                                                         const gchar *language);
GList *             ezfc_config_get_fonts               (ezfc_config_t *config);
GList *             ezfc_config_get_language_list       (ezfc_config_t *config);
const gchar *       ezfc_config_get_name                (ezfc_config_t *config);
gint                ezfc_config_get_priority            (ezfc_config_t *config);
gboolean            ezfc_config_load                    (ezfc_config_t *config,
                                                         GError **error);
ezfc_config_t *     ezfc_config_new                     (void);
ezfc_config_t *     ezfc_config_ref                     (ezfc_config_t *config);
gboolean            ezfc_config_remove_alias            (ezfc_config_t *config,
                                                         const gchar *language,
                                                         const gchar *alias_name);
gboolean            ezfc_config_remove_aliases          (ezfc_config_t *config,
                                                         const gchar *language);
gboolean            ezfc_config_remove_font             (ezfc_config_t *config,
                                                         const gchar *family);
gboolean            ezfc_config_remove_fonts            (ezfc_config_t *config);
gboolean            ezfc_config_save                    (ezfc_config_t *config,
                                                         GError **error);
GString *           ezfc_config_save_to_buffer          (ezfc_config_t *config,
                                                         GError **error);
void                ezfc_config_set_migration           (ezfc_config_t *config,
                                                         gboolean flag);
void                ezfc_config_set_name                (ezfc_config_t *config,
                                                         const gchar *name);
void                ezfc_config_set_priority            (ezfc_config_t *config,
                                                         guint priority);
                    ezfc_config_t;
void                ezfc_config_unref                   (ezfc_config_t *config);

Description

This class provides an easy access to assign an instance of ezfc_alias_t to a language and to read/write the configuration file.

Details

ezfc_config_add_alias ()

gboolean            ezfc_config_add_alias               (ezfc_config_t *config,
                                                         const gchar *language,
                                                         ezfc_alias_t *alias);

Add a alias font for language language. if giving NULL to language, alias takes effect for any languages.

config :

a ezfc_config_t.

language :

a language name to add alias for or NULL for global settings. [allow-none]

alias :

a ezfc_alias_t.

Returns :

TRUE if it's successfully completed, otherwise FALSE.

ezfc_config_add_font ()

gboolean            ezfc_config_add_font                (ezfc_config_t *config,
                                                         ezfc_font_t *font);

Add a font font to generate non-language-specific, non-alias-specific rules.

config :

a ezfc_config_t.

font :

a ezfc_font_t.

Returns :

TRUE if it's successfully completed, otherwise FALSE.

ezfc_config_dump ()

void                ezfc_config_dump                    (ezfc_config_t *config);

Output the object data to the standard output.

config :

a ezfc_config_t.

ezfc_config_get_aliases ()

const GList *       ezfc_config_get_aliases             (ezfc_config_t *config,
                                                         const gchar *language);

Obtains the list of ezfc_alias_t in ezfc_config_t instance.

config :

a ezfc_config_t.

language :

a language name referenced to the alias. [allow-none]

Returns :

a GList contains ezfc_alias_t or NULL. [element-type ezfc_alias_t][transfer none]

ezfc_config_get_fonts ()

GList *             ezfc_config_get_fonts               (ezfc_config_t *config);

Obtains the list of ezfc_font_t in config.

config :

a ezfc_config_t.

Returns :

a GList contains ezfc_font_t or NULL. [element-type ezfc_font_t][transfer container]

ezfc_config_get_language_list ()

GList *             ezfc_config_get_language_list       (ezfc_config_t *config);

Obtains the list of languages registered by ezfc_config_add_alias() in config.

config :

a ezfc_config_t.

Returns :

a GList contains languages or NULL. [element-type utf8][transfer none]

ezfc_config_get_name ()

const gchar *       ezfc_config_get_name                (ezfc_config_t *config);

Obtains the configuration name that is set by ezfc_config_set_name().

config :

a ezfc_config_t.

Returns :

the configuration name.

ezfc_config_get_priority ()

gint                ezfc_config_get_priority            (ezfc_config_t *config);

Obtains the priority number in config.

config :

a ezfc_config_t.

Returns :

the priority number. if any errors happens, returns -1.

ezfc_config_load ()

gboolean            ezfc_config_load                    (ezfc_config_t *config,
                                                         GError **error);

Read the configuration file and rebuild the object. You have to invoke ezfc_config_set_priority() and ezfc_config_set_name() first to read the appropriate configuration file.

config :

a ezfc_config_t.

error :

a GError. [allow-none]

Returns :

TRUE if it's successfully completed, otherwise FALSE.

ezfc_config_new ()

ezfc_config_t *     ezfc_config_new                     (void);

Create a new instance of a ezfc_config_t.

Returns :

a new instance of ezfc_config_t. [transfer full]

ezfc_config_ref ()

ezfc_config_t *     ezfc_config_ref                     (ezfc_config_t *config);

Increases the refernce count of config.

config :

a ezfc_config_t.

Returns :

the same config object. [transfer none]

ezfc_config_remove_alias ()

gboolean            ezfc_config_remove_alias            (ezfc_config_t *config,
                                                         const gchar *language,
                                                         const gchar *alias_name);

Removes alias_name assigned for language language from config.

config :

a ezfc_config_t.

language :

a language name to remove alias_name from. [allow-none]

alias_name :

a alias font name to remove.

Returns :

TRUE if it's successfully removed, otherwise FALSE.

ezfc_config_remove_aliases ()

gboolean            ezfc_config_remove_aliases          (ezfc_config_t *config,
                                                         const gchar *language);

Removes all of aliases assigned for language language from config.

config :

a ezfc_config_t.

language :

a language name to remove alias_name from. [allow-none]

Returns :

TRUE if it's successfully removed, otherwise FALSE.

ezfc_config_remove_font ()

gboolean            ezfc_config_remove_font             (ezfc_config_t *config,
                                                         const gchar *family);

Remove a ezfc_font_t instance corresponding to family.

config :

a ezfc_config_t.

family :

a family name to be removed.

Returns :

TRUE if it's successfully removed, otherwise FALSE.

ezfc_config_remove_fonts ()

gboolean            ezfc_config_remove_fonts            (ezfc_config_t *config);

Remove all of fonts from config, which added by ezfc_config_add_font().

config :

a ezfc_config_t.

Returns :

TRUE if it's successfully removed, otherwise FALSE.

ezfc_config_save ()

gboolean            ezfc_config_save                    (ezfc_config_t *config,
                                                         GError **error);

Write the data to the configuration file. you may want to invoke ezfc_config_set_priority() and ezfc_config_set_name() first to write it to the appropriate configuration file.

config :

a ezfc_config_t.

error :

a GError. [allow-none]

Returns :

TRUE if it's successfully completed, otherwise FALSE.

ezfc_config_save_to_buffer ()

GString *           ezfc_config_save_to_buffer          (ezfc_config_t *config,
                                                         GError **error);

Write the data to the buffer.

config :

a ezfc_config_t.

error :

a GError. [allow-none]

Returns :

a GString containing a xml data. NULL if fails.

ezfc_config_set_migration ()

void                ezfc_config_set_migration           (ezfc_config_t *config,
                                                         gboolean flag);

Set a flag to migrate the configuration file on the older place to the new one where XDG Base Directory Specification defines. If flag is TRUE, ezfc_config_load() will tries to read the config file from the old path prior to new place and the old file will be removed during ezfc_config_save().

This feature is enabled by default.

config :

a ezfc_config_t.

flag :

a gboolean.

Since 0.8


ezfc_config_set_name ()

void                ezfc_config_set_name                (ezfc_config_t *config,
                                                         const gchar *name);

Set name as the additional configuration name. this is an optional to make the change in the filename for output.

config :

a ezfc_config_t.

name :

additional configuration name. [allow-none]

ezfc_config_set_priority ()

void                ezfc_config_set_priority            (ezfc_config_t *config,
                                                         guint priority);

Set priority to config instance.

config :

a ezfc_config_t.

priority :

a priority number that is used for a filename. it has to be within 3 digits. so the maximum value is 999.

ezfc_config_t

typedef struct _ezfc_config_t ezfc_config_t;

All the fields in the ezfc_config_t structure are private to the ezfc_config_t implementation.


ezfc_config_unref ()

void                ezfc_config_unref                   (ezfc_config_t *config);

Decreases the reference count of config. when its reference count drops to 0, the object is finalized (i.e. its memory is freed).

config :

a ezfc_config_t.