GrlConfig

GrlConfig — Configuration data storage

Synopsis

#include <grilo.h>

struct              GrlConfig;
struct              GrlConfigClass;
#define             GRL_CONFIG_KEY_APIKEY
#define             GRL_CONFIG_KEY_APIKEY_BLOB
#define             GRL_CONFIG_KEY_APISECRET
#define             GRL_CONFIG_KEY_APITOKEN
#define             GRL_CONFIG_KEY_PASSWORD
#define             GRL_CONFIG_KEY_PLUGIN
#define             GRL_CONFIG_KEY_SOURCE
#define             GRL_CONFIG_KEY_USERNAME
GrlConfig *         grl_config_new                      (const gchar *plugin,
                                                         const gchar *source);
gchar *             grl_config_get_api_key              (GrlConfig *config);
guint8 *            grl_config_get_api_key_blob         (GrlConfig *config,
                                                         gsize *size);
gchar *             grl_config_get_api_secret           (GrlConfig *config);
gchar *             grl_config_get_api_token            (GrlConfig *config);
guint8 *            grl_config_get_binary               (GrlConfig *config,
                                                         const gchar *param,
                                                         gsize *size);
gboolean            grl_config_get_boolean              (GrlConfig *config,
                                                         const gchar *param);
gfloat              grl_config_get_float                (GrlConfig *config,
                                                         const gchar *param);
gint                grl_config_get_int                  (GrlConfig *config,
                                                         const gchar *param);
gchar *             grl_config_get_password             (GrlConfig *config);
gchar *             grl_config_get_plugin               (GrlConfig *config);
gchar *             grl_config_get_source               (GrlConfig *config);
gchar *             grl_config_get_string               (GrlConfig *config,
                                                         const gchar *param);
gchar *             grl_config_get_username             (GrlConfig *config);
gboolean            grl_config_has_param                (GrlConfig *config,
                                                         const gchar *param);
void                grl_config_set                      (GrlConfig *config,
                                                         const gchar *param,
                                                         const GValue *value);
void                grl_config_set_api_key              (GrlConfig *config,
                                                         const gchar *key);
void                grl_config_set_api_key_blob         (GrlConfig *config,
                                                         const guint8 *blob,
                                                         gsize size);
void                grl_config_set_api_secret           (GrlConfig *config,
                                                         const gchar *secret);
void                grl_config_set_api_token            (GrlConfig *config,
                                                         const gchar *token);
void                grl_config_set_binary               (GrlConfig *config,
                                                         const gchar *param,
                                                         const guint8 *blob,
                                                         gsize size);
void                grl_config_set_boolean              (GrlConfig *config,
                                                         const gchar *param,
                                                         gboolean value);
void                grl_config_set_float                (GrlConfig *config,
                                                         const gchar *param,
                                                         gfloat value);
void                grl_config_set_int                  (GrlConfig *config,
                                                         const gchar *param,
                                                         gint value);
void                grl_config_set_password             (GrlConfig *config,
                                                         const gchar *password);
void                grl_config_set_plugin               (GrlConfig *config,
                                                         const gchar *plugin);
void                grl_config_set_source               (GrlConfig *config,
                                                         const gchar *source);
void                grl_config_set_string               (GrlConfig *config,
                                                         const gchar *param,
                                                         const gchar *value);
void                grl_config_set_username             (GrlConfig *config,
                                                         const gchar *username);

Object Hierarchy

  GObject
   +----GrlConfig

Description

This class is used to configure plugins during a session.

Pre-defined settings are read from plugin specific configuration files. The settings can be changed to properly setup the session, but are not persistent. Changes are local to each GrlConfig instance.

Details

struct GrlConfig

struct GrlConfig;

struct GrlConfigClass

struct GrlConfigClass {
  GObjectClass parent_class;
};

Grilo Config Class

GObjectClass parent_class;

the parent class structure

