summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2019-06-09 13:18:07 +0200
committerThomas Haller <thaller@redhat.com>2019-06-09 13:25:46 +0200
commitdd3b47deed0f17903290bb4503a82818ad17634e (patch)
tree1024c2c2acaa0ae3ee770ffa4db1fd0ed01b3268
parent5b0982034a1a6b98f08959905ca8f392d1f4569c (diff)
downloadNetworkManager-dd3b47deed0f17903290bb4503a82818ad17634e.tar.gz
wwan: don't call _nm_modem_set_operator_code() in property setter
NM_MODEM_OPERATOR_CODE property is construct-only. Add our common code comment to the property setter. Construct-only setters are pretty simple. They run before the object is constructed, hence their scope is clearer. As such, there is no need to emit property changed notifications (also because that is already taken care by the GObject property setter). Don't call _nm_modem_set_operator_code(), just directly set the property. Usually we aim to have only one place where we set state (_nm_modem_set_operator_code()). But a construct-only property setter is trivial enough that we can affort having two places to modify the property. In particular, because the property setter does not "modify" the property, it merely initializes it before the object is fully constructed.
-rw-r--r--src/devices/wwan/nm-modem.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/devices/wwan/nm-modem.c b/src/devices/wwan/nm-modem.c
index e5e20751ef..63a00546a2 100644
--- a/src/devices/wwan/nm-modem.c
+++ b/src/devices/wwan/nm-modem.c
@@ -1714,7 +1714,8 @@ set_property (GObject *object, guint prop_id,
priv->sim_operator_id = g_strdup (s);
break;
case PROP_OPERATOR_CODE:
- _nm_modem_set_operator_code (NM_MODEM (object), g_value_get_string (value));
+ /* construct-only */
+ priv->operator_code = g_value_dup_string (value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);