core: kill nm_device_interface_get_state()

This commit is contained in:
Dan Williams 2011-11-17 22:50:36 -06:00
parent e5c1a0ed13
commit f8852bf4a4
9 changed files with 20 additions and 28 deletions

View file

@ -421,7 +421,7 @@ ppp_failed (NMModem *modem, NMDeviceStateReason reason, gpointer user_data)
{
NMDevice *device = NM_DEVICE (user_data);
switch (nm_device_interface_get_state (NM_DEVICE_INTERFACE (device))) {
switch (nm_device_get_state (device)) {
case NM_DEVICE_STATE_PREPARE:
case NM_DEVICE_STATE_CONFIG:
case NM_DEVICE_STATE_NEED_AUTH:
@ -478,7 +478,7 @@ modem_prepare_result (NMModem *modem,
NMDevice *device = NM_DEVICE (user_data);
NMDeviceState state;
state = nm_device_interface_get_state (NM_DEVICE_INTERFACE (device));
state = nm_device_get_state (device);
g_return_if_fail (state == NM_DEVICE_STATE_CONFIG || state == NM_DEVICE_STATE_NEED_AUTH);
if (success) {
@ -611,7 +611,7 @@ nm_device_bt_modem_added (NMDeviceBt *self,
/* Can only accept the modem in stage2, but since the interface matched
* what we were expecting, don't let anything else claim the modem either.
*/
state = nm_device_interface_get_state (NM_DEVICE_INTERFACE (self));
state = nm_device_get_state (NM_DEVICE (self));
if (state != NM_DEVICE_STATE_CONFIG) {
nm_log_warn (LOGD_BT | LOGD_MB,
"(%s): modem found but device not in correct state (%d)",

View file

@ -334,11 +334,14 @@ gboolean
nm_device_interface_disconnect (NMDeviceInterface *device,
GError **error)
{
NMDeviceState state;
gboolean success = FALSE;
g_return_val_if_fail (NM_IS_DEVICE_INTERFACE (device), FALSE);
switch (nm_device_interface_get_state (device)) {
g_object_get (G_OBJECT (device), "state", &state, NULL);
switch (state) {
case NM_DEVICE_STATE_UNKNOWN:
case NM_DEVICE_STATE_UNMANAGED:
case NM_DEVICE_STATE_UNAVAILABLE:
@ -371,15 +374,6 @@ nm_device_interface_deactivate (NMDeviceInterface *device, NMDeviceStateReason r
NM_DEVICE_INTERFACE_GET_INTERFACE (device)->deactivate (device, reason);
}
NMDeviceState
nm_device_interface_get_state (NMDeviceInterface *device)
{
NMDeviceState state;
g_object_get (G_OBJECT (device), "state", &state, NULL);
return state;
}
gboolean
nm_device_interface_spec_match_list (NMDeviceInterface *device,
const GSList *specs)

View file

@ -141,8 +141,6 @@ gboolean nm_device_interface_activate (NMDeviceInterface *device,
void nm_device_interface_deactivate (NMDeviceInterface *device, NMDeviceStateReason reason);
NMDeviceState nm_device_interface_get_state (NMDeviceInterface *device);
gboolean nm_device_interface_spec_match_list (NMDeviceInterface *device,
const GSList *specs);

View file

@ -69,7 +69,7 @@ ppp_failed (NMModem *modem, NMDeviceStateReason reason, gpointer user_data)
{
NMDevice *device = NM_DEVICE (user_data);
switch (nm_device_interface_get_state (NM_DEVICE_INTERFACE (device))) {
switch (nm_device_get_state (device)) {
case NM_DEVICE_STATE_PREPARE:
case NM_DEVICE_STATE_CONFIG:
case NM_DEVICE_STATE_NEED_AUTH:
@ -99,7 +99,7 @@ modem_prepare_result (NMModem *modem,
NMDevice *device = NM_DEVICE (user_data);
NMDeviceState state;
state = nm_device_interface_get_state (NM_DEVICE_INTERFACE (device));
state = nm_device_get_state (device);
g_return_if_fail (state == NM_DEVICE_STATE_PREPARE);
if (success)
@ -302,7 +302,7 @@ real_set_enabled (NMDeviceInterface *device, gboolean enabled)
nm_modem_set_mm_enabled (priv->modem, enabled);
if (enabled == FALSE) {
state = nm_device_interface_get_state (device);
state = nm_device_get_state (NM_DEVICE (device));
if (state == NM_DEVICE_STATE_ACTIVATED) {
nm_device_state_changed (NM_DEVICE (device),
NM_DEVICE_STATE_DISCONNECTED,

View file

@ -3071,7 +3071,7 @@ real_set_enabled (NMDeviceInterface *device, gboolean enabled)
nm_device_get_iface (NM_DEVICE (device)),
enabled ? "enabled" : "disabled");
state = nm_device_interface_get_state (NM_DEVICE_INTERFACE (self));
state = nm_device_get_state (NM_DEVICE (self));
if (state < NM_DEVICE_STATE_UNAVAILABLE) {
nm_log_dbg (LOGD_WIFI, "(%s): %s blocked by UNMANAGED state",
enabled ? "enable" : "disable",

View file

@ -77,7 +77,7 @@ carrier_action_defer_cb (gpointer user_data)
priv->carrier_action_defer_id = 0;
state = nm_device_interface_get_state (NM_DEVICE_INTERFACE (self));
state = nm_device_get_state (NM_DEVICE (self));
if (state == NM_DEVICE_STATE_UNAVAILABLE) {
if (priv->carrier)
nm_device_state_changed (NM_DEVICE (self), NM_DEVICE_STATE_DISCONNECTED, NM_DEVICE_STATE_REASON_CARRIER);
@ -109,7 +109,7 @@ set_carrier (NMDeviceWired *self,
priv->carrier = carrier;
g_object_notify (G_OBJECT (self), "carrier");
state = nm_device_interface_get_state (NM_DEVICE_INTERFACE (self));
state = nm_device_get_state (NM_DEVICE (self));
nm_log_info (LOGD_HW | NM_DEVICE_WIRED_LOG_LEVEL (NM_DEVICE (self)),
"(%s): carrier now %s (device state %d%s)",
nm_device_get_iface (NM_DEVICE (self)),
@ -166,7 +166,7 @@ carrier_off (NMNetlinkMonitor *monitor,
* so that tripping over a cable, power-cycling a switch, or breaking
* off the RJ45 locking tab isn't so catastrophic.
*/
state = nm_device_interface_get_state (NM_DEVICE_INTERFACE (self));
state = nm_device_get_state (device);
if (state > NM_DEVICE_STATE_DISCONNECTED)
defer = TRUE;

View file

@ -2096,7 +2096,7 @@ nm_manager_activate_connection (NMManager *manager,
return NULL;
}
state = nm_device_interface_get_state (NM_DEVICE_INTERFACE (device));
state = nm_device_get_state (device);
if (state < NM_DEVICE_STATE_DISCONNECTED) {
g_set_error (error,
NM_MANAGER_ERROR, NM_MANAGER_ERROR_UNMANAGED_DEVICE,

View file

@ -960,7 +960,7 @@ schedule_activate_check (NMPolicy *policy, NMDevice *device, guint delay_seconds
if (nm_manager_get_state (policy->manager) == NM_STATE_ASLEEP)
return;
state = nm_device_interface_get_state (NM_DEVICE_INTERFACE (device));
state = nm_device_get_state (device);
if (state < NM_DEVICE_STATE_DISCONNECTED)
return;

View file

@ -322,7 +322,7 @@ update_availability (NMDeviceWimax *self, gboolean old_available)
if (new_available == old_available)
return FALSE;
state = nm_device_interface_get_state (NM_DEVICE_INTERFACE (self));
state = nm_device_get_state (device);
if (state == NM_DEVICE_STATE_UNAVAILABLE) {
if (new_available == TRUE) {
nm_device_state_changed (device,
@ -879,7 +879,7 @@ wmx_state_change_cb (struct wmxsdk *wmxsdk,
if (new_status == old_status)
return;
state = nm_device_interface_get_state (NM_DEVICE_INTERFACE (self));
state = nm_device_get_state (NM_DEVICE (self));
old_available = nm_device_is_available (NM_DEVICE (self));
priv->status = new_status;
@ -994,7 +994,7 @@ wmx_media_status_cb (struct wmxsdk *wmxsdk,
const char *iface;
iface = nm_device_get_iface (NM_DEVICE (self));
state = nm_device_interface_get_state (NM_DEVICE_INTERFACE (self));
state = nm_device_get_state (NM_DEVICE (self));
nm_log_dbg (LOGD_WIMAX, "(%s): media status change to %s",
iface, iwmx_sdk_media_status_to_str (new_status));
@ -1035,7 +1035,7 @@ wmx_connect_result_cb (struct wmxsdk *wmxsdk,
NMDeviceWimaxPrivate *priv = NM_DEVICE_WIMAX_GET_PRIVATE (self);
NMDeviceState state;
state = nm_device_interface_get_state (NM_DEVICE_INTERFACE (self));
state = nm_device_get_state (NM_DEVICE (self));
if (IS_ACTIVATING_STATE (state)) {
priv->connect_failed = (result == WIMAX_API_CONNECTION_SUCCESS);
/* Wait for the state change so we can get the reason code; we