summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBeniamino Galvani <bgalvani@redhat.com>2016-09-12 14:20:05 +0200
committerBeniamino Galvani <bgalvani@redhat.com>2016-09-14 23:19:17 +0200
commit68654ab9825b2eb8fbeec1b5c44580dd38066132 (patch)
tree77699c3fae54379f82060b0bf22f94502d17389c
parent5866cdba47c85515215afb38ad29fc3fcab1b052 (diff)
downloadnetwork-manager-applet-68654ab9825b2eb8fbeec1b5c44580dd38066132.tar.gz
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.
-rw-r--r--src/connection-editor/ce-page-ip4.ui3
-rw-r--r--src/connection-editor/ce-page-ip6.ui3
-rw-r--r--src/connection-editor/ce-page.h8
-rw-r--r--src/connection-editor/page-ip4.c15
-rw-r--r--src/connection-editor/page-ip6.c18
5 files changed, 36 insertions, 11 deletions
diff --git a/src/connection-editor/ce-page-ip4.ui b/src/connection-editor/ce-page-ip4.ui
index 7acaab56..11c077fe 100644
--- a/src/connection-editor/ce-page-ip4.ui
+++ b/src/connection-editor/ce-page-ip4.ui
@@ -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>
diff --git a/src/connection-editor/ce-page-ip6.ui b/src/connection-editor/ce-page-ip6.ui
index e3b94b06..511383b6 100644
--- a/src/connection-editor/ce-page-ip6.ui
+++ b/src/connection-editor/ce-page-ip6.ui
@@ -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>
diff --git a/src/connection-editor/ce-page.h b/src/connection-editor/ce-page.h
index 6fdb33cb..7670f1f2 100644
--- a/src/connection-editor/ce-page.h
+++ b/src/connection-editor/ce-page.h
@@ -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);
diff --git a/src/connection-editor/page-ip4.c b/src/connection-editor/page-ip4.c
index 4efadd3a..94277233 100644
--- a/src/connection-editor/page-ip4.c
+++ b/src/connection-editor/page-ip4.c
@@ -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).
*/
diff --git a/src/connection-editor/page-ip6.c b/src/connection-editor/page-ip6.c
index 8564285d..5bebf419 100644
--- a/src/connection-editor/page-ip6.c
+++ b/src/connection-editor/page-ip6.c
@@ -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);