From: Max Kellermann Date: Fri, 12 Jun 2009 17:41:07 +0000 (+0200) Subject: mpdclient: moved browse callback invocation from screen.c X-Git-Tag: release-0.15~50 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=1ba1a6748f4d3e26562df7d1d3b49cebe88ae4e3;p=ncmpc.git mpdclient: moved browse callback invocation from screen.c The screen code shouldn't bother to do any callbacks, because screen.c should only care about the GUI. Move that invocation to the mpdclient library. --- diff --git a/src/mpdclient.c b/src/mpdclient.c index cc391ab..496d904 100644 --- a/src/mpdclient.c +++ b/src/mpdclient.c @@ -233,6 +233,11 @@ mpdclient_update(mpdclient_t *c) if ((retval=mpdclient_finish_command(c))) return retval; + if (c->updatingdb && c->updatingdb != c->status->updatingDb) + mpdclient_browse_callback(c, BROWSE_DB_UPDATED, NULL); + + c->updatingdb = c->status->updatingDb; + /* check if the playlist needs an update */ if (c->playlist.id != c->status->playlist) { if (playlist_is_empty(&c->playlist)) @@ -421,7 +426,7 @@ mpdclient_cmd_db_update(mpdclient_t *c, gchar *path) /* set updatingDb to make sure the browse callback gets called even if the update has finished before status is updated */ - c->status->updatingDb = 1; + c->updatingdb = 1; return ret; } diff --git a/src/mpdclient.h b/src/mpdclient.h index dc7cbf9..c2ba476 100644 --- a/src/mpdclient.h +++ b/src/mpdclient.h @@ -28,6 +28,8 @@ typedef struct mpdclient { mpd_Song *song; gboolean need_update; + + int updatingdb; } mpdclient_t; /** functions ***************************************************************/ diff --git a/src/screen.c b/src/screen.c index 929766b..200f9db 100644 --- a/src/screen.c +++ b/src/screen.c @@ -674,7 +674,6 @@ screen_update(mpdclient_t *c) if (dbupdate && dbupdate != c->status->updatingDb) { screen_status_printf(_("Database updated")); - mpdclient_browse_callback(c, BROWSE_DB_UPDATED, NULL); } repeat = c->status->repeat;