diff options
author | Dan Williams <dcbw@redhat.com> | 2015-04-29 10:06:51 +0200 |
---|---|---|
committer | Dan Williams <dcbw@redhat.com> | 2015-05-06 16:14:24 -0500 |
commit | 477cbc848af27f0eccf59092873d75e5a50552c1 (patch) | |
tree | 6835fc03b564990daa4058fd0d6a8ff6b19bd9e0 | |
parent | baee9080b790830183fa74fd83f5bf9757f4ac78 (diff) | |
download | NetworkManager-477cbc848af27f0eccf59092873d75e5a50552c1.tar.gz |
trivial: move code
-rw-r--r-- | src/devices/nm-device-vlan.c | 83 |
1 files changed, 39 insertions, 44 deletions
diff --git a/src/devices/nm-device-vlan.c b/src/devices/nm-device-vlan.c index 34fa585488..b2a2fbf5f4 100644 --- a/src/devices/nm-device-vlan.c +++ b/src/devices/nm-device-vlan.c @@ -107,6 +107,45 @@ bring_up (NMDevice *dev, gboolean *no_firmware) /******************************************************************/ +static void +parent_state_changed (NMDevice *parent, + NMDeviceState new_state, + NMDeviceState old_state, + NMDeviceStateReason reason, + gpointer user_data) +{ + NMDeviceVlan *self = NM_DEVICE_VLAN (user_data); + + /* We'll react to our own carrier state notifications. Ignore the parent's. */ + if (reason == NM_DEVICE_STATE_REASON_CARRIER) + return; + + nm_device_set_unmanaged (NM_DEVICE (self), NM_UNMANAGED_PARENT, !nm_device_get_managed (parent), reason); +} + +static void +nm_device_vlan_set_parent (NMDeviceVlan *device, NMDevice *parent) +{ + NMDeviceVlanPrivate *priv = NM_DEVICE_VLAN_GET_PRIVATE (device); + + if (priv->parent_state_id) { + g_signal_handler_disconnect (priv->parent, priv->parent_state_id); + priv->parent_state_id = 0; + } + g_clear_object (&priv->parent); + + if (parent) { + priv->parent = g_object_ref (parent); + priv->parent_state_id = g_signal_connect (priv->parent, + "state-changed", + G_CALLBACK (parent_state_changed), + device); + } + g_object_notify (G_OBJECT (device), NM_DEVICE_VLAN_PARENT); +} + +/******************************************************************/ + static gboolean match_parent (NMDeviceVlan *self, const char *parent) { @@ -239,32 +278,6 @@ complete_connection (NMDevice *device, return TRUE; } -static void parent_state_changed (NMDevice *parent, NMDeviceState new_state, - NMDeviceState old_state, - NMDeviceStateReason reason, - gpointer user_data); - -static void -nm_device_vlan_set_parent (NMDeviceVlan *device, NMDevice *parent) -{ - NMDeviceVlanPrivate *priv = NM_DEVICE_VLAN_GET_PRIVATE (device); - - if (priv->parent_state_id) { - g_signal_handler_disconnect (priv->parent, priv->parent_state_id); - priv->parent_state_id = 0; - } - g_clear_object (&priv->parent); - - if (parent) { - priv->parent = g_object_ref (parent); - priv->parent_state_id = g_signal_connect (priv->parent, - "state-changed", - G_CALLBACK (parent_state_changed), - device); - } - g_object_notify (G_OBJECT (device), NM_DEVICE_VLAN_PARENT); -} - static void update_connection (NMDevice *device, NMConnection *connection) { @@ -397,24 +410,6 @@ deactivate (NMDevice *device) /******************************************************************/ static void -parent_state_changed (NMDevice *parent, - NMDeviceState new_state, - NMDeviceState old_state, - NMDeviceStateReason reason, - gpointer user_data) -{ - NMDeviceVlan *self = NM_DEVICE_VLAN (user_data); - - /* We'll react to our own carrier state notifications. Ignore the parent's. */ - if (reason == NM_DEVICE_STATE_REASON_CARRIER) - return; - - nm_device_set_unmanaged (NM_DEVICE (self), NM_UNMANAGED_PARENT, !nm_device_get_managed (parent), reason); -} - -/******************************************************************/ - -static void nm_device_vlan_init (NMDeviceVlan * self) { } |