From: Max Kellermann Date: Tue, 29 Sep 2009 18:57:48 +0000 (+0200) Subject: mpdclient: don't export mpdclient_finish_command() X-Git-Tag: release-0.16~304 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=f9c7a709f12c67ed93219ad40b0577e3b2b1bc39;p=ncmpc.git mpdclient: don't export mpdclient_finish_command() Use plain libmpdclient2 functions plus mpdclient_handle_error() instead. --- diff --git a/src/mpdclient.c b/src/mpdclient.c index e7024d2..8324698 100644 --- a/src/mpdclient.c +++ b/src/mpdclient.c @@ -130,7 +130,7 @@ mpdclient_handle_error(struct 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 5d299bf..735c505 100644 --- a/src/mpdclient.h +++ b/src/mpdclient.h @@ -29,9 +29,6 @@ struct mpdclient { 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 ac41c09..a91f634 100644 --- a/src/screen_outputs.c +++ b/src/screen_outputs.c @@ -44,7 +44,6 @@ outputs_repaint(void) static int toggle_output(struct mpdclient *c, unsigned int output_index) { - int return_value; struct mpd_output *output; assert(mpd_outputs != NULL); @@ -55,16 +54,22 @@ toggle_output(struct mpdclient *c, unsigned int output_index) 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 */ @@ -72,11 +77,9 @@ toggle_output(struct mpdclient *c, unsigned int output_index) 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 dd8c280..11ffd61 100644 --- a/src/screen_search.c +++ b/src/screen_search.c @@ -299,9 +299,11 @@ search_advanced_query(char *query, struct mpdclient *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); } }