Code

screen: use idle events in screen_update()
authorMax Kellermann <max@duempel.org>
Wed, 30 Sep 2009 18:28:38 +0000 (20:28 +0200)
committerMax Kellermann <max@duempel.org>
Wed, 30 Sep 2009 18:28:38 +0000 (20:28 +0200)
src/screen.c

index 9850f397351ecd958d9380a0f1644b2a24e6edc2..7295c47098c9975c4cdb4c0b9474a4265908f4dc 100644 (file)
@@ -365,17 +365,15 @@ screen_update(struct mpdclient *c)
        static bool single;
        static bool consume;
        static unsigned crossfade;
-       static unsigned dbupdate;
 
        /* print a message if mpd status has changed */
-       if (c->status != NULL) {
+       if ((c->events & MPD_IDLE_OPTIONS) && c->status != NULL) {
                if (!initialized) {
                        repeat = mpd_status_get_repeat(c->status);
                        random_enabled = mpd_status_get_random(c->status);
                        single = mpd_status_get_single(c->status);
                        consume = mpd_status_get_consume(c->status);
                        crossfade = mpd_status_get_crossfade(c->status);
-                       dbupdate = mpd_status_get_update_id(c->status);
                        initialized = true;
                }
 
@@ -412,19 +410,16 @@ screen_update(struct mpdclient *c)
                        screen_status_printf(_("Crossfade %d seconds"),
                                             mpd_status_get_crossfade(c->status));
 
-               if (dbupdate != 0 &&
-                   dbupdate != mpd_status_get_update_id(c->status)) {
-                       screen_status_printf(_("Database updated"));
-               }
-
                repeat = mpd_status_get_repeat(c->status);
                random_enabled = mpd_status_get_random(c->status);
                single = mpd_status_get_single(c->status);
                consume = mpd_status_get_consume(c->status);
                crossfade = mpd_status_get_crossfade(c->status);
-               dbupdate = mpd_status_get_update_id(c->status);
        }
 
+       if (c->events & MPD_IDLE_DATABASE)
+               screen_status_printf(_("Database updated"));
+
        /* update title/header window */
        if (welcome && options.welcome_screen_list &&
            time(NULL)-screen.start_timestamp <= SCREEN_WELCOME_TIME)