Gda.Set

g GObject.Object GObject.Object Gda.Set Gda.Set GObject.Object->Gda.Set

Subclasses:

Gda.DataModelIter

Methods

Inherited:

GObject.Object (37)

Structs:

GObject.ObjectClass (5)

class

error_quark ()

class

new (holders)

class

new_from_spec_node (xml_spec)

class

new_from_spec_string (xml_spec)

class

new_read_only (holders)

add_holder (holder)

copy ()

get_group (holder)

get_holder (holder_id)

get_holder_value (holder_id)

get_node (holder)

get_nth_holder (pos)

get_source (holder)

get_source_for_model (model)

is_valid ()

merge_with_set (set_to_merge)

remove_holder (holder)

replace_source_model (source, model)

Virtual Methods

Inherited:

GObject.Object (7)

do_holder_attr_changed (holder, attr_name, attr_value)

do_holder_changed (holder)

do_holder_type_set (holder)

do_public_data_changed ()

do_source_model_changed (source)

do_validate_holder_change (holder, new_value)

do_validate_set ()

Properties

Name

Type

Flags

Short Description

description

str

r/w

Description

holders

int

w/co

Gda.Holder objects the set should contain

id

str

r/w

Id

name

str

r/w

Name

validate-changes

bool

r/w

Defines if the validate-set signal is emitted

Signals

Inherited:

GObject.Object (1)

Name

Short Description

holder-attr-changed

Gets emitted when an attribute for any of the Gda.Holder objects managed by set has changed

holder-changed

holder-type-set

Gets emitted when holder in set has its type finally set, in case it was #GDA_TYPE_NULL

public-data-changed

Gets emitted when set's public data (Gda.SetNode, Gda.SetGroup or Gda.SetSource values) have changed

source-model-changed

Gets emitted when the data model in source has changed

validate-holder-change

Gets emitted when a Gda.Holder's in set is going to change its value.

validate-set

Gets emitted when Gda.Set.is_valid() is called, use this signal to control which combination of values set's holder can have (for example to implement some business rules)

Fields

Inherited:

GObject.Object (1)

Name

Type

Access

Description

groups_list

[Gda.SetGroup]

r

list of Gda.SetGroup

holders

[Gda.Holder]

r

list of Gda.Holder objects

nodes_list

[Gda.SetNode]

r

list of Gda.SetNode

object

GObject.Object

r

sources_list

[Gda.SetSource]

r

list of Gda.SetSource

Class Details

class Gda.Set(**kwargs)
Bases:

GObject.Object

Abstract:

No

Structure:

Gda.SetClass

classmethod error_quark()
Return type:

int

classmethod new(holders)
Parameters:

holders ([Gda.Holder]) – a list of Gda.Holder objects

Returns:

a new Gda.Set object

Return type:

Gda.Set

Creates a new Gda.Set object, and populates it with the list given as argument. The list can then be freed as it is copied. All the value holders in holders are referenced counted and modified, so they should not be used anymore afterwards.

classmethod new_from_spec_node(xml_spec)
Parameters:

xml_spec (libxml2.NodePtr) – a libxml2.NodePtr for a <parameters> tag

Raises:

GLib.Error

Returns:

a new object, or None if an error occurred

Return type:

Gda.Set

Creates a new Gda.Set object from the xml_spec specifications

classmethod new_from_spec_string(xml_spec)
Parameters:

xml_spec (str) – a string

Raises:

GLib.Error

Returns:

a new object, or None if an error occurred

Return type:

Gda.Set

Creates a new Gda.Set object from the xml_spec specifications

classmethod new_read_only(holders)
Parameters:

holders ([Gda.Holder]) – a list of Gda.Holder objects

Returns:

a new Gda.Set object

Return type:

Gda.Set

Creates a new Gda.Set like Gda.Set.new(), but does not allow modifications to any of the Gda.Holder object in holders. This function is used for Libgda’s database providers’ implementation.

New in version 4.2.

add_holder(holder)
Parameters:

holder (Gda.Holder) – a Gda.Holder object

Returns:

True if holder has been added to self (and False if it has not been added because there is another Gda.Holder with the same ID)

Return type:

bool

Adds holder to the list of holders managed within self.

