RB.History

g GObject.Object GObject.Object RB.History RB.History GObject.Object->RB.History

Subclasses:

None

Methods

Inherited:

GObject.Object (37)

Structs:

GObject.ObjectClass (5)

class

new (truncate_on_play, destroyer, *destroy_userdata)

append (entry)

clear ()

contains_entry (entry)

current ()

dump ()

first ()

get_current_index ()

go_first ()

go_last ()

go_next ()

go_previous ()

insert_at_index (entry, index)

last ()

length ()

next ()

previous ()

remove_entry (entry)

set_destroy_notify (destroyer, *destroy_userdata)

set_maximum_size (maximum_size)

set_playing (entry)

set_truncate_on_play (truncate_on_play)

Virtual Methods

Inherited:

GObject.Object (7)

Properties

Name

Type

Flags

Short Description

maximum-size

int

r/w

Maximum length of the history. Infinite if 0

truncate-on-play

bool

r/w/c

Whether RB.History.set_playing() truncates the rest of the list

Signals

Inherited:

GObject.Object (1)

Fields

Inherited:

GObject.Object (1)

Name

Type

Access

Description

parent

GObject.Object

r

Class Details

class RB.History(**kwargs)
Bases:

GObject.Object

Abstract:

No

Structure:

RB.HistoryClass

classmethod new(truncate_on_play, destroyer, *destroy_userdata)
Parameters:
  • truncate_on_play (bool) – Whether RB.History.set_playing() should truncate the history

  • destroyer (GLib.Func) – function to call when removing an entry from the history

  • destroy_userdata (object or None) – data to pass to destroyer

Returns:

a new RB.History

Return type:

RB.History

Creates a new history instance.

append(entry)
Parameters:

entry (RB.RhythmDBEntry) – a RB.RhythmDBEntry to append

Adds a new entry to the end of the history list. If a size limit is set, an entry may be removed from the start to keep the history list within the limit.

clear()

Empties the history list.

contains_entry(entry)
Parameters:

entry (RB.RhythmDBEntry) – a RB.RhythmDBEntry to check for

Returns:

True if found

Return type:

bool

Returns True if the entry is present in the history list.

current()
Returns:

current entry or None

Return type:

RB.RhythmDBEntry

Returns the current RB.RhythmDBEntry, or None if there is no current position

dump()
Returns:

a copy of the history list

Return type:

[RB.RhythmDBEntry]

Constructs a copy of the whole history in order. Caller must free the result. The caller does not own any references on the entries in the returned array. Takes O(Nlog(N)) time.

first()
Returns:

first entry

Return type:

RB.RhythmDBEntry

Returns the first entry in the history.

get_current_index()
Returns:

index of the current entry

Return type:

int

Gets the index of the current entry. This is guaranteed to be < the history’s size, so if the history is empty, it returns -1.

go_first()

Moves the current position to the first entry in the history

go_last()

Moves the current position to the last entry in the history

go_next()

Moves the current position to the next entry. If the current position is already at the end of the history, nothing happens.

go_previous()

Moves the current position to the previous entry. If the current position is already at the start of the history, nothing happens.

insert_at_index(entry, index)
Parameters:

Inserts entry at index within the history list. 0<=`index`<=size

last()
Returns:

last entry

Return type:

RB.RhythmDBEntry

Returns the last RB.RhythmDBEntry in the history

length()
Returns:

number of entries

Return type:

int

Returns the number of entries in the history.

next()
Returns:

next entry

Return type:

RB.RhythmDBEntry

Returns the RB.RhythmDBEntry after the current position

previous()
Returns:

previous entry

Return type:

RB.RhythmDBEntry

Returns the RB.RhythmDBEntry before the current position.

remove_entry(entry)
Parameters:

entry (RB.RhythmDBEntry) – the RB.RhythmDBEntry to remove

Removes the specified entry from the history list.

set_destroy_notify(destroyer, *destroy_userdata)
Parameters:
  • destroyer (GLib.Func) – function to call when removing an entry from the history

  • destroy_userdata (object or None) – data to pass to destroyer

Sets a new function to call when removing entries from the history.

set_maximum_size(maximum_size)
Parameters:

maximum_size (int) – new maximum size of the history (or 0 for no limit)

Sets the maximum-size property

set_playing(entry)
Parameters:

entry (RB.RhythmDBEntry) – the new playing RB.RhythmDBEntry

Updates the current position to point to the specified entry. If the truncate-on-play property is set, this will remove all entries after that.

set_truncate_on_play(truncate_on_play)
Parameters:

truncate_on_play (bool) – Whether RB.History.set_playing() should truncate the history

Sets the ‘truncate-on-play’ property.

Property Details

RB.History.props.maximum_size
Name:

maximum-size

Type:

int

Default Value:

0

Flags:

READABLE, WRITABLE

Maximum number of entries to store in the history. If 0, no limit is applied.

RB.History.props.truncate_on_play
Name:

truncate-on-play

Type:

bool

Default Value:

False

Flags:

READABLE, WRITABLE, CONSTRUCT

If set, RB.History.set_playing() truncates the rest of the history