Xfconf.Channel

g GObject.Object GObject.Object Xfconf.Channel Xfconf.Channel GObject.Object->Xfconf.Channel

Subclasses:

None

Methods

Inherited:

GObject.Object (37)

Structs:

GObject.ObjectClass (5)

class

get (channel_name)

class

new (channel_name)

class

new_with_property_base (channel_name, property_base)

get_arrayv (property)

get_bool (property, default_value)

get_double (property, default_value)

get_int (property, default_value)

get_named_struct (property, struct_name, value_struct)

get_properties (property_base)

get_property (property, value)

get_string (property, default_value)

get_string_list (property)

get_structv (property, value_struct, n_members, member_types)

get_uint (property, default_value)

get_uint64 (property, default_value)

has_property (property)

is_property_locked (property)

reset_property (property_base, recursive)

set_arrayv (property, values)

set_bool (property, value)

set_double (property, value)

set_int (property, value)

set_named_struct (property, struct_name, value_struct)

set_property (property, value)

set_string (property, value)

set_string_list (property, values)

set_structv (property, value_struct, n_members, member_types)

set_uint (property, value)

set_uint64 (property, value)

Virtual Methods

Inherited:

GObject.Object (7)

Properties

Name

Type

Flags

Short Description

channel-name

str

r/w/co

The name of the channel

is-singleton

bool

r/w/co

Whether or not this instance is a singleton

property-base

str

r/w/co

Base property path

Signals

Inherited:

GObject.Object (1)

Name

Short Description

property-changed

Emitted whenever a property on channel has changed.

Fields

Inherited:

GObject.Object (1)

Class Details

class Xfconf.Channel(**kwargs)
Bases:

GObject.Object

Abstract:

No

An opaque structure that holds state about a channel.

classmethod get(channel_name)
Parameters:

channel_name (str) – A channel name.

Returns:

An Xfconf.Channel singleton.

Return type:

Xfconf.Channel

Either creates a new channel, or fetches a singleton object for channel_name. This function always returns a valid object; no checking is done to see if the channel exists or has a valid name.

The reference count of the returned channel is owned by libxfconf.

New in version 4.5.91.

classmethod new(channel_name)
Parameters:

channel_name (str) – A channel name.

Returns:

A new Xfconf.Channel. Release with GObject.Object.unref() when no longer needed.

Return type:

Xfconf.Channel

Creates a new channel using name as the channel’s identifier. This function always returns a valid object; no checking is done to see if the channel exists or has a valid name.

Note: use of this function is not recommended, in favor of Xfconf.Channel.get(), which returns a singleton object and saves a little memory. However, Xfconf.Channel.new() can be useful in some cases where you want to tie an Xfconf.Channel's lifetime (and thus the lifetime of connected signals and bound GObject.Object properties) to the lifetime of another object.

Also note that each channel has its own cache, so if you create 2 new channels with the same name, it will double the dbus traffic, so in this cases it is highly recommended to use Xfconf.Channel.get().

classmethod new_with_property_base(channel_name, property_base)
Parameters:
  • channel_name (str) – A channel name.

  • property_base (str) – A property root name.

Returns:

A new Xfconf.Channel. Release with GObject.Object.unref() when no longer needed.

Return type:

Xfconf.Channel

Creates a new channel using name as the channel’s identifier, restricting the accessible properties to be rooted at property_base. This function always returns a valid object; no checking is done to see if the channel exists or has a valid name.

New in version 4.5.92.

get_arrayv(property)
Parameters:

property (str) – A property string.

Returns:

A newly-allocated GLib.PtrArray on success, or None on failure.

Return type:

[GObject.Value] or None

Gets an array property on self and returns it as a GLib.PtrArray, which can be freed with Xfconf.array_free() when no longer needed.

get_bool(property, default_value)
Parameters:
  • property (str) – A property name.

  • default_value (bool) – A fallback value.

Returns:

The boolean value, or, if property is not in self, default_value is returned.

Return type:

bool

Retrieves the boolean value associated with property on self.

get_double(property, default_value)
Parameters:
  • property (str) – A property name.

  • default_value (float) – A fallback value.

Returns:

The double value, or, if property is not in self, default_value is returned.

Return type:

float

Retrieves the double value associated with property on self.

get_int(property, default_value)
Parameters:
  • property (str) – A property name.

  • default_value (int) – A fallback value.