GRL_CONFIG_KEY_APIKEY

#define GRL_CONFIG_KEY_APIKEY      "api-key"

GRL_CONFIG_KEY_APIKEY_BLOB

#define GRL_CONFIG_KEY_APIKEY_BLOB "api-key-blob"

GRL_CONFIG_KEY_APISECRET

#define GRL_CONFIG_KEY_APISECRET   "api-secret"

GRL_CONFIG_KEY_APITOKEN

#define GRL_CONFIG_KEY_APITOKEN    "api-token"

GRL_CONFIG_KEY_PASSWORD

#define GRL_CONFIG_KEY_PASSWORD    "password"

GRL_CONFIG_KEY_PLUGIN

#define GRL_CONFIG_KEY_PLUGIN      "target-plugin"

GRL_CONFIG_KEY_SOURCE

#define GRL_CONFIG_KEY_SOURCE      "target-source"

GRL_CONFIG_KEY_USERNAME

#define GRL_CONFIG_KEY_USERNAME    "username"

grl_config_new ()

GrlConfig *         grl_config_new                      (const gchar *plugin,
                                                         const gchar *source);

Creates a new data config object that will be associated with a plugin (if source is NULL), or a specific source spawned from a plugin (if source is not NULL). The latter may be useful for plugins spawning various sources, each one needing a different configuration.

plugin :

plugin id for this configuration

source :

source id for this configuration. [allow-none]

Returns :

a newly-allocated data config. The data config associated with the plugin should not be freed until the plugin has been unloaded. [transfer none]

Since 0.1.4


grl_config_get_api_key ()

gchar *             grl_config_get_api_key              (GrlConfig *config);

config :

the config instance

Returns :

the webservice API key

Since 0.1.4


grl_config_get_api_key_blob ()

guint8 *            grl_config_get_api_key_blob         (GrlConfig *config,
                                                         gsize *size);

config :

the config instance

size :

pointer to size of data

Returns :

the binary API key, size will reflect the size of the buffer

Since 0.1.9


grl_config_get_api_secret ()

gchar *             grl_config_get_api_secret           (GrlConfig *config);

config :

the config instance

Returns :

the webservice API passphrase

Since 0.1.4


grl_config_get_api_token ()

gchar *             grl_config_get_api_token            (GrlConfig *config);

config :

the config instance

Returns :

the webservice API token

Since 0.1.4


grl_config_get_binary ()

guint8 *            grl_config_get_binary               (GrlConfig *config,
                                                         const gchar *param,
                                                         gsize *size);

Gets the value of param encoded as base64. If size is not NULL, it puts there the size of the value.

config :

the config instance

param :

a binary type parameter

size :

place for size of value. [allow-none]

Returns :

param value

Since 0.1.9


grl_config_get_boolean ()

gboolean            grl_config_get_boolean              (GrlConfig *config,
                                                         const gchar *param);

config :

the config instance

param :

a boolean type parameter

Returns :

param value

Since 0.1.8


grl_config_get_float ()

gfloat              grl_config_get_float                (GrlConfig *config,
                                                         const gchar *param);

config :

the config instance

param :

a float type parameter

Returns :

param value

Since 0.1.5


grl_config_get_int ()

gint                grl_config_get_int                  (GrlConfig *config,
                                                         const gchar *param);

config :

the config instance

param :

an integer type parameter

Returns :

param value

Since 0.1.5


grl_config_get_password ()

gchar *             grl_config_get_password             (GrlConfig *config);

config :

the config instance

Returns :

the password

Since 0.1.8


grl_config_get_plugin ()

gchar *             grl_config_get_plugin               (GrlConfig *config);

config :

the config instance

Returns :

the plugin id

Since 0.1.4


grl_config_get_source ()

gchar *             grl_config_get_source               (GrlConfig *config);

config :

the config instance

Returns :

the source id

grl_config_get_string ()

