From aee50deefe83ea3a79255cb64a252c58775f8a5b Mon Sep 17 00:00:00 2001 From: Andreas Obergrusberger Date: Wed, 8 Nov 2006 15:10:37 +0000 Subject: [PATCH] go to root/parent dir key added git-svn-id: https://svn.musicpd.org/ncmpc/branches/tradiaz@5034 09075e82-0dd4-0310-85a5-a0d7c8717e4f --- ChangeLog | 5 ++ po/ncmpc.pot | 176 +++++++++++++++++++++++++--------------------- src/command.c | 4 ++ src/command.h | 2 + src/screen_file.c | 35 ++++++--- src/screen_help.c | 4 +- 6 files changed, 135 insertions(+), 91 deletions(-) diff --git a/ChangeLog b/ChangeLog index 557279d..a02f43d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2006-11-8 Andreas Obergrusberger + * Daniel added the functionality to go to + the parent and root directory via shortcu + * updated ncmpc.pot + 2006-11-5 Andreas Obergrusberger * spanish translation updated diff --git a/po/ncmpc.pot b/po/ncmpc.pot index d4e7990..25e0edc 100644 --- a/po/ncmpc.pot +++ b/po/ncmpc.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2006-08-07 11:40+0000\n" +"POT-Creation-Date: 2006-11-08 17:12+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -24,21 +24,21 @@ msgstr "" msgid "n" msgstr "" -#: src/main.c:133 src/main.c:140 +#: src/main.c:134 src/main.c:141 msgid "Exiting..." msgstr "" -#: src/main.c:290 +#: src/main.c:300 #, c-format msgid "Error: MPD version %d.%d.%d is to old (0.11.0 needed).\n" msgstr "" -#: src/main.c:342 +#: src/main.c:351 #, c-format msgid "Connecting to %s... [Press %s to abort]" msgstr "" -#: src/main.c:354 +#: src/main.c:363 #, c-format msgid "Connected to %s!" msgstr "" @@ -84,65 +84,65 @@ msgstr "" msgid "[Paused]" msgstr "" -#: src/screen.c:471 src/screen.c:580 +#: src/screen.c:471 src/screen.c:579 #, c-format msgid "Error: Screen to small!\n" msgstr "" -#: src/screen.c:732 +#: src/screen.c:736 msgid "Repeat is on" msgstr "" -#: src/screen.c:733 +#: src/screen.c:737 msgid "Repeat is off" msgstr "" -#: src/screen.c:736 +#: src/screen.c:740 msgid "Random is on" msgstr "" -#: src/screen.c:737 +#: src/screen.c:741 msgid "Random is off" msgstr "" -#: src/screen.c:740 +#: src/screen.c:744 #, c-format msgid "Crossfade %d seconds" msgstr "" -#: src/screen.c:743 +#: src/screen.c:747 msgid "Database updated!" msgstr "" -#: src/screen.c:905 +#: src/screen.c:909 msgid "Shuffled playlist!" msgstr "" -#: src/screen.c:909 +#: src/screen.c:913 msgid "Cleared playlist!" msgstr "" -#: src/screen.c:927 src/screen_file.c:655 +#: src/screen.c:931 src/screen_file.c:687 msgid "Database update started!" msgstr "" -#: src/screen.c:930 src/screen_file.c:663 +#: src/screen.c:934 src/screen_file.c:695 msgid "Database update running..." msgstr "" -#: src/screen.c:943 +#: src/screen.c:947 msgid "Find mode: Wrapped" msgstr "" -#: src/screen.c:944 +#: src/screen.c:948 msgid "Find mode: Normal" msgstr "" -#: src/screen.c:949 +#: src/screen.c:953 msgid "Auto center mode: On" msgstr "" -#: src/screen.c:950 +#: src/screen.c:954 msgid "Auto center mode: Off" msgstr "" @@ -154,7 +154,11 @@ msgstr "" msgid "Find backward: " msgstr "" -#: src/screen_utils.c:166 +#: src/screen_utils.c:128 +msgid "Password: " +msgstr "" + +#: src/screen_utils.c:214 #, c-format msgid "Unable to find '%s'" msgstr "" @@ -168,7 +172,7 @@ msgstr "" msgid "Replace %s [%s/%s] ? " msgstr "" -#: src/screen_play.c:200 src/screen_file.c:313 src/screen_keydef.c:162 +#: src/screen_play.c:200 src/screen_file.c:326 src/screen_keydef.c:162 msgid "Aborted!" msgstr "" @@ -191,44 +195,44 @@ msgstr "" msgid "Playlist on %s" msgstr "" -#: src/screen_file.c:256 +#: src/screen_file.c:269 #, c-format msgid "Loading playlist %s..." msgstr "" -#: src/screen_file.c:298 +#: src/screen_file.c:311 msgid "You can only delete playlists!" msgstr "" -#: src/screen_file.c:305 +#: src/screen_file.c:318 #, c-format msgid "Delete playlist %s [%s/%s] ? " msgstr "" -#: src/screen_file.c:321 +#: src/screen_file.c:334 msgid "Playlist deleted!" msgstr "" -#: src/screen_file.c:340 src/screen_file.c:461 src/screen_file.c:487 +#: src/screen_file.c:353 src/screen_file.c:474 src/screen_file.c:500 #, c-format msgid "Adding '%s' to playlist\n" msgstr "" -#: src/screen_file.c:391 +#: src/screen_file.c:404 #, c-format msgid "Adding directory %s...\n" msgstr "" -#: src/screen_file.c:552 +#: src/screen_file.c:574 #, c-format -msgid "Browse: %s" +msgid "Browse: %s%s%s" msgstr "" -#: src/screen_file.c:644 +#: src/screen_file.c:676 msgid "Screen updated!" msgstr "" -#: src/screen_file.c:652 +#: src/screen_file.c:684 #, c-format msgid "Database update of %s started!" msgstr "" @@ -451,59 +455,59 @@ msgstr "" msgid "Delete playlist" msgstr "" -#: src/screen_help.c:121 +#: src/screen_help.c:123 msgid "Keys - Search screen" msgstr "" -#: src/screen_help.c:123 +#: src/screen_help.c:125 msgid "Search" msgstr "" -#: src/screen_help.c:124 +#: src/screen_help.c:126 msgid "Select and play" msgstr "" -#: src/screen_help.c:131 +#: src/screen_help.c:133 msgid "Keys - Lyrics screen" msgstr "" -#: src/screen_help.c:133 +#: src/screen_help.c:135 msgid "View Lyrics" msgstr "" -#: src/screen_help.c:134 +#: src/screen_help.c:136 msgid "(Re)load lyrics" msgstr "" -#: src/screen_help.c:135 +#: src/screen_help.c:137 msgid "Interrupt retrieval" msgstr "" -#: src/screen_help.c:136 +#: src/screen_help.c:138 msgid "Explicitly download lyrics" msgstr "" -#: src/screen_help.c:137 +#: src/screen_help.c:139 msgid "Save lyrics" msgstr "" -#: src/screen_help.c:220 +#: src/screen_help.c:222 msgid "Help" msgstr "" -#: src/screen_lyrics.c:479 +#: src/screen_lyrics.c:482 msgid "Lyrics [No connection]" msgstr "" -#: src/screen_lyrics.c:480 +#: src/screen_lyrics.c:483 msgid "Lyrics [Not found]" msgstr "" -#: src/screen_lyrics.c:483 +#: src/screen_lyrics.c:486 msgid "Lyrics [retrieving]" msgstr "" -#: src/screen_lyrics.c:565 +#: src/screen_lyrics.c:567 msgid "Lyrics saved!" msgstr "" @@ -627,152 +631,160 @@ msgstr "" msgid "Add url/file to playlist" msgstr "" +#: src/command.c:141 +msgid "Go to root directory" +msgstr "" + #: src/command.c:143 +msgid "Go to parent directory" +msgstr "" + +#: src/command.c:147 msgid "Move item up" msgstr "" -#: src/command.c:145 +#: src/command.c:149 msgid "Move item down" msgstr "" -#: src/command.c:147 +#: src/command.c:151 msgid "Update screen" msgstr "" -#: src/command.c:152 +#: src/command.c:156 msgid "Toggle find mode" msgstr "" -#: src/command.c:154 +#: src/command.c:158 msgid "Toggle auto center mode" msgstr "" -#: src/command.c:159 +#: src/command.c:163 msgid "Next screen" msgstr "" -#: src/command.c:161 +#: src/command.c:165 msgid "Previous screen" msgstr "" -#: src/command.c:166 +#: src/command.c:170 msgid "Forward find" msgstr "" -#: src/command.c:168 +#: src/command.c:172 msgid "Forward find next" msgstr "" -#: src/command.c:170 +#: src/command.c:174 msgid "Backward find" msgstr "" -#: src/command.c:172 +#: src/command.c:176 msgid "Backward find previous" msgstr "" -#: src/command.c:178 +#: src/command.c:182 msgid "Artist screen" msgstr "" -#: src/command.c:182 +#: src/command.c:186 msgid "Search screen" msgstr "" -#: src/command.c:184 +#: src/command.c:188 msgid "Change search mode" msgstr "" -#: src/command.c:189 +#: src/command.c:193 msgid "Clock screen" msgstr "" -#: src/command.c:193 +#: src/command.c:197 msgid "Lyrics screen" msgstr "" -#: src/command.c:195 +#: src/command.c:199 msgid "Interrupt action" msgstr "" -#: src/command.c:197 +#: src/command.c:201 msgid "Update Lyrics" msgstr "" -#: src/command.c:220 +#: src/command.c:224 msgid "Undefined" msgstr "" -#: src/command.c:222 +#: src/command.c:226 msgid "Space" msgstr "" -#: src/command.c:224 +#: src/command.c:228 msgid "Enter" msgstr "" -#: src/command.c:226 +#: src/command.c:230 msgid "Backspace" msgstr "" -#: src/command.c:228 +#: src/command.c:232 msgid "Delete" msgstr "" -#: src/command.c:230 +#: src/command.c:234 msgid "Up" msgstr "" -#: src/command.c:232 +#: src/command.c:236 msgid "Down" msgstr "" -#: src/command.c:234 +#: src/command.c:238 msgid "Left" msgstr "" -#: src/command.c:236 +#: src/command.c:240 msgid "Right" msgstr "" -#: src/command.c:238 +#: src/command.c:242 msgid "Home" msgstr "" -#: src/command.c:240 +#: src/command.c:244 msgid "End" msgstr "" -#: src/command.c:242 +#: src/command.c:246 msgid "PageDown" msgstr "" -#: src/command.c:244 +#: src/command.c:248 msgid "PageUp" msgstr "" -#: src/command.c:246 +#: src/command.c:250 msgid "Tab" msgstr "" -#: src/command.c:248 +#: src/command.c:252 msgid "Shift+Tab" msgstr "" -#: src/command.c:250 +#: src/command.c:254 msgid "Esc" msgstr "" -#: src/command.c:252 +#: src/command.c:256 msgid "Insert" msgstr "" -#: src/command.c:502 +#: src/command.c:506 #, c-format msgid "Key %s assigned to %s and %s (press %s for the key editor)" msgstr "" -#: src/command.c:509 src/command.c:516 +#: src/command.c:513 src/command.c:520 #, c-format msgid "Error: Key %s assigned to %s and %s !!!\n" msgstr "" diff --git a/src/command.c b/src/command.c index 2f0ece1..3210f39 100644 --- a/src/command.c +++ b/src/command.c @@ -137,6 +137,10 @@ static command_definition_t cmds[] = { { 'a', 0, 0 }, 0, CMD_ADD, "add", N_("Add url/file to playlist") }, + { { '!', 0, 0 }, 0, CMD_GO_ROOT_DIRECTORY, "go-root-directory", + N_("Go to root directory") }, + { { '"', 0, 0 }, 0, CMD_GO_PARENT_DIRECTORY, "go-parent-directory", + N_("Go to parent directory") }, /* lists */ { { 11, 0, 0 }, 0, CMD_LIST_MOVE_UP, "move-up", diff --git a/src/command.h b/src/command.h index 86db34c..745b528 100644 --- a/src/command.h +++ b/src/command.h @@ -55,6 +55,8 @@ typedef enum CMD_SCREEN_LYRICS, CMD_LYRICS_UPDATE, CMD_INTERRUPT, + CMD_GO_ROOT_DIRECTORY, + CMD_GO_PARENT_DIRECTORY, CMD_QUIT } command_t; diff --git a/src/screen_file.c b/src/screen_file.c index b2d320f..4a4bdf7 100644 --- a/src/screen_file.c +++ b/src/screen_file.c @@ -207,20 +207,33 @@ browse_lw_callback(int index, int *highlight, void *data) /* chdir */ static int -change_directory(screen_t *screen, mpdclient_t *c, filelist_entry_t *entry) +change_directory(screen_t *screen, mpdclient_t *c, filelist_entry_t *entry, char *new_path) { - mpd_InfoEntity *entity = entry->entity; + mpd_InfoEntity *entity = NULL; gchar *path = NULL; + if( entry!=NULL ) + entity = entry->entity; + else if( new_path==NULL ) + return -1; + if( entity==NULL ) { - /* return to parent */ - char *parent = g_path_get_dirname(filelist->path); - if( strcmp(parent, ".") == 0 ) + if( entry || 0==strcmp(new_path, "..") ) + { + /* return to parent */ + char *parent = g_path_get_dirname(filelist->path); + if( strcmp(parent, ".") == 0 ) + { + parent[0] = '\0'; + } + path = g_strdup(parent); + } + else { - parent[0] = '\0'; + /* entry==NULL, then new_path ("" is root) */ + path = g_strdup(new_path); } - path = g_strdup(parent); list_window_reset(lw); /* restore previous list window state */ list_window_pop_state(lw_state,lw); @@ -366,7 +379,7 @@ browse_handle_enter(screen_t *screen, entity = entry->entity; if( entity==NULL || entity->type==MPD_INFO_ENTITY_TYPE_DIRECTORY ) - return change_directory(screen, c, entry); + return change_directory(screen, c, entry, NULL); else if( entity->type==MPD_INFO_ENTITY_TYPE_PLAYLISTFILE ) return load_playlist(screen, c, entry); else if( entity->type==MPD_INFO_ENTITY_TYPE_SONG ) @@ -635,6 +648,12 @@ browse_cmd(screen_t *screen, mpdclient_t *c, command_t cmd) case CMD_PLAY: browse_handle_enter(screen, c, lw, filelist); return 1; + case CMD_GO_ROOT_DIRECTORY: + return change_directory(screen, c, NULL, ""); + break; + case CMD_GO_PARENT_DIRECTORY: + return change_directory(screen, c, NULL, ".."); + break; case CMD_SELECT: if( browse_handle_select(screen, c, lw, filelist) == 0 ) { diff --git a/src/screen_help.c b/src/screen_help.c index 31a125a..6825e56 100644 --- a/src/screen_help.c +++ b/src/screen_help.c @@ -98,7 +98,7 @@ static help_text_row_t help_text[] = { 0, CMD_PLAY, N_("Play") }, { 0, CMD_DELETE, NULL }, { 0, CMD_CLEAR, NULL }, - { 0, CMD_LIST_MOVE_UP, N_("Move song up") }, + { 1, CMD_LIST_MOVE_UP, N_("Move song up") }, { 0, CMD_LIST_MOVE_DOWN, N_("Move song down") }, { 0, CMD_ADD, NULL }, { 0, CMD_SAVE_PLAYLIST, NULL }, @@ -113,6 +113,8 @@ static help_text_row_t help_text[] = { 0, CMD_SELECT, NULL }, { 0, CMD_SAVE_PLAYLIST, NULL }, { 0, CMD_DELETE, N_("Delete playlist") }, + { 0, CMD_GO_PARENT_DIRECTORY, NULL }, + { 0, CMD_GO_ROOT_DIRECTORY, NULL }, { 0, CMD_SCREEN_UPDATE, NULL }, #ifdef ENABLE_SEARCH_SCREEN -- 2.30.2