static void
real_deactivate (NMDevice *device)
{
	nm_modem_deactivate (NM_DEVICE_MODEM_GET_PRIVATE (device)->modem, device);
}
static void
deactivate (NMDevice *device)
{
    NMDeviceBtPrivate *priv = NM_DEVICE_BT_GET_PRIVATE (device);

    priv->have_iface = FALSE;
    priv->connected = FALSE;

    if (priv->bt_type == NM_BT_CAPABILITY_DUN) {

        if (priv->modem) {
            nm_modem_deactivate (priv->modem, device);

            /* Since we're killing the Modem object before it'll get the
             * state change signal, simulate the state change here.
             */
            nm_modem_device_state_changed (priv->modem,
                                           NM_DEVICE_STATE_DISCONNECTED,
                                           NM_DEVICE_STATE_ACTIVATED,
                                           NM_DEVICE_STATE_REASON_USER_REQUESTED);
            g_object_unref (priv->modem);
            priv->modem = NULL;
        }

        if (priv->type_proxy) {
            /* Don't ever pass NULL through dbus; rfcomm_iface
             * might happen to be NULL for some reason.
             */
            if (priv->rfcomm_iface) {
                dbus_g_proxy_call_no_reply (priv->type_proxy, "Disconnect",
                                            G_TYPE_STRING, priv->rfcomm_iface,
                                            G_TYPE_INVALID);
            }
            g_object_unref (priv->type_proxy);
            priv->type_proxy = NULL;
        }
    } else if (priv->bt_type == NM_BT_CAPABILITY_NAP) {
        if (priv->type_proxy) {
            dbus_g_proxy_call_no_reply (priv->type_proxy, "Disconnect",
                                        G_TYPE_INVALID);
            g_object_unref (priv->type_proxy);
            priv->type_proxy = NULL;
        }
    }

    if (priv->dev_proxy) {
        g_object_unref (priv->dev_proxy);
        priv->dev_proxy = NULL;
    }

    if (priv->timeout_id) {
        g_source_remove (priv->timeout_id);
        priv->timeout_id = 0;
    }

    priv->bt_type = NM_BT_CAPABILITY_NONE;

    g_free (priv->rfcomm_iface);
    priv->rfcomm_iface = NULL;

    if (NM_DEVICE_CLASS (nm_device_bt_parent_class)->deactivate)
        NM_DEVICE_CLASS (nm_device_bt_parent_class)->deactivate (device);
}