Commit 6a3ffaf7 authored by Sébastien Blin's avatar Sébastien Blin

nmclient: detect changes on all active connections

Change-Id: Ic6a177176367b2ad5e1fc06dcd195f05e92c85d8
parent bf5a216c
......@@ -134,7 +134,6 @@ struct RingMainWindowPrivate
#if USE_LIBNM
/* NetworkManager */
NMClient *nm_client;
NMActiveConnection *primary_connection;
#endif
};
......@@ -997,15 +996,8 @@ primary_connection_changed(NMClient *nm, GParamSpec*, RingMainWindow* self)
{
auto* priv = RING_MAIN_WINDOW_GET_PRIVATE(RING_MAIN_WINDOW(self));
auto connection = nm_client_get_primary_connection(nm);
if (priv->primary_connection != connection) {
/* make sure the connection really changed
* on client start it seems to always emit the notify::primary-connection signal though it
* hasn't changed */
log_connection_info(connection);
priv->primary_connection = connection;
priv->cpp->lrc_->connectivityChanged();
}
log_connection_info(connection);
priv->cpp->lrc_->connectivityChanged();
}
static void
......@@ -1023,14 +1015,7 @@ nm_client_cb(G_GNUC_UNUSED GObject *source_object, GAsyncResult *result, RingMa
auto connection = nm_client_get_primary_connection(nm_client);
log_connection_info(connection);
priv->primary_connection = connection;
/* We monitor the primary connection and notify the daemon to re-load its connections
* (accounts, UPnP, ...) when it changes. For example, on most systems, if we have an
* ethernet connection and then also connect to wifi, the primary connection will not change;
* however it will change in the opposite case because an ethernet connection is preferred.
*/
g_signal_connect(nm_client, "notify::primary-connection", G_CALLBACK(primary_connection_changed), self);
g_signal_connect(nm_client, "notify::active-connections", G_CALLBACK(primary_connection_changed), self);
} else {
g_warning("error initializing NetworkManager client: %s", error->message);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment