summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: f9ad977)
raw | patch | inline | side by side (parent: f9ad977)
author | Max Kellermann <max@duempel.org> | |
Thu, 25 Sep 2008 15:44:48 +0000 (17:44 +0200) | ||
committer | Max Kellermann <max@duempel.org> | |
Thu, 25 Sep 2008 15:44:48 +0000 (17:44 +0200) |
Repaint the artist screen on demand. No need for the update() method
anymore.
anymore.
src/screen_artist.c | patch | blob | history |
diff --git a/src/screen_artist.c b/src/screen_artist.c
index b8f5bb018f2f6df82e90ece7afc569f7fefebd8d..7a28a78879c0f9367cfd459beda9e642f61f40c2 100644 (file)
--- a/src/screen_artist.c
+++ b/src/screen_artist.c
@@ -80,11 +80,30 @@ artist_lw_callback(unsigned idx, mpd_unused int *highlight, mpd_unused void *dat
return buf;
}
+static void
+paint(mpdclient_t *c);
+
+static void
+artist_repaint(void)
+{
+ paint(NULL);
+ wrefresh(browser.lw->w);
+}
+
+static void
+artist_repaint_if_active(void)
+{
+ if (get_cur_mode_id() == 2) /* XXX don't use the literal number */
+ artist_repaint();
+}
+
/* the playlist have been updated -> fix highlights */
static void
playlist_changed_callback(mpdclient_t *c, int event, gpointer data)
{
browser_playlist_changed(&browser, c, event, data);
+
+ artist_repaint_if_active();
}
/* fetch artists/albums/songs from mpd */
default:
break;
}
+
+ artist_repaint_if_active();
}
static void
}
}
-static void
-update(mpd_unused screen_t *screen, mpdclient_t *c)
-{
- if (browser.filelist && !browser.filelist->updated)
- list_window_paint(browser.lw, browser_lw_callback,
- browser.filelist);
- else if (metalist)
- list_window_paint(browser.lw, artist_lw_callback, metalist);
- else
- paint(c);
- wnoutrefresh(browser.lw->w);
-}
-
static const char *
get_title(char *str, size_t size)
{
{
char *selected;
+ if (browser.filelist == NULL && metalist != NULL &&
+ list_window_cmd(browser.lw, metalist_length, cmd)) {
+ list_window_paint(browser.lw, artist_lw_callback, metalist);
+ wrefresh(browser.lw->w);
+ return 1;
+ }
+
switch(cmd) {
case CMD_PLAY:
switch (mode) {
browser.lw->selected);
update_metalist(c, g_strdup(selected), NULL);
list_window_push_state(browser.lw_state, browser.lw);
+
+ list_window_paint(browser.lw, artist_lw_callback, metalist);
+ wrefresh(browser.lw->w);
break;
case LIST_ALBUMS:
update_metalist(c, g_strdup(artist), g_strdup(selected));
list_window_push_state(browser.lw_state, browser.lw);
}
+
+ artist_repaint();
break;
case LIST_SONGS:
/* restore previous list window state */
list_window_pop_state(browser.lw_state,
browser.lw);
+
+ list_window_paint(browser.lw, artist_lw_callback, metalist);
+ wrefresh(browser.lw->w);
} else
browser_handle_enter(&browser, c);
break;
list_window_pop_state(browser.lw_state, browser.lw);
break;
}
+
+ artist_repaint();
break;
case CMD_GO_ROOT_DIRECTORY:
while(list_window_pop_state(browser.lw_state, browser.lw));
break;
}
+
+ artist_repaint();
break;
case CMD_SELECT:
case CMD_LIST_FIND_NEXT:
case CMD_LIST_RFIND_NEXT:
if (browser.filelist)
- return screen_find(screen,
- browser.lw, filelist_length(browser.filelist),
- cmd, browser_lw_callback,
- browser.filelist);
+ screen_find(screen,
+ browser.lw, filelist_length(browser.filelist),
+ cmd, browser_lw_callback,
+ browser.filelist);
else if (metalist)
- return screen_find(screen,
- browser.lw, metalist_length,
- cmd, artist_lw_callback, metalist);
+ screen_find(screen,
+ browser.lw, metalist_length,
+ cmd, artist_lw_callback, metalist);
else
return 1;
+ artist_repaint();
+ return 1;
+
case CMD_MOUSE_EVENT:
return browser_handle_mouse_event(&browser, c);
break;
}
- if (browser.filelist)
- return list_window_cmd(browser.lw, filelist_length(browser.filelist), cmd);
- else if (metalist)
- return list_window_cmd(browser.lw, metalist_length, cmd);
+ if (browser.filelist != NULL &&
+ list_window_cmd(browser.lw, filelist_length(browser.filelist),
+ cmd)) {
+ list_window_paint(browser.lw, browser_lw_callback,
+ browser.filelist);
+ wrefresh(browser.lw->w);
+ browser.filelist->updated = FALSE;
+ return 1;
+ }
return 0;
}
.open = open,
.resize = resize,
.paint = paint,
- .update = update,
.cmd = artist_cmd,
.get_title = get_title,
};