From fe8895120e565f83f18fb3c0af7a0bbbc881e5d9 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Thu, 18 Sep 2008 01:55:45 +0200 Subject: [PATCH] playlist: removed "updated" flag The caller may check the playlist.id instead of checking the old "updated" flag. --- src/mpdclient.c | 2 -- src/playlist.c | 1 - src/playlist.h | 3 --- src/screen_play.c | 5 +++-- 4 files changed, 3 insertions(+), 8 deletions(-) diff --git a/src/mpdclient.c b/src/mpdclient.c index 469c794..1b54866 100644 --- a/src/mpdclient.c +++ b/src/mpdclient.c @@ -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); diff --git a/src/playlist.c b/src/playlist.c index 6751e5d..76a448b 100644 --- a/src/playlist.c +++ b/src/playlist.c @@ -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); } diff --git a/src/playlist.h b/src/playlist.h index 93c034f..0d524ad 100644 --- a/src/playlist.h +++ b/src/playlist.h @@ -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; diff --git a/src/screen_play.c b/src/screen_play.c index c89d150..cd43982 100644 --- a/src/screen_play.c +++ b/src/screen_play.c @@ -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); -- 2.30.2