Commit 68654ab9 authored by Beniamino Galvani's avatar Beniamino Galvani

editor: allow specifying static IP addresses for automatic methods

Allow users to add static IP addresses when the "Automatic" and
"Automatic, addresses only" method are selected in the "IPv4 settings"
and "IPv6 settings" pages.
parent 5866cdba
......@@ -84,7 +84,6 @@
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Addresses</property>
<attributes>
<attribute name="weight" value="bold"/>
</attributes>
......@@ -117,8 +116,6 @@
<property name="height_request">100</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="has_tooltip">True</property>
<property name="tooltip_text" translatable="yes">IP addresses identify your computer on the network. Click the "Add" button to add an IP address.</property>
<child internal-child="selection">
<object class="GtkTreeSelection" id="treeview-selection1"/>
</child>
......
......@@ -101,7 +101,6 @@
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Addresses</property>
<attributes>
<attribute name="weight" value="bold"/>
</attributes>
......@@ -134,8 +133,6 @@
<property name="height_request">100</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="has_tooltip">True</property>
<property name="tooltip_text" translatable="yes">IP addresses identify your computer on the network. Click the "Add" button to add an IP address.</property>
<child internal-child="selection">
<object class="GtkTreeSelection" id="treeview-selection1"/>
</child>
......
......@@ -99,6 +99,14 @@ typedef CEPage* (*CEPageNewFunc)(NMConnectionEditor *editor,
const char **out_secrets_setting_name,
GError **error);
#define CE_TOOLTIP_ADDR_AUTO _("IP addresses identify your computer on the network. " \
"Click the \"Add\" button to add static IP address to be " \
"configured in addition to the automatic ones.")
#define CE_TOOLTIP_ADDR_MANUAL _("IP addresses identify your computer on the network. " \
"Click the \"Add\" button to add an IP address.")
#define CE_LABEL_ADDR_AUTO _("Additional static addresses")
#define CE_LABEL_ADDR_MANUAL _("Addresses")
GType ce_page_get_type (void);
......
......@@ -248,6 +248,7 @@ method_changed (GtkComboBox *combo, gpointer user_data)
gboolean method_auto = FALSE;
GtkTreeIter iter;
GtkListStore *store;
const char *tooltip = NULL, *label = NULL;
if (gtk_combo_box_get_active_iter (priv->method, &iter)) {
gtk_tree_model_get (GTK_TREE_MODEL (priv->method_store), &iter,
......@@ -256,18 +257,25 @@ method_changed (GtkComboBox *combo, gpointer user_data)
switch (method) {
case IP4_METHOD_AUTO:
addr_enabled = FALSE;
addr_enabled = TRUE;
dhcp_enabled = routes_enabled = TRUE;
dns_enabled = TRUE;
method_auto = TRUE;
tooltip = CE_TOOLTIP_ADDR_AUTO;
label = CE_LABEL_ADDR_AUTO;
break;
case IP4_METHOD_AUTO_ADDRESSES:
addr_enabled = FALSE;
addr_enabled = TRUE;
dns_enabled = dhcp_enabled = routes_enabled = TRUE;
tooltip = CE_TOOLTIP_ADDR_AUTO;
label = CE_LABEL_ADDR_AUTO;
break;
case IP4_METHOD_MANUAL:
addr_enabled = dns_enabled = routes_enabled = TRUE;
tooltip = CE_TOOLTIP_ADDR_MANUAL;
label = CE_LABEL_ADDR_MANUAL;
break;
case IP4_METHOD_SHARED:
case IP4_METHOD_DISABLED:
addr_enabled = dns_enabled = dhcp_enabled = routes_enabled = ip4_required_enabled = FALSE;
break;
......@@ -275,6 +283,9 @@ method_changed (GtkComboBox *combo, gpointer user_data)
break;
}
gtk_widget_set_tooltip_text (GTK_WIDGET (priv->addr_list), tooltip);
gtk_label_set_text (GTK_LABEL (priv->addr_label), label);
/* Disable DHCP stuff for VPNs (though in the future we should support
* DHCP over tap interfaces for OpenVPN and vpnc).
*/
......
......@@ -248,6 +248,7 @@ method_changed (GtkComboBox *combo, gpointer user_data)
gboolean method_auto = FALSE;
GtkTreeIter iter;
GtkListStore *store;
const char *tooltip = NULL, *label = NULL;
if (gtk_combo_box_get_active_iter (priv->method, &iter)) {
gtk_tree_model_get (GTK_TREE_MODEL (priv->method_store), &iter,
......@@ -256,23 +257,31 @@ method_changed (GtkComboBox *combo, gpointer user_data)
switch (method) {
case IP6_METHOD_AUTO:
addr_enabled = FALSE;
addr_enabled = TRUE;
routes_enabled = TRUE;
dns_enabled = TRUE;
method_auto = TRUE;
ip6_privacy_enabled = TRUE;
tooltip = CE_TOOLTIP_ADDR_AUTO;
label = CE_LABEL_ADDR_AUTO;
break;
case IP6_METHOD_AUTO_ADDRESSES:
addr_enabled = FALSE;
addr_enabled = TRUE;
dns_enabled = routes_enabled = TRUE;
ip6_privacy_enabled = TRUE;
tooltip = CE_TOOLTIP_ADDR_AUTO;
label = CE_LABEL_ADDR_AUTO;
break;
case IP6_METHOD_AUTO_DHCP_ONLY:
addr_enabled = FALSE;
addr_enabled = TRUE;
routes_enabled = TRUE;
tooltip = CE_TOOLTIP_ADDR_AUTO;
label = CE_LABEL_ADDR_AUTO;
break;
case IP6_METHOD_MANUAL:
addr_enabled = dns_enabled = routes_enabled = TRUE;
tooltip = CE_TOOLTIP_ADDR_MANUAL;
label = CE_LABEL_ADDR_MANUAL;
break;
case IP6_METHOD_IGNORE:
ip6_required_enabled = FALSE;
......@@ -281,6 +290,9 @@ method_changed (GtkComboBox *combo, gpointer user_data)
break;
}
gtk_widget_set_tooltip_text (GTK_WIDGET (priv->addr_list), tooltip);
gtk_label_set_text (GTK_LABEL (priv->addr_label), label);
gtk_widget_set_sensitive (priv->addr_label, addr_enabled);
gtk_widget_set_sensitive (GTK_WIDGET (priv->addr_add), addr_enabled);
gtk_widget_set_sensitive (GTK_WIDGET (priv->addr_delete), addr_enabled);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment