libnm: update property in the manager after connectivity check

Currently, after a client performs a connectivity check it cannot
access the up-to-date value of the manager.connectivity property right
away, but it must wait that the queued PropertiesChanged signal is
processed, which is cumbersome.

Arguably, clients already receive the new connectivity value as the
result of the connectivity check call, so they don't have to read it
from the object; however it would be better if the right value of the
object property was available immediately as well.

https://bugzilla.gnome.org/show_bug.cgi?id=784629
(cherry picked from commit b799de281b)
This commit is contained in:
Beniamino Galvani 2017-07-27 15:32:05 +02:00
parent 0ba498b17d
commit 883f348534

View file

@ -576,8 +576,13 @@ nm_manager_check_connectivity (NMManager *manager,
if (nmdbus_manager_call_check_connectivity_sync (priv->proxy,
&connectivity,
cancellable, error))
cancellable, error)) {
if (connectivity != priv->connectivity) {
priv->connectivity = connectivity;
g_object_notify (G_OBJECT (manager), NM_MANAGER_CONNECTIVITY);
}
return connectivity;
}
else {
if (error && *error)
g_dbus_error_strip_remote_error (*error);
@ -593,12 +598,21 @@ check_connectivity_cb (GObject *object,
GSimpleAsyncResult *simple = user_data;
guint32 connectivity;
GError *error = NULL;
NMManager *manager;
NMManagerPrivate *priv;
if (nmdbus_manager_call_check_connectivity_finish (NMDBUS_MANAGER (object),
&connectivity,
result, &error))
result, &error)) {
g_simple_async_result_set_op_res_gssize (simple, connectivity);
else {
manager = NM_MANAGER (g_async_result_get_source_object (G_ASYNC_RESULT (simple)));
priv = NM_MANAGER_GET_PRIVATE (manager);
if (connectivity != priv->connectivity) {
priv->connectivity = connectivity;
g_object_notify (G_OBJECT (manager), NM_MANAGER_CONNECTIVITY);
}
} else {
g_dbus_error_strip_remote_error (error);
g_simple_async_result_take_error (simple, error);
}