NOTE: if self already has a Gda.Holder with the same ID as holder, then holder will not be added to the set (even if holder's type or value is not the same as the one already in self).

copy()
Returns:

a new Gda.Set object

Return type:

Gda.Set

Creates a new Gda.Set object, copy of self

get_group(holder)
Parameters:

holder (Gda.Holder) – a Gda.Holder object

Returns:

the requested Gda.SetGroup or None

Return type:

Gda.SetGroup

Finds a Gda.SetGroup which lists a Gda.SetNode containing holder, don’t modify the returned structure.

get_holder(holder_id)
Parameters:

holder_id (str) – the ID of the requested value holder

Returns:

the requested Gda.Holder or None

Return type:

Gda.Holder

Finds a Gda.Holder using its ID

get_holder_value(holder_id)
Parameters:

holder_id (str) – the ID of the holder to set the value

Returns:

the requested GObject.Value, or None (see Gda.Holder.get_value())

Return type:

GObject.Value or None

Get the value of the Gda.Holder which ID is holder_id

get_node(holder)
Parameters:

holder (Gda.Holder) – a Gda.Holder object

Returns:

the requested Gda.SetNode or None

Return type:

Gda.SetNode

Finds a Gda.SetNode holding information for holder, don’t modify the returned structure

get_nth_holder(pos)
Parameters:

pos (int) – the position of the requested Gda.Holder, starting at %0

Returns:

the requested Gda.Holder or None

Return type:

Gda.Holder

Finds a Gda.Holder using its position

New in version 4.2.

get_source(holder)
Parameters:

holder (Gda.Holder) – a Gda.Holder object

Returns:

the requested Gda.SetSource or None

Return type:

Gda.SetSource

Finds a Gda.SetSource which contains the Gda.DataModel restricting the possible values of holder, don’t modify the returned structure.

get_source_for_model(model)
Parameters:

model (Gda.DataModel) – a Gda.DataModel object

Returns:

the requested Gda.SetSource pointer or None.

Return type:

Gda.SetSource

Finds the Gda.SetSource structure used in self for which model is a the data model (the returned structure should not be modified).

is_valid()
Raises:

GLib.Error

Returns:

True if the set is valid

Return type:

bool

This method tells if all self's Gda.Holder objects are valid, and if they represent a valid combination of values, as defined by rules external to Libgda: the “validate-set” signal is emitted and if none of the signal handlers return an error, then the returned value is True, otherwise the return value is False as soon as a signal handler returns an error.

merge_with_set(set_to_merge)
Parameters:

set_to_merge (Gda.Set) – a Gda.Set object

Add to self all the holders of set_to_merge. Note1: only the Gda.Holder of set_to_merge for which no holder in self has the same ID are merged Note2: all the Gda.Holder merged in self are still used by set_to_merge.

remove_holder(holder)
Parameters:

holder (Gda.Holder) – the Gda.Holder to remove from self

Removes a Gda.Holder from the list of holders managed by self

replace_source_model(source, model)
Parameters:

Replaces source->data_model with model, which must have the same characteristics as source->data_model (same column types)

Also for each Gda.Holder for which source->data_model is a source model, this method calls Gda.Holder.set_source_model() with model to replace the source by the new model

New in version 4.2.

do_holder_attr_changed(holder, attr_name, attr_value) virtual
Parameters:
do_holder_changed(holder) virtual
Parameters:

holder (Gda.Holder) –

do_holder_type_set(holder) virtual
Parameters:

holder (Gda.Holder) –

do_public_data_changed() virtual
do_source_model_changed(source) virtual
Parameters:

source (Gda.SetSource) –

do_validate_holder_change(holder, new_value) virtual
Parameters:
Return type:

GLib.Error

do_validate_set() virtual
Return type:

GLib.Error

Signal Details

Gda.Set.signals.holder_attr_changed(set, holder, attr_name, attr_value)
Signal Name:

holder-attr-changed

Flags:

RUN_FIRST

Parameters:
  • set (Gda.Set) – The object which received the signal

  • holder (Gda.Holder) – the Gda.Holder for which an attribute changed

  • attr_name (str) – attribute’s name

  • attr_value (GObject.Value) – attribute’s value

Gets emitted when an attribute for any of the Gda.Holder objects managed by set has changed

Gda.Set.signals.holder_changed(set, object)
Signal Name:

holder-changed

Flags:

RUN_FIRST

Parameters:
Gda.Set.signals.holder_type_set(set, holder)
Signal Name:

holder-type-set

Flags:

RUN_FIRST

Parameters:

Gets emitted when holder in set has its type finally set, in case it was #GDA_TYPE_NULL

New in version 4.2.

Gda.Set.signals.public_data_changed(set)
Signal Name:

public-data-changed

Flags:

RUN_FIRST

Parameters:

set (Gda.Set) – The object which received the signal

Gets emitted when set's public data (Gda.SetNode, Gda.SetGroup or Gda.SetSource values) have changed

Gda.Set.signals.source_model_changed(set, source)
Signal Name:

source-model-changed

Flags:

RUN_FIRST

Parameters:

Gets emitted when the data model in source has changed

New in version 4.2.

Gda.Set.signals.validate_holder_change(set, holder, new_value)
Signal Name:

validate-holder-change

Flags:

RUN_LAST

Parameters:
Returns:

None if holder is allowed to change its value to new_value, or a GLib.Error otherwise.

Return type:

GLib.Error

Gets emitted when a Gda.Holder's in set is going to change its value. One can connect to this signal to control which values holder can have (for example to implement some business rules)

Gda.Set.signals.validate_set(set)
Signal Name:

validate-set

Flags:

RUN_LAST

Parameters:

set (Gda.Set) – The object which received the signal

Returns:

None if set's contents has been validated, or a GLib.Error otherwise.

Return type:

GLib.Error

Gets emitted when Gda.Set.is_valid() is called, use this signal to control which combination of values set's holder can have (for example to implement some business rules)

Property Details

Gda.Set.props.description
Name:

description

Type:

str

Default Value:

None

Flags:

READABLE, WRITABLE

Description

Gda.Set.props.holders
Name:

holders

Type:

int

Default Value:

None

Flags:

WRITABLE, CONSTRUCT_ONLY

Gda.Holder objects the set should contain

Gda.Set.props.id
Name:

id

Type:

str

Default Value:

None

Flags:

READABLE, WRITABLE

Id

Gda.Set.props.name
Name:

name

Type:

str

Default Value:

None

Flags:

READABLE, WRITABLE

Name

Gda.Set.props.validate_changes
Name:

validate-changes

Type:

bool

Default Value:

True

Flags:

READABLE, WRITABLE

Defines if the “validate-set” signal gets emitted when any holder in the data set changes. This property also affects the Gda.Holder :validate-changes property.

New in version 5.2.0.