Skip to content

Commit

Permalink
chore: remove _on_player_model_changed
Browse files Browse the repository at this point in the history
This function was originally from GNOME Music, where it serves as the
handler for a signal. Here in muzika, the sole caller is
`_on_current_song_changed`, and none of the arguments passed are
actually relevant, so move the important bits into
`_on_current_song_changed` directly.
  • Loading branch information
DaPigGuy committed Aug 5, 2024
1 parent 653f4c2 commit e79dea2
Showing 1 changed file with 1 addition and 17 deletions.
18 changes: 1 addition & 17 deletions src/mpris.ts
Original file line number Diff line number Diff line change
Expand Up @@ -379,25 +379,9 @@ export class MPRIS extends DBusInterface {
return [false, ["/", "", ""]];
}

private _on_current_song_changed() {
// IDK
this._on_player_model_changed(this.player.queue.list, 0, 0, 0);
}

previous_state = new Map<string, unknown>();

_on_player_model_changed(
model: Gio.ListStore,
_pos: number,
_removed: number,
added: number,
) {
// Don't update the properties if the model has completely changed.
// These changes will be applied once a new song starts playing.
if (added == model.n_items) {
return;
}

private _on_current_song_changed() {
const properties: Record<string, GLib.Variant> = {
Metadata: GLib.Variant.new("a{sv}", this._get_metadata()),
};
Expand Down

0 comments on commit e79dea2

Please sign in to comment.