AppStream.ComponentBox

g AppStream.ComponentBox AppStream.ComponentBox GObject.Object GObject.Object GObject.Object->AppStream.ComponentBox

Subclasses:

None

Methods

Inherited:

GObject.Object (37)

Structs:

GObject.ObjectClass (5)

class

new (flags)

class

new_simple ()

add (cpt)

as_array ()

clear ()

get_flags ()

get_size ()

index_safe (index)

is_empty ()

remove_at (index)

sort ()

sort_by_score ()

Virtual Methods

Inherited:

GObject.Object (7)

Properties

Name

Type

Flags

Short Description

flags

int

r/w/co

Component box flags

Signals

Inherited:

GObject.Object (1)

Fields

Inherited:

GObject.Object (1)

Name

Type

Access

Description

cpts

[object]

r

parent_instance

GObject.Object

r

Class Details

class AppStream.ComponentBox(**kwargs)
Bases:

GObject.Object

Abstract:

No

Structure:

AppStream.ComponentBoxClass

classmethod new(flags)
Parameters:

flags (AppStream.ComponentBoxFlags) –

Returns:

an AppStream.ComponentBox

Return type:

AppStream.ComponentBox

Creates a new AppStream.ComponentBox.

New in version 1.0.

classmethod new_simple()
Returns:

an AppStream.ComponentBox

Return type:

AppStream.ComponentBox

Creates a new AppStream.ComponentBox with the simplest parameters, so it is basically an array storage without overhead.

Only the most basic checks on inserted components will be performed, and it is assumed that the inserted components have been checked already prior to insertion.

add(cpt)
Parameters:

cpt (AppStream.Component) –

Raises:

GLib.Error

Returns:

True on success.

Return type:

bool

Add a component to the box. Returns an error if we could not add it (most likely due to component box constraints).

as_array()
Returns:

an array of AppStream.Component instances.

Return type:

[AppStream.Component]

Get the contents of this component box as GLib.PtrArray.

clear()

Remove all contents of this component box.

get_flags()
Returns:

The AppStream.ComponentBoxFlags that are in effect.

Return type:

AppStream.ComponentBoxFlags

Get the flags this component box was constructed with.

get_size()
Returns:

Amount of components.

Return type:

int

Get the amount of components in this box.

index_safe(index)
Parameters:

index (int) – The component index.

Returns:

An AppStream.Component or None

Return type:

AppStream.Component

Retrieve a component at the respective index from the internal component array.

is_empty()
Returns:

True if this component box is empty.

Return type:

bool

Check if there are any components present.

remove_at(index)
Parameters:

index (int) – the index of the component to remove.

Remove a component at the specified index. Please ensure that the index is not larger than AppStream.ComponentBox.get_size() - 1

sort()

Sort components to bring them into a deterministic order.

sort_by_score()

Sort components by their (search) match score.

Property Details

AppStream.ComponentBox.props.flags
Name:

flags

Type:

int

Default Value:

0

Flags:

READABLE, WRITABLE, CONSTRUCT_ONLY

Component box flags