| Tizen Login Manager Reference Manual | ||||
|---|---|---|---|---|
| Top | Description | Object Hierarchy | ||||
#include <tlm-config.h> struct TlmConfig; struct TlmConfigClass; gboolean tlm_config_get_boolean (TlmConfig *self,const gchar *group,const gchar *key,gboolean retval); GHashTable * tlm_config_get_group (TlmConfig *self,const gchar *group); gint tlm_config_get_int (TlmConfig *self,const gchar *group,const gchar *key,gint retval); const gchar * tlm_config_get_string (TlmConfig *self,const gchar *group,const gchar *key); guint tlm_config_get_uint (TlmConfig *self,const gchar *group,const gchar *key,guint retval); gboolean tlm_config_has_group (TlmConfig *self,const gchar *group); gboolean tlm_config_has_key (TlmConfig *self,const gchar *group,const gchar *key); TlmConfig * tlm_config_new (); void tlm_config_reload (TlmConfig *self); void tlm_config_set_boolean (TlmConfig *self,const gchar *group,const gchar *key,gboolean value); void tlm_config_set_int (TlmConfig *self,const gchar *group,const gchar *key,gint value); void tlm_config_set_string (TlmConfig *self,const gchar *group,const gchar *key,const gchar *value); void tlm_config_set_uint (TlmConfig *self,const gchar *group,const gchar *key,guint value);
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 file
struct TlmConfigClass {
GObjectClass parent_class;
};
Opaque structure for the class.
gboolean tlm_config_get_boolean (TlmConfig *self,const gchar *group,const gchar *key,gboolean retval);
Get a boolean configuration value.
|
an instance of TlmConfig. [transfer none] |
|
the group name. [transfer none] |
|
the key name. [transfer none] |
|
value to be returned in case key is not found |
Returns : |
the value corresponding to the key as boolean. If the key does not exist or cannot be converted to boolean, retval is returned. |
GHashTable * tlm_config_get_group (TlmConfig *self,const gchar *group);
Retrives the configuration in given group as GHashTable
|
an instance of TlmConfig. [transfer none] |
|
the group name |
Returns : |
the key, value paired dictionary if found, NULL otherwise. [transfer none] |
gint tlm_config_get_int (TlmConfig *self,const gchar *group,const gchar *key,gint retval);
Get an integer configuration value.
|
an instance of TlmConfig. [transfer none] |
|
the group name |
|
the key name |
|
value to be returned in case key is not found |
Returns : |
the value corresponding to the key as an integer. If the key does not exist or cannot be converted to the integer, retval is returned. |
const gchar * tlm_config_get_string (TlmConfig *self,const gchar *group,const gchar *key);
Get a string configuration value.
|
an instance of TlmConfig. [transfer none] |
|
the group name, NULL refers to General. [transfer none] |
|
the key name. [transfer none] |
Returns : |
the value corresponding to the key as an string. If the key does not exist or cannot be converted to the integer, NULL is returned. |
guint tlm_config_get_uint (TlmConfig *self,const gchar *group,const gchar *key,guint retval);
Get an unsigned integer configuration value.
|
an instance of TlmConfig. [transfer none] |
|
the group name. [transfer none] |
|
the key name. [transfer none] |
|
value to be returned in case key is not found |
Returns : |
the value corresponding to the key as an unsigned integer. If the key does not exist or cannot be converted to the integer, retval is returned. |
gboolean tlm_config_has_group (TlmConfig *self,const gchar *group);
Checks if any configuration available for group.
|
an instance of TlmConfig. [transfer none] |
|
the group name |
Returns : |
TRUE if found, FALSE otherwise. |
gboolean tlm_config_has_key (TlmConfig *self,const gchar *group,const gchar *key);
Checks if key is in given group.
|
an instance of TlmConfig. [transfer none] |
|
the group name |
|
the key name |
Returns : |
TRUE, if found, FALSE otherwise. |
TlmConfig * tlm_config_new ();
Create a TlmConfig object.
Returns : |
an instance of TlmConfig. |
void tlm_config_reload (TlmConfig *self);
Reloads the configuration.
|
an instance of TlmConfig. [transfer none] |
void tlm_config_set_boolean (TlmConfig *self,const gchar *group,const gchar *key,gboolean value);
Sets the configuration value to the provided value.
|
an instance of TlmConfig. [transfer none] |
|
the group name |
|
the key name |
|
the value |
void tlm_config_set_int (TlmConfig *self,const gchar *group,const gchar *key,gint value);
Sets the configuration value to the provided integer.
|
an instance of TlmConfig. [transfer none] |
|
the group name |
|
the key name |
|
the value |
void tlm_config_set_string (TlmConfig *self,const gchar *group,const gchar *key,const gchar *value);
Sets the configuration value to the provided string.
|
an instance of TlmConfig. [transfer none] |
|
the group name. [transfer none] |
|
the key name. [transfer none] |
|
the value. [transfer none] |
void tlm_config_set_uint (TlmConfig *self,const gchar *group,const gchar *key,guint value);
Sets the configuration value to the provided unsigned integer.
|
an instance of TlmConfig. [transfer none] |
|
the group name. [transfer none] |
|
the key name |
|
the value |