mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2025-12-29 09:10:10 +01:00
settings: emit NM_SETTINGS_CONNECTION_UPDATED right away and not on an idle handler
I want to combine NM_SETTINGS_CONNECTION_UPDATED and NM_SETTINGS_CONNECTION_UPDATED_BY_USER
into one signal. Thus, they must have same behavior with respect as to whether they are
scheduled on idle.
Emit NM_SETTINGS_CONNECTION_UPDATED right away.
The "Updated" signal is exposed via D-Bus on the settings object.
Removing the idle handling has no bad consequences there.
Apart from that, the signal has only the listener NMSettings::connection_updated().
connection_updated() first emits NM_SETTINGS_SIGNAL_CONNECTION_UPDATED, which only
has listener: NMPolicy::connection_updated(), which already delegates to
an idle handler.
Second, NMSettings::connection_updated() emits
NM_CP_SIGNAL_CONNECTION_UPDATED which has the following listeners:
- NMBluezDevice::cp_connection_updated(), which can cause the
connection to be tracked/untracked. Any further changes are
already delayed on an idle handler (check_emit_usable_schedule()).
- NMDevice::cp_connection_added_or_updated(), which causes the
connection to be tracked by the device. It also emits
"notify::available-connections", which however is only relevant
for the D-Bus bindings.
At last, it does available_connections_check_delete_unrealized()
which also is on an idle handler already.
(cherry picked from commit a4f1a1794f)
This commit is contained in:
parent
887fc983be
commit
fba19c43ee
1 changed files with 2 additions and 23 deletions
|
|
@ -96,8 +96,6 @@ typedef struct {
|
|||
NMSettingsConnectionFlags flags;
|
||||
gboolean ready;
|
||||
|
||||
guint updated_idle_id;
|
||||
|
||||
GSList *pending_auths; /* List of pending authentication requests */
|
||||
gboolean visible; /* Is this connection is visible by some session? */
|
||||
|
||||
|
|
@ -464,23 +462,6 @@ secrets_cleared_cb (NMSettingsConnection *self)
|
|||
priv->agent_secrets = NULL;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
emit_updated (NMSettingsConnection *self)
|
||||
{
|
||||
NM_SETTINGS_CONNECTION_GET_PRIVATE (self)->updated_idle_id = 0;
|
||||
g_signal_emit (self, signals[UPDATED], 0);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
emit_updated_schedule (NMSettingsConnection *self)
|
||||
{
|
||||
NMSettingsConnectionPrivate *priv = NM_SETTINGS_CONNECTION_GET_PRIVATE (self);
|
||||
|
||||
if (priv->updated_idle_id == 0)
|
||||
priv->updated_idle_id = g_idle_add ((GSourceFunc) emit_updated, self);
|
||||
}
|
||||
|
||||
static void
|
||||
set_unsaved (NMSettingsConnection *self, gboolean now_unsaved)
|
||||
{
|
||||
|
|
@ -502,7 +483,7 @@ static void
|
|||
connection_changed_cb (NMSettingsConnection *self, gpointer unused)
|
||||
{
|
||||
set_unsaved (self, TRUE);
|
||||
emit_updated_schedule (self);
|
||||
g_signal_emit (self, signals[UPDATED], 0);
|
||||
}
|
||||
|
||||
/* Update the settings of this connection to match that of 'new_connection',
|
||||
|
|
@ -585,7 +566,7 @@ nm_settings_connection_replace_settings (NMSettingsConnection *self,
|
|||
if (update_unsaved)
|
||||
set_unsaved (self, TRUE);
|
||||
|
||||
emit_updated_schedule (self);
|
||||
g_signal_emit (self, signals[UPDATED], 0);
|
||||
|
||||
g_signal_emit (self, signals[UPDATED_BY_USER], 0);
|
||||
|
||||
|
|
@ -2618,8 +2599,6 @@ dispose (GObject *object)
|
|||
}
|
||||
}
|
||||
|
||||
nm_clear_g_source (&priv->updated_idle_id);
|
||||
|
||||
/* Disconnect handlers.
|
||||
* connection_changed_cb() has to be disconnected *before* nm_connection_clear_secrets(),
|
||||
* because nm_connection_clear_secrets() emits NM_CONNECTION_CHANGED signal.
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue