summaryrefslogtreecommitdiffstats
path: root/ui
diff options
context:
space:
mode:
authorSamuel Mendoza-Jonas <sam.mj@au1.ibm.com>2015-09-04 15:52:20 +1000
committerSamuel Mendoza-Jonas <sam.mj@au1.ibm.com>2015-09-07 16:55:50 +1000
commit72148c718113a17d80fd1da3c8dd82b471bed07a (patch)
treea3bcf26a76f842cdb1448d8c5047d28194a1f625 /ui
parentf84a33d3b924b3fff999826e4bf86d64067728b2 (diff)
downloadpetitboot-72148c718113a17d80fd1da3c8dd82b471bed07a.zip
petitboot-72148c718113a17d80fd1da3c8dd82b471bed07a.tar.gz
ui/ncurses: Change arrangement of boot order buttons
The buttons 'Add Device', 'Clear', and 'Clear & Boot Any' are short enough to be positioned horizontally, but several localisations have strings as long as all three buttons combined. Instead arrange the buttons vertically and allow longer strings to resize the width of the button to fit the whole string. Signed-off-by: Samuel Mendoza-Jonas <sam.mj@au1.ibm.com>
Diffstat (limited to 'ui')
-rw-r--r--ui/ncurses/nc-config.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/ui/ncurses/nc-config.c b/ui/ncurses/nc-config.c
index aba3f99..b257076 100644
--- a/ui/ncurses/nc-config.c
+++ b/ui/ncurses/nc-config.c
@@ -418,11 +418,11 @@ static void config_screen_layout_widgets(struct config_screen *screen)
y += 1;
widget_move(widget_button_base(screen->widgets.boot_add_b),
- y, screen->field_x);
+ y++, screen->field_x);
widget_move(widget_button_base(screen->widgets.boot_any_b),
- y, screen->field_x + 14);
+ y++, screen->field_x);
widget_move(widget_button_base(screen->widgets.boot_none_b),
- y, screen->field_x + 34);
+ y, screen->field_x);
wf = widget_button_base(screen->widgets.boot_add_b);
if (widget_subset_n_inactive(screen->widgets.boot_order_f))
@@ -710,6 +710,7 @@ static void config_screen_setup_widgets(struct config_screen *screen,
char *str, *ip, *mask, *gw;
enum net_conf_type type;
unsigned int i;
+ int add_len, clear_len, any_len, min_len = 20;
build_assert(sizeof(screen->widgets) / sizeof(struct widget *)
== N_FIELDS);
@@ -717,15 +718,19 @@ static void config_screen_setup_widgets(struct config_screen *screen,
type = screen->net_conf_type;
ifcfg = first_active_interface(config);
- screen->widgets.boot_add_b = widget_new_button(set, 0, 0, 10,
+ add_len = max(min_len, strncols(_("Add Device")));
+ clear_len = max(min_len, strncols(_("Clear")));
+ any_len = max(min_len, strncols(_("Clear & Boot Any")));
+
+ screen->widgets.boot_add_b = widget_new_button(set, 0, 0, add_len,
_("Add Device"),
config_screen_add_device, screen);
- screen->widgets.boot_none_b = widget_new_button(set, 0, 0, 10,
+ screen->widgets.boot_none_b = widget_new_button(set, 0, 0, clear_len,
_("Clear"),
config_screen_autoboot_none, screen);
- screen->widgets.boot_any_b = widget_new_button(set, 0, 0, 16,
+ screen->widgets.boot_any_b = widget_new_button(set, 0, 0, any_len,
_("Clear & Boot Any"),
config_screen_autoboot_any, screen);
OpenPOWER on IntegriCloud