| Top |
| TlmConfig * | tlm_config_new () |
| gint | tlm_config_get_int () |
| void | tlm_config_set_int () |
| guint | tlm_config_get_uint () |
| void | tlm_config_set_uint () |
| const gchar * | tlm_config_get_string () |
| const gchar * | tlm_config_get_string_default () |
| void | tlm_config_set_string () |
| gboolean | tlm_config_get_boolean () |
| void | tlm_config_set_boolean () |
| gboolean | tlm_config_has_group () |
| gboolean | tlm_config_has_key () |
| GHashTable * | tlm_config_get_group () |
| void | tlm_config_reload () |
TlmConfig holds configuration information as a set of keys and values (integer or strings). The key names are defined in
General config keys.Note that authentication and account plugins may use plugin-specific configuration keys; see plugins' documentation for specifics.
The configuration is retrieved from the tlm configuration file. See below for where the file is searched for.
Following code snippet demonstrates how to create and use config object:
TlmConfig* config = tlm_config_new (); const gchar *str = tlm_config_get_string (config, TLM_CONFIG_GENERAL, TLM_CONFIG_GENERAL_PAM_SERVICE, 0); g_object_unref(config);
If tlm has been compiled with --enable-debug, then these locations are used, in decreasing order of priority:
TLM_CONF_FILE environment variable
g_get_user_config_dir() + "tlm.conf"
each of g_get_system_config_dirs() + "tlm.conf"
Otherwise, the config file location is determined at compilation time as $(sysconfdir) + "tlm.conf"
See example configuration file here:
tlm configuration filegint tlm_config_get_int (TlmConfig *self,const gchar *group,const gchar *key,gint retval);
Get an integer configuration value.
self |
an instance of TlmConfig. |
[transfer none] |
group |
the group name |
|
key |
the key name |
|
retval |
value to be returned in case key is not found |
void tlm_config_set_int (TlmConfig *self,const gchar *group,const gchar *key,gint value);
Sets the configuration value to the provided integer.
self |
an instance of TlmConfig. |
[transfer none] |
group |
the group name |
|
key |
the key name |
|
value |
the value |
guint tlm_config_get_uint (TlmConfig *self,const gchar *group,const gchar *key,guint retval);
Get an unsigned integer configuration value.
self |
an instance of TlmConfig. |
[transfer none] |
group |
the group name. |
[transfer none] |
key |
the key name. |
[transfer none] |
retval |
value to be returned in case key is not found |
void tlm_config_set_uint (TlmConfig *self,const gchar *group,const gchar *key,guint value);
Sets the configuration value to the provided unsigned integer.
self |
an instance of TlmConfig. |
[transfer none] |
group |
the group name. |
[transfer none] |
key |
the key name |
|
value |
the value |
const gchar * tlm_config_get_string (TlmConfig *self,const gchar *group,const gchar *key);
Get a string configuration value.
self |
an instance of TlmConfig. |
[transfer none] |
group |
the group name, NULL refers to General. |
[transfer none] |
key |
the key name. |
[transfer none] |
const gchar * tlm_config_get_string_default (TlmConfig *self,const gchar *group,const gchar *key,const gchar *value);
Get a string configuration value.
self |
an instance of TlmConfig. |
[transfer none] |
group |
the group name, NULL refers to General. |
[transfer none] |
key |
the key name. |
[transfer none] |
value |
default value. |
[transfer none] |
void tlm_config_set_string (TlmConfig *self,const gchar *group,const gchar *key,const gchar *value);
Sets the configuration value to the provided string.
self |
an instance of TlmConfig. |
[transfer none] |
group |
the group name. |
[transfer none] |
key |
the key name. |
[transfer none] |
value |
the value. |
[transfer none] |
gboolean tlm_config_get_boolean (TlmConfig *self,const gchar *group,const gchar *key,gboolean retval);
Get a boolean configuration value.
self |
an instance of TlmConfig. |
[transfer none] |
group |
the group name. |
[transfer none] |
key |
the key name. |
[transfer none] |
retval |
value to be returned in case key is not found |
void tlm_config_set_boolean (TlmConfig *self,const gchar *group,const gchar *key,gboolean value);
Sets the configuration value to the provided value.
self |
an instance of TlmConfig. |
[transfer none] |
group |
the group name |
|
key |
the key name |
|
value |
the value |
gboolean tlm_config_has_group (TlmConfig *self,const gchar *group);
Checks if any configuration available for group.
gboolean tlm_config_has_key (TlmConfig *self,const gchar *group,const gchar *key);
Checks if key is in given group.
GHashTable * tlm_config_get_group (TlmConfig *self,const gchar *group);
Retrives the configuration in given group as GHashTable