summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: e314afc)
raw | patch | inline | side by side (parent: e314afc)
author | Max Kellermann <max@duempel.org> | |
Tue, 18 Nov 2008 21:09:23 +0000 (22:09 +0100) | ||
committer | Max Kellermann <max@duempel.org> | |
Tue, 18 Nov 2008 21:09:23 +0000 (22:09 +0100) |
Return true/false instead of 1/0.
diff --git a/src/screen.h b/src/screen.h
index 5eb6cba207b98929db3ad8d5f5b92f7349fcbc74..5d7737973d2d0649c994cf328f9edd4dde5d2967 100644 (file)
--- a/src/screen.h
+++ b/src/screen.h
void (*resize)(int cols, int rows);
void (*paint)(void);
void (*update)(mpdclient_t *c);
- int (*cmd)(mpdclient_t *c, command_t cmd);
+ bool (*cmd)(mpdclient_t *c, command_t cmd);
const char *(*get_title)(char *s, size_t size);
} screen_functions_t;
diff --git a/src/screen_artist.c b/src/screen_artist.c
index 74fd96c1aed9a755543d07d7f2fb6b27d89d5855..01fbc9c1fbc35184f6d0ff5200446ff19bbfb711 100644 (file)
--- a/src/screen_artist.c
+++ b/src/screen_artist.c
return -1;
}
-static int
+static bool
artist_cmd(mpdclient_t *c, command_t cmd)
{
char *selected;
case CMD_SCREEN_UPDATE:
reload_lists(c);
screen_status_printf(_("Screen updated!"));
- return 0;
+ return false;
case CMD_LIST_FIND:
case CMD_LIST_RFIND:
screen_find(browser.lw, artist_list->len,
cmd, artist_lw_callback, artist_list);
artist_repaint();
- return 1;
+ return true;
case LIST_ALBUMS:
screen_find(browser.lw, album_list->len + 2,
cmd, artist_lw_callback, album_list);
artist_repaint();
- return 1;
+ return true;
case LIST_SONGS:
/* handled by browser_cmd() */
if (artist_lw_cmd(c, cmd)) {
if (screen_is_visible(&screen_artist))
artist_repaint();
- return 1;
+ return true;
}
- return 0;
+ return false;
}
const struct screen_functions screen_artist = {
diff --git a/src/screen_file.c b/src/screen_file.c
index a934ef2763ffa79c271be662cf05154045d3ef5e..d7742879131a150bfeacdd0bc589e8b0411c0993 100644 (file)
--- a/src/screen_file.c
+++ b/src/screen_file.c
list_window_paint(browser.lw, browser_lw_callback, browser.filelist);
}
-static int
+static bool
browse_cmd(mpdclient_t *c, command_t cmd)
{
switch(cmd) {
case CMD_GO_ROOT_DIRECTORY:
browser_change_directory(&browser, c, NULL, "");
file_repaint();
- return 1;
+ return true;
case CMD_GO_PARENT_DIRECTORY:
browser_change_directory(&browser, c, NULL, "..");
file_repaint();
- return 1;
+ return true;
case CMD_LOCATE:
/* don't let browser_cmd() evaluate the locate command
file_repaint();
screen_status_printf(_("Screen updated!"));
- return 0;
+ return false;
case CMD_DB_UPDATE:
if (c->status == NULL)
- return 1;
+ return true;
if (!c->status->updatingDb) {
if (mpdclient_cmd_db_update(c, browser.filelist->path) == 0) {
}
} else
screen_status_printf(_("Database update running..."));
- return 1;
+ return true;
default:
break;
if (browser_cmd(&browser, c, cmd)) {
if (screen_is_visible(&screen_browse))
file_repaint();
- return 1;
+ return true;
}
- return 0;
+ return false;
}
const struct screen_functions screen_browse = {
diff --git a/src/screen_help.c b/src/screen_help.c
index e462ddc907897d86dfdd109e72f121015ba0c41e..423e85f59932cb843a67b6ab3ce23c7becc1881f 100644 (file)
--- a/src/screen_help.c
+++ b/src/screen_help.c
list_window_paint(lw, list_callback, NULL);
}
-static int
+static bool
help_cmd(mpd_unused mpdclient_t *c, command_t cmd)
{
if (list_window_scroll_cmd(lw, help_text_rows, cmd)) {
list_window_paint(lw, list_callback, NULL);
wrefresh(lw->w);
- return 1;
+ return true;
}
lw->selected = lw->start+lw->rows;
list_window_center(lw, help_text_rows, lw->selected);
list_window_paint(lw, list_callback, NULL);
wrefresh(lw->w);
- return 1;
+ return true;
}
- return 0;
+ return false;
}
const struct screen_functions screen_help = {
diff --git a/src/screen_keydef.c b/src/screen_keydef.c
index 4e42b386f2975d5002dddfa603572876a480c554..509a44fc5e929110619e0d186826af579e8215ad 100644 (file)
--- a/src/screen_keydef.c
+++ b/src/screen_keydef.c
list_window_paint(lw, list_callback, NULL);
}
-static int
+static bool
keydef_cmd(mpd_unused mpdclient_t *c, command_t cmd)
{
int length = LIST_LENGTH();
if (list_window_cmd(lw, length, cmd)) {
keydef_repaint();
- return 1;
+ return true;
}
switch(cmd) {
subcmd,
lw->selected - STATIC_SUB_ITEMS);
}
- return 1;
+ return true;
case CMD_DELETE:
if (subcmd >= 0 && lw->selected >= STATIC_SUB_ITEMS)
delete_key(subcmd, lw->selected - STATIC_SUB_ITEMS);
- return 1;
+ return true;
break;
case CMD_SAVE_PLAYLIST:
apply_keys();
screen_find(lw, length,
cmd, list_callback, NULL);
keydef_repaint();
- return 1;
+ return true;
default:
break;
}
- return 0;
+ return false;
}
const struct screen_functions screen_keydef = {
diff --git a/src/screen_lyrics.c b/src/screen_lyrics.c
index 30a89a163973ddaf8f29143bf2bd5c88fdea20f1..9cffd57770e1d0d19feede84b6c8f7778e60c59b 100644 (file)
--- a/src/screen_lyrics.c
+++ b/src/screen_lyrics.c
list_window_paint(lw, list_callback, NULL);
}
-static int
+static bool
lyrics_cmd(mpdclient_t *c, command_t cmd)
{
if (list_window_scroll_cmd(lw, current.lines->len, cmd)) {
lyrics_repaint();
- return 1;
+ return true;
}
switch(cmd) {
screen_lyrics_abort();
screen_lyrics_clear();
}
- return 1;
+ return true;
case CMD_ADD:
if (current.loader == NULL && current.artist != NULL &&
current.title != NULL && store_lyr_hd() == 0)
screen_status_message (_("Lyrics saved!"));
- return 1;
+ return true;
case CMD_LYRICS_UPDATE:
if (c->song != NULL) {
screen_lyrics_load(c->song);
lyrics_repaint();
}
- return 1;
+ return true;
case CMD_LOCATE:
if (current.song != NULL) {
/* center the row */
list_window_center(lw, current.lines->len, lw->selected);
lyrics_repaint();
- return 1;
+ return true;
}
- return 0;
+ return false;
}
const struct screen_functions screen_lyrics = {
diff --git a/src/screen_play.c b/src/screen_play.c
index 1e0dcaa280759c05d74fd02246f1ac1ab592c895..4b50f7459916481650c5735c6732f2ce6b055c39 100644 (file)
--- a/src/screen_play.c
+++ b/src/screen_play.c
}
#ifdef HAVE_GETMOUSE
-static int
+static bool
handle_mouse_event(struct mpdclient *c)
{
int row;
if (screen_get_mouse_event(c, &bstate, &row) ||
list_window_mouse(lw, playlist_length(playlist), bstate, row)) {
playlist_repaint();
- return 1;
+ return true;
}
if (bstate & BUTTON1_DOUBLE_CLICKED) {
/* stop */
screen_cmd(c, CMD_STOP);
- return 1;
+ return true;
}
selected = lw->start + row;
list_window_check_selected(lw, playlist_length(playlist));
playlist_repaint();
- return 1;
+ return true;
}
#endif
-static int
+static bool
play_cmd(mpdclient_t *c, command_t cmd)
{
lw->flags &= ~LW_HIDE_CURSOR;
if (list_window_cmd(lw, playlist_length(&c->playlist), cmd)) {
playlist_repaint();
- return 1;
+ return true;
}
switch(cmd) {
case CMD_PLAY:
mpdclient_cmd_play(c, lw->selected);
- return 1;
+ return true;
case CMD_DELETE:
mpdclient_cmd_delete(c, lw->selected);
- return 1;
+ return true;
case CMD_SAVE_PLAYLIST:
playlist_save(c, NULL, NULL);
- return 1;
+ return true;
case CMD_ADD:
handle_add_to_playlist(c);
- return 1;
+ return true;
case CMD_SCREEN_UPDATE:
center_playing_item(c);
playlist_repaint();
- return 0;
+ return false;
case CMD_LIST_MOVE_UP:
mpdclient_cmd_move(c, lw->selected, lw->selected-1);
- return 1;
+ return true;
case CMD_LIST_MOVE_DOWN:
mpdclient_cmd_move(c, lw->selected, lw->selected+1);
- return 1;
+ return true;
case CMD_LIST_FIND:
case CMD_LIST_RFIND:
case CMD_LIST_FIND_NEXT:
screen_find(lw, playlist_length(&c->playlist),
cmd, list_callback, NULL);
playlist_repaint();
- return 1;
+ return true;
#ifdef HAVE_GETMOUSE
case CMD_MOUSE_EVENT:
case CMD_SCREEN_LYRICS:
if (lw->selected < playlist_length(&c->playlist)) {
screen_lyrics_switch(c, playlist_get(&c->playlist, lw->selected));
- return 1;
+ return true;
}
break;
break;
}
- return 0;
+ return false;
}
const struct screen_functions screen_playlist = {
diff --git a/src/screen_search.c b/src/screen_search.c
index e5239b0c74b97ce24c033fc5b887f642ec013174..277a9e2775c82f4b6151b27703c85a8e9fd4c7a8 100644 (file)
--- a/src/screen_search.c
+++ b/src/screen_search.c
return str;
}
-static int
+static bool
search_cmd(mpdclient_t *c, command_t cmd)
{
switch (cmd) {
sync_highlights(c, browser.filelist);
}
search_repaint();
- return 1;
+ return true;
case CMD_SCREEN_SEARCH:
search_new(c);
search_repaint();
- return 1;
+ return true;
case CMD_CLEAR:
search_clear(c, TRUE);
list_window_reset(browser.lw);
search_repaint();
- return 1;
+ return true;
default:
break;
browser_cmd(&browser, c, cmd)) {
if (screen_is_visible(&screen_search))
search_repaint();
- return 1;
+ return true;
}
- return 0;
+ return false;
}
const struct screen_functions screen_search = {