mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2025-12-25 10:40:08 +01:00
core: move nm_device_interface_get_enabled() to nm-device.c
This commit is contained in:
parent
c71656ff07
commit
51c25508c2
7 changed files with 19 additions and 18 deletions
|
|
@ -368,13 +368,3 @@ nm_device_interface_set_enabled (NMDeviceInterface *device, gboolean enabled)
|
|||
NM_DEVICE_INTERFACE_GET_INTERFACE (device)->set_enabled (device, enabled);
|
||||
}
|
||||
|
||||
gboolean
|
||||
nm_device_interface_get_enabled (NMDeviceInterface *device)
|
||||
{
|
||||
g_return_val_if_fail (NM_IS_DEVICE_INTERFACE (device), FALSE);
|
||||
|
||||
if (NM_DEVICE_INTERFACE_GET_INTERFACE (device)->get_enabled)
|
||||
return NM_DEVICE_INTERFACE_GET_INTERFACE (device)->get_enabled (device);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -102,8 +102,6 @@ struct _NMDeviceInterface {
|
|||
|
||||
void (*set_enabled) (NMDeviceInterface *device, gboolean enabled);
|
||||
|
||||
gboolean (*get_enabled) (NMDeviceInterface *device);
|
||||
|
||||
/* Signals */
|
||||
void (*state_changed) (NMDeviceInterface *device,
|
||||
NMDeviceState new_state,
|
||||
|
|
@ -124,8 +122,6 @@ gboolean nm_device_interface_activate (NMDeviceInterface *device,
|
|||
|
||||
void nm_device_interface_deactivate (NMDeviceInterface *device, NMDeviceStateReason reason);
|
||||
|
||||
gboolean nm_device_interface_get_enabled (NMDeviceInterface *device);
|
||||
|
||||
void nm_device_interface_set_enabled (NMDeviceInterface *device, gboolean enabled);
|
||||
|
||||
#endif /* NM_DEVICE_INTERFACE_H */
|
||||
|
|
|
|||
|
|
@ -286,7 +286,7 @@ real_act_stage3_ip4_config_start (NMDevice *device,
|
|||
/*****************************************************************************/
|
||||
|
||||
static gboolean
|
||||
real_get_enabled (NMDeviceInterface *device)
|
||||
real_get_enabled (NMDevice *device)
|
||||
{
|
||||
return nm_modem_get_mm_enabled (NM_DEVICE_MODEM_GET_PRIVATE (device)->modem);
|
||||
}
|
||||
|
|
@ -351,7 +351,6 @@ nm_device_modem_new (NMModem *modem, const char *driver)
|
|||
static void
|
||||
device_interface_init (NMDeviceInterface *iface_class)
|
||||
{
|
||||
iface_class->get_enabled = real_get_enabled;
|
||||
iface_class->set_enabled = real_set_enabled;
|
||||
}
|
||||
|
||||
|
|
@ -457,6 +456,7 @@ nm_device_modem_class_init (NMDeviceModemClass *mclass)
|
|||
device_class->act_stage1_prepare = real_act_stage1_prepare;
|
||||
device_class->act_stage2_config = real_act_stage2_config;
|
||||
device_class->act_stage3_ip4_config_start = real_act_stage3_ip4_config_start;
|
||||
device_class->get_enabled = real_get_enabled;
|
||||
|
||||
/* Properties */
|
||||
g_object_class_install_property
|
||||
|
|
|
|||
|
|
@ -560,6 +560,17 @@ nm_device_is_available (NMDevice *self)
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
gboolean
|
||||
nm_device_get_enabled (NMDevice *self)
|
||||
{
|
||||
g_return_val_if_fail (self != NULL, FALSE);
|
||||
g_return_val_if_fail (NM_IS_DEVICE (self), FALSE);
|
||||
|
||||
if (NM_DEVICE_GET_CLASS (self)->get_enabled)
|
||||
return NM_DEVICE_GET_CLASS (self)->get_enabled (self);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
autoconnect_allowed_accumulator (GSignalInvocationHint *ihint,
|
||||
GValue *return_accu,
|
||||
|
|
|
|||
|
|
@ -73,6 +73,8 @@ typedef struct {
|
|||
|
||||
gboolean (* is_available) (NMDevice *self);
|
||||
|
||||
gboolean (* get_enabled) (NMDevice *self);
|
||||
|
||||
NMConnection * (* get_best_auto_connection) (NMDevice *self,
|
||||
GSList *connections,
|
||||
char **specific_object);
|
||||
|
|
@ -173,6 +175,8 @@ gboolean nm_device_autoconnect_allowed (NMDevice *self);
|
|||
|
||||
NMDeviceState nm_device_get_state (NMDevice *device);
|
||||
|
||||
gboolean nm_device_get_enabled (NMDevice *device);
|
||||
|
||||
gboolean nm_device_get_managed (NMDevice *device);
|
||||
void nm_device_set_managed (NMDevice *device,
|
||||
gboolean managed,
|
||||
|
|
|
|||
|
|
@ -1239,7 +1239,7 @@ nm_manager_get_modem_enabled_state (NMManager *self)
|
|||
|
||||
g_object_get (G_OBJECT (candidate), NM_DEVICE_INTERFACE_RFKILL_TYPE, &devtype, NULL);
|
||||
if (devtype == RFKILL_TYPE_WWAN) {
|
||||
if (!nm_device_interface_get_enabled (NM_DEVICE_INTERFACE (candidate)))
|
||||
if (!nm_device_get_enabled (candidate))
|
||||
candidate_state = RFKILL_SOFT_BLOCKED;
|
||||
|
||||
if (candidate_state > wwan_state)
|
||||
|
|
|
|||
|
|
@ -964,7 +964,7 @@ schedule_activate_check (NMPolicy *policy, NMDevice *device, guint delay_seconds
|
|||
if (state < NM_DEVICE_STATE_DISCONNECTED)
|
||||
return;
|
||||
|
||||
if (!nm_device_interface_get_enabled (NM_DEVICE_INTERFACE (device)))
|
||||
if (!nm_device_get_enabled (device))
|
||||
return;
|
||||
|
||||
if (!nm_device_autoconnect_allowed (device))
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue