Details
enum GConfValueType
typedef enum {
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;
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()
#define gconf_value_get_string(x) ((const gchar*)((x)->d.string_data)) |
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()
#define gconf_value_get_int(x) ((x)->d.int_data) |
Returns a gint for a GConfValue with type GCONF_VALUE_INT.
gconf_value_get_float()
#define gconf_value_get_float(x) ((x)->d.float_data) |
Returns a gdouble for a GConfValue with type GCONF_VALUE_DOUBLE.
gconf_value_get_list_type()
#define gconf_value_get_list_type(x) ((x)->d.list_data.type) |
Returns the type of the list elements in a GConfValue with type
GCONF_VALUE_LIST.
gconf_value_get_list()
#define gconf_value_get_list(x) ((x)->d.list_data.list) |
Returns a GSList containing GConfValue objects. Each GConfValue in
the returned list will have the type returned by
gconf_value_get_list_type(). Remember that the empty GSList is equal to
NULL. The list is not a copy; it is "owned" by the
GConfValue and will be destroyed when the GConfValue is destroyed.
gconf_value_get_car()
#define gconf_value_get_car(x) ((x)->d.pair_data.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()
#define gconf_value_get_cdr(x) ((x)->d.pair_data.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_bool()
#define gconf_value_get_bool(x) ((x)->d.bool_data) |
Returns a gboolean for a GConfValue with type GCONF_VALUE_BOOL.
gconf_value_get_schema()
#define gconf_value_get_schema(x) ((x)->d.schema_data) |
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 ()
void gconf_value_set_int (GConfValue *value,
gint the_int); |
Sets the value of a GConfValue with type GCONF_VALUE_INT.
gconf_value_set_string ()
void gconf_value_set_string (GConfValue *value,
const gchar *the_str); |
Sets the value of a GConfValue with type
GCONF_VALUE_STRING. the_str is copied.
gconf_value_set_float ()
void gconf_value_set_float (GConfValue *value,
gdouble the_float); |
Sets the value of a GConfValue with type
GCONF_VALUE_FLOAT.
gconf_value_set_bool ()
void gconf_value_set_bool (GConfValue *value,
gboolean the_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_nocopy ()
void gconf_value_set_list_nocopy (GConfValue *value,
GSList *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 does
not copy the list; the GConfValue will take
ownership of the list and its contents, and they will be destroyed
when the GConfValue is destroyed. Alternatively, use
gconf_value_set_list() to make a copy.
gconf_value_set_list ()
void gconf_value_set_list (GConfValue *value,
GSList *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()
#define gconf_meta_info_get_schema(x) ((const gchar*)(x)->schema) |
gconf_meta_info_get_mod_user()
#define gconf_meta_info_get_mod_user(x) ((x)->mod_user) |
gconf_meta_info_mod_time()
#define gconf_meta_info_mod_time(x) ((x)->mod_time) |
gconf_meta_info_set_schema ()
void gconf_meta_info_set_schema (GConfMetaInfo *gcmi,
const gchar *schema_name); |
gconf_meta_info_set_mod_user ()
void gconf_meta_info_set_mod_user (GConfMetaInfo *gcmi,
const gchar *mod_user); |
gconf_meta_info_set_mod_time ()
void gconf_meta_info_set_mod_time (GConfMetaInfo *gcmi,
GTime mod_time); |
struct GConfEntry
struct GConfEntry {
gchar* key;
GConfValue* value;
gchar* schema_name;
guint is_default : 1;
guint is_writable : 1;
}; |
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()
#define gconf_entry_get_key(x) ((const gchar*)(x)->key) |
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()
#define gconf_entry_get_value(x) ((x)->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()
#define gconf_entry_get_is_default(x) ((x)->is_default) |
gconf_entry_get_schema_name()
#define gconf_entry_get_schema_name(x) ((const gchar*)(x)->schema_name) |
gconf_entry_set_is_default ()
void gconf_entry_set_is_default (GConfEntry *entry,
gboolean is_default); |
gconf_entry_set_schema_name ()
void gconf_entry_set_schema_name (GConfEntry *entry,
const gchar *name); |
gconf_entry_set_value_nocopy ()