summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2019-10-17 10:47:29 +0200
committerThomas Haller <thaller@redhat.com>2019-10-18 22:09:18 +0200
commit15cc1d87702977e137af46d1deeb9bd901da12e4 (patch)
tree9cca3c0b7bdfbd93b099c2c487fedf8121f37862
parente761d230c3b47e3acfed01c2e013e52b4321363e (diff)
downloadNetworkManager-15cc1d87702977e137af46d1deeb9bd901da12e4.tar.gz
libnm: avoid g_object_notify() in favor of _notify()
This looks up the GParamSpec from the obj_properties and is thus more efficient. Also, the generated _notify() function has the proper argument type and is thus generally preferable.
-rw-r--r--libnm/nm-active-connection.c4
-rw-r--r--libnm/nm-client.c2
-rw-r--r--libnm/nm-manager.c4
-rw-r--r--libnm/nm-remote-connection.c4
-rw-r--r--libnm/nm-vpn-connection.c4
5 files changed, 9 insertions, 9 deletions
diff --git a/libnm/nm-active-connection.c b/libnm/nm-active-connection.c
index 5909c11604..94e02d9df0 100644
--- a/libnm/nm-active-connection.c
+++ b/libnm/nm-active-connection.c
@@ -47,7 +47,7 @@ typedef struct {
NMActiveConnectionStateReason reason;
} NMActiveConnectionPrivate;
-NM_GOBJECT_PROPERTIES_DEFINE_BASE (
+NM_GOBJECT_PROPERTIES_DEFINE (NMActiveConnection,
PROP_CONNECTION,
PROP_ID,
PROP_UUID,
@@ -392,7 +392,7 @@ state_changed_proxy (NMDBusActiveConnectionProxy *proxy,
priv->state = state;
priv->reason = reason;
g_signal_emit (connection, signals[STATE_CHANGED], 0, state, reason);
- g_object_notify (G_OBJECT (connection), NM_ACTIVE_CONNECTION_STATE);
+ _notify (connection, PROP_STATE);
}
static void
diff --git a/libnm/nm-client.c b/libnm/nm-client.c
index a915c718f0..5ab1ba2461 100644
--- a/libnm/nm-client.c
+++ b/libnm/nm-client.c
@@ -3461,7 +3461,7 @@ new_object_manager (GObject *source_object, GAsyncResult *res, gpointer user_dat
NMClientPrivate *priv = NM_CLIENT_GET_PRIVATE (self);
g_clear_object (&priv->new_object_manager_cancellable);
- g_object_notify (G_OBJECT (user_data), NM_CLIENT_NM_RUNNING);
+ _notify (user_data, PROP_NM_RUNNING);
}
static void
diff --git a/libnm/nm-manager.c b/libnm/nm-manager.c
index ca60d81a89..10fb4a18b6 100644
--- a/libnm/nm-manager.c
+++ b/libnm/nm-manager.c
@@ -75,7 +75,7 @@ typedef struct {
gboolean connectivity_check_enabled;
} NMManagerPrivate;
-NM_GOBJECT_PROPERTIES_DEFINE_BASE (
+NM_GOBJECT_PROPERTIES_DEFINE (NMManager,
PROP_VERSION,
PROP_STATE,
PROP_STARTUP,
@@ -631,7 +631,7 @@ _nm_manager_set_connectivity_hack (NMManager *manager,
if ((NMConnectivityState) connectivity != priv->connectivity) {
priv->connectivity = (NMConnectivityState) connectivity;
- g_object_notify (G_OBJECT (manager), NM_MANAGER_CONNECTIVITY);
+ _notify (manager, PROP_CONNECTIVITY);
}
}
diff --git a/libnm/nm-remote-connection.c b/libnm/nm-remote-connection.c
index 785e5f7f28..6a667b13ef 100644
--- a/libnm/nm-remote-connection.c
+++ b/libnm/nm-remote-connection.c
@@ -39,7 +39,7 @@ G_DEFINE_TYPE_WITH_CODE (NMRemoteConnection, nm_remote_connection, NM_TYPE_OBJEC
G_IMPLEMENT_INTERFACE (G_TYPE_ASYNC_INITABLE, nm_remote_connection_async_initable_iface_init);
)
-NM_GOBJECT_PROPERTIES_DEFINE_BASE (
+NM_GOBJECT_PROPERTIES_DEFINE (NMRemoteConnection,
PROP_UNSAVED,
PROP_FLAGS,
PROP_FILENAME,
@@ -657,7 +657,7 @@ updated_get_settings_cb (GObject *proxy,
if (visible != priv->visible) {
priv->visible = visible;
- g_object_notify (G_OBJECT (self), NM_REMOTE_CONNECTION_VISIBLE);
+ _notify (self, PROP_VISIBLE);
}
g_object_unref (self);
diff --git a/libnm/nm-vpn-connection.c b/libnm/nm-vpn-connection.c
index 6c8576c1fc..7ef24aaa96 100644
--- a/libnm/nm-vpn-connection.c
+++ b/libnm/nm-vpn-connection.c
@@ -27,7 +27,7 @@ typedef struct {
NMVpnConnectionState vpn_state;
} NMVpnConnectionPrivate;
-NM_GOBJECT_PROPERTIES_DEFINE_BASE (
+NM_GOBJECT_PROPERTIES_DEFINE (NMVpnConnection,
PROP_VPN_STATE,
PROP_BANNER,
);
@@ -85,7 +85,7 @@ vpn_state_changed_proxy (NMDBusVpnConnection *proxy,
if (priv->vpn_state != vpn_state) {
priv->vpn_state = vpn_state;
g_signal_emit (connection, signals[VPN_STATE_CHANGED], 0, vpn_state, reason);
- g_object_notify (G_OBJECT (connection), NM_VPN_CONNECTION_VPN_STATE);
+ _notify (connection, PROP_VPN_STATE);
}
}