Code

mpdclient: moved browse callback invocation from screen.c
authorMax Kellermann <max@duempel.org>
Fri, 12 Jun 2009 17:41:07 +0000 (19:41 +0200)
committerMax Kellermann <max@duempel.org>
Fri, 12 Jun 2009 17:41:07 +0000 (19:41 +0200)
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.

src/mpdclient.c
src/mpdclient.h
src/screen.c

index cc391ab1a41a745334ca0cb1c44d320f660d4546..496d904129968038ea4e106030483682a56149ed 100644 (file)
@@ -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;
 }
index dc7cbf976b8d4939822fdbbc8f3cf8cee1082aa5..c2ba4767356bb1441c168c7409bb5ef0da620d27 100644 (file)
@@ -28,6 +28,8 @@ typedef struct mpdclient {
        mpd_Song       *song;
 
        gboolean       need_update;
+
+       int updatingdb;
 } mpdclient_t;
 
 /** functions ***************************************************************/
index 929766b998a8593306af867207f026285a133451..200f9dbb67d27f188f264f9d3877462d01b6e60b 100644 (file)
@@ -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;