diff options
author | Nikolay Martynov <mar.kolya@gmail.com> | 2017-05-22 22:24:44 -0400 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2017-05-28 23:22:55 +0200 |
commit | 6a4af482f02c4342c69cd38dd46c078aeaf60d0d (patch) | |
tree | 46aa61c6fdb5fb10251165d7f48bc64da8019e76 /clients/tui | |
parent | a5691020f89f4847a4f068896a45372f1da4893a (diff) | |
download | NetworkManager-6a4af482f02c4342c69cd38dd46c078aeaf60d0d.tar.gz |
nmtui: always create ethernet settings for VLAN and wireless security for wifi.
Ethernet settings for VLAN are always created later in settings
normalization. We might as well always created them.
This fixes a user visible problem: currently if user specifies cloned
mac when connection is created this value doesn't get saved. User has
to go, edit saved connection to add it again.
Similar problem existed for wireless security and wifi
Signed-off-by: Nikolay Martynov <mar.kolya@gmail.com>
Diffstat (limited to 'clients/tui')
-rw-r--r-- | clients/tui/nmt-page-vlan.c | 29 | ||||
-rw-r--r-- | clients/tui/nmt-page-wifi.c | 31 |
2 files changed, 5 insertions, 55 deletions
diff --git a/clients/tui/nmt-page-vlan.c b/clients/tui/nmt-page-vlan.c index 9cd6542163..5ff3fa5824 100644 --- a/clients/tui/nmt-page-vlan.c +++ b/clients/tui/nmt-page-vlan.c @@ -32,13 +32,6 @@ G_DEFINE_TYPE (NmtPageVlan, nmt_page_vlan, NMT_TYPE_EDITOR_PAGE_DEVICE) -#define NMT_PAGE_VLAN_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NMT_TYPE_PAGE_VLAN, NmtPageVlanPrivate)) - -typedef struct { - NMSettingWired *s_wired; - -} NmtPageVlanPrivate; - NmtEditorPage * nmt_page_vlan_new (NMConnection *conn, NmtDeviceEntry *deventry) @@ -67,7 +60,6 @@ static void nmt_page_vlan_constructed (GObject *object) { NmtPageVlan *vlan = NMT_PAGE_VLAN (object); - NmtPageVlanPrivate *priv = NMT_PAGE_VLAN_GET_PRIVATE (vlan); NmtEditorSection *section; NmtEditorGrid *grid; NMSettingWired *s_wired; @@ -83,13 +75,9 @@ nmt_page_vlan_constructed (GObject *object) } s_wired = nm_connection_get_setting_wired (conn); if (!s_wired) { - /* It makes things simpler if we always have a NMSettingWired; - * we'll hold a ref on one, and add it to and remove it from - * the connection as needed. - */ - s_wired = NM_SETTING_WIRED (nm_setting_wired_new ()); + nm_connection_add_setting (conn, nm_setting_wired_new ()); + s_wired = nm_connection_get_setting_wired (conn); } - priv->s_wired = g_object_ref_sink (s_wired); section = nmt_editor_section_new (_("VLAN"), NULL, TRUE); grid = nmt_editor_section_get_body (section); @@ -133,23 +121,10 @@ nmt_page_vlan_constructed (GObject *object) } static void -nmt_page_vlan_finalize (GObject *object) -{ - NmtPageVlanPrivate *priv = NMT_PAGE_VLAN_GET_PRIVATE (object); - - g_clear_object (&priv->s_wired); - - G_OBJECT_CLASS (nmt_page_vlan_parent_class)->finalize (object); -} - -static void nmt_page_vlan_class_init (NmtPageVlanClass *vlan_class) { GObjectClass *object_class = G_OBJECT_CLASS (vlan_class); - g_type_class_add_private (vlan_class, sizeof (NmtPageVlanPrivate)); - /* virtual methods */ object_class->constructed = nmt_page_vlan_constructed; - object_class->finalize = nmt_page_vlan_finalize; } diff --git a/clients/tui/nmt-page-wifi.c b/clients/tui/nmt-page-wifi.c index 35625fe4c7..7d734f004b 100644 --- a/clients/tui/nmt-page-wifi.c +++ b/clients/tui/nmt-page-wifi.c @@ -38,13 +38,6 @@ G_DEFINE_TYPE (NmtPageWifi, nmt_page_wifi, NMT_TYPE_EDITOR_PAGE_DEVICE) -#define NMT_PAGE_WIFI_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NMT_TYPE_PAGE_WIFI, NmtPageWifiPrivate)) - -typedef struct { - NMSettingWirelessSecurity *s_wsec; - -} NmtPageWifiPrivate; - NmtEditorPage * nmt_page_wifi_new (NMConnection *conn, NmtDeviceEntry *deventry) @@ -177,7 +170,6 @@ ssid_transform_from_entry (GBinding *binding, static void nmt_page_wifi_constructed (GObject *object) { - NmtPageWifiPrivate *priv = NMT_PAGE_WIFI_GET_PRIVATE (object); NmtPageWifi *wifi = NMT_PAGE_WIFI (object); NmtDeviceEntry *deventry; NmtEditorSection *section; @@ -198,13 +190,10 @@ nmt_page_wifi_constructed (GObject *object) s_wsec = nm_connection_get_setting_wireless_security (conn); if (!s_wsec) { - /* It makes things simpler if we always have a - * NMSettingWirelessSecurity; we'll hold a ref on one, and add - * it to and remove it from the connection as needed. - */ - s_wsec = NM_SETTING_WIRELESS_SECURITY (nm_setting_wireless_security_new ()); + nm_connection_add_setting (conn, nm_setting_wireless_security_new ()); + s_wsec = nm_connection_get_setting_wireless_security (conn); } - priv->s_wsec = g_object_ref_sink (s_wsec); + s_wsec = nm_connection_get_setting_wireless_security (conn); deventry = nmt_editor_page_device_get_device_entry (NMT_EDITOR_PAGE_DEVICE (object)); g_object_bind_property (s_wireless, NM_SETTING_WIRELESS_MAC_ADDRESS, @@ -375,23 +364,9 @@ nmt_page_wifi_constructed (GObject *object) } static void -nmt_page_wifi_finalize (GObject *object) -{ - NmtPageWifiPrivate *priv = NMT_PAGE_WIFI_GET_PRIVATE (object); - - g_clear_object (&priv->s_wsec); - - G_OBJECT_CLASS (nmt_page_wifi_parent_class)->finalize (object); -} - - -static void nmt_page_wifi_class_init (NmtPageWifiClass *wifi_class) { GObjectClass *object_class = G_OBJECT_CLASS (wifi_class); - g_type_class_add_private (wifi_class, sizeof (NmtPageWifiPrivate)); - object_class->constructed = nmt_page_wifi_constructed; - object_class->finalize = nmt_page_wifi_finalize; } |