diff options
Diffstat (limited to 'libnm/nm-device-adsl.c')
| -rw-r--r-- | libnm/nm-device-adsl.c | 93 |
1 files changed, 38 insertions, 55 deletions
diff --git a/libnm/nm-device-adsl.c b/libnm/nm-device-adsl.c index 95871efa..56ab49ed 100644 --- a/libnm/nm-device-adsl.c +++ b/libnm/nm-device-adsl.c @@ -1,21 +1,7 @@ +// SPDX-License-Identifier: LGPL-2.1+ /* - * 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. - * - * author: Pantelis Koukousoulas <pktoss@gmail.com> - * Copyright 2009 - 2011 Red Hat, Inc. + * Author: Pantelis Koukousoulas <pktoss@gmail.com> + * Copyright (C) 2009 - 2011 Red Hat, Inc. */ #include "nm-default.h" @@ -26,21 +12,31 @@ #include "nm-setting-adsl.h" #include "nm-setting-connection.h" -G_DEFINE_TYPE (NMDeviceAdsl, nm_device_adsl, NM_TYPE_DEVICE) +/*****************************************************************************/ -#define NM_DEVICE_ADSL_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NM_TYPE_DEVICE_ADSL, NMDeviceAdslPrivate)) +NM_GOBJECT_PROPERTIES_DEFINE_BASE ( + PROP_CARRIER, +); typedef struct { - gboolean carrier; - + bool carrier; } NMDeviceAdslPrivate; -enum { - PROP_0, - PROP_CARRIER, - LAST_PROP +struct _NMDeviceAdsl { + NMDevice parent; + NMDeviceAdslPrivate _priv; +}; + +struct _NMDeviceAdslClass { + NMDeviceClass parent; }; +G_DEFINE_TYPE (NMDeviceAdsl, nm_device_adsl, NM_TYPE_DEVICE) + +#define NM_DEVICE_ADSL_GET_PRIVATE(self) _NM_GET_PRIVATE(self, NMDeviceAdsl, NM_IS_DEVICE_ADSL, NMObject, NMDevice) + +/*****************************************************************************/ + /** * nm_device_adsl_get_carrier: * @device: a #NMDeviceAdsl @@ -86,22 +82,6 @@ nm_device_adsl_init (NMDeviceAdsl *device) } static void -init_dbus (NMObject *object) -{ - NMDeviceAdslPrivate *priv = NM_DEVICE_ADSL_GET_PRIVATE (object); - const NMPropertiesInfo property_info[] = { - { NM_DEVICE_ADSL_CARRIER, &priv->carrier }, - { NULL }, - }; - - NM_OBJECT_CLASS (nm_device_adsl_parent_class)->init_dbus (object); - - _nm_object_register_properties (object, - NM_DBUS_INTERFACE_DEVICE_ADSL, - property_info); -} - -static void get_property (GObject *object, guint prop_id, GValue *value, @@ -119,33 +99,36 @@ get_property (GObject *object, } } +const NMLDBusMetaIface _nml_dbus_meta_iface_nm_device_adsl = NML_DBUS_META_IFACE_INIT_PROP ( + NM_DBUS_INTERFACE_DEVICE_ADSL, + nm_device_adsl_get_type, + NML_DBUS_META_INTERFACE_PRIO_INSTANTIATE_HIGH, + NML_DBUS_META_IFACE_DBUS_PROPERTIES ( + NML_DBUS_META_PROPERTY_INIT_B ("Carrier", PROP_CARRIER, NMDeviceAdsl, _priv.carrier), + ), +); + static void nm_device_adsl_class_init (NMDeviceAdslClass *adsl_class) { GObjectClass *object_class = G_OBJECT_CLASS (adsl_class); - NMObjectClass *nm_object_class = NM_OBJECT_CLASS (adsl_class); NMDeviceClass *device_class = NM_DEVICE_CLASS (adsl_class); - g_type_class_add_private (object_class, sizeof (NMDeviceAdslPrivate)); - - /* virtual methods */ object_class->get_property = get_property; - nm_object_class->init_dbus = init_dbus; - device_class->connection_compatible = connection_compatible; - device_class->get_setting_type = get_setting_type; + device_class->get_setting_type = get_setting_type; - /* properties */ /** * NMDeviceAdsl:carrier: * * Whether the device has carrier. **/ - g_object_class_install_property - (object_class, PROP_CARRIER, - g_param_spec_boolean (NM_DEVICE_ADSL_CARRIER, "", "", - FALSE, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); + obj_properties[PROP_CARRIER] = + g_param_spec_boolean (NM_DEVICE_ADSL_CARRIER, "", "", + FALSE, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); + + _nml_dbus_meta_class_init_with_properties (object_class, &_nml_dbus_meta_iface_nm_device_adsl); } |