Code

playlist: removed "updated" flag
authorMax Kellermann <max@duempel.org>
Wed, 17 Sep 2008 23:55:45 +0000 (01:55 +0200)
committerMax Kellermann <max@duempel.org>
Wed, 17 Sep 2008 23:55:45 +0000 (01:55 +0200)
The caller may check the playlist.id instead of checking the old
"updated" flag.

src/mpdclient.c
src/playlist.c
src/playlist.h
src/screen_play.c

index 469c794c61a977b87b1b538abd8507936306ca17..1b548661658c9c21588826aa5413bb2f0ef2f653 100644 (file)
@@ -666,7 +666,6 @@ mpdclient_playlist_update(mpdclient_t *c)
 
        c->playlist.id = c->status->playlist;
        c->song = NULL;
-       c->playlist.updated = TRUE;
 
        /* call playlist updated callbacks */
        mpdclient_playlist_callback(c, PLAYLIST_EVENT_UPDATED, NULL);
@@ -718,7 +717,6 @@ mpdclient_playlist_update_changes(mpdclient_t *c)
 
        c->song = NULL;
        c->playlist.id = c->status->playlist;
-       c->playlist.updated = TRUE;
 
        mpdclient_playlist_callback(c, PLAYLIST_EVENT_UPDATED, NULL);
 
index 6751e5dad5870f1a3c9a1d647725fb4331e7a26f..76a448ba2fbc460e9e4a4418e48996b05106451b 100644 (file)
@@ -33,7 +33,6 @@ void
 playlist_init(struct mpdclient_playlist *playlist)
 {
        playlist->id = 0;
-       playlist->updated = FALSE;
        playlist->list = g_ptr_array_sized_new(1024);
 }
 
index 93c034f5a1361926090224d3025a3dfaa0ef7d8b..0d524adbee9f98473c541bce2d52a4b017175ece 100644 (file)
@@ -33,9 +33,6 @@ typedef struct mpdclient_playlist {
        /* playlist id */
        long long id;
 
-       /* true if the list is updated */
-       gboolean updated;
-
        /* the list */
        GPtrArray *list;
 } mpdclient_playlist_t;
index c89d150cff17c59beeaae70eddb5ff9ae095ca84..cd43982c334de9a4252e4b7cba546c3cd7f24dcf 100644 (file)
@@ -51,6 +51,7 @@ typedef struct
 } completion_callback_data_t;
 
 static list_window_t *lw = NULL;
+static long long playlist_id;
 
 static void
 playlist_changed_callback(mpdclient_t *c, int event, gpointer data)
@@ -398,14 +399,14 @@ play_update(screen_t *screen, mpdclient_t *c)
                }
        }
 
-       if( c->playlist.updated ) {
+       if (c->playlist.id != playlist_id) {
                if (lw->selected >= c->playlist.list->len)
                        lw->selected = c->playlist.list->len - 1;
                if (lw->start >= c->playlist.list->len)
                        list_window_reset(lw);
 
                play_paint(screen, c);
-               c->playlist.updated = FALSE;
+               playlist_id = c->playlist.id;
        } else if( lw->repaint || 1) {
                list_window_paint(lw, list_callback, (void *) c);
                wnoutrefresh(lw->w);