summaryrefslogtreecommitdiffstats
path: root/ui/ncurses/nc-menu.h
Commit message (Collapse)AuthorAgeFilesLines
* ui/ncurses: Allow multiple hot key handlers per pmenuSamuel Mendoza-Jonas2018-01-101-1/+6
| | | | | | | | | | | | | | | | | | | | | The main menu and plugin menu are separate screens but they share the pmenu_process_key() handler. This means all the key shortcuts intended for the main menu can also be used in the plugin menu, which is particularly odd for "add new boot option" for example. To work around this extend the 'hot_key' functionality in pmenu to allow multiple handlers. This allows all pmenus to have the usual navigation and action keys, and then add extra handlers as needed. For example, ps3_mm_init() needs main menu shortcuts as well as some PS3-specific shortcuts, whereas plugin_menu_init() only needs the generic key handler. This changes the functionality of pmenu_process_key() such that if a hot_key_fn successfully handles a key, pmenu_process_key() returns instead of continuing to process the key. This does not affect the current usage. Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
* ui/ncurses: Add plugin menu and nc-plugin screenSamuel Mendoza-Jonas2017-08-151-0/+1
| | | | | | | | | | | | Add a second pmenu accessible via the main menu which displays uninstalled and installed pb-plugins. Uninstalled options can be selected to trigger pb-plugin to install them, after which they are updated and marked as installed in the menu. Installed plugins can be investigated by entering the new plugin screen, where plugin metadata and executables are displayed. Executables can be run from this screen via cui_run_cmd(). Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
* ui/ncurses: Move menu initialisation to cui codeJeremy Kerr2014-07-281-1/+0
| | | | | | | | | | | We'll want to re-initialise the petitboot main menu (when the language is changed), which we can't do if the items are populated entirely from the main() function. This change moves the menu initilisation to the cui code, we we can re-init when necessary. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* ui/ncurses: Use a separate type for help textJeremy Kerr2014-07-281-1/+1
| | | | | | | | | | | | Because it's initialised statically, help text won't be directly gettext()-ed. Instead, we need to perform the gettext translation at runtime, and pass untranslated strings into the help_screen code. Instead of trusting callers to pass the untranslated strings though, we encapsulate the help text data into struct help_text, so we know we have an unstranslated string. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* ui/ncurses: Add device hierarchySamuel Mendoza-Jonas2014-07-221-0/+4
| | | | | | | | Boot options are now listed under their matching boot device in the ncurses UI to help differentitate similar boot option names Signed-off-by: Samuel Mendoza-Jonas <sam.mj@au1.ibm.com> Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* ui/ncurses: Separate menu item creation & initialisation from insertionJeremy Kerr2014-04-101-16/+3
| | | | | | | | | | | | | | | | | | | | | | | Currently, the menu item creation is has two main functions: pmenu_item_alloc and pmenu_item_setup. The latter does initialisation (it sets item->name), and inserts the item into the menu. We have pmenu_item_init to combine this into one, but that means we need to do further initialisation (eg, to set on_execute) after the item has been added to the menu. Instead, this change use a more direct _create and _insert interface. Create does the allocation and initialisation, while _insert does the actual insertion. This means new_item failures will be detected at creation time, rather than during pmenu_insert. Also, we're now insert a completely-populated item into the menu, rather than populating on_edit, on_execute and data after insertion. Because we can detect errors from creation (ie, from new_item failing), we add handling code to cui_boot_option_add and cui_boot_editor_on_exit. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* ui/ncurses: Remove pmenu_item_replaceJeremy Kerr2014-04-081-1/+0
| | | | | | ... as nothing uses it. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* ui/ncurses: Don't free item in pmenu_item_setupJeremy Kerr2014-04-081-1/+8
| | | | | | | | | | | | | Currently pmenu_item_setup may free its item parameter on error. This makes it non-obvious whether the item is still allocated on exit to the caller. Instead, this change removes the talloc_free, and requires that the caller do this on error. This makes the potential use-after-free in cui_boot_editor_on_exit obvious, so we fix that too. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* ui/ncurses: Add help text to nc-menu & generic-mainJeremy Kerr2014-01-311-0/+2
| | | | Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* ui/ncurses: Make boot editor API consistent with config & sysinfo screensJeremy Kerr2013-11-221-0/+5
| | | | | | | | | | | | The boot-editor API is a little more exposed than it needs to be: the boot_editor struct does not need to be available to other files, and the init function and on_exit functions differ from those provided for the config and sysinfo screens. This change unifies the boot_editor API with those for the other screens. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* ui/ncurses: nc-menu.h needs assert.hJeremy Kerr2013-11-131-0/+2
| | | | Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* logging: Clean up debug logsJeremy Kerr2013-11-011-12/+4
| | | | | | | We have quite a few pb_logs which should be pb_debug. This change moves developer-specific info to pb_debug. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* ui/ncurses: Defer item creation until boot editor is doneJeremy Kerr2013-10-101-2/+2
| | | | | | | | | | | | Currently, when creating new menu entries, we create an empty item, add it to the menu, then run the boot editor. This means that cancelling the edit will leave an empty item in the menu. This change defers the creation until the boot editor is done. To do this, we modify the on_open callback to take a menu rather than an item, and pass NULL boot data to the editor. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* configure: Update to use AX_WITH_CURSESGeoff Levand2013-07-231-2/+9
| | | | | | | | | | | For a more portable build system convert to using the autoconf-archive AX_WITH_CURSES macros. Allows building on openSUSE, which has a different header file layout than other distros, and fixes menu entries with UTF-8 characters; this causes fedora installs (codename "Schrödinger´s cat") to break the UI. Signed-off-by: Geoff Levand <geoff@infradead.org>
* lib/types: Create common file for type definitionsJeremy Kerr2013-04-101-1/+1
| | | | | | | | | | | | The device and boot_option types are defined in pb-protocol.h, but aren't really specific to the procotol. This means a lot of non-messaging-related files are #including the protocol definitions unnecessarily. This change separates the types out into lib/types/types.h. Signed-off-by: Jeremy Kerr <jk@ozlabs.org> Signed-off-by: Geoff Levand <geoff@infradead.org>
* Add ncurses joystick supportGeoff Levand2009-07-091-0/+1
| | | | Signed-off-by: Geoff Levand <geoffrey.levand@am.sony.com>
* Update item text on editGeoff Levand2009-07-091-0/+1
| | | | | | Update the boot option menu item text on edit. Signed-off-by: Geoff Levand <geoffrey.levand@am.sony.com>
* Remove nc menu descriptionGeoff Levand2009-07-091-4/+3
| | | | | | Remove some unused nc menu description code. Signed-off-by: Geoff Levand <geoffrey.levand@am.sony.com>
* CUI add empty itemGeoff Levand2009-07-091-0/+1
| | | | | | Add a CUI hot-key 'o' that opens a new empty menu item. Signed-off-by: Geoff Levand <geoffrey.levand@am.sony.com>
* Add ncurses UI menuGeoff Levand2009-06-301-0/+130
Add support for an ncurses UI menu object. Signed-off-by: Geoff Levand <geoffrey.levand@am.sony.com> Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
OpenPOWER on IntegriCloud