summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: eb10be2)
raw | patch | inline | side by side (parent: eb10be2)
author | Max Kellermann <max@duempel.org> | |
Tue, 29 Sep 2009 18:57:48 +0000 (20:57 +0200) | ||
committer | Max Kellermann <max@duempel.org> | |
Tue, 29 Sep 2009 18:57:48 +0000 (20:57 +0200) |
Use plain libmpdclient2 functions plus mpdclient_handle_error()
instead.
instead.
src/mpdclient.c | patch | blob | history | |
src/mpdclient.h | patch | blob | history | |
src/screen_outputs.c | patch | blob | history | |
src/screen_search.c | patch | blob | history |
diff --git a/src/mpdclient.c b/src/mpdclient.c
index e7024d298d1dea24c2f20fd6f177e4a220140f88..83246989ba99350184d6dedb73e2a1b6c7023e59 100644 (file)
--- a/src/mpdclient.c
+++ b/src/mpdclient.c
return error;
}
-gint
+static gint
mpdclient_finish_command(struct mpdclient *c)
{
return mpd_response_finish(c->connection)
diff --git a/src/mpdclient.h b/src/mpdclient.h
index 5d299bfc1be66514a7c13c331e67b5fd4d2d46b2..735c505df7d25828d4ca5a56fb769f9c6e670e82 100644 (file)
--- a/src/mpdclient.h
+++ b/src/mpdclient.h
gint
mpdclient_handle_error(struct mpdclient *c);
-gint
-mpdclient_finish_command(struct mpdclient *c);
-
struct mpdclient *
mpdclient_new(void);
diff --git a/src/screen_outputs.c b/src/screen_outputs.c
index ac41c0968556d7772b2e127740491bfa64a67b5d..a91f634b1d499641ec021c82e2fe24f9f7878dfd 100644 (file)
--- a/src/screen_outputs.c
+++ b/src/screen_outputs.c
static int
toggle_output(struct mpdclient *c, unsigned int output_index)
{
- int return_value;
struct mpd_output *output;
assert(mpd_outputs != NULL);
output = g_ptr_array_index(mpd_outputs, output_index);
if (!mpd_output_get_enabled(output)) {
- mpd_send_enable_output(c->connection,
- mpd_output_get_id(output));
+ if (!mpd_run_enable_output(c->connection,
+ mpd_output_get_id(output))) {
+ mpdclient_handle_error(c);
+ return -1;
+ }
/* XXX reload */
screen_status_printf(_("Output '%s' enabled"),
mpd_output_get_name(output));
} else {
- mpd_send_disable_output(c->connection,
- mpd_output_get_id(output));
+ if (!mpd_run_disable_output(c->connection,
+ mpd_output_get_id(output))) {
+ mpdclient_handle_error(c);
+ return -1;
+ }
/* XXX reload */
mpd_output_get_name(output));
}
- return_value = mpdclient_finish_command(c);
-
outputs_repaint();
- return return_value;
+ return 0;
}
static void
diff --git a/src/screen_search.c b/src/screen_search.c
index dd8c280a1c151a72ede15c09ce1e30c6993c9ae3..11ffd619f134bcbe50b3ef16ad3fcd6c6d0a52ec 100644 (file)
--- a/src/screen_search.c
+++ b/src/screen_search.c
while ((entity = mpd_recv_entity(c->connection)) != NULL)
filelist_append(fl, entity);
- if (mpdclient_finish_command(c)) {
+ if (!mpd_response_finish(c->connection)) {
filelist_free(fl);
fl = NULL;
+
+ mpdclient_handle_error(c);
}
}