gchar *             grl_config_get_string               (GrlConfig *config,
                                                         const gchar *param);

config :

the config instance

param :

a string type paramter

Returns :

param value

Since 0.1.5


grl_config_get_username ()

gchar *             grl_config_get_username             (GrlConfig *config);

config :

the config instance

Returns :

the username

Since 0.1.8


grl_config_has_param ()

gboolean            grl_config_has_param                (GrlConfig *config,
                                                         const gchar *param);

config :

the config instance

param :

the param

Returns :

TRUE if params has a defined value within config, FALSE otherwise.

Since 0.1.8


grl_config_set ()

void                grl_config_set                      (GrlConfig *config,
                                                         const gchar *param,
                                                         const GValue *value);

Set param value.

config :

the config instance

param :

a parameter

value :

value

Since 0.1.5


grl_config_set_api_key ()

void                grl_config_set_api_key              (GrlConfig *config,
                                                         const gchar *key);

Set the webservice API key in the configuration

config :

the config instance

key :

the API key

Since 0.1.4


grl_config_set_api_key_blob ()

void                grl_config_set_api_key_blob         (GrlConfig *config,
                                                         const guint8 *blob,
                                                         gsize size);

Set the binary API key in the configuration

config :

the config instance

blob :

the binary API key blob

size :

the size of the blob

Since 0.1.9


grl_config_set_api_secret ()

void                grl_config_set_api_secret           (GrlConfig *config,
                                                         const gchar *secret);

Set the webservice passphrase in the configuration

config :

the config instance

secret :

the webservice passphrase

Since 0.1.4


grl_config_set_api_token ()

void                grl_config_set_api_token            (GrlConfig *config,
                                                         const gchar *token);

Set the webservice API token in the configuration

config :

the config instance

token :

the API token

Since 0.1.4


grl_config_set_binary ()

void                grl_config_set_binary               (GrlConfig *config,
                                                         const gchar *param,
                                                         const guint8 *blob,
                                                         gsize size);

Set param value.

config :

the config instance

param :

a binary type parameter

blob :

a base64 encoded binary value

size :

size of value

Since 0.1.9


grl_config_set_boolean ()

void                grl_config_set_boolean              (GrlConfig *config,
                                                         const gchar *param,
                                                         gboolean value);

Set param value.

config :

the config instance

param :

a boolean type parameter

value :

a value

Since 0.1.8


grl_config_set_float ()

void                grl_config_set_float                (GrlConfig *config,
                                                         const gchar *param,
                                                         gfloat value);

Set param value.

config :

the config instance

param :

a float type parameter

value :

a value

Since 0.1.5


grl_config_set_int ()

void                grl_config_set_int                  (GrlConfig *config,
                                                         const gchar *param,
                                                         gint value);

Set param value.

config :

the config instance

param :

an integer type parameter

value :

a value

Since 0.1.5


grl_config_set_password ()

void                grl_config_set_password             (GrlConfig *config,
                                                         const gchar *password);

Set the password in the configuration

config :

the config instance

password :

the password

Since 0.1.8


grl_config_set_plugin ()

void                grl_config_set_plugin               (GrlConfig *config,
                                                         const gchar *plugin);

Set the plugin key in the configuration

config :

the config instance

plugin :

the plugin id

Since 0.1.4


grl_config_set_source ()

void                grl_config_set_source               (GrlConfig *config,
                                                         const gchar *source);

Set the source key in the configuration

config :

the config instance

source :

the source id

Since 0.1.4


grl_config_set_string ()

void                grl_config_set_string               (GrlConfig *config,
                                                         const gchar *param,
                                                         const gchar *value);

Set param value.

config :

the config instance

param :

a string type parameter

value :

a value

Since 0.1.5


grl_config_set_username ()

void                grl_config_set_username             (GrlConfig *config,
                                                         const gchar *username);

Set the username in the configuration

config :

the config instance

username :

the username

Since 0.1.8