return max(widget_height(label_w), widget_height(field));
}
-static void config_screen_layout_widgets(struct config_screen *screen,
- enum net_conf_type net_conf)
+static void config_screen_layout_widgets(struct config_screen *screen)
{
struct nc_widget *wl, *wf, *wh;
int y, x, help_x;
wl = widget_label_base(screen->widgets.iface_l);
wf = widget_select_base(screen->widgets.iface_f);
- show = net_conf == NET_CONF_TYPE_DHCP_ONE ||
- net_conf == NET_CONF_TYPE_STATIC;
+ show = screen->net_conf_type == NET_CONF_TYPE_DHCP_ONE ||
+ screen->net_conf_type == NET_CONF_TYPE_STATIC;
widget_set_visible(wl, show);
widget_set_visible(wf, show);
y += layout_pair(screen, y, screen->widgets.iface_l, wf) + 1;
/* conditionally show static IP params */
- show = net_conf == NET_CONF_TYPE_STATIC;
+ show = screen->net_conf_type == NET_CONF_TYPE_STATIC;
wl = widget_label_base(screen->widgets.ip_addr_l);
wf = widget_textbox_base(screen->widgets.ip_addr_f);
y++;
/* we show the DNS/DHCP help if we're configuring DHCP */
- show = net_conf != NET_CONF_TYPE_STATIC;
+ show = screen->net_conf_type != NET_CONF_TYPE_STATIC;
wl = widget_label_base(screen->widgets.dns_dhcp_help_l);
widget_set_visible(wl, show);
if (show) {
struct config_screen *screen = arg;
screen->net_conf_type = value;
widgetset_unpost(screen->widgetset);
- config_screen_layout_widgets(screen, value);
+ config_screen_layout_widgets(screen);
widgetset_post(screen->widgetset);
}
screen->widgets.timeout_f = widget_new_textbox(set, 0, 0, 5, str);
screen->widgets.timeout_help_l = widget_new_label(set, 0, 0, "seconds");
+ widget_textbox_set_fixed_size(screen->widgets.timeout_f);
widget_textbox_set_validator_integer(screen->widgets.timeout_f, 0, 999);
screen->widgets.network_l = widget_new_label(set, 0, 0, "Network");
screen->widgets.ip_addr_l = widget_new_label(set, 0, 0, "IP/mask:");
screen->widgets.ip_addr_f = widget_new_textbox(set, 0, 0, 16, ip);
screen->widgets.ip_mask_l = widget_new_label(set, 0, 0, "/");
- screen->widgets.ip_mask_f = widget_new_textbox(set, 0, 0, 4, mask);
+ screen->widgets.ip_mask_f = widget_new_textbox(set, 0, 0, 3, mask);
screen->widgets.ip_addr_mask_help_l =
widget_new_label(set, 0, 0, "(eg. 192.168.0.10 / 24)");
+ widget_textbox_set_fixed_size(screen->widgets.ip_addr_f);
+ widget_textbox_set_fixed_size(screen->widgets.ip_mask_f);
widget_textbox_set_validator_ipv4(screen->widgets.ip_addr_f);
widget_textbox_set_validator_integer(screen->widgets.ip_mask_f, 1, 31);
screen->widgets.gateway_help_l =
widget_new_label(set, 0, 0, "(eg. 192.168.0.1)");
+ widget_textbox_set_fixed_size(screen->widgets.gateway_f);
widget_textbox_set_validator_ipv4(screen->widgets.gateway_f);
str = talloc_strdup(screen, "");
screen->net_conf_type = find_net_conf_type(config);
config_screen_setup_widgets(screen, config, sysinfo);
- config_screen_layout_widgets(screen, screen->net_conf_type);
+ config_screen_layout_widgets(screen);
}
if (repost)