summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLubomir Rintel <lkundrak@v3.sk>2015-03-23 14:29:25 +0100
committerThomas Haller <thaller@redhat.com>2015-06-30 16:45:27 +0200
commit498d1fe435f63d06ad95a500fb99603e20df9456 (patch)
tree312607d362a03746124f39803a87408381728d34
parent988f0411da862f6400ad3ddc575603da614dafd6 (diff)
downloadNetworkManager-498d1fe435f63d06ad95a500fb99603e20df9456.tar.gz
device: allow modifying Managed property
https://bugzilla.redhat.com/show_bug.cgi?id=1114685 https://bugzilla.gnome.org/show_bug.cgi?id=746566 Related: https://bugzilla.gnome.org/show_bug.cgi?id=680909 Related: https://bugzilla.gnome.org/show_bug.cgi?id=731014
-rw-r--r--introspection/nm-device.xml2
-rw-r--r--src/devices/nm-device.c15
-rw-r--r--src/nm-manager.c3
3 files changed, 18 insertions, 2 deletions
diff --git a/introspection/nm-device.xml b/introspection/nm-device.xml
index 239358a1e7..912a121ef5 100644
--- a/introspection/nm-device.xml
+++ b/introspection/nm-device.xml
@@ -96,7 +96,7 @@
NM_DEVICE_STATE_ACTIVATED state.
</tp:docstring>
</property>
- <property name="Managed" type="b" access="read">
+ <property name="Managed" type="b" access="readwrite">
<tp:docstring>
Whether or not this device is managed by NetworkManager.
</tp:docstring>
diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c
index d8b24cb801..da9a754b94 100644
--- a/src/devices/nm-device.c
+++ b/src/devices/nm-device.c
@@ -9161,6 +9161,19 @@ set_property (GObject *object, guint prop_id,
case PROP_IP4_ADDRESS:
priv->ip4_address = g_value_get_uint (value);
break;
+ case PROP_MANAGED:
+ if (g_value_get_boolean (value)) {
+ if (priv->state == NM_DEVICE_STATE_UNMANAGED)
+ nm_device_state_changed (self,
+ NM_DEVICE_STATE_DISCONNECTED,
+ NM_DEVICE_STATE_REASON_USER_REQUESTED);
+ } else {
+ if (priv->state != NM_DEVICE_STATE_UNMANAGED)
+ nm_device_state_changed (self,
+ NM_DEVICE_STATE_UNMANAGED,
+ NM_DEVICE_STATE_REASON_USER_REQUESTED);
+ }
+ break;
case PROP_AUTOCONNECT:
nm_device_set_autoconnect (self, g_value_get_boolean (value));
break;
@@ -9530,7 +9543,7 @@ nm_device_class_init (NMDeviceClass *klass)
(object_class, PROP_MANAGED,
g_param_spec_boolean (NM_DEVICE_MANAGED, "", "",
FALSE,
- G_PARAM_READABLE |
+ G_PARAM_READWRITE |
G_PARAM_STATIC_STRINGS));
g_object_class_install_property
diff --git a/src/nm-manager.c b/src/nm-manager.c
index d32ab2167f..73ddd9cd31 100644
--- a/src/nm-manager.c
+++ b/src/nm-manager.c
@@ -4424,6 +4424,9 @@ prop_filter (DBusConnection *connection,
} else if (!strcmp (propname, "Autoconnect")) {
glib_propname = NM_DEVICE_AUTOCONNECT;
permission = NM_AUTH_PERMISSION_NETWORK_CONTROL;
+ } else if (!strcmp (propname, "Managed")) {
+ glib_propname = NM_DEVICE_MANAGED;
+ permission = NM_AUTH_PERMISSION_NETWORK_CONTROL;
} else
return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;