Commit 1f5b48a5 authored by Lubomir Rintel's avatar Lubomir Rintel 🥕

libnm: use the o.fd.DBus.ObjectManager API for object management

This speeds up the initial object tree load significantly. Also, it
reduces the object management complexity by shifting the duties to
GDBusObjectManager.

The lifetime of all NMObjects is now managed by the NMClient via the
object manager. The NMClient creates the NMObjects for GDBus objects,
triggers the initialization and serves as an object registry (replaces
the nm-cache).

The ObjectManager uses the o.fd.DBus.ObjectManager API to learn of the
object creation, removal and property changes. It takes care of the
property changes so that we don't have to and lets us always see a
consistent object state.  Thus at the time we learn of a new object we
already know its properties.

The NMObject unfortunately can't be made synchronously initializable as
the NMRemoteConnection's settings are not managed with standard
o.fd.DBus Properties and ObjectManager APIs and thus are not known to
the ObjectManager.  Thus most of the asynchronous object property
changing code in nm-object.c is preserved. The objects notify the
properties that reference them of their initialization in from their
init_finish() methods, thus the asynchronously created objects are not
allowed to fail creation (or the dependees would wait forever). Not a
problem -- if a connection can't get its Settings, it's either invisible
or being removed (presumably we'd learn of the removal from the object
manager soon).

The NMObjects can't be created by the object manager itself, since we
can't determine the resulting object type in proxy_type() yet (we can't
tell from the name and can't access the interface list). Therefore the
GDBusObject is coupled with a NMObject later on.

