summaryrefslogtreecommitdiff
path: root/src/devices/wifi/nm-wifi-factory.c
diff options
context:
space:
mode:
authorDan Williams <dcbw@redhat.com>2014-09-17 14:17:30 -0500
committerThomas Haller <thaller@redhat.com>2015-06-17 16:19:19 +0200
commitc174da8e1391f54396c01a7c20f3fe46d67533bb (patch)
tree2c2aa8e3135fa7e13583783682563541dfc594f7 /src/devices/wifi/nm-wifi-factory.c
parent998f1cf7324cd3d0b169bae480b6ea4c5cafab27 (diff)
core: let device plugins advertise supported link and setting types
Instead of looping over all plugins and asking each plugin whether it can handle a link or a connection, have them advertise the link and connection types they support, and use that when creating new devices. (cherry picked from commit 71bde20c302ba321688f203a8c5cd1e2d296f0d1)
Diffstat (limited to 'src/devices/wifi/nm-wifi-factory.c')
-rw-r--r--src/devices/wifi/nm-wifi-factory.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/src/devices/wifi/nm-wifi-factory.c b/src/devices/wifi/nm-wifi-factory.c
index 4093c61239..19578b3d58 100644
--- a/src/devices/wifi/nm-wifi-factory.c
+++ b/src/devices/wifi/nm-wifi-factory.c
@@ -23,6 +23,8 @@
#include <gmodule.h>
#include "nm-device-factory.h"
+#include "nm-setting-wireless.h"
+#include "nm-setting-olpc-mesh.h"
#include "nm-device-wifi.h"
#include "nm-device-olpc-mesh.h"
#include "nm-settings-connection.h"
@@ -63,20 +65,19 @@ new_link (NMDeviceFactory *factory, NMPlatformLink *plink, GError **error)
return nm_device_wifi_new (plink);
else if (plink->type == NM_LINK_TYPE_OLPC_MESH)
return nm_device_olpc_mesh_new (plink);
- return NULL;
+ g_assert_not_reached ();
}
-static NMDeviceType
-get_device_type (NMDeviceFactory *factory)
-{
- return NM_DEVICE_TYPE_WIFI;
-}
+NM_DEVICE_FACTORY_DECLARE_TYPES (
+ NM_DEVICE_FACTORY_DECLARE_LINK_TYPES (NM_LINK_TYPE_WIFI, NM_LINK_TYPE_OLPC_MESH)
+ NM_DEVICE_FACTORY_DECLARE_SETTING_TYPES (NM_SETTING_WIRELESS_SETTING_NAME, NM_SETTING_OLPC_MESH_SETTING_NAME)
+)
static void
device_factory_interface_init (NMDeviceFactory *factory_iface)
{
factory_iface->new_link = new_link;
- factory_iface->get_device_type = get_device_type;
+ factory_iface->get_supported_types = get_supported_types;
}
static void