aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog6
-rw-r--r--src/list_window.c8
-rw-r--r--src/list_window.h2
-rw-r--r--src/screen_artist.c34
-rw-r--r--src/screen_file.c9
-rw-r--r--src/screen_search.c10
6 files changed, 56 insertions, 13 deletions
diff --git a/ChangeLog b/ChangeLog
index a02f43df3..6fb81d022 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,10 @@
+2006-11-11 Andreas Obergrusberger <tradiaz@yahoo.de>
+ * fixed advanced search
+ * go root/parent also for artist screen
+
2006-11-8 Andreas Obergrusberger <tradiaz@yahoo.de>
* 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 <tradiaz@yahoo.de>
diff --git a/src/list_window.c b/src/list_window.c
index 6492d4153..db14ff96f 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 2061e81aa..9d1211ec4 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 085c6aac1..9f98fb631 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 4a4bdf70c..14a11478c 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 3f07d4768..530883f67 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));