diff options
author | Jeremy Kerr <jk@ozlabs.org> | 2013-11-17 14:04:08 +1100 |
---|---|---|
committer | Jeremy Kerr <jk@ozlabs.org> | 2013-11-22 10:45:54 +0800 |
commit | 37c9aee3ffc02a299d94867df9df8132b09fc611 (patch) | |
tree | ff87ad3b758f7da2bad7c69b9b8d7113657b9dcb /ui/ncurses/nc-boot-editor.h | |
parent | 504b84c7a37ba8656bceb80fa37138751b7a6702 (diff) | |
download | talos-petitboot-37c9aee3ffc02a299d94867df9df8132b09fc611.tar.gz talos-petitboot-37c9aee3ffc02a299d94867df9df8132b09fc611.zip |
ui/ncurses: Make boot editor API consistent with config & sysinfo screens
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>
Diffstat (limited to 'ui/ncurses/nc-boot-editor.h')
-rw-r--r-- | ui/ncurses/nc-boot-editor.h | 69 |
1 files changed, 12 insertions, 57 deletions
diff --git a/ui/ncurses/nc-boot-editor.h b/ui/ncurses/nc-boot-editor.h index 6b72f25..5c22598 100644 --- a/ui/ncurses/nc-boot-editor.h +++ b/ui/ncurses/nc-boot-editor.h @@ -19,69 +19,24 @@ #if !defined(_PB_NC_KED_H) #define _PB_NC_KED_H -#include <linux/input.h> /* This must be included before ncurses.h */ -#if defined HAVE_NCURSESW_FORM_H -# include <ncursesw/form.h> -#elif defined HAVE_NCURSES_FORM_H -# include <ncurses/form.h> -#elif defined HAVE_FORM_H -# include <form.h> -#else -# error "Curses form.h not found." -#endif +#include "ui/common/discover-client.h" #include "types/types.h" -#include "ui/common/ui-system.h" -#include "nc-scr.h" - -enum boot_editor_attr_cursor { - boot_editor_attr_cursor_ins = A_NORMAL, - boot_editor_attr_cursor_ovl = A_NORMAL | A_UNDERLINE, -}; +#include "nc-cui.h" -/** - * enum boot_editor_result - Result code for boot_editor:on_exit(). - * @boot_editor_cancel: The user canceled the operation. - * @boot_editor_update: The args were updated. - */ +struct boot_editor; -enum boot_editor_result { - boot_editor_cancel, - boot_editor_update, -}; - -/** - * struct boot_editor - kexec args editor. - */ +struct boot_editor *boot_editor_init(struct cui *cui, + struct pmenu_item *item, + const struct system_info *sysinfo, + void (*on_exit)(struct cui *cui, + struct pmenu_item *item, + struct pb_boot_data *bd)); -struct boot_editor { - struct nc_scr scr; - void *data; - struct pmenu *original_pmenu; - void (*on_exit)(struct boot_editor *boot_editor, - enum boot_editor_result result, - struct pb_boot_data *bd); - enum boot_editor_attr_cursor attr_cursor; +struct nc_scr *boot_editor_scr(struct boot_editor *boot_editor); - struct nc_widgetset *widgetset; - struct { - struct nc_widget_label *image_l; - struct nc_widget_textbox *image_f; - struct nc_widget_label *initrd_l; - struct nc_widget_textbox *initrd_f; - struct nc_widget_label *dtb_l; - struct nc_widget_textbox *dtb_f; - struct nc_widget_label *args_l; - struct nc_widget_textbox *args_f; - struct nc_widget_button *ok_b; - struct nc_widget_button *cancel_b; - } widgets; -}; +void boot_editor_update(struct boot_editor *boot_editor, + const struct system_info *info); -struct boot_editor *boot_editor_init(struct pmenu *menu, - const struct pb_boot_data *bd, - void (*on_exit)(struct boot_editor *, - enum boot_editor_result, - struct pb_boot_data *)); #endif |