Skip to content

Commit

Permalink
player_command: use Interface::Alert()
Browse files Browse the repository at this point in the history
  • Loading branch information
MaxKellermann committed Sep 14, 2024
1 parent 4c7c2b6 commit 54acf4f
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
9 changes: 5 additions & 4 deletions src/player_command.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,12 @@
#include "Options.hxx"
#include "i18n.h"
#include "screen_client.hxx"
#include "screen_status.hxx"
#include "Interface.hxx"
#include "client/mpdclient.hxx"

bool
handle_player_command(struct mpdclient &c, DelayedSeek &seek, Command cmd)
handle_player_command(Interface &interface,
struct mpdclient &c, DelayedSeek &seek, Command cmd)
{
if (!c.IsReady() || c.status == nullptr)
return false;
Expand Down Expand Up @@ -59,15 +60,15 @@ handle_player_command(struct mpdclient &c, DelayedSeek &seek, Command cmd)
case Command::SHUFFLE:
if (auto *connection = c.GetConnection()) {
if (mpd_run_shuffle(connection))
screen_status_message(_("Shuffled queue"));
interface.Alert(_("Shuffled queue"));
else
c.HandleError();
}

break;
case Command::CLEAR:
if (c.RunClearQueue())
screen_status_message(_("Cleared queue"));
interface.Alert(_("Cleared queue"));
break;
case Command::REPEAT:
if (auto *connection = c.GetConnection();
Expand Down
9 changes: 4 additions & 5 deletions src/player_command.hxx
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
// SPDX-License-Identifier: GPL-2.0-or-later
// Copyright The Music Player Daemon Project

#ifndef NCMPC_PLAYER_COMMAND_H
#define NCMPC_PLAYER_COMMAND_H
#pragma once

enum class Command : unsigned;
struct mpdclient;
class Interface;
class DelayedSeek;

bool
handle_player_command(struct mpdclient &c, DelayedSeek &seek, Command cmd);

#endif
handle_player_command(Interface &interface,
struct mpdclient &c, DelayedSeek &seek, Command cmd);
2 changes: 1 addition & 1 deletion src/screen.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ ScreenManager::OnCommand(struct mpdclient &c, DelayedSeek &seek, Command cmd)
if (GetCurrentPage().OnCommand(c, cmd))
return;

if (handle_player_command(c, seek, cmd))
if (handle_player_command(*this, c, seek, cmd))
return;

switch(cmd) {
Expand Down

0 comments on commit 54acf4f

Please sign in to comment.