Description
GConfValue stores one of the value types GConf understands; GConf
uses GConfValue to pass values around because it doesn't know the
type of its values at compile time.
A GConfEntry pairs a relative key
name with a value, for example if the value "10" is stored at the key
"/foo/bar/baz", the GConfEntry will store "baz" and "10".
A GConfMetaInfo object holds metainformation about a key, such as
its last modification time and the name of the schema associated with
it. You should rarely if ever need to use GConfMetaInfo.
(In fact you can't get the metainfo for a key using the current API.)
Details
enum GConfValueType
typedef enum { /*< prefix=GCONF_VALUE >*/
GCONF_VALUE_INVALID,
GCONF_VALUE_STRING,
GCONF_VALUE_INT,
GCONF_VALUE_FLOAT,
GCONF_VALUE_BOOL,
GCONF_VALUE_SCHEMA,
/* unfortunately these aren't really types; we want list_of_string,
list_of_int, etc. but it's just too complicated to implement.
instead we'll complain in various places if you do something
moronic like mix types in a list or treat pair<string,int> and
pair<float,bool> as the same type. */
GCONF_VALUE_LIST,
GCONF_VALUE_PAIR
} GConfValueType; |
Used to indicate the type of a GConfValue.
struct GConfValue
struct GConfValue {
GConfValueType type;
/* this is all PRIVATE dangit */
union {
gchar* string_data;
gint int_data;
gboolean bool_data;
gdouble float_data;
GConfSchema* schema_data;
struct {
GConfValueType type;
GSList* list;
} list_data;
struct {
GConfValue* car;
GConfValue* cdr;
} pair_data;
} d;
}; |
Represents a dynamically-typed value. The type field tells you the
type of the value; the other fields should be accessed with the
accessor functions and macros.
A GConfValue should always
be initialized before use. That is, you should not use a GConfValue
unless you have called one of the functions beginning with
"gconf_value_set_".. For lists, initialization has two
steps: first you must set the list element type, then you must set the
list value.
GCONF_VALUE_TYPE_VALID()
#define GCONF_VALUE_TYPE_VALID(x) (((x) > GCONF_VALUE_INVALID) && ((x) <= GCONF_VALUE_PAIR)) |
gconf_value_new ()
Creates a new GConfValue with type type. The type is immutable after
creation; values have a fixed type. You must
initialize the GConfValue after creation; that is, you must set its
value with one of the "setter" functions.
gconf_value_copy ()
Copies a GConfValue. The copy is a deep copy, that is, any allocated
memory inside the GConfValue will also be copied.
gconf_value_free ()
Deallocates a GConfValue. Also deallocates any allocated memory
inside the GConfValue (such as lists, pair members, strings, and schemas).
gconf_value_get_string ()
const char* gconf_value_get_string (const GConfValue *value); |
Returns a const gchar* for a GConfValue with type
GCONF_VALUE_STRING. The returned string is not a
copy, don't try to free it. It is "owned" by the GConfValue and will
be destroyed when the GConfValue is destroyed.
If the GConfValue is not initialized (i.e. no one has called
gconf_value_set_string()) then the string may be
NULL, but of course you should not try to use an
uninitialized GConfValue.
gconf_value_get_int ()
int gconf_value_get_int (const GConfValue *value); |
Returns a gint for a GConfValue with type GCONF_VALUE_INT.
gconf_value_get_float ()
double gconf_value_get_float (const GConfValue *value); |
Returns a gdouble for a GConfValue with type GCONF_VALUE_DOUBLE.
gconf_value_get_list_type ()
Returns the type of the list elements in a GConfValue with type
GCONF_VALUE_LIST.
gconf_value_get_car ()
Returns the first member (car) of a GConfValue with type
GCONF_VALUE_PAIR. The car is another GConfValue, with a primitive
type (bool, int, float, string, schema).
The returned value is not a copy; it is "owned" by the pair and will
be destroyed when the pair is destroyed.
gconf_value_get_cdr ()
Returns the second member (cdr) of a GConfValue with type
GCONF_VALUE_PAIR. The cdr is another GConfValue, with a primitive
type (bool, int, float, string, schema).
The returned value is not a copy; it is "owned" by the pair and will
be destroyed when the pair is destroyed.
gconf_value_get_schema ()
Returns a GConfSchema for a GConfValue with type
GCONF_VALUE_SCHEMA. If the GConfValue is uninitialized, it
may return NULL; but of course you should have
initialized the GConfValue. The GConf library will not return values
with a NULL schema.
The returned value is not a copy; it is "owned" by the GConfValue and will
be destroyed when the GConfValue is destroyed.
gconf_value_set_int ()
Sets the value of a GConfValue with type GCONF_VALUE_INT.
gconf_value_set_string ()
Sets the value of a GConfValue with type
GCONF_VALUE_STRING. the_str is copied.
gconf_value_set_float ()
Sets the value of a GConfValue with type
GCONF_VALUE_FLOAT.
gconf_value_set_bool ()
Sets the value of a GConfValue with type
GCONF_VALUE_BOOL.
gconf_value_set_list_type ()
Sets the type of the elements in a GConfValue of type
GCONF_VALUE_LIST. All the elements in the list must have the same
type. You must set the list type before you can set the list value.
gconf_value_set_list ()
Sets the value of a GConfValue with type GCONF_VALUE_LIST. The
list argument should be a GSList of GConfValue. Each GConfValue in
the list must have the same type, and this type must be specified in
advance with gconf_value_set_list_type(). This function copies the
list; it will not modify the list argument.
gconf_value_to_string ()
Creates a human-readable string representation of a GConfValue. This
is intended for debugging and the like; the string representation is
not suitable for reliable machine parsing (that is, you shouldn't use
this function to save a value to a file or anything like that). The
exact nature of the string representation may change in future
versions. The returned string is newly-allocated and must be freed
with g_free().
struct GConfMetaInfo
struct GConfMetaInfo {
gchar* schema;
gchar* mod_user; /* user owning the daemon that made the last modification */
GTime mod_time; /* time of the modification */
}; |
gconf_meta_info_get_schema ()
gconf_meta_info_get_mod_user ()
gconf_meta_info_mod_time ()
gconf_meta_info_set_schema ()
gconf_meta_info_set_mod_user ()
gconf_meta_info_set_mod_time ()
struct GConfEntry
struct GConfEntry {
char *key;
#if 0
GConfValue *value;
char *schema_name;
int pad1;
gpointer pad2;
gpointer pad3;
GTime pad4;
int refcount;
guint is_default : 1;
guint is_writable : 1;
guint pad5 : 1;
guint pad6 : 1;
guint pad7 : 1;
#endif
}; |
Stores an entry from a GConf "directory," including a key-value pair,
the name of the schema applicable to this entry, whether the value is
a default value, and whether GConf can write a new value at this
key. key should be an absolute key, not a relative key. (Note that
internally GConf breaks this rule sometimes; but in the public
interface, key is always an absolute key.) To access the key and
value, use gconf_entry_get_key() and gconf_entry_get_value().
Warning |
Value can be NULL, indicating that the
value is not set. |
gconf_entry_new_nocopy ()
Creates a new GConfEntry with key key and value val. key should be a full
path to the key, starting with '/'. Neither the key nor the value is copied;
both are freed when the GConfEntry is freed. The string will be freed with
g_free() so should be allocated with a GLib function, not malloc().
gconf_entry_free ()
Destroys a GConfEntry, freeing the key, the value, and the entry itself.
gconf_entry_get_key ()
const char* gconf_entry_get_key (const GConfEntry *entry); |
Accesses the key field of a GConfEntry. The returned key is not a
copy, and should not be freed or modified.
gconf_entry_get_value ()
Accesses the value field of a GConfEntry. The returned value is not
a copy, and should not be freed or modified. If you have called
gconf_entry_steal_value(), the returned value will be
NULL.
gconf_entry_get_is_default ()
gconf_entry_get_schema_name ()
const char* gconf_entry_get_schema_name (const GConfEntry *entry); |
gconf_entry_set_is_default ()
gconf_entry_set_schema_name ()
gconf_entry_set_value_nocopy ()