Returns:

The int value, or, if property is not in self, default_value is returned.

Return type:

int

Retrieves the int value associated with property on self.

get_named_struct(property, struct_name, value_struct)
Parameters:
  • property (str) – A string property name.

  • struct_name (str) – A string struct name.

  • value_struct (object or None) – A pointer to a struct.

Returns:

True if the property was retrieved successfully, False otherwise.

Return type:

bool

Gets a property from self and fills in value_struct using the retrieved values. The struct_name parameter is the same name that must have been used to register the struct’s layout with Xfconf.named_struct_register().

get_properties(property_base)
Parameters:

property_base (str) – The base property name of properties to retrieve.

Returns:

A newly-allocated GLib.HashTable, which should be freed with GLib.HashTable.destroy() when no longer needed.

Return type:

{str: GObject.Value}

Retrieves multiple properties from self and stores them in a GLib.HashTable in which the keys correspond to the string (str *) property names, and the values correspond to variant (GObject.Value *) values. The keys and values are owned by the hash table and should be copied if needed. The value of the property specified by property_base (if it exists) and all sub-properties are retrieved. To retrieve all properties in the channel, specify “/” or None for property_base.

get_property(property, value)
Parameters:
Returns:

True if the property was retrieved successfully, False otherwise.

Return type:

bool

Gets a property on self and stores it in value. The caller is responsible for calling GObject.Value.unset() when finished with value.

This function can be called with an initialized or uninitialized value. If value is initialized to a particular type, libxfconf will attempt to convert the value returned from the configuration store to that type if they don’t match. If the value type returned from the configuration store is an array type, each element of the array will be converted to the type of value. If value is uninitialized, the value in the configuration store will be returned in its native type.

get_string(property, default_value)
Parameters:
  • property (str) – A property name.

  • default_value (str) – A fallback value.

Returns:

A newly-allocated string which should be freed with GLib.free() when no longer needed. If property is not in self, a GLib.strdup()ed copy of default_value is returned.

Return type:

str

Retrieves the string value associated with property on self.

get_string_list(property)
Parameters:

property (str) – A property name.

Returns:

A newly-allocated string list which should be freed with GLib.strfreev() when no longer needed. If property is not in self, None is returned.

Return type:

[str]

Retrieves the string list value associated with property on self.

get_structv(property, value_struct, n_members, member_types)
Parameters:
  • property (str) – A string property name.

  • value_struct (object or None) – A pointer to a struct in which to store values.

  • n_members (int) – The number of data members in the struct.

  • member_types (GObject.GType) – An array of n_members GObject.GType s.

Returns:

True if the property was retrieved successfully, False oherwise.

Return type:

bool

Gets a property on self and stores it as members of the value_struct struct. The member_types array should hold a GObject.GType for each member of the struct.

Note: Struct members can only be non-pointer types such as int, boolean, double, etc.

get_uint(property, default_value)
Parameters:
  • property (str) – A property name.

  • default_value (int) – A fallback value.

Returns:

The uint value, or, if property is not in self, default_value is returned.

Return type:

int

Retrieves the unsigned int value associated with property on self.

get_uint64(property, default_value)
Parameters:
  • property (str) – A property name.

  • default_value (int) – A fallback value.

Returns:

The uint64 value, or, if property is not in self, default_value is returned.

Return type:

int

Retrieves the 64-bit int value associated with property on self.

has_property(property)
Parameters:

property (str) – A property name.

Returns:

True if property exists, False otherwise.

Return type:

bool

Checks to see if property exists on self.

is_property_locked(property)
Parameters:

property (str) – A property name.

Returns:

True if the property is locked, False otherwise.

Return type:

bool

Queries whether or not property on self is locked by system policy. If the property is locked, calls to Xfconf.Channel.set_property() (or any of the “set” family of functions) or Xfconf.Channel.reset_property() will fail.

New in version 4.5.91.

reset_property(property_base, recursive)
Parameters:
  • property_base (str) – A property tree root or property name.

  • recursive (bool) – Whether to reset properties recursively.

Resets properties starting at (and including) property_base. If recursive is True, will also reset all properties that are under property_base in the property hierarchy.

A bit of an explanation as to what this function actually does: Since Xfconf backends are expected to support setting defaults via what you might call “optional schema,” you can’t really “remove” properties. Since the client library can’t know if a channel provides default values (or even if the backend supports it!), at best it can only reset properties to their default values.

