summaryrefslogtreecommitdiff
path: root/libnm/nm-device.c
diff options
context:
space:
mode:
Diffstat (limited to 'libnm/nm-device.c')
-rw-r--r--libnm/nm-device.c45
1 files changed, 45 insertions, 0 deletions
diff --git a/libnm/nm-device.c b/libnm/nm-device.c
index 3cc787948b..8de27a0785 100644
--- a/libnm/nm-device.c
+++ b/libnm/nm-device.c
@@ -1892,6 +1892,29 @@ nm_device_is_software (NMDevice *device)
return !!(NM_DEVICE_GET_PRIVATE (device)->capabilities & NM_DEVICE_CAP_IS_SOFTWARE);
}
+/**
+ * nm_device_disconnect:
+ * @device: a #NMDevice
+ * @cancellable: a #GCancellable, or %NULL
+ * @error: location for a #GError, or %NULL
+ *
+ * Disconnects the device if currently connected, and prevents the device from
+ * automatically connecting to networks until the next manual network connection
+ * request.
+ *
+ * Returns: %TRUE on success, %FALSE on error, in which case @error will be set.
+ **/
+gboolean
+nm_device_disconnect (NMDevice *device,
+ GCancellable *cancellable,
+ GError **error)
+{
+ g_return_val_if_fail (NM_IS_DEVICE (device), FALSE);
+
+ return nmdbus_device_call_disconnect_sync (NM_DEVICE_GET_PRIVATE (device)->proxy,
+ cancellable, error);
+}
+
static void
device_disconnect_cb (GObject *proxy,
GAsyncResult *result,
@@ -1965,6 +1988,28 @@ nm_device_disconnect_finish (NMDevice *device,
return g_simple_async_result_get_op_res_gboolean (simple);
}
+/**
+ * nm_device_delete:
+ * @device: a #NMDevice
+ * @cancellable: a #GCancellable, or %NULL
+ * @error: location for a #GError, or %NULL
+ *
+ * Deletes the software device. Hardware devices can't be deleted.
+ *
+ * Returns: %TRUE on success, %FALSE on error, in which case @error
+ * will be set.
+ **/
+gboolean
+nm_device_delete (NMDevice *device,
+ GCancellable *cancellable,
+ GError **error)
+{
+ g_return_val_if_fail (NM_IS_DEVICE (device), FALSE);
+
+ return nmdbus_device_call_delete_sync (NM_DEVICE_GET_PRIVATE (device)->proxy,
+ cancellable, error);
+}
+
static void
device_delete_cb (GObject *proxy,
GAsyncResult *result,