mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-03-02 17:50:30 +01:00
core: drop NM_DEVICE_RECHECK_AUTO_ACTIVATE signal and call policy directly
GObject signals don't make the code easier to understand, on the
contrary. They may have their purpose, when objects truly must/should
not be aware of each other, and need to be composed very loosely. That
is not the case here.
There really is only one subscriber to NM_DEVICE_RECHECK_AUTO_ACTIVATE
signal, and it only makes sense this way. Instead of going through a
signal invocation, just call the well known method directly. It becomes
clearer who calls this code (and it has a lower overhead).
When using cscope/ctags it also is easier to follow the code because the
tools understand function calls.
(cherry picked from commit 3c59c6b393)
This commit is contained in:
parent
65d127461b
commit
3382e666b2
5 changed files with 13 additions and 26 deletions
|
|
@ -335,7 +335,6 @@ enum {
|
|||
IP6_PREFIX_DELEGATED,
|
||||
IP6_SUBNET_NEEDED,
|
||||
REMOVED,
|
||||
RECHECK_AUTO_ACTIVATE,
|
||||
RECHECK_ASSUME,
|
||||
DNS_LOOKUP_DONE,
|
||||
PLATFORM_ADDRESS_CHANGED,
|
||||
|
|
@ -9083,7 +9082,7 @@ nm_device_queue_recheck_available(NMDevice *self,
|
|||
void
|
||||
nm_device_emit_recheck_auto_activate(NMDevice *self)
|
||||
{
|
||||
g_signal_emit(self, signals[RECHECK_AUTO_ACTIVATE], 0);
|
||||
nm_manager_device_recheck_auto_activate_schedule(nm_device_get_manager(self), self);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
@ -18554,16 +18553,6 @@ nm_device_class_init(NMDeviceClass *klass)
|
|||
G_TYPE_NONE,
|
||||
0);
|
||||
|
||||
signals[RECHECK_AUTO_ACTIVATE] = g_signal_new(NM_DEVICE_RECHECK_AUTO_ACTIVATE,
|
||||
G_OBJECT_CLASS_TYPE(object_class),
|
||||
G_SIGNAL_RUN_FIRST,
|
||||
0,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
G_TYPE_NONE,
|
||||
0);
|
||||
|
||||
signals[RECHECK_ASSUME] = g_signal_new(NM_DEVICE_RECHECK_ASSUME,
|
||||
G_OBJECT_CLASS_TYPE(object_class),
|
||||
G_SIGNAL_RUN_FIRST,
|
||||
|
|
|
|||
|
|
@ -75,7 +75,6 @@
|
|||
#define NM_DEVICE_IP6_PREFIX_DELEGATED "ip6-prefix-delegated"
|
||||
#define NM_DEVICE_IP6_SUBNET_NEEDED "ip6-subnet-needed"
|
||||
#define NM_DEVICE_REMOVED "removed"
|
||||
#define NM_DEVICE_RECHECK_AUTO_ACTIVATE "recheck-auto-activate"
|
||||
#define NM_DEVICE_RECHECK_ASSUME "recheck-assume"
|
||||
#define NM_DEVICE_STATE_CHANGED "state-changed"
|
||||
#define NM_DEVICE_LINK_INITIALIZED "link-initialized"
|
||||
|
|
|
|||
|
|
@ -2666,6 +2666,16 @@ _rfkill_update_from_user(NMManager *self, NMRfkillType rtype, gboolean enabled)
|
|||
|
||||
/*****************************************************************************/
|
||||
|
||||
void
|
||||
nm_manager_device_recheck_auto_activate_schedule(NMManager *self, NMDevice *device)
|
||||
{
|
||||
g_return_if_fail(NM_IS_MANAGER(self));
|
||||
|
||||
nm_policy_device_recheck_auto_activate_schedule(NM_MANAGER_GET_PRIVATE(self)->policy, device);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
static void
|
||||
device_auth_done_cb(NMAuthChain *chain, GDBusMethodInvocation *context, gpointer user_data)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -121,6 +121,8 @@ NMSettingsConnection **nm_manager_get_activatable_connections(NMManager *manager
|
|||
gboolean sort,
|
||||
guint *out_len);
|
||||
|
||||
void nm_manager_device_recheck_auto_activate_schedule(NMManager *self, NMDevice *device);
|
||||
|
||||
void nm_manager_write_device_state_all(NMManager *manager);
|
||||
gboolean nm_manager_write_device_state(NMManager *manager, NMDevice *device, int *out_ifindex);
|
||||
|
||||
|
|
|
|||
|
|
@ -2257,15 +2257,6 @@ device_autoconnect_changed(NMDevice *device, GParamSpec *pspec, gpointer user_da
|
|||
nm_policy_device_recheck_auto_activate_schedule(self, device);
|
||||
}
|
||||
|
||||
static void
|
||||
device_recheck_auto_activate(NMDevice *device, gpointer user_data)
|
||||
{
|
||||
NMPolicyPrivate *priv = user_data;
|
||||
NMPolicy *self = _PRIV_TO_SELF(priv);
|
||||
|
||||
nm_policy_device_recheck_auto_activate_schedule(self, device);
|
||||
}
|
||||
|
||||
static void
|
||||
devices_list_unregister(NMPolicy *self, NMDevice *device)
|
||||
{
|
||||
|
|
@ -2298,10 +2289,6 @@ devices_list_register(NMPolicy *self, NMDevice *device)
|
|||
"notify::" NM_DEVICE_AUTOCONNECT,
|
||||
G_CALLBACK(device_autoconnect_changed),
|
||||
priv);
|
||||
g_signal_connect(device,
|
||||
NM_DEVICE_RECHECK_AUTO_ACTIVATE,
|
||||
G_CALLBACK(device_recheck_auto_activate),
|
||||
priv);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue