2008-03-12 Dan Williams <dcbw@redhat.com>

Move the 'carrier' property from NMDevice to NMDevice8023Ethernet;
	convert the libnm-glib NMDevice8023Ethernet to cached properties

	* introspection/nm-device-802-3-ethernet.xml
		- New 'Carrier' property
		- New 'PropertiesChanged' signal

	* introspection/nm-device.xml
		- Remove 'Carrier' property
		- Remove 'CarrierChanged' signal

	* src/nm-device-interface.c
	  src/nm-device-interface.h
		- (nm_device_interface_init): remove 'carrier' property and
			'carrier-changed' signal

	* src/nm-device.c
	  src/nm-device.h
		- (nm_device_get_carrier, nm_device_set_carrier): remove
		- (nm_device_activate_stage5_ip_config_commit): don't bother updating
			the link here; wired device will handle that
		- (handle_dhcp_lease_change): don't bother updating link here
		- (get_property, nm_device_class_init): remove carrier property

	* src/nm-device-802-11-wireless.c
		- (real_update_link, nm_device_802_11_wireless_class_init): remove
			real_update_link(); wireless devices don't use carrier at all
		- (link_timeout_cb, supplicant_iface_state_cb_handler,
		   supplicant_iface_connection_state_cb_handler,
		   supplicant_mgr_state_cb_handler): remove anything to do with carrier

	* src/nm-device-802-3-ethernet.c
	  src/nm-device-802-3-ethernet.h
		- (nm_device_802_3_ethernet_carrier_on,
		   nm_device_802_3_ethernet_carrier_off, constructor): use set_carrier()
			instead of nm_device_set_carrier()
		- (device_state_changed): update link from sysfs on activation;
			replaces real_update_link()
		- (real_update_link): remove, replaced by device_state_changed()
		- (nm_device_802_3_ethernet_get_carrier, set_carrier): new functions
		- (nm_device_802_3_ethernet_get_speed): move up with other getters/setters
		- (real_get_generic_capabilities, real_can_interrupt_activation): use
			new get_carrier function
		- (get_property): add 'carrier' property
		- (nm_device_802_3_ethernet_class_init): add 'carrier' property and
			hook into property-changed signal helper

	* src/NetworkManagerPolicy.c
		- (device_carrier_changed): will only ever be called with a wired device
		- (device_added): only hook up to carrier-changed for wired devices

	* libnm-glib/nm-device.c
	  libnm-glib/nm-device.h
		- (constructor, nm_device_class_init): remove carrier-changed signal
		- (device_carrier_changed_proxy): remove; unused
		- (nm_device_get_carrier): remove; carrier a property of wired devices

	* libnm-glib/nm-device-802-3-ethernet.c
	  libnm-glib/nm-device-802-3-ethernet.h
		- Convert to cached properties like AP and Wireless objects
		- (nm_device_802_3_ethernet_get_hw_address): now returns a 'const char *'
			instead of a 'char *', return value should not be freed
		- (nm_device_802_3_ethernet_get_carrier): return current carrier status
		- (constructor): hook into properties-changed helper
		- (set_property, get_property): new functions
		- (nm_device_802_3_ethernet_class_init): export GObject properties

	* test/nm-tool.c
		- (detail_device): strdup the wired hardware address too since it's
			cached now

	* libnm-glib/libnm-glib-test.c
		- (dump_wired): strdup the wired hardware address too since it's
			cached now



git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@3428 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
This commit is contained in:
Dan Williams
2008-03-12 16:12:39 +00:00
parent 763913b200
commit f30cf17bf7
18 changed files with 492 additions and 295 deletions

View File

@@ -66,7 +66,6 @@ struct _NMDevicePrivate
guint32 capabilities;
char * driver;
gboolean carrier;
guint32 ip4_address;
struct in6_addr ip6_address;
@@ -123,7 +122,6 @@ nm_device_init (NMDevice * self)
self->priv->capabilities = NM_DEVICE_CAP_NONE;
self->priv->driver = NULL;
self->priv->carrier = FALSE;
self->priv->ip4_address = 0;
memset (&self->priv->ip6_address, 0, sizeof (struct in6_addr));
@@ -346,33 +344,6 @@ nm_device_get_act_request (NMDevice *self)
}
/*
* Get/set functions for carrier
*/
gboolean
nm_device_get_carrier (NMDevice *self)
{
g_return_val_if_fail (self != NULL, FALSE);
return self->priv->carrier;
}
void
nm_device_set_carrier (NMDevice *self,
const gboolean carrier)
{
NMDevicePrivate *priv;
g_return_if_fail (NM_IS_DEVICE (self));
priv = NM_DEVICE_GET_PRIVATE (self);
if (priv->carrier != carrier) {
priv->carrier = carrier;
g_signal_emit_by_name (self, "carrier-changed", carrier);
}
}
gboolean
nm_device_can_activate (NMDevice *self, gboolean wireless_enabled)
{
@@ -918,14 +889,10 @@ nm_device_activate_stage5_ip_config_commit (gpointer user_data)
nm_info ("Activation (%s) Stage 5 of 5 (IP Configure Commit) started...",
iface);
if (nm_device_set_ip4_config (self, ip4_config)) {
if (NM_DEVICE_GET_CLASS (self)->update_link)
NM_DEVICE_GET_CLASS (self)->update_link (self);
if (nm_device_set_ip4_config (self, ip4_config))
nm_device_state_changed (self, NM_DEVICE_STATE_ACTIVATED);
} else {
else
nm_device_state_changed (self, NM_DEVICE_STATE_FAILED);
}
nm_info ("Activation (%s) Stage 5 of 5 (IP Configure Commit) complete.",
iface);
@@ -1276,10 +1243,7 @@ handle_dhcp_lease_change (NMDevice *device)
g_object_set_data (G_OBJECT (req), NM_ACT_REQUEST_IP4_CONFIG, config);
if (nm_device_set_ip4_config (device, config)) {
if (NM_DEVICE_GET_CLASS (device)->update_link)
NM_DEVICE_GET_CLASS (device)->update_link (device);
} else {
if (!nm_device_set_ip4_config (device, config)) {
nm_warning ("Failed to update IP4 config in response to DHCP event.");
nm_device_state_changed (device, NM_DEVICE_STATE_FAILED);
}
@@ -1724,9 +1688,6 @@ get_property (GObject *object, guint prop_id,
case NM_DEVICE_INTERFACE_PROP_DEVICE_TYPE:
g_value_set_uint (value, priv->type);
break;
case NM_DEVICE_INTERFACE_PROP_CARRIER:
g_value_set_boolean (value, priv->carrier);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
@@ -1791,10 +1752,6 @@ nm_device_class_init (NMDeviceClass *klass)
g_object_class_override_property (object_class,
NM_DEVICE_INTERFACE_PROP_DEVICE_TYPE,
NM_DEVICE_INTERFACE_DEVICE_TYPE);
g_object_class_override_property (object_class,
NM_DEVICE_INTERFACE_PROP_CARRIER,
NM_DEVICE_INTERFACE_CARRIER);
}
void