summaryrefslogtreecommitdiff
path: root/src/mpdpp.cpp
diff options
context:
space:
mode:
authorAndrzej Rybczak <electricityispower@gmail.com>2012-07-18 01:34:55 +0200
committerAndrzej Rybczak <electricityispower@gmail.com>2012-08-14 01:44:14 +0200
commit181224b837fd44a68323ff899a90ae990ab5da71 (patch)
treeb6f71bdc31ceba80ea73ee4d47378d9119b7a82c /src/mpdpp.cpp
parent4cf9fe33db05bcc4221cfb43332dacfa697bd43c (diff)
keybinding system rewrite
Diffstat (limited to 'src/mpdpp.cpp')
-rw-r--r--src/mpdpp.cpp27
1 files changed, 15 insertions, 12 deletions
diff --git a/src/mpdpp.cpp b/src/mpdpp.cpp
index b735e957..811db775 100644
--- a/src/mpdpp.cpp
+++ b/src/mpdpp.cpp
@@ -30,7 +30,6 @@ MPD::Connection Mpd;
const char *MPD::Message::PartOfSongsAdded = "Only part of requested songs' list added to playlist!";
const char *MPD::Message::FullPlaylist = "Playlist is full!";
-const char *MPD::Message::FunctionDisabledFilteringEnabled = "Function disabled due to enabled filtering in playlist";
MPD::Connection::Connection() : itsConnection(0),
isCommandsListEnabled(0),
@@ -480,19 +479,19 @@ void MPD::Connection::Prev()
}
}
-void MPD::Connection::Move(unsigned from, unsigned to)
+bool MPD::Connection::Move(unsigned from, unsigned to)
{
if (!itsConnection)
- return;
+ return false;
if (!isCommandsListEnabled)
{
GoBusy();
- mpd_run_move(itsConnection, from, to);
+ return mpd_run_move(itsConnection, from, to);
}
else
{
assert(!isIdle);
- mpd_send_move(itsConnection, from, to);
+ return mpd_send_move(itsConnection, from, to);
}
}
@@ -598,17 +597,21 @@ void MPD::Connection::AddToPlaylist(const std::string &path, const std::string &
}
}
-void MPD::Connection::Move(const std::string &path, int from, int to)
+bool MPD::Connection::Move(const std::string &path, int from, int to)
{
if (!itsConnection)
- return;
+ return false;
if (!isCommandsListEnabled)
+ {
GoBusy();
+ return mpd_send_playlist_move(itsConnection, path.c_str(), from, to)
+ && mpd_response_finish(itsConnection);
+ }
else
+ {
assert(!isIdle);
- mpd_send_playlist_move(itsConnection, path.c_str(), from, to);
- if (!isCommandsListEnabled)
- mpd_response_finish(itsConnection);
+ return mpd_send_playlist_move(itsConnection, path.c_str(), from, to);
+ }
}
bool MPD::Connection::Rename(const std::string &from, const std::string &to)
@@ -1025,10 +1028,10 @@ bool MPD::Connection::CommitCommandsList()
assert(isCommandsListEnabled);
assert(!isIdle);
mpd_command_list_end(itsConnection);
- mpd_response_finish(itsConnection);
+ isCommandsListEnabled = 0;
+ return mpd_response_finish(itsConnection);
if (GetPlaylistLength() == itsMaxPlaylistLength && itsErrorHandler)
itsErrorHandler(this, MPD_SERVER_ERROR_PLAYLIST_MAX, Message::FullPlaylist, itsErrorHandlerUserdata);
- isCommandsListEnabled = 0;
bool result = !CheckForErrors();
UpdateStatus();
return result;