network: Move class property inside the two subclasses that use it

This commit is contained in:
Robert Ancell 2019-11-06 14:19:56 +13:00
parent 80a2af7f32
commit f5949160c3
10 changed files with 9 additions and 17 deletions

View file

@ -103,7 +103,6 @@ ce_page_8021x_security_new (NMConnection *connection,
self = CE_PAGE_8021X_SECURITY (ce_page_new (ce_page_8021x_security_get_type (),
connection,
client,
"/org/gnome/control-center/network/8021x-security-page.ui"));
self->box = GTK_BOX (gtk_builder_get_object (CE_PAGE (self)->builder, "box"));

View file

@ -423,7 +423,6 @@ ce_page_details_new (NMConnection *connection,
self = CE_PAGE_DETAILS (ce_page_new (ce_page_details_get_type (),
connection,
client,
"/org/gnome/control-center/network/details-page.ui"));
self->all_user_check = GTK_CHECK_BUTTON (gtk_builder_get_object (CE_PAGE (self)->builder, "all_user_check"));

View file

@ -35,14 +35,15 @@ struct _CEPageEthernet
{
CEPage parent;
NMSettingConnection *setting_connection;
NMSettingWired *setting_wired;
GtkEntry *name;
GtkComboBoxText *device_mac;
GtkComboBoxText *cloned_mac;
GtkSpinButton *mtu;
GtkWidget *mtu_label;
NMClient *client;
NMSettingConnection *setting_connection;
NMSettingWired *setting_wired;
};
G_DEFINE_TYPE (CEPageEthernet, ce_page_ethernet, CE_TYPE_PAGE)
@ -87,7 +88,7 @@ connect_ethernet_page (CEPageEthernet *self)
gtk_entry_set_text (self->name, name);
/* Device MAC address */
mac_list = ce_page_get_mac_list (CE_PAGE (self)->client, NM_TYPE_DEVICE_ETHERNET,
mac_list = ce_page_get_mac_list (self->client, NM_TYPE_DEVICE_ETHERNET,
NM_DEVICE_ETHERNET_PERMANENT_HW_ADDRESS);
s_mac_str = nm_setting_wired_get_mac_address (setting);
ce_page_setup_mac_combo (self->device_mac, s_mac_str, mac_list);
@ -203,7 +204,6 @@ ce_page_ethernet_new (NMConnection *connection,
self = CE_PAGE_ETHERNET (ce_page_new (ce_page_ethernet_get_type (),
connection,
client,
"/org/gnome/control-center/network/ethernet-page.ui"));
self->name = GTK_ENTRY (gtk_builder_get_object (CE_PAGE (self)->builder, "name_entry"));
@ -212,6 +212,7 @@ ce_page_ethernet_new (NMConnection *connection,
self->mtu = GTK_SPIN_BUTTON (gtk_builder_get_object (CE_PAGE (self)->builder, "mtu_spin"));
self->mtu_label = GTK_WIDGET (gtk_builder_get_object (CE_PAGE (self)->builder, "mtu_label"));
self->client = client;
self->setting_connection = nm_connection_get_setting_connection (connection);
self->setting_wired = nm_connection_get_setting_wired (connection);

View file

@ -899,7 +899,6 @@ ce_page_ip4_new (NMConnection *connection,
self = CE_PAGE_IP4 (ce_page_new (ce_page_ip4_get_type (),
connection,
client,
"/org/gnome/control-center/network/ip4-page.ui"));
self->setting = nm_connection_get_setting_ip4_config (connection);

View file

@ -823,7 +823,6 @@ ce_page_ip6_new (NMConnection *connection,
self = CE_PAGE_IP6 (ce_page_new (ce_page_ip6_get_type (),
connection,
client,
"/org/gnome/control-center/network/ip6-page.ui"));
self->setting = nm_connection_get_setting_ip6_config (connection);

View file

@ -463,7 +463,6 @@ ce_page_security_new (NMConnection *connection,
self = CE_PAGE_SECURITY (ce_page_new (ce_page_security_get_type (),
connection,
client,
"/org/gnome/control-center/network/security-page.ui"));
sws = nm_connection_get_setting_wireless_security (connection);

View file

@ -208,7 +208,6 @@ ce_page_vpn_new (NMConnection *connection,
self = CE_PAGE_VPN (ce_page_new (ce_page_vpn_get_type (),
connection,
client,
"/org/gnome/control-center/network/vpn-page.ui"));
self->failure_label = GTK_LABEL (gtk_builder_get_object (CE_PAGE (self)->builder, "failure_label"));

View file

@ -40,6 +40,7 @@ struct _CEPageWifi
GtkComboBoxText *mac_combo;
GtkEntry *ssid_entry;
NMClient *client;
NMSettingWireless *setting;
};
@ -78,7 +79,7 @@ connect_wifi_page (CEPageWifi *self)
g_strfreev (bssid_list);
g_signal_connect_swapped (self->bssid_combo, "changed", G_CALLBACK (ce_page_changed), self);
mac_list = ce_page_get_mac_list (CE_PAGE (self)->client, NM_TYPE_DEVICE_WIFI,
mac_list = ce_page_get_mac_list (self->client, NM_TYPE_DEVICE_WIFI,
NM_DEVICE_WIFI_PERMANENT_HW_ADDRESS);
s_mac_str = nm_setting_wireless_get_mac_address (self->setting);
ce_page_setup_mac_combo (self->mac_combo, s_mac_str, mac_list);
@ -189,7 +190,6 @@ ce_page_wifi_new (NMConnection *connection,
self = CE_PAGE_WIFI (ce_page_new (ce_page_wifi_get_type (),
connection,
client,
"/org/gnome/control-center/network/wifi-page.ui"));
self->bssid_combo = GTK_COMBO_BOX_TEXT (gtk_builder_get_object (CE_PAGE (self)->builder, "bssid_combo"));
@ -197,6 +197,7 @@ ce_page_wifi_new (NMConnection *connection,
self->mac_combo = GTK_COMBO_BOX_TEXT (gtk_builder_get_object (CE_PAGE (self)->builder, "mac_combo"));
self->ssid_entry = GTK_ENTRY (gtk_builder_get_object (CE_PAGE (self)->builder, "ssid_entry"));
self->client = client;
self->setting = nm_connection_get_setting_wireless (connection);
connect_wifi_page (self);

View file

@ -200,7 +200,6 @@ ce_page_class_init (CEPageClass *page_class)
CEPage *
ce_page_new (GType type,
NMConnection *connection,
NMClient *client,
const gchar *ui_resource)
{
g_autoptr(CEPage) self = NULL;
@ -209,7 +208,6 @@ ce_page_new (GType type,
self = CE_PAGE (g_object_new (type,
"connection", connection,
NULL));
self->client = client;
if (ui_resource) {
if (!gtk_builder_add_from_resource (self->builder, ui_resource, &error)) {

View file

@ -49,7 +49,6 @@ struct _CEPage
GtkWidget *page;
NMConnection *connection;
NMClient *client;
};
struct _CEPageClass
@ -73,7 +72,6 @@ gboolean ce_page_get_initialized (CEPage *page);
void ce_page_changed (CEPage *page);
CEPage *ce_page_new (GType type,
NMConnection *connection,
NMClient *client,
const gchar *ui_resource);
void ce_page_complete_init (CEPage *page,
const gchar *setting_name,