Code

po: regenerate ncmpc.pot
[ncmpc.git] / src / command.c
index c458a4ae85f3e35413f472e639d3aea41b35bdd3..f323b12c457e189f5f6f99dad5ed85ab467a3a2f 100644 (file)
@@ -1,5 +1,5 @@
 /* ncmpc (Ncurses MPD Client)
- * (c) 2004-2009 The Music Player Daemon Project
+ * (c) 2004-2010 The Music Player Daemon Project
  * Project homepage: http://musicpd.org
 
  * This program is free software; you can redistribute it and/or modify
@@ -77,11 +77,11 @@ static command_definition_t cmds[] = {
        { { DWN, 'j', 0 }, 0, CMD_LIST_NEXT, "down",
          N_("Move cursor down") },
        { { 'H', 0, 0 }, 0, CMD_LIST_TOP, "top",
-         N_("Move cursor to top of screen") },
+         N_("Move cursor to the top of screen") },
        { { 'M', 0, 0 }, 0, CMD_LIST_MIDDLE, "middle",
-         N_("Move cursor to middle of screen") },
+         N_("Move cursor to the middle of screen") },
        { { 'L', 0, 0 }, 0, CMD_LIST_BOTTOM, "bottom",
-         N_("Move cursor to bottom of screen") },
+         N_("Move cursor to the bottom of screen") },
        { { HOME, 0x01, 0 }, 0, CMD_LIST_FIRST, "home",
          N_("Move cursor to the top of the list") },
        { { END, 0x05, 0 }, 0, CMD_LIST_LAST, "end",
@@ -100,6 +100,8 @@ static command_definition_t cmds[] = {
          N_("Scroll up half a screen") },
        { { 'B',  0, 0 }, 0, CMD_LIST_SCROLL_UP_HALF, "scroll-up-half",
          N_("Scroll down half a screen") },
+       { { 'l', 0, 0 }, 0, CMD_SELECT_PLAYING, "select-playing",
+         N_("Select currently playing song") },
 
 
        /* basic screens */
@@ -192,7 +194,7 @@ static command_definition_t cmds[] = {
          N_("Next screen") },
        { { STAB, 0, 0 }, 0, CMD_SCREEN_PREVIOUS, "screen-prev",
          N_("Previous screen") },
-    { { '`', 0, 0 }, 0, CMD_SCREEN_SWAP, "screen-swap",
+       { { '`', 0, 0 }, 0, CMD_SCREEN_SWAP, "screen-swap",
          N_("Swap to most recent screen") },
 
 
@@ -319,9 +321,8 @@ key2str(int key)
 void
 command_dump_keys(void)
 {
-       int i;
+       int i = 0;
 
-       i = 0;
        while (cmds[i].description) {
                if (cmds[i].command != CMD_NONE)
                        printf(" %20s : %s\n", get_key_names(cmds[i].command,1),cmds[i].name);
@@ -334,9 +335,8 @@ command_dump_keys(void)
 static int
 set_key_flags(command_definition_t *cp, command_t command, int flags)
 {
-       int i;
+       int i = 0;
 
-       i = 0;
        while (cp[i].name) {
                if (cp[i].command == command) {
                        cp[i].flags |= flags;
@@ -353,36 +353,34 @@ set_key_flags(command_definition_t *cp, command_t command, int flags)
 const char *
 get_key_names(command_t command, int all)
 {
-  int i;
-
-  i=0;
-  while (cmds[i].description) {
-         if (cmds[i].command == command) {
-                 int j;
-                 static char keystr[80];
-
-                 g_strlcpy(keystr, key2str(cmds[i].keys[0]), sizeof(keystr));
-                 if (!all)
-                         return keystr;
-                 j=1;
-                 while (j < MAX_COMMAND_KEYS && cmds[i].keys[j] > 0) {
-                         g_strlcat(keystr, " ", sizeof(keystr));
-                         g_strlcat(keystr, key2str(cmds[i].keys[j]), sizeof(keystr));
-                         j++;
-                 }
-                 return keystr;
-         }
-         i++;
-  }
-  return NULL;
+       int i = 0;
+
+       while (cmds[i].description) {
+               if (cmds[i].command == command) {
+                       int j;
+                       static char keystr[80];
+
+                       g_strlcpy(keystr, key2str(cmds[i].keys[0]), sizeof(keystr));
+                       if (!all)
+                               return keystr;
+                       j=1;
+                       while (j < MAX_COMMAND_KEYS && cmds[i].keys[j] > 0) {
+                               g_strlcat(keystr, " ", sizeof(keystr));
+                               g_strlcat(keystr, key2str(cmds[i].keys[j]), sizeof(keystr));
+                               j++;
+                       }
+                       return keystr;
+               }
+               i++;
+       }
+       return NULL;
 }
 
 const char *
 get_key_description(command_t command)
 {
-       int i;
+       int i = 0;
 
-       i=0;
        while (cmds[i].description) {
                if (cmds[i].command == command)
                        return _(cmds[i].description);
@@ -395,9 +393,8 @@ get_key_description(command_t command)
 const char *
 get_key_command_name(command_t command)
 {
-       int i;
+       int i = 0;
 
-       i=0;
        while (cmds[i].name) {
                if (cmds[i].command == command)
                        return cmds[i].name;
@@ -409,9 +406,8 @@ get_key_command_name(command_t command)
 command_t
 get_key_command_from_name(char *name)
 {
-       int i;
+       int i = 0;
 
-       i=0;
        while (cmds[i].name) {
                if (strcmp(name, cmds[i].name) == 0)
                        return cmds[i].command;
@@ -424,9 +420,8 @@ get_key_command_from_name(char *name)
 command_t
 find_key_command(int key, command_definition_t *c)
 {
-       int i;
+       int i = 0;
 
-       i=0;
        while (key && c && c[i].name) {
                if (c[i].keys[0] == key ||
                    c[i].keys[1] == key ||
@@ -464,9 +459,8 @@ get_keyboard_command(void)
 int
 assign_keys(command_t command, int keys[MAX_COMMAND_KEYS])
 {
-       int i;
+       int i = 0;
 
-       i=0;
        while (cmds[i].name) {
                if (cmds[i].command == command) {
                        memcpy(cmds[i].keys, keys, sizeof(int)*MAX_COMMAND_KEYS);
@@ -485,19 +479,18 @@ assign_keys(command_t command, int keys[MAX_COMMAND_KEYS])
 int
 check_key_bindings(command_definition_t *cp, char *buf, size_t bufsize)
 {
-       int i;
+       int i = 0;
        int retval = 0;
 
        if (cp == NULL)
                cp = cmds;
 
-       i=0;
        while (cp[i].name) {
                cp[i].flags &= ~COMMAND_KEY_CONFLICT;
                i++;
        }
 
-       i=0;
+       i = 0;
        while (cp[i].name) {
                int j;
                command_t cmd;
@@ -531,12 +524,11 @@ check_key_bindings(command_definition_t *cp, char *buf, size_t bufsize)
 int
 write_key_bindings(FILE *f, int flags)
 {
-       int i,j;
+       int i = 0, j;
 
        if (flags & KEYDEF_WRITE_HEADER)
                fprintf(f, "## Key bindings for ncmpc (generated by ncmpc)\n\n");
 
-       i = 0;
        while (cmds[i].name && !ferror(f)) {
                if (cmds[i].flags & COMMAND_KEY_MODIFIED ||
                    flags & KEYDEF_WRITE_ALL) {