The property_base parameter can be None or the empty string (“”), in which case the channel root (“/”) will be assumed. Of course, True must be passed for recursive in this case.

New in version 4.5.91.

set_arrayv(property, values)
Parameters:
Returns:

True if the property was set successfully, False otherwise.

Return type:

bool

Sets an array property on self, using the values in the provided values array.

set_bool(property, value)
Parameters:
  • property (str) – A property name.

  • value (bool) – The value to set.

Returns:

True on success, False if an error occured.

Return type:

bool

Sets value for property on self in the configuration store.

set_double(property, value)
Parameters:
  • property (str) – A property name.

  • value (float) – The value to set.

Returns:

True on success, False if an error occured.

Return type:

bool

Sets value for property on self in the configuration store.

set_int(property, value)
Parameters:
  • property (str) – A property name.

  • value (int) – The value to set.

Returns:

True on success, False if an error occured.

Return type:

bool

Sets value for property on self in the configuration store.

set_named_struct(property, struct_name, value_struct)
Parameters:
  • property (str) – A string property name.

  • struct_name (str) – A string struct name.

  • value_struct (object or None) – A pointer to a struct.

Returns:

True if the property was set successfully, False otherwise.

Return type:

bool

Sets a property on self using the members of value_struct as the array of values. The struct_name parameter is the same name that must have been used to register the struct’s layout with Xfconf.named_struct_register().

set_property(property, value)
Parameters:
Returns:

True if the property was set successfully, False otherwise.

Return type:

bool

Sets the value stored in value to a property on self.

Note: The configuration store backend almost certainly supports only a restricted set of value types.

set_string(property, value)
Parameters:
  • property (str) – A property name.

  • value (str) – The value to set.

Returns:

True on success, False if an error occured.

Return type:

bool

Sets value for property on self in the configuration store.

set_string_list(property, values)
Parameters:
  • property (str) – A property name.

  • values (str) – The value to set.

Returns:

True on success, False if an error occured.

Return type:

bool

Sets values for property on self in the configuration store.

set_structv(property, value_struct, n_members, member_types)
Parameters:
  • property (str) – A string property name.

  • value_struct (object or None) – A pointer to a struct from which to take values.

  • n_members (int) – The number of data members in the struct.

  • member_types (GObject.GType) – An array of n_members GObject.GType s.

Returns:

True if the property was set successfully, False oherwise.

Return type:

bool

Sets a property on self using the members of value_struct as a value array. The member_types array should hold a GObject.GType for each member of the struct.

set_uint(property, value)
Parameters:
  • property (str) – A property name.

  • value (int) – The value to set.

Returns:

True on success, False if an error occured.

Return type:

bool

Sets value for property on self in the configuration store.

set_uint64(property, value)
Parameters:
  • property (str) – A property name.

  • value (int) – The value to set.

Returns:

True on success, False if an error occured.

Return type:

bool

Sets value for property on self in the configuration store.

Signal Details

Xfconf.Channel.signals.property_changed(channel, property, value)
Signal Name:

property-changed

Flags:

RUN_LAST, DETAILED

Parameters:
  • channel (Xfconf.Channel) – The object which received the signal

  • property (str) – The property that changed.

  • value (GObject.Value) – The new value.

Emitted whenever a property on channel has changed. If the change was caused by the removal of property, value will be unset; you should test this with

G_VALUE_TYPE(value) == G_TYPE_INVALID

Property Details

Xfconf.Channel.props.channel_name
Name:

channel-name

Type:

str

Default Value:

None

Flags:

READABLE, WRITABLE, CONSTRUCT_ONLY

The string identifier used for this channel.

Xfconf.Channel.props.is_singleton
Name:

is-singleton

Type:

bool

Default Value:

True

Flags:

READABLE, WRITABLE, CONSTRUCT_ONLY

Identifies the instance of the class as a singleton instance or not. This is mainly used internally by Xfconf.Channel but may be useful for API users.

Xfconf.Channel.props.property_base
Name:

property-base

Type:

str

Default Value:

None

Flags:

READABLE, WRITABLE, CONSTRUCT_ONLY

The string identifier used for the property base inside a channel. This can be used to restrict a channel to a subset of properties.