diff options
author | Max Kellermann <max@duempel.org> | 2008-09-18 23:35:12 +0200 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2008-09-18 23:35:12 +0200 |
commit | cb2ec6826f7646ec3a5cf430fdda8b8249cb8f4b (patch) | |
tree | 3c0c30c24c8480abaf681255a74534b7267c2d23 /src | |
parent | eb04b19e0eaa2554f573837f5597f73f01dba318 (diff) | |
download | mpd-cb2ec6826f7646ec3a5cf430fdda8b8249cb8f4b.tar.gz mpd-cb2ec6826f7646ec3a5cf430fdda8b8249cb8f4b.tar.xz mpd-cb2ec6826f7646ec3a5cf430fdda8b8249cb8f4b.zip |
screen_browser: removed redundant highlight check
browser_select_entry() checked the entry's "highlight" flag twice: the
first time, it was toggled, and the second time, action was performed
based on the flag. Merge the two checks.
Diffstat (limited to 'src')
-rw-r--r-- | src/screen_browser.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/src/screen_browser.c b/src/screen_browser.c index b9ef7d4e7..f3ec8eda6 100644 --- a/src/screen_browser.c +++ b/src/screen_browser.c @@ -358,14 +358,11 @@ browser_select_entry(mpdclient_t *c, filelist_entry_t *entry, if (entry->entity->type != MPD_INFO_ENTITY_TYPE_SONG) return -1; - if (toggle && entry->flags & HIGHLIGHT) - entry->flags &= ~HIGHLIGHT; - else - entry->flags |= HIGHLIGHT; - - if (toggle || entry->flags & HIGHLIGHT) { + if (!toggle || (entry->flags & HIGHLIGHT) == 0) { mpd_Song *song = entry->entity->info.song; + entry->flags |= HIGHLIGHT; + if (mpdclient_cmd_add(c, song) == 0) { char buf[BUFSIZE]; @@ -376,6 +373,8 @@ browser_select_entry(mpdclient_t *c, filelist_entry_t *entry, /* remove song from playlist */ mpd_Song *song = entry->entity->info.song; + entry->flags &= ~HIGHLIGHT; + if (song) { int idx; |