Network: Use better label for IP address
When we have only one of ip v4 or v6, just label it 'IP Address'. https://bugzilla.gnome.org/show_bug.cgi?id=644965
This commit is contained in:
parent
e43f922b89
commit
b6e340aaa1
1 changed files with 37 additions and 10 deletions
|
@ -605,6 +605,21 @@ out:
|
||||||
g_free (label_id);
|
g_free (label_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
panel_set_widget_heading (CcNetworkPanel *panel,
|
||||||
|
const gchar *sub_pane,
|
||||||
|
const gchar *widget_suffix,
|
||||||
|
const gchar *heading)
|
||||||
|
{
|
||||||
|
gchar *label_id = NULL;
|
||||||
|
GtkWidget *widget;
|
||||||
|
|
||||||
|
label_id = g_strdup_printf ("heading_%s_%s", sub_pane, widget_suffix);
|
||||||
|
widget = GTK_WIDGET (gtk_builder_get_object (panel->priv->builder, label_id));
|
||||||
|
gtk_label_set_label (GTK_LABEL (widget), heading);
|
||||||
|
g_free (label_id);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
add_access_point (CcNetworkPanel *panel, NMAccessPoint *ap, NMAccessPoint *active)
|
add_access_point (CcNetworkPanel *panel, NMAccessPoint *ap, NMAccessPoint *active)
|
||||||
{
|
{
|
||||||
|
@ -998,6 +1013,8 @@ nm_device_refresh_device_ui (CcNetworkPanel *panel, NetDevice *device)
|
||||||
NMDHCP4Config *config_dhcp4 = NULL;
|
NMDHCP4Config *config_dhcp4 = NULL;
|
||||||
NMIP6Config *ip6_config = NULL;
|
NMIP6Config *ip6_config = NULL;
|
||||||
NMDevice *nm_device;
|
NMDevice *nm_device;
|
||||||
|
gboolean has_ip4;
|
||||||
|
gboolean has_ip6;
|
||||||
|
|
||||||
/* we have a new device */
|
/* we have a new device */
|
||||||
nm_device = net_device_get_nm_device (device);
|
nm_device = net_device_get_nm_device (device);
|
||||||
|
@ -1211,11 +1228,13 @@ nm_device_refresh_device_ui (CcNetworkPanel *panel, NetDevice *device)
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
/* IPv4 address */
|
/* IPv4 address */
|
||||||
|
str = nm_dhcp4_config_get_one_option (config_dhcp4,
|
||||||
|
"ip_address");
|
||||||
panel_set_widget_data (panel,
|
panel_set_widget_data (panel,
|
||||||
sub_pane,
|
sub_pane,
|
||||||
"ip4",
|
"ip4",
|
||||||
nm_dhcp4_config_get_one_option (config_dhcp4,
|
str);
|
||||||
"ip_address"));
|
has_ip4 = str != NULL;
|
||||||
|
|
||||||
/* IPv4 DNS */
|
/* IPv4 DNS */
|
||||||
panel_set_widget_data (panel,
|
panel_set_widget_data (panel,
|
||||||
|
@ -1245,6 +1264,7 @@ nm_device_refresh_device_ui (CcNetworkPanel *panel, NetDevice *device)
|
||||||
sub_pane,
|
sub_pane,
|
||||||
"ip4",
|
"ip4",
|
||||||
NULL);
|
NULL);
|
||||||
|
has_ip4 = FALSE;
|
||||||
|
|
||||||
/* IPv4 DNS */
|
/* IPv4 DNS */
|
||||||
panel_set_widget_data (panel,
|
panel_set_widget_data (panel,
|
||||||
|
@ -1273,16 +1293,23 @@ nm_device_refresh_device_ui (CcNetworkPanel *panel, NetDevice *device)
|
||||||
|
|
||||||
/* IPv6 address */
|
/* IPv6 address */
|
||||||
str_tmp = get_ipv6_config_address_as_string (ip6_config);
|
str_tmp = get_ipv6_config_address_as_string (ip6_config);
|
||||||
panel_set_widget_data (panel,
|
panel_set_widget_data (panel, sub_pane, "ip6", str_tmp);
|
||||||
sub_pane,
|
has_ip6 = str_tmp != NULL;
|
||||||
"ip6",
|
|
||||||
str_tmp);
|
|
||||||
g_free (str_tmp);
|
g_free (str_tmp);
|
||||||
} else {
|
} else {
|
||||||
panel_set_widget_data (panel,
|
panel_set_widget_data (panel, sub_pane, "ip6", NULL);
|
||||||
sub_pane,
|
has_ip6 = FALSE;
|
||||||
"ip6",
|
}
|
||||||
NULL);
|
|
||||||
|
if (has_ip4 && has_ip6) {
|
||||||
|
panel_set_widget_heading (panel, sub_pane, "ip4", _("IPv4 Address"));
|
||||||
|
panel_set_widget_heading (panel, sub_pane, "ip6", _("IPv6 Address"));
|
||||||
|
}
|
||||||
|
else if (has_ip4) {
|
||||||
|
panel_set_widget_heading (panel, sub_pane, "ip4", _("IP Address"));
|
||||||
|
}
|
||||||
|
else if (has_ip6) {
|
||||||
|
panel_set_widget_heading (panel, sub_pane, "ip6", _("IP Address"));
|
||||||
}
|
}
|
||||||
out: ;
|
out: ;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue