summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: f0aa88e)
raw | patch | inline | side by side (parent: f0aa88e)
author | Max Kellermann <max@duempel.org> | |
Wed, 17 Sep 2008 23:55:45 +0000 (01:55 +0200) | ||
committer | Max 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.
"updated" flag.
src/mpdclient.c | patch | blob | history | |
src/playlist.c | patch | blob | history | |
src/playlist.h | patch | blob | history | |
src/screen_play.c | patch | blob | history |
diff --git a/src/mpdclient.c b/src/mpdclient.c
index 469c794c61a977b87b1b538abd8507936306ca17..1b548661658c9c21588826aa5413bb2f0ef2f653 100644 (file)
--- a/src/mpdclient.c
+++ b/src/mpdclient.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);
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 6751e5dad5870f1a3c9a1d647725fb4331e7a26f..76a448ba2fbc460e9e4a4418e48996b05106451b 100644 (file)
--- a/src/playlist.c
+++ b/src/playlist.c
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 93c034f5a1361926090224d3025a3dfaa0ef7d8b..0d524adbee9f98473c541bce2d52a4b017175ece 100644 (file)
--- a/src/playlist.h
+++ b/src/playlist.h
/* 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 c89d150cff17c59beeaae70eddb5ff9ae095ca84..cd43982c334de9a4252e4b7cba546c3cd7f24dcf 100644 (file)
--- a/src/screen_play.c
+++ b/src/screen_play.c
} 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)
}
}
- 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);