Libxfce4util.Rc¶
Fields¶
None
Methods¶
class |
|
class |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Details¶
- class Libxfce4util.Rc¶
- classmethod config_open(type, resource, readonly)¶
- Parameters:
type (
Libxfce4util.ResourceType
) – The resource type being openedresource (
str
) – The resource name to openreadonly (
bool
) – whether to open resource readonly.
- Returns:
the newly created
Libxfce4util.Rc
object, orNone
on error.- Return type:
If readonly is
True
parsing is generally faster, because only untranslated entries and entries that match the current locale will be loaded. Also if you passTrue
for readonly, #xfce_rc_config will fail if resource does not reference a regular file.It is no error if readonly is
False
and the file referenced by resource does not exists. In this case you’ll start with a fresh config, which contains only the default group and no entries.New in version 4.2.
- classmethod simple_open(filename, readonly)¶
- Parameters:
- Returns:
the newly created
Libxfce4util.Rc
object, orNone
on error.- Return type:
Parses the resource config file specified by filename.
If readonly is
True
parsing is generally faster, because only untranslated entries and entries that match the current locale will be loaded. Also if you passTrue
for readonly,Libxfce4util.Rc.simple_open
will fail if filename does not reference a regular file.It is no error if readonly is
False
and the file referenced by filename does not exists. In this case you’ll start with a fresh config, which contains only the default group and no entries.New in version 4.2.
- close()¶
Destructs self.
If self was opened read-write and contains dirty (modified) entries, these will be flushed to permanent storage first.
New in version 4.2.
- delete_entry(key, global_)¶
-
Similar to
Libxfce4util.Rc.delete_group
, but works on an entry in the current group.New in version 4.2.
- delete_group(group, global_)¶
- Parameters:
If self is a simple config object and group exists, it is deleted. All entries within group will be deleted. For simple config objects, global is ignored.
If self is a complex config object and group exists, it will be deleted will all entries. If global is
True
, the entry will be marked as deleted globally, therefore all calls toLibxfce4util.Rc.read_entry
and related functions will return the fallback values. If global isFalse
, the group will be deleted in the per-user config file, and further calls toLibxfce4util.Rc.read_entry
will most probably return the system-wide config entries.New in version 4.2.
- flush()¶
Flushes all changes that currently reside only in memory back to permanent storage. Dirty configuration entries are written in the most specific file available.
New in version 4.2.
- get_entries(group)¶
- Parameters:
group (
str
) – the name of the group to get entries from.- Returns:
a
None
-terminated string array with all entries in group. Has to be freed usingGLib.strfreev
() if no longer needed. If the specified group does not exists,None
is returned. If the group has no entries, an empty string array is returned.- Return type:
[
str
]
Returns the names of all entries in group if any.
None
is a valid input value for group.Libxfce4util.Rc.get_entries
will then return all entries in the so called “None
group”. Though this “None
group” should only be used for backward compatibility with old applications. You should not use it in newly written code.New in version 4.2.
- get_group()¶
- Returns:
the name of the current group.
- Return type:
Returns the name of the group in which we are searching for keys and from which we are retrieving entries. If the currently active group is the default group (the so called “
None
group”),None
will be returned.New in version 4.2.
- get_groups()¶
- Returns:
a
None
-terminated string array will the names of all groups in self. Should be freed usingGLib.strfreev
() when no longer needed.- Return type:
[
str
]
Returns the names of all known groups in self.
Since the default groups (the “
None
group”) name isNone
, it will not be returned with this functions. But it does not matter at all, since the default group is known to always exist.New in version 4.2.
- get_locale()¶
- Returns:
a string representing the current locale.
- Return type:
Returns current locale used by self to lookup translated entries.
New in version 4.2.
- has_entry(key)¶
- Parameters:
key (
str
) – the key to search for.- Returns:
- Return type:
Checks whether the key has an entry in the current group.
New in version 4.2.
- has_group(group)¶
-
Returns
True
if the specified group is known about.New in version 4.2.
- is_dirty()¶
-
Checks whether self has any dirty (modified) entries.
New in version 4.2.
- is_readonly()¶
- Returns:
the read-only status.
- Return type:
Returns the read-only status of self.
New in version 4.2.
- read_bool_entry(key, fallback)¶
- Parameters:
- Returns:
the value for this key.
- Return type:
Reads the value of an entry specified by key in the current group and interpret it as a boolean value. Currently “on”, “true” and “yes” are accepted as true, everything else is false.
New in version 4.2.
- read_entry(key, fallback)¶
- Parameters:
- Returns:
the value for this key, or fallback if key was not found.
- Return type:
Reads the value of an entry specified by key in the current group.
New in version 4.2.
- read_entry_untranslated(key, fallback)¶
- Parameters:
- Returns:
the untranslated value for this key, or fallback if key was not found.
- Return type:
Reads the value of an entry specified by key in the current group. The untranslated entry is returned. You normally do not need this.
New in version 4.2.
- read_int_entry(key, fallback)¶
- Parameters:
- Returns:
the value for this key.
- Return type:
Reads the value of an entry specified by key in the current group and interprets it as an integer value.
New in version 4.2.
- read_list_entry(key, delimiter)¶
-
Reads a list of strings in the entry specified by key in the current group. The returned list has to be freed using
GLib.strfreev
() when no longer needed.This does not support delimiter escaping. If you need this feature, use
GLib.KeyFile.get_string_list
() instead.New in version 4.2.
- rollback()¶
Mark self as “clean”, i.e. don’t write dirty entries at destruction time. If you then call
Libxfce4util.Rc.write_entry
again, the dirty flag is set again and dirty entries will be written at a subsequentLibxfce4util.Rc.flush
call.New in version 4.2.
- set_group(group)¶
-
Specifies the group in which keys will be read and written. Subsequent calls to
Libxfce4util.Rc.read_entry
andLibxfce4util.Rc.write_entry
will be applied only in the active group.If group references a group that does not exists, it will be created for you. But note, that empty groups will not be synced to permanent storage.
New in version 4.2.
- write_bool_entry(key, value)¶
-
Wrapper for
Libxfce4util.Rc.write_entry
, that stores a boolean value.New in version 4.2.
- write_entry(key, value)¶
-
Writes a key/value pair. This has no effect if the resource config was opened readonly, else the value will be written to permanent storage on the next call to
Libxfce4util.Rc.flush
or when self is destroyed usingLibxfce4util.Rc.close
.If self was opened using
Libxfce4util.Rc.config_open
, the value will be written to the most specific config file.New in version 4.2.
- write_int_entry(key, value)¶
-
Wrapper for
Libxfce4util.Rc.write_entry
, that stores an integer value.New in version 4.2.
- write_list_entry(key, value, separator)¶
- Parameters:
Wrapper for
Libxfce4util.Rc.write_entry
, that stores a string list value.This does not support delimiter escaping. If you need this feature, use
GLib.KeyFile.set_string_list
() instead.New in version 4.2.