</tp:docstring>
</method>
+ <method name="Delete">
+ <annotation name="org.freedesktop.DBus.GLib.CSymbol" value="impl_device_delete"/>
+ <annotation name="org.freedesktop.DBus.GLib.Async" value=""/>
+ <tp:docstring>
+ Deletes a software device from NetworkManager and removes the interface from the system.
+ The method returns an error when called for a hardware device.
+ </tp:docstring>
+ </method>
+
<signal name="StateChanged">
<arg name="new_state" type="u" tp:type="NM_DEVICE_STATE">
<tp:docstring>
#include "nm-dns-manager.h"
static void impl_device_disconnect (NMDevice *device, DBusGMethodInvocation *context);
+static void impl_device_delete (NMDevice *device, DBusGMethodInvocation *context);
#include "nm-device-glue.h"
NULL);
}
+static void
+delete_cb (NMDevice *device,
+ DBusGMethodInvocation *context,
+ GError *error,
+ gpointer user_data)
+{
+ if (error) {
+ dbus_g_method_return_error (context, error);
+ return;
+ }
+
+ /* Authorized */
+ nm_platform_link_delete (nm_device_get_ifindex (device));
+ dbus_g_method_return (context);
+}
+
+static void
+impl_device_delete (NMDevice *device, DBusGMethodInvocation *context)
+{
+ GError *error = NULL;
+
+ if (!nm_device_is_software (device)) {
+ error = g_error_new_literal (NM_DEVICE_ERROR,
+ NM_DEVICE_ERROR_NOT_SOFTWARE,
+ "This device is not a software device");
+ dbus_g_method_return_error (context, error);
+ g_error_free (error);
+ return;
+ }
+
+ /* Ask the manager to authenticate this request for us */
+ g_signal_emit (device, signals[AUTH_REQUEST], 0,
+ context,
+ NULL,
+ NM_AUTH_PERMISSION_NETWORK_CONTROL,
+ TRUE,
+ delete_cb,
+ NULL);
+}
+
static void
_device_activate (NMDevice *self, NMActRequest *req)
{
NM_DEVICE_ERROR_CONNECTION_INVALID, /*< nick=ConnectionInvalid >*/
NM_DEVICE_ERROR_NOT_ACTIVE, /*< nick=NotActive >*/
NM_DEVICE_ERROR_UNSUPPORTED_DEVICE_TYPE, /*< nick=UnsupportedDeviceType >*/
+ NM_DEVICE_ERROR_NOT_SOFTWARE, /*< nick=NotSoftware >*/
} NMDeviceError;
struct _NMDevice {