Lastly, now that all the objects are managed by the object manager, the
NMRemoteSettings and NMManager go away when the daemon is stopped. The
complexity of dealing with calls to NMClient that would require any of
the resources that these objects manage (connection or device lists,
etc.) had to be moved to NMClient. The bright side is that his allows
for removal all of the daemon presence tracking from NMObject.
parent ff3eb24c
......@@ -228,7 +228,9 @@ nodist_introspection_libnmdbus_la_SOURCES = \
introspection/nmdbus-vpn-connection.c \
introspection/nmdbus-vpn-connection.h \
introspection/nmdbus-vpn-plugin.c \
introspection/nmdbus-vpn-plugin.h
introspection/nmdbus-vpn-plugin.h \
introspection/nmdbus-wimax-nsp.c \
introspection/nmdbus-wimax-nsp.h
DBUS_INTERFACE_DOCS = \
introspection/nmdbus-access-point-org.freedesktop.NetworkManager.AccessPoint.xml \
......@@ -668,7 +670,6 @@ libnm_libnm_la_private_headers = \
libnm/nm-ip4-config.h \
libnm/nm-ip6-config.h \
libnm/nm-manager.h \
libnm/nm-object-cache.h \
libnm/nm-object-private.h \
libnm/nm-remote-connection-private.h \
libnm/nm-remote-settings.h
......@@ -704,7 +705,6 @@ libnm_libnm_la_sources = \
libnm/nm-ip4-config.c \
libnm/nm-ip6-config.c \
libnm/nm-manager.c \
libnm/nm-object-cache.c \
libnm/nm-object.c \
libnm/nm-remote-connection.c \
libnm/nm-remote-settings.c \
......
......@@ -45,7 +45,6 @@ IGNORE_HFILES= \
nm-ip4-config.h \
nm-ip6-config.h \
nm-manager.h \
nm-object-cache.h \
nm-object-private.h \
nm-property-compare.h \
nm-remote-connection-private.h \
......
......@@ -485,8 +485,6 @@ nm_access_point_class_init (NMAccessPointClass *ap_class)
g_type_class_add_private (ap_class, sizeof (NMAccessPointPrivate));
_nm_object_class_add_interface (nm_object_class, NM_DBUS_INTERFACE_ACCESS_POINT);
/* virtual methods */
object_class->get_property = get_property;
object_class->finalize = finalize;
......
......@@ -28,7 +28,6 @@
#include "nm-object-private.h"
#include "nm-core-internal.h"
#include "nm-device.h"
#include "nm-device-private.h"
#include "nm-connection.h"
#include "nm-vpn-connection.h"
#include "nm-dbus-helpers.h"
......@@ -38,14 +37,7 @@
#include "nm-ip6-config.h"
#include "nm-remote-connection.h"
static GType _nm_active_connection_decide_type (GVariant *value);
G_DEFINE_TYPE_WITH_CODE (NMActiveConnection, nm_active_connection, NM_TYPE_OBJECT,
_nm_object_register_type_func (g_define_type_id,
_nm_active_connection_decide_type,
NM_DBUS_INTERFACE_ACTIVE_CONNECTION,
"Vpn");
)
G_DEFINE_TYPE (NMActiveConnection, nm_active_connection, NM_TYPE_OBJECT);
#define NM_ACTIVE_CONNECTION_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NM_TYPE_ACTIVE_CONNECTION, NMActiveConnectionPrivate))
......@@ -88,16 +80,6 @@ enum {
LAST_PROP
};
static GType
_nm_active_connection_decide_type (GVariant *value)
{
/* @value is the value of the o.fd.NM.ActiveConnection property "VPN" */
if (g_variant_get_boolean (value))
return NM_TYPE_VPN_CONNECTION;
else
return NM_TYPE_ACTIVE_CONNECTION;
}
/**
* nm_active_connection_get_connection:
* @connection: a #NMActiveConnection
......@@ -519,8 +501,6 @@ nm_active_connection_class_init (NMActiveConnectionClass *ap_class)
g_type_class_add_private (ap_class, sizeof (NMActiveConnectionPrivate));
_nm_object_class_add_interface (nm_object_class, NM_DBUS_INTERFACE_ACTIVE_CONNECTION);
/* virtual methods */
object_class->get_property = get_property;
object_class->dispose = dispose;
......
This diff is collapsed.
......@@ -98,24 +98,6 @@ _nm_dbus_is_connection_private (GDBusConnection *connection)
return g_dbus_connection_get_unique_name (connection) == NULL;
}
static GHashTable *proxy_types;
#undef _nm_dbus_register_proxy_type
void
_nm_dbus_register_proxy_type (const char *interface,
GType proxy_type)
{
if (!proxy_types)
proxy_types = g_hash_table_new (g_str_hash, g_str_equal);
g_assert (g_hash_table_lookup (proxy_types, interface) == NULL);
g_hash_table_insert (proxy_types, (char *) interface, GSIZE_TO_POINTER (proxy_type));
}
/* We don't (currently) use GDBus's property-handling code */
#define NM_DBUS_PROXY_FLAGS (G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES | \
G_DBUS_PROXY_FLAGS_DO_NOT_AUTO_START)
/* D-Bus has an upper limit on number of Match rules and it's rather easy
* to hit as the proxy likes to add one for each object. Let's remove the Match
* rule the proxy added and ensure a less granular rule is present instead.
......@@ -126,15 +108,13 @@ _nm_dbus_register_proxy_type (const char *interface,
* Ideally, we should be able to tell glib not to hook its rules:
* https://bugzilla.gnome.org/show_bug.cgi?id=758749
*/
static void
void
_nm_dbus_proxy_replace_match (GDBusProxy *proxy)
{
GDBusConnection *connection = g_dbus_proxy_get_connection (proxy);
static unsigned match_counter = 1024;
gchar *match;
nm_assert (!g_strcmp0 (g_dbus_proxy_get_name (proxy), NM_DBUS_SERVICE));
if (match_counter == 1) {
/* If we hit the low matches watermark, install a
* less granular one. */
......@@ -177,83 +157,6 @@ _nm_dbus_proxy_replace_match (GDBusProxy *proxy)
g_free (match);
}
GDBusProxy *
_nm_dbus_new_proxy_for_connection (GDBusConnection *connection,
const char *path,
const char *interface,
GCancellable *cancellable,
GError **error)
{
GDBusProxy *proxy;
GType proxy_type;
const char *name;
proxy_type = GPOINTER_TO_SIZE (g_hash_table_lookup (proxy_types, interface));
if (!proxy_type)
proxy_type = G_TYPE_DBUS_PROXY;
if (_nm_dbus_is_connection_private (connection))
name = NULL;
else
name = NM_DBUS_SERVICE;
proxy = g_initable_new (proxy_type, cancellable, error,
"g-connection", connection,
"g-flags", NM_DBUS_PROXY_FLAGS,
"g-name", name,
"g-object-path", path,
"g-interface-name", interface,
NULL);
_nm_dbus_proxy_replace_match (proxy);
return proxy;
}
void
_nm_dbus_new_proxy_for_connection_async (GDBusConnection *connection,
const char *path,
const char *interface,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data)
{
GType proxy_type;
const char *name;
proxy_type = GPOINTER_TO_SIZE (g_hash_table_lookup (proxy_types, interface));
if (!proxy_type)
proxy_type = G_TYPE_DBUS_PROXY;
if (_nm_dbus_is_connection_private (connection))
name = NULL;
else
name = NM_DBUS_SERVICE;
g_async_initable_new_async (proxy_type, G_PRIORITY_DEFAULT,
cancellable, callback, user_data,
"g-connection", connection,
"g-flags", NM_DBUS_PROXY_FLAGS,
"g-name", name,
"g-object-path", path,
"g-interface-name", interface,
NULL);
}
GDBusProxy *
_nm_dbus_new_proxy_for_connection_finish (GAsyncResult *result,
GError **error)
{
GObject *source;
GDBusProxy *proxy;
source = g_async_result_get_source_object (result);
proxy = G_DBUS_PROXY (g_async_initable_new_finish (G_ASYNC_INITABLE (source), result, error));
g_object_unref (source);
_nm_dbus_proxy_replace_match (proxy);
return proxy;
}
/* Binds the properties on a generated server-side GDBus object to the
* corresponding properties on the public object.
*/
......
......@@ -36,26 +36,7 @@ GDBusConnection *_nm_dbus_new_connection_finish (GAsyncResult *result,
gboolean _nm_dbus_is_connection_private (GDBusConnection *connection);
void _nm_dbus_register_proxy_type (const char *interface,
GType proxy_type);
/* Guarantee that @interface is a static string */
#define _nm_dbus_register_proxy_type(interface, proxy_type) \
_nm_dbus_register_proxy_type (interface "", proxy_type) \
GDBusProxy *_nm_dbus_new_proxy_for_connection (GDBusConnection *connection,
const char *path,
const char *interface,
GCancellable *cancellable,
GError **error);
void _nm_dbus_new_proxy_for_connection_async (GDBusConnection *connection,
const char *path,
const char *interface,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data);
GDBusProxy *_nm_dbus_new_proxy_for_connection_finish (GAsyncResult *result,
GError **error);
void _nm_dbus_proxy_replace_match (GDBusProxy *proxy);
void _nm_dbus_bind_properties (gpointer object,
gpointer skeleton);
......
......@@ -25,7 +25,6 @@
#include <string.h>
#include "nm-device-private.h"
#include "nm-object-private.h"
#include "nm-setting-adsl.h"
......@@ -89,7 +88,6 @@ get_setting_type (NMDevice *device)
static void
nm_device_adsl_init (NMDeviceAdsl *device)
{
_nm_device_set_device_type (NM_DEVICE (device), NM_DEVICE_TYPE_ADSL);
}
static void
......@@ -135,8 +133,6 @@ nm_device_adsl_class_init (NMDeviceAdslClass *adsl_class)
g_type_class_add_private (object_class, sizeof (NMDeviceAdslPrivate));
_nm_object_class_add_interface (nm_object_class, NM_DBUS_INTERFACE_DEVICE_ADSL);
/* virtual methods */
object_class->get_property = get_property;
......
......@@ -27,7 +27,6 @@
#include "nm-utils.h"
#include "nm-device-bond.h"
#include "nm-device-private.h"
#include "nm-object-private.h"
#include "nm-core-internal.h"
......@@ -137,8 +136,6 @@ nm_device_bond_init (NMDeviceBond *device)
{
NMDeviceBondPrivate *priv = NM_DEVICE_BOND_GET_PRIVATE (device);
_nm_device_set_device_type (NM_DEVICE (device), NM_DEVICE_TYPE_BOND);
priv->slaves = g_ptr_array_new ();
}
......@@ -213,8 +210,6 @@ nm_device_bond_class_init (NMDeviceBondClass *bond_class)
g_type_class_add_private (bond_class, sizeof (NMDeviceBondPrivate));
_nm_object_class_add_interface (nm_object_class, NM_DBUS_INTERFACE_DEVICE_BOND);
/* virtual methods */
object_class->dispose = dispose;
object_class->finalize = finalize;
......
......@@ -27,7 +27,6 @@
#include "nm-utils.h"
#include "nm-device-bridge.h"
#include "nm-device-private.h"
#include "nm-object-private.h"
#include "nm-core-internal.h"
......@@ -137,8 +136,6 @@ nm_device_bridge_init (NMDeviceBridge *device)
{
NMDeviceBridgePrivate *priv = NM_DEVICE_BRIDGE_GET_PRIVATE (device);
_nm_device_set_device_type (NM_DEVICE (device), NM_DEVICE_TYPE_BRIDGE);
priv->slaves = g_ptr_array_new ();
}
......@@ -213,8 +210,6 @@ nm_device_bridge_class_init (NMDeviceBridgeClass *bridge_class)
g_type_class_add_private (bridge_class, sizeof (NMDeviceBridgePrivate));
_nm_object_class_add_interface (nm_object_class, NM_DBUS_INTERFACE_DEVICE_BRIDGE);
/* virtual methods */
object_class->dispose = dispose;
object_class->finalize = finalize;
......
......@@ -28,7 +28,6 @@
#include "nm-utils.h"
#include "nm-device-bt.h"
#include "nm-device-private.h"
#include "nm-object-private.h"
#include "nm-enum-types.h"
......@@ -183,7 +182,6 @@ get_hw_address (NMDevice *device)
static void
nm_device_bt_init (NMDeviceBt *device)
{
_nm_device_set_device_type (NM_DEVICE (device), NM_DEVICE_TYPE_BT);
}
static void
......@@ -248,8 +246,6 @@ nm_device_bt_class_init (NMDeviceBtClass *bt_class)
g_type_class_add_private (bt_class, sizeof (NMDeviceBtPrivate));
_nm_object_class_add_interface (nm_object_class, NM_DBUS_INTERFACE_DEVICE_BLUETOOTH);
/* virtual methods */
object_class->finalize = finalize;
object_class->get_property = get_property;
......
......@@ -29,7 +29,6 @@
#include "nm-utils.h"
#include "nm-device-ethernet.h"
#include "nm-device-private.h"
#include "nm-object-private.h"
G_DEFINE_TYPE (NMDeviceEthernet, nm_device_ethernet, NM_TYPE_DEVICE)
......@@ -282,7 +281,6 @@ get_hw_address (NMDevice *device)
static void
nm_device_ethernet_init (NMDeviceEthernet *device)
{
_nm_device_set_device_type (NM_DEVICE (device), NM_DEVICE_TYPE_ETHERNET);
}
static void
......@@ -357,8 +355,6 @@ nm_device_ethernet_class_init (NMDeviceEthernetClass *eth_class)
g_type_class_add_private (eth_class, sizeof (NMDeviceEthernetPrivate));
_nm_object_class_add_interface (nm_object_class, NM_DBUS_INTERFACE_DEVICE_WIRED);
/* virtual methods */
object_class->finalize = finalize;
object_class->get_property = get_property;
......
......@@ -23,7 +23,6 @@
#include <string.h>
#include "nm-device-generic.h"
#include "nm-device-private.h"
#include "nm-object-private.h"
#include "nm-setting-generic.h"
#include "nm-setting-connection.h"
......@@ -113,7 +112,6 @@ get_setting_type (NMDevice *device)
static void
nm_device_generic_init (NMDeviceGeneric *device)
{
_nm_device_set_device_type (NM_DEVICE (device), NM_DEVICE_TYPE_GENERIC);
}
static void
......@@ -175,8 +173,6 @@ nm_device_generic_class_init (NMDeviceGenericClass *klass)
g_type_class_add_private (klass, sizeof (NMDeviceGenericPrivate));
_nm_object_class_add_interface (nm_object_class, NM_DBUS_INTERFACE_DEVICE_GENERIC);
object_class->finalize = finalize;
object_class->get_property = get_property;
......
......@@ -27,7 +27,6 @@
#include "nm-utils.h"
#include "nm-device-infiniband.h"
#include "nm-device-private.h"
#include "nm-object-private.h"
G_DEFINE_TYPE (NMDeviceInfiniband, nm_device_infiniband, NM_TYPE_DEVICE)
......@@ -132,7 +131,6 @@ get_hw_address (NMDevice *device)
static void
nm_device_infiniband_init (NMDeviceInfiniband *device)
{
_nm_device_set_device_type (NM_DEVICE (device), NM_DEVICE_TYPE_INFINIBAND);
}
static void
......@@ -192,8 +190,6 @@ nm_device_infiniband_class_init (NMDeviceInfinibandClass *ib_class)
g_type_class_add_private (ib_class, sizeof (NMDeviceInfinibandPrivate));
_nm_object_class_add_interface (nm_object_class, NM_DBUS_INTERFACE_DEVICE_INFINIBAND);
/* virtual methods */
object_class->finalize = finalize;
object_class->get_property = get_property;
......
......@@ -27,7 +27,6 @@
#include "nm-utils.h"
#include "nm-device-ip-tunnel.h"
#include "nm-device-private.h"
#include "nm-object-private.h"
#include "nm-core-internal.h"
......@@ -269,7 +268,6 @@ get_setting_type (NMDevice *device)
static void
nm_device_ip_tunnel_init (NMDeviceIPTunnel *device)
{
_nm_device_set_device_type (NM_DEVICE (device), NM_DEVICE_TYPE_IP_TUNNEL);
}
static void
......@@ -369,8 +367,6 @@ nm_device_ip_tunnel_class_init (NMDeviceIPTunnelClass *bond_class)
g_type_class_add_private (bond_class, sizeof (NMDeviceIPTunnelPrivate));
_nm_object_class_add_interface (nm_object_class, NM_DBUS_INTERFACE_DEVICE_IP_TUNNEL);
/* virtual methods */
object_class->finalize = finalize;
object_class->get_property = get_property;
......
......@@ -28,7 +28,6 @@
#include "nm-utils.h"
#include "nm-device-macvlan.h"
#include "nm-device-private.h"
#include "nm-object-private.h"
G_DEFINE_TYPE (NMDeviceMacvlan, nm_device_macvlan, NM_TYPE_DEVICE)
......@@ -186,7 +185,6 @@ get_setting_type (NMDevice *device)
static void
nm_device_macvlan_init (NMDeviceMacvlan *device)
{
_nm_device_set_device_type (NM_DEVICE (device), NM_DEVICE_TYPE_MACVLAN);
}
static void
......@@ -260,8 +258,6 @@ nm_device_macvlan_class_init (NMDeviceMacvlanClass *gre_class)
g_type_class_add_private (gre_class, sizeof (NMDeviceMacvlanPrivate));
_nm_object_class_add_interface (nm_object_class, NM_DBUS_INTERFACE_DEVICE_MACVLAN);
/* virtual methods */
object_class->finalize = finalize;
object_class->get_property = get_property;
......
......@@ -28,7 +28,6 @@
#include "nm-setting-cdma.h"
#include "nm-device-modem.h"
#include "nm-device-private.h"
#include "nm-object-private.h"
#include "nm-enum-types.h"
......@@ -158,7 +157,6 @@ get_setting_type (NMDevice *device)
static void
nm_device_modem_init (NMDeviceModem *device)
{
_nm_device_set_device_type (NM_DEVICE (device), NM_DEVICE_TYPE_MODEM);
}
static void
......@@ -208,8 +206,6 @@ nm_device_modem_class_init (NMDeviceModemClass *modem_class)
g_type_class_add_private (modem_class, sizeof (NMDeviceModemPrivate));
_nm_object_class_add_interface (nm_object_class, NM_DBUS_INTERFACE_DEVICE_MODEM);
/* virtual methods */
object_class->get_property = get_property;
......
......@@ -26,7 +26,6 @@
#include "nm-setting-olpc-mesh.h"
#include "nm-device-olpc-mesh.h"
#include "nm-device-private.h"
#include "nm-object-private.h"
#include "nm-device-wifi.h"
......@@ -130,7 +129,6 @@ get_setting_type (NMDevice *device)
static void
nm_device_olpc_mesh_init (NMDeviceOlpcMesh *device)
{
_nm_device_set_device_type (NM_DEVICE (device), NM_DEVICE_TYPE_OLPC_MESH);
}
static void
......@@ -204,8 +202,6 @@ nm_device_olpc_mesh_class_init (NMDeviceOlpcMeshClass *olpc_mesh_class)
g_type_class_add_private (olpc_mesh_class, sizeof (NMDeviceOlpcMeshPrivate));
_nm_object_class_add_interface (nm_object_class, NM_DBUS_INTERFACE_DEVICE_OLPC_MESH);
/* virtual methods */
object_class->dispose = dispose;
object_class->finalize = finalize;
......
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
/*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301 USA.
*
* Copyright 2007 - 2012 Red Hat, Inc.
*/
#ifndef __NM_DEVICE_PRIVATE_H__
#define __NM_DEVICE_PRIVATE_H__
void _nm_device_set_device_type (NMDevice *device, NMDeviceType dtype);
#endif /* __NM_DEVICE_PRIVATE_H__ */
......@@ -27,7 +27,6 @@
#include "nm-utils.h"
#include "nm-device-team.h"
#include "nm-device-private.h"
#include "nm-object-private.h"
#include "nm-core-internal.h"
......@@ -158,8 +157,6 @@ nm_device_team_init (NMDeviceTeam *device)
{
NMDeviceTeamPrivate *priv = NM_DEVICE_TEAM_GET_PRIVATE (device);
_nm_device_set_device_type (NM_DEVICE (device), NM_DEVICE_TYPE_TEAM);
priv->slaves = g_ptr_array_new ();
}
......@@ -239,8 +236,6 @@ nm_device_team_class_init (NMDeviceTeamClass *team_class)
g_type_class_add_private (team_class, sizeof (NMDeviceTeamPrivate));
_nm_object_class_add_interface (nm_object_class, NM_DBUS_INTERFACE_DEVICE_TEAM);
/* virtual methods */
object_class->dispose = dispose;
object_class->finalize = finalize;
......
......@@ -28,7 +28,6 @@
#include "nm-utils.h"
#include "nm-device-tun.h"
#include "nm-device-private.h"
#include "nm-object-private.h"
G_DEFINE_TYPE (NMDeviceTun, nm_device_tun, NM_TYPE_DEVICE)
......@@ -239,7 +238,6 @@ get_hw_address (NMDevice *device)
static void
nm_device_tun_init (NMDeviceTun *device)
{
_nm_device_set_device_type (NM_DEVICE (device), NM_DEVICE_TYPE_TUN);
}
static void
......@@ -320,8 +318,6 @@ nm_device_tun_class_init (NMDeviceTunClass *gre_class)
g_type_class_add_private (gre_class, sizeof (NMDeviceTunPrivate));
_nm_object_class_add_interface (nm_object_class, NM_DBUS_INTERFACE_DEVICE_TUN);
/* virtual methods */
object_class->finalize = finalize;
object_class->get_property = get_property;
......
......@@ -28,7 +28,6 @@
#include "nm-utils.h"
#include "nm-device-vlan.h"
#include "nm-device-private.h"
#include "nm-object-private.h"
G_DEFINE_TYPE (NMDeviceVlan, nm_device_vlan, NM_TYPE_DEVICE)
......@@ -172,7 +171,6 @@ get_hw_address (NMDevice *device)
static void
nm_device_vlan_init (NMDeviceVlan *device)
{
_nm_device_set_device_type (NM_DEVICE (device), NM_DEVICE_TYPE_VLAN);
}
static void
......@@ -241,8 +239,6 @@ nm_device_vlan_class_init (NMDeviceVlanClass *vlan_class)
g_type_class_add_private (vlan_class, sizeof (NMDeviceVlanPrivate));
_nm_object_class_add_interface (nm_object_class, NM_DBUS_INTERFACE_DEVICE_VLAN);
/* virtual methods */
object_class->finalize = finalize;
object_class->get_property = get_property;
......
......@@ -27,7 +27,6 @@
#include "nm-utils.h"
#include "nm-device-vxlan.h"
#include "nm-device-private.h"
#include "nm-object-private.h"
G_DEFINE_TYPE (NMDeviceVxlan, nm_device_vxlan, NM_TYPE_DEVICE)
......@@ -415,7 +414,6 @@ get_hw_address (NMDevice *device)
static void
nm_device_vxlan_init (NMDeviceVxlan *device)
{
_nm_device_set_device_type (NM_DEVICE (device), NM_DEVICE_TYPE_VXLAN);
}
static void
......@@ -542,8 +540,6 @@ nm_device_vxlan_class_init (NMDeviceVxlanClass *vxlan_class)
g_type_class_add_private (vxlan_class, sizeof (NMDeviceVxlanPrivate));
_nm_object_class_add_interface (nm_object_class, NM_DBUS_INTERFACE_DEVICE_VXLAN);
/* virtual methods */
object_class->finalize = finalize;
object_class->get_property = get_property;
......
......@@ -31,9 +31,7 @@
#include "nm-utils.h"
#include "nm-access-point.h"
#include "nm-device-private.h"
#include "nm-object-private.h"
#include "nm-object-cache.h"
#include "nm-core-internal.h"
#include "nm-dbus-helpers.h"
......@@ -660,8 +658,6 @@ nm_device_wifi_init (NMDeviceWifi *device)
{
NMDeviceWifiPrivate *priv = NM_DEVICE_WIFI_GET_PRIVATE (device);
_nm_device_set_device_type (NM_DEVICE (device), NM_DEVICE_TYPE_WIFI);
g_signal_connect (device,
"notify::" NM_DEVICE_STATE,
G_CALLBACK (state_changed_cb),
......@@ -797,10 +793,6 @@ nm_device_wifi_class_init (NMDeviceWifiClass *wifi_class)
g_type_class_add_private (wifi_class, sizeof (NMDeviceWifiPrivate));
_nm_object_class_add_interface (nm_object_class, NM_DBUS_INTERFACE_DEVICE_WIRELESS);
_nm_dbus_register_proxy_type (NM_DBUS_INTERFACE_DEVICE_WIRELESS,
NMDBUS_TYPE_DEVICE_WIFI_PROXY);
/* virtual methods */
object_class->get_property = get_property;
object_class->dispose = dispose;
......
......@@ -30,9 +30,7 @@
#include "nm-device-wimax.h"
#include "nm-wimax-nsp.h"
#include "nm-object-private.h"
#include "nm-object-cache.h"
#include "nm-core-internal.h"
#include "nm-device-private.h"
G_DEFINE_TYPE (NMDeviceWimax, nm_device_wimax, NM_TYPE_DEVICE)
......@@ -355,8 +353,6 @@ get_hw_address (NMDevice *device)
static void
nm_device_wimax_init (NMDeviceWimax *device)
{
_nm_device_set_device_type (NM_DEVICE (device), NM_DEVICE_TYPE_WIMAX);
g_signal_connect (device,
"notify::" NM_DEVICE_STATE,
G_CALLBACK (state_changed_cb),
......@@ -531,8 +527,6 @@ nm_device_wimax_class_init (NMDeviceWimaxClass *wimax_class)
g_type_class_add_private (wimax_class, sizeof (NMDeviceWimaxPrivate));
_nm_object_class_add_interface (nm_object_class, NM_DBUS_INTERFACE_DEVICE_WIMAX);
/* virtual methods */
object_class->get_property = get_property;
object_class->dispose = dispose;
......
......@@ -28,29 +28,12 @@
#include "nm-dbus-interface.h"
#include "nm-active-connection.h"
#include "nm-device-ethernet.h"
#include "nm-device-adsl.h"
#include "nm-device-wifi.h"
#include "nm-device-modem.h"
#include "nm-device-bt.h"
#include "nm-device-olpc-mesh.h"
#include "nm-device-wimax.h"
#include "nm-device-infiniband.h"
#include "nm-device-bond.h"
#include "nm-device-team.h"
#include "nm-device-bridge.h"
#include "nm-device-vlan.h"
#include "nm-device-vxlan.h"
#include "nm-device-generic.h"
#include "nm-device-ip-tunnel.h"
#include "nm-device-macvlan.h"
#include "nm-device-private.h"
#include "nm-dhcp4-config.h"
#include "nm-dhcp6-config.h"
#include "nm-ip4-config.h"
#include "nm-ip6-config.h"
#include "nm-object-private.h"
#include "nm-object-cache.h"
#include "nm-remote-connection.h"
#include "nm-core-internal.h"
#include "nm-utils.h"
......@@ -60,16 +43,10 @@
#include "nmdbus-device.h"
static GType _nm_device_decide_type (GVariant *value);
static gboolean connection_compatible (NMDevice *device, NMConnection *connection, GError **error);
static NMLldpNeighbor *nm_lldp_neighbor_dup (NMLldpNeighbor *neighbor);
G_DEFINE_TYPE_WITH_CODE (NMDevice, nm_device, NM_TYPE_OBJECT,
_nm_object_register_type_func (g_define_type_id,
_nm_device_decide_type,
NM_DBUS_INTERFACE_DEVICE,
"DeviceType");
)
G_DEFINE_ABSTRACT_TYPE (NMDevice, nm_device, NM_TYPE_OBJECT);
#define NM_DEVICE_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NM_TYPE_DEVICE, NMDevicePrivate))
......@@ -213,11 +190,7 @@ demarshal_lldp_neighbors (NMObject *object, GParamSpec *pspec, GVariant *value,
}