Code

mpdclient: tweak updatingdb in mpdclient.c
authorMax Kellermann <max@duempel.org>
Fri, 12 Jun 2009 17:40:08 +0000 (19:40 +0200)
committerMax Kellermann <max@duempel.org>
Fri, 12 Jun 2009 17:40:08 +0000 (19:40 +0200)
The mpdclient library should care about setting the new (temporary)
MPD update status.

src/mpdclient.c
src/screen_file.c

index 9aab2fc39b99a3e7d5fafdfeee52f3a3f9ffc2d0..cc391ab1a41a745334ca0cb1c44d320f660d4546 100644 (file)
@@ -412,8 +412,18 @@ mpdclient_cmd_crossfade(mpdclient_t *c, gint value)
 gint
 mpdclient_cmd_db_update(mpdclient_t *c, gchar *path)
 {
+       gint ret;
+
        mpd_sendUpdateCommand(c->connection, path ? path : "");
-       return mpdclient_finish_command(c);
+       ret = mpdclient_finish_command(c);
+
+       if (ret == 0)
+               /* set updatingDb to make sure the browse callback
+                  gets called even if the update has finished before
+                  status is updated */
+               c->status->updatingDb = 1;
+
+       return ret;
 }
 
 gint
index fdb8a5ae6b2f6f5177e6f974ba8f66bc54ac1dc4..a149e9131791fd82ae6bafdf30b9ad3fbb75936e 100644 (file)
@@ -272,10 +272,6 @@ browse_cmd(mpdclient_t *c, command_t cmd)
                                        g_free(path_locale);
                                } else
                                        screen_status_printf(_("Database update started"));
-
-                               /* set updatingDb to make sure the browse callback gets called
-                                * even if the updated has finished before status is updated */
-                               c->status->updatingDb = 1;
                        }
                } else
                        screen_status_printf(_("Database update running..."));