From: Andreas Obergrusberger Date: Sat, 11 Nov 2006 20:11:32 +0000 (+0000) Subject: Daniel rocked the house X-Git-Tag: v0.12_alpha1~352 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=7f611951dc9f46941c7db2daeb9f3d6f084d7c20;p=ncmpc.git Daniel rocked the house git-svn-id: https://svn.musicpd.org/ncmpc/branches/tradiaz@5041 09075e82-0dd4-0310-85a5-a0d7c8717e4f --- diff --git a/ChangeLog b/ChangeLog index a02f43d..6fb81d0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,10 @@ +2006-11-11 Andreas Obergrusberger + * fixed advanced search + * go root/parent also for artist screen + 2006-11-8 Andreas Obergrusberger * Daniel added the functionality to go to - the parent and root directory via shortcu + the parent and root directory via shortcut * updated ncmpc.pot 2006-11-5 Andreas Obergrusberger diff --git a/src/list_window.c b/src/list_window.c index 6492d41..db14ff9 100644 --- a/src/list_window.c +++ b/src/list_window.c @@ -371,7 +371,7 @@ list_window_push_state(list_window_state_t *state, list_window_t *lw) } } -void +bool list_window_pop_state(list_window_state_t *state, list_window_t *lw) { if( state && state->list ) @@ -383,7 +383,7 @@ list_window_pop_state(list_window_state_t *state, list_window_t *lw) state->list->data = NULL; state->list = g_list_delete_link(state->list, state->list); } -} - - + // return TRUE if there are still states in the list + return (state && state->list) ? TRUE : FALSE; +} diff --git a/src/list_window.h b/src/list_window.h index 2061e81..9d1211e 100644 --- a/src/list_window.h +++ b/src/list_window.h @@ -80,7 +80,7 @@ list_window_rfind(list_window_t *lw, list_window_state_t *list_window_init_state(void); list_window_state_t *list_window_free_state(list_window_state_t *state); void list_window_push_state(list_window_state_t *state, list_window_t *lw); -void list_window_pop_state(list_window_state_t *state, list_window_t *lw); +bool list_window_pop_state(list_window_state_t *state, list_window_t *lw); diff --git a/src/screen_artist.c b/src/screen_artist.c index 085c6aa..9f98fb6 100644 --- a/src/screen_artist.c +++ b/src/screen_artist.c @@ -369,6 +369,40 @@ artist_cmd(screen_t *screen, mpdclient_t *c, command_t cmd) } return 1; + + /* FIXME? CMD_GO_* handling duplicates code from CMD_PLAY */ + + case CMD_GO_PARENT_DIRECTORY: + switch(mode) + { + case LIST_ALBUMS: + update_metalist(c, NULL, NULL); + list_window_reset(lw); + /* restore previous list window state */ + list_window_pop_state(lw_state,lw); + break; + case LIST_SONGS: + update_metalist(c, g_strdup(artist), NULL); + list_window_reset(lw); + /* restore previous list window state */ + list_window_pop_state(lw_state,lw); + break; + } + break; + + case CMD_GO_ROOT_DIRECTORY: + switch(mode) + { + case LIST_ALBUMS: + case LIST_SONGS: + update_metalist(c, NULL, NULL); + list_window_reset(lw); + /* restore first list window state (pop while returning true) */ + while(list_window_pop_state(lw_state,lw)); + break; + } + break; + case CMD_SELECT: switch(mode) { diff --git a/src/screen_file.c b/src/screen_file.c index 4a4bdf7..14a1147 100644 --- a/src/screen_file.c +++ b/src/screen_file.c @@ -228,15 +228,18 @@ change_directory(screen_t *screen, mpdclient_t *c, filelist_entry_t *entry, char parent[0] = '\0'; } path = g_strdup(parent); + list_window_reset(lw); + /* restore previous list window state */ + list_window_pop_state(lw_state,lw); } else { /* entry==NULL, then new_path ("" is root) */ path = g_strdup(new_path); + list_window_reset(lw); + /* restore first list window state (pop while returning true) */ + while(list_window_pop_state(lw_state,lw)); } - list_window_reset(lw); - /* restore previous list window state */ - list_window_pop_state(lw_state,lw); } else if( entity->type==MPD_INFO_ENTITY_TYPE_DIRECTORY) diff --git a/src/screen_search.c b/src/screen_search.c index 3f07d47..530883f 100644 --- a/src/screen_search.c +++ b/src/screen_search.c @@ -276,19 +276,21 @@ search_advanced_query(char *query, mpdclient_t *c) * + the code below should live in mpdclient.c *----------------------------------------------------------------------- */ - mpd_InfoEntity *entity; - /** stupid - but this is just a test...... (fulhack) */ + mpd_startSearch(c->connection, FALSE); + int iter; - for(iter = 0; i < 10; i++) + for(iter = 0; iter < 10; iter++) { - mpd_addConstraintSearch(c->connection, table[i], arg[i]); + mpd_addConstraintSearch(c->connection, table[iter], arg[iter]); } mpd_commitSearch(c->connection); filelist = g_malloc0(sizeof(mpdclient_filelist_t)); + mpd_InfoEntity *entity; + while( (entity=mpd_getNextInfoEntity(c->connection)) ) { filelist_entry_t *entry = g_malloc0(sizeof(filelist_entry_t));