Add a shortcut type 'shutdown' which will turn off the player

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@31157 a1c6a512-1295-4272-9138-f99709370657
diff --git a/apps/shortcuts.c b/apps/shortcuts.c
index 5541849..e9fa71e 100644
--- a/apps/shortcuts.c
+++ b/apps/shortcuts.c
@@ -51,6 +51,7 @@
     [SHORTCUT_BROWSER] = "browse",
     [SHORTCUT_PLAYLISTMENU] = "playlist menu",
     [SHORTCUT_SEPARATOR] = "separator",
+    [SHORTCUT_SHUTDOWN] = "shutdown",
 };
 
 struct shortcut {
@@ -138,6 +139,7 @@
             return sc->u.setting != NULL;
         case SHORTCUT_DEBUGITEM:
         case SHORTCUT_SEPARATOR:
+        case SHORTCUT_SHUTDOWN:
         default:
             break;
     }
@@ -258,6 +260,7 @@
                     sc->u.setting = find_setting_by_cfgname(value, NULL);
                     break;
                 case SHORTCUT_SEPARATOR:
+                case SHORTCUT_SHUTDOWN:
                     break;
             }
         }
@@ -310,6 +313,11 @@
         return sc->name[0] ? sc->name : P2STR(ID2P(sc->u.setting->lang_id));
     else if (sc->type == SHORTCUT_SEPARATOR)
         return sc->name;
+    else if (sc->type == SHORTCUT_SHUTDOWN && sc->name[0] == '\0')
+    {
+        /* No translation support as only soft_shutdown has LANG_SHUTDOWN defined */
+        return type_strings[SHORTCUT_SHUTDOWN];
+    }
     return sc->name[0] ? sc->name : sc->u.path;
 }
 
@@ -341,6 +349,8 @@
                 return Icon_Menu_functioncall;
             case SHORTCUT_PLAYLISTMENU:
                 return Icon_Playlist;
+            case SHORTCUT_SHUTDOWN:
+                return Icon_System_menu;
             default:
                 break;
         }
@@ -413,6 +423,14 @@
                 case SHORTCUT_DEBUGITEM:
                     run_debug_screen(sc->u.path);
                     break;
+                case SHORTCUT_SHUTDOWN:
+#if CONFIG_CHARGING
+                    if (charger_inserted())
+                        charging_splash();
+                    else
+#endif
+                        sys_poweroff();
+                    break;
                 case SHORTCUT_UNDEFINED:
                 default:
                     break;
diff --git a/apps/shortcuts.h b/apps/shortcuts.h
index d36b2a9..c18834a 100644
--- a/apps/shortcuts.h
+++ b/apps/shortcuts.h
@@ -32,6 +32,7 @@
     SHORTCUT_BROWSER,
     SHORTCUT_PLAYLISTMENU,
     SHORTCUT_SEPARATOR,
+    SHORTCUT_SHUTDOWN,
 
     SHORTCUT_TYPE_COUNT
 };
diff --git a/manual/main_menu/main.tex b/manual/main_menu/main.tex
index 223ef2b..2fa3366 100644
--- a/manual/main_menu/main.tex
+++ b/manual/main_menu/main.tex
@@ -280,6 +280,7 @@
   \item A setting can be configured (any which can be added to the
         \setting{Quick Screen})
   \item A debug menu item can be displayed (useful for developers mostly)
+  \item A shortcut to shutdown the player
 \end{itemize}
 
 \note{Shortcuts into the database are not possible}
@@ -309,6 +310,8 @@
 \item[debug] \config{data} is the name of the debug menu item to display
 \item[separator] \config{data} is ignored; \config{name} can be used to display text,
   or left blank to make the list more accessible with visual gaps
+\item[shutdown] \config{data} is ignored; \config{name} can be used to display text,
+  Causes the player to turn off.
 \end{description}
 
 If the name/icon items are not specified, a sensible default will be used.