Code

Daniel rocked the house
authorAndreas Obergrusberger <tradiaz@yahoo.de>
Sat, 11 Nov 2006 20:11:32 +0000 (20:11 +0000)
committerAndreas Obergrusberger <tradiaz@yahoo.de>
Sat, 11 Nov 2006 20:11:32 +0000 (20:11 +0000)
git-svn-id: https://svn.musicpd.org/ncmpc/branches/tradiaz@5041 09075e82-0dd4-0310-85a5-a0d7c8717e4f

ChangeLog
src/list_window.c
src/list_window.h
src/screen_artist.c
src/screen_file.c
src/screen_search.c

index a02f43df3c0f25f13f24d8d3d0a106cfc4e88e79..6fb81d02282bfc812d6112fc293d8f5ae5f5a638 100644 (file)
--- 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>
index 6492d415307a2f83cfcb02e4546c9ea07f4bdf51..db14ff96fb919a65d4405a2c985b401a37f23ebc 100644 (file)
@@ -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;
+}
index 2061e81aa9d6ddf4f8fc5b0dbf6388c2ffc64bc4..9d1211ec4104b65a10eb656b084766dae46a5076 100644 (file)
@@ -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);
 
 
 
index 085c6aac1bea5afa2be3c1833d70599286b18f88..9f98fb6318754aeed4fa729da938d6d7ceafa11f 100644 (file)
@@ -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)
        {
index 4a4bdf70c1bcb0b65b5842cf5ba1c2d13a71bbbd..14a11478c210836d3c143cfeab4fdf56f7666d09 100644 (file)
@@ -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)
index 3f07d47682056d1b6016b6ffbd6e85d7d3711231..530883f67b52db0e4cbd026113cef963f19ca838 100644 (file)
@@ -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));