libnm: various cleanup of NMP2PPeer and NMDeviceP2PWifi

- fix leaking hw_address in finalize().

- reorder code.

- avoid double tabs in GObject property definitions.

- hide struct definitions from header.

- don't use signal slots in class structure.

- use NM_GOBJECT_PROPERTIES_DEFINE_BASE().

- add missing NM_AVAILABLE_IN_1_16 annotations.
This commit is contained in:
Thomas Haller
2019-01-28 00:49:40 +01:00
parent 41b2d8c6c9
commit c6c41eb17a
4 changed files with 230 additions and 240 deletions

View File

@@ -14,8 +14,7 @@
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301 USA. * Boston, MA 02110-1301 USA.
* *
* Copyright 2007 - 2008 Novell, Inc. * Copyright 2018 - 2019 Red Hat, Inc.
* Copyright 2007 - 2018 Red Hat, Inc.
*/ */
#include "nm-default.h" #include "nm-default.h"
@@ -35,37 +34,19 @@
#include "introspection/org.freedesktop.NetworkManager.Device.P2PWireless.h" #include "introspection/org.freedesktop.NetworkManager.Device.P2PWireless.h"
G_DEFINE_TYPE (NMDeviceP2PWifi, nm_device_p2p_wifi, NM_TYPE_DEVICE) /*****************************************************************************/
#define NM_DEVICE_P2P_WIFI_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NM_TYPE_DEVICE_P2P_WIFI, NMDeviceP2PWifiPrivate))
void _nm_device_p2p_wifi_set_p2p_wireless_enabled (NMDeviceP2PWifi *device, gboolean enabled);
static void state_changed_cb (NMDevice *device, GParamSpec *pspec, gpointer user_data);
typedef struct { typedef struct {
NMDeviceP2PWifi *device; NMDeviceP2PWifi *device;
GSimpleAsyncResult *simple; GSimpleAsyncResult *simple;
} RequestScanInfo; } RequestScanInfo;
typedef struct { NM_GOBJECT_PROPERTIES_DEFINE_BASE (
NMDBusDeviceP2PWifi *proxy;
char *hw_address;
gboolean group_owner;
GByteArray *wfd_ies;
GPtrArray *peers;
} NMDeviceP2PWifiPrivate;
enum {
PROP_0,
PROP_HW_ADDRESS, PROP_HW_ADDRESS,
PROP_GROUP_OWNER, PROP_GROUP_OWNER,
PROP_WFDIES, PROP_WFDIES,
PROP_PEERS, PROP_PEERS,
);
LAST_PROP
};
enum { enum {
PEER_ADDED, PEER_ADDED,
@@ -73,8 +54,44 @@ enum {
LAST_SIGNAL LAST_SIGNAL
}; };
static guint signals[LAST_SIGNAL] = { 0 }; static guint signals[LAST_SIGNAL] = { 0 };
typedef struct {
NMDBusDeviceP2PWifi *proxy;
char *hw_address;
GByteArray *wfd_ies;
GPtrArray *peers;
gboolean group_owner;
} NMDeviceP2PWifiPrivate;
/**
* NMDeviceP2PWifi:
*
* Since: 1.16
*/
struct _NMDeviceP2PWifi {
NMDevice parent;
NMDeviceP2PWifiPrivate _priv;
};
struct _NMDeviceP2PWifiClass {
NMDeviceClass parent;
};
G_DEFINE_TYPE (NMDeviceP2PWifi, nm_device_p2p_wifi, NM_TYPE_DEVICE)
#define NM_DEVICE_P2P_WIFI_GET_PRIVATE(self) _NM_GET_PRIVATE (self, NMDeviceP2PWifi, NM_IS_DEVICE_P2P_WIFI, NMDevice, NMObject)
/*****************************************************************************/
static void state_changed_cb (NMDevice *device, GParamSpec *pspec, gpointer user_data);
/*****************************************************************************/
/** /**
* nm_device_p2p_wifi_get_hw_address: * nm_device_p2p_wifi_get_hw_address:
* @device: a #NMDeviceP2PWifi * @device: a #NMDeviceP2PWifi
@@ -406,20 +423,15 @@ nm_device_p2p_wifi_class_init (NMDeviceP2PWifiClass *wifi_class)
NMObjectClass *nm_object_class = NM_OBJECT_CLASS (wifi_class); NMObjectClass *nm_object_class = NM_OBJECT_CLASS (wifi_class);
NMDeviceClass *device_class = NM_DEVICE_CLASS (wifi_class); NMDeviceClass *device_class = NM_DEVICE_CLASS (wifi_class);
g_type_class_add_private (wifi_class, sizeof (NMDeviceP2PWifiPrivate));
/* virtual methods */
object_class->get_property = get_property; object_class->get_property = get_property;
object_class->dispose = dispose; object_class->dispose = dispose;
object_class->finalize = finalize; object_class->finalize = finalize;
nm_object_class->init_dbus = init_dbus;
device_class->connection_compatible = connection_compatible; device_class->connection_compatible = connection_compatible;
device_class->get_setting_type = get_setting_type; device_class->get_setting_type = get_setting_type;
device_class->get_hw_address = get_hw_address; device_class->get_hw_address = get_hw_address;
/* properties */ nm_object_class->init_dbus = init_dbus;
/** /**
* NMDeviceP2PWifi:hw-address: * NMDeviceP2PWifi:hw-address:
@@ -428,12 +440,11 @@ nm_device_p2p_wifi_class_init (NMDeviceP2PWifiClass *wifi_class)
* *
* Since: 1.16 * Since: 1.16
**/ **/
g_object_class_install_property obj_properties[PROP_HW_ADDRESS] =
(object_class, PROP_HW_ADDRESS, g_param_spec_string (NM_DEVICE_P2P_WIFI_HW_ADDRESS, "", "",
g_param_spec_string (NM_DEVICE_P2P_WIFI_HW_ADDRESS, "", "", NULL,
NULL, G_PARAM_READABLE |
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
G_PARAM_STATIC_STRINGS));
/** /**
@@ -443,12 +454,11 @@ nm_device_p2p_wifi_class_init (NMDeviceP2PWifiClass *wifi_class)
* *
* Since: 1.16 * Since: 1.16
**/ **/
g_object_class_install_property obj_properties[PROP_GROUP_OWNER] =
(object_class, PROP_GROUP_OWNER, g_param_spec_boolean (NM_DEVICE_P2P_WIFI_GROUP_OWNER, "", "",
g_param_spec_boolean (NM_DEVICE_P2P_WIFI_GROUP_OWNER, "", "", FALSE,
FALSE, G_PARAM_READABLE |
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
G_PARAM_STATIC_STRINGS));
/** /**
* NMDeviceP2PWifi:wfd-ies: * NMDeviceP2PWifi:wfd-ies:
@@ -457,13 +467,12 @@ nm_device_p2p_wifi_class_init (NMDeviceP2PWifiClass *wifi_class)
* *
* Since: 1.16 * Since: 1.16
**/ **/
g_object_class_install_property obj_properties[PROP_WFDIES] =
(object_class, PROP_WFDIES, g_param_spec_variant (NM_DEVICE_P2P_WIFI_WFDIES, "", "",
g_param_spec_variant (NM_DEVICE_P2P_WIFI_WFDIES, "", "", G_VARIANT_TYPE ("ay"),
G_VARIANT_TYPE ("ay"), NULL,
NULL, G_PARAM_READABLE |
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
G_PARAM_STATIC_STRINGS));
/** /**
* NMDeviceP2PWifi:peers: (type GPtrArray(NMP2PPeer)) * NMDeviceP2PWifi:peers: (type GPtrArray(NMP2PPeer))
@@ -472,14 +481,13 @@ nm_device_p2p_wifi_class_init (NMDeviceP2PWifiClass *wifi_class)
* *
* Since: 1.16 * Since: 1.16
**/ **/
g_object_class_install_property obj_properties[PROP_PEERS] =
(object_class, PROP_PEERS, g_param_spec_boxed (NM_DEVICE_P2P_WIFI_PEERS, "", "",
g_param_spec_boxed (NM_DEVICE_P2P_WIFI_PEERS, "", "", G_TYPE_PTR_ARRAY,
G_TYPE_PTR_ARRAY, G_PARAM_READABLE |
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
G_PARAM_STATIC_STRINGS));
/* signals */ g_object_class_install_properties (object_class, _PROPERTY_ENUMS_LAST, obj_properties);
/** /**
* NMDeviceP2PWifi::peer-added: * NMDeviceP2PWifi::peer-added:
@@ -491,14 +499,13 @@ nm_device_p2p_wifi_class_init (NMDeviceP2PWifiClass *wifi_class)
* Since: 1.16 * Since: 1.16
**/ **/
signals[PEER_ADDED] = signals[PEER_ADDED] =
g_signal_new ("peer-added", g_signal_new ("peer-added",
G_OBJECT_CLASS_TYPE (object_class), G_OBJECT_CLASS_TYPE (object_class),
G_SIGNAL_RUN_FIRST, G_SIGNAL_RUN_FIRST,
G_STRUCT_OFFSET (NMDeviceP2PWifiClass, peer_added), 0, NULL, NULL,
NULL, NULL, g_cclosure_marshal_VOID__OBJECT,
g_cclosure_marshal_VOID__OBJECT, G_TYPE_NONE, 1,
G_TYPE_NONE, 1, G_TYPE_OBJECT);
G_TYPE_OBJECT);
/** /**
* NMDeviceP2PWifi::peer-removed: * NMDeviceP2PWifi::peer-removed:
@@ -510,12 +517,11 @@ nm_device_p2p_wifi_class_init (NMDeviceP2PWifiClass *wifi_class)
* Since: 1.16 * Since: 1.16
**/ **/
signals[PEER_REMOVED] = signals[PEER_REMOVED] =
g_signal_new ("peer-removed", g_signal_new ("peer-removed",
G_OBJECT_CLASS_TYPE (object_class), G_OBJECT_CLASS_TYPE (object_class),
G_SIGNAL_RUN_FIRST, G_SIGNAL_RUN_FIRST,
G_STRUCT_OFFSET (NMDeviceP2PWifiClass, peer_removed), 0, NULL, NULL,
NULL, NULL, g_cclosure_marshal_VOID__OBJECT,
g_cclosure_marshal_VOID__OBJECT, G_TYPE_NONE, 1,
G_TYPE_NONE, 1, G_TYPE_OBJECT);
G_TYPE_OBJECT);
} }

View File

@@ -14,8 +14,7 @@
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301 USA. * Boston, MA 02110-1301 USA.
* *
* Copyright 2007 - 2008 Novell, Inc. * Copyright 2018 - 2019 Red Hat, Inc.
* Copyright 2007 - 2018 Red Hat, Inc.
*/ */
#ifndef __NM_DEVICE_P2P_WIFI_H__ #ifndef __NM_DEVICE_P2P_WIFI_H__
@@ -41,41 +40,34 @@ G_BEGIN_DECLS
#define NM_DEVICE_P2P_WIFI_PEERS "peers" #define NM_DEVICE_P2P_WIFI_PEERS "peers"
#define NM_DEVICE_P2P_WIFI_WFDIES "wfdies" #define NM_DEVICE_P2P_WIFI_WFDIES "wfdies"
/** typedef struct _NMDeviceP2PWifiClass NMDeviceP2PWifiClass;
* NMDeviceP2PWifi:
*/
struct _NMDeviceP2PWifi {
NMDevice parent;
};
typedef struct {
NMDeviceClass parent;
/* Signals */
void (*peer_added) (NMDeviceP2PWifi *device, NMP2PPeer *peer);
void (*peer_removed) (NMDeviceP2PWifi *device, NMP2PPeer *peer);
/*< private >*/
gpointer padding[4];
} NMDeviceP2PWifiClass;
NM_AVAILABLE_IN_1_16
GType nm_device_p2p_wifi_get_type (void); GType nm_device_p2p_wifi_get_type (void);
NM_AVAILABLE_IN_1_16
const char * nm_device_p2p_wifi_get_hw_address (NMDeviceP2PWifi *device); const char * nm_device_p2p_wifi_get_hw_address (NMDeviceP2PWifi *device);
NM_AVAILABLE_IN_1_16
gboolean nm_device_p2p_wifi_get_group_owner (NMDeviceP2PWifi *device); gboolean nm_device_p2p_wifi_get_group_owner (NMDeviceP2PWifi *device);
#if 0 #if 0
gboolean nm_device_p2p_wifi_get_wfdies (NMDeviceP2PWifi *device); gboolean nm_device_p2p_wifi_get_wfdies (NMDeviceP2PWifi *device);
#endif #endif
NM_AVAILABLE_IN_1_16
NMP2PPeer * nm_device_p2p_wifi_get_peer_by_path (NMDeviceP2PWifi *device, NMP2PPeer * nm_device_p2p_wifi_get_peer_by_path (NMDeviceP2PWifi *device,
const char *path); const char *path);
NM_AVAILABLE_IN_1_16
const GPtrArray * nm_device_p2p_wifi_get_peers (NMDeviceP2PWifi *device); const GPtrArray * nm_device_p2p_wifi_get_peers (NMDeviceP2PWifi *device);
NM_AVAILABLE_IN_1_16
gboolean nm_device_p2p_wifi_start_find (NMDeviceP2PWifi *device, gboolean nm_device_p2p_wifi_start_find (NMDeviceP2PWifi *device,
GCancellable *cancellable, GCancellable *cancellable,
GError **error); GError **error);
NM_AVAILABLE_IN_1_16
gboolean nm_device_p2p_wifi_stop_find (NMDeviceP2PWifi *device, gboolean nm_device_p2p_wifi_stop_find (NMDeviceP2PWifi *device,
GCancellable *cancellable, GCancellable *cancellable,
GError **error); GError **error);

View File

@@ -14,8 +14,7 @@
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301 USA. * Boston, MA 02110-1301 USA.
* *
* Copyright 2007 - 2008 Novell, Inc. * Copyright 2018 - 2019 Red Hat, Inc.
* Copyright 2007 - 2018 Red Hat, Inc.
*/ */
#include "nm-default.h" #include "nm-default.h"
@@ -32,29 +31,9 @@
#include "nm-dbus-interface.h" #include "nm-dbus-interface.h"
#include "nm-object-private.h" #include "nm-object-private.h"
G_DEFINE_TYPE (NMP2PPeer, nm_p2p_peer, NM_TYPE_OBJECT) /*****************************************************************************/
#define NM_P2P_PEER_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NM_TYPE_P2P_PEER, NMP2PPeerPrivate)) NM_GOBJECT_PROPERTIES_DEFINE_BASE (
typedef struct {
NM80211ApFlags flags;
char *name;
char *manufacturer;
char *model;
char *model_number;
char *serial;
GBytes *wfd_ies;
char *hw_address;
guint8 strength;
int last_seen;
} NMP2PPeerPrivate;
enum {
PROP_0,
PROP_FLAGS, PROP_FLAGS,
PROP_NAME, PROP_NAME,
PROP_MANUFACTURER, PROP_MANUFACTURER,
@@ -65,10 +44,44 @@ enum {
PROP_HW_ADDRESS, PROP_HW_ADDRESS,
PROP_STRENGTH, PROP_STRENGTH,
PROP_LAST_SEEN, PROP_LAST_SEEN,
);
LAST_PROP typedef struct {
char *name;
char *manufacturer;
char *model;
char *model_number;
char *serial;
GBytes *wfd_ies;
char *hw_address;
int last_seen;
NM80211ApFlags flags;
guint8 strength;
} NMP2PPeerPrivate;
/**
* NMP2PPeer:
*/
struct _NMP2PPeer {
NMObject parent;
NMP2PPeerPrivate _priv;
}; };
struct _NMP2PPeerClass {
NMObjectClass parent;
};
G_DEFINE_TYPE (NMP2PPeer, nm_p2p_peer, NM_TYPE_OBJECT)
#define NM_P2P_PEER_GET_PRIVATE(self) _NM_GET_PRIVATE (self, NMP2PPeer, NM_IS_P2P_PEER, NMObject)
/*****************************************************************************/
/** /**
* nm_p2p_peer_get_flags: * nm_p2p_peer_get_flags:
* @peer: a #NMP2PPeer * @peer: a #NMP2PPeer
@@ -279,25 +292,27 @@ nm_p2p_peer_connection_valid (NMP2PPeer *peer, NMConnection *connection)
const char *hw_address; const char *hw_address;
const char *setting_peer; const char *setting_peer;
s_p2p_wifi = (NMSettingP2PWireless *) nm_connection_get_setting (connection, NM_TYPE_SETTING_P2P_WIRELESS);
if (!s_p2p_wifi)
return FALSE;
s_con = nm_connection_get_setting_connection (connection); s_con = nm_connection_get_setting_connection (connection);
if (!s_con) if (!s_con)
return FALSE; return FALSE;
ctype = nm_setting_connection_get_connection_type (s_con); ctype = nm_setting_connection_get_connection_type (s_con);
if (!ctype || !nm_streq (ctype, NM_SETTING_P2P_WIRELESS_SETTING_NAME)) if ( !ctype
return FALSE; || !nm_streq (ctype, NM_SETTING_P2P_WIRELESS_SETTING_NAME))
s_p2p_wifi = (NMSettingP2PWireless*) nm_connection_get_setting (connection, NM_TYPE_SETTING_P2P_WIRELESS);
if (!s_p2p_wifi)
return FALSE; return FALSE;
/* HW Address check */ /* HW Address check */
hw_address = nm_p2p_peer_get_hw_address (peer); hw_address = nm_p2p_peer_get_hw_address (peer);
if (!hw_address) if (!hw_address)
return FALSE; return FALSE;
setting_peer = nm_setting_p2p_wireless_get_peer (s_p2p_wifi); setting_peer = nm_setting_p2p_wireless_get_peer (s_p2p_wifi);
if ( !setting_peer if ( !setting_peer
|| g_strcmp0 (hw_address, setting_peer)) || !nm_streq (hw_address, setting_peer))
return FALSE; return FALSE;
return TRUE; return TRUE;
@@ -329,7 +344,7 @@ GPtrArray *
nm_p2p_peer_filter_connections (NMP2PPeer *peer, const GPtrArray *connections) nm_p2p_peer_filter_connections (NMP2PPeer *peer, const GPtrArray *connections)
{ {
GPtrArray *filtered; GPtrArray *filtered;
int i; guint i;
filtered = g_ptr_array_new_with_free_func (g_object_unref); filtered = g_ptr_array_new_with_free_func (g_object_unref);
for (i = 0; i < connections->len; i++) { for (i = 0; i < connections->len; i++) {
@@ -344,6 +359,33 @@ nm_p2p_peer_filter_connections (NMP2PPeer *peer, const GPtrArray *connections)
/*****************************************************************************/ /*****************************************************************************/
static void
init_dbus (NMObject *object)
{
NMP2PPeerPrivate *priv = NM_P2P_PEER_GET_PRIVATE (object);
const NMPropertiesInfo property_info[] = {
{ NM_P2P_PEER_FLAGS, &priv->flags },
{ NM_P2P_PEER_NAME, &priv->name },
{ NM_P2P_PEER_MANUFACTURER, &priv->manufacturer },
{ NM_P2P_PEER_MODEL, &priv->model },
{ NM_P2P_PEER_MODEL_NUMBER, &priv->model_number },
{ NM_P2P_PEER_SERIAL, &priv->serial },
{ NM_P2P_PEER_WFD_IES, &priv->wfd_ies },
{ NM_P2P_PEER_HW_ADDRESS, &priv->hw_address },
{ NM_P2P_PEER_STRENGTH, &priv->strength },
{ NM_P2P_PEER_LAST_SEEN, &priv->last_seen },
{ NULL },
};
NM_OBJECT_CLASS (nm_p2p_peer_parent_class)->init_dbus (object);
_nm_object_register_properties (object,
NM_DBUS_INTERFACE_P2P_PEER,
property_info);
}
/*****************************************************************************/
static void static void
get_property (GObject *object, get_property (GObject *object,
guint prop_id, guint prop_id,
@@ -389,6 +431,8 @@ get_property (GObject *object,
} }
} }
/*****************************************************************************/
static void static void
nm_p2p_peer_init (NMP2PPeer *peer) nm_p2p_peer_init (NMP2PPeer *peer)
{ {
@@ -406,53 +450,24 @@ finalize (GObject *object)
g_free (priv->model_number); g_free (priv->model_number);
g_free (priv->serial); g_free (priv->serial);
if (priv->wfd_ies) g_free (priv->hw_address);
g_bytes_unref (priv->wfd_ies);
g_bytes_unref (priv->wfd_ies);
G_OBJECT_CLASS (nm_p2p_peer_parent_class)->finalize (object); G_OBJECT_CLASS (nm_p2p_peer_parent_class)->finalize (object);
} }
static void static void
init_dbus (NMObject *object) nm_p2p_peer_class_init (NMP2PPeerClass *klass)
{ {
NMP2PPeerPrivate *priv = NM_P2P_PEER_GET_PRIVATE (object); GObjectClass *object_class = G_OBJECT_CLASS (klass);
const NMPropertiesInfo property_info[] = { NMObjectClass *nm_object_class = NM_OBJECT_CLASS (klass);
{ NM_P2P_PEER_FLAGS, &priv->flags },
{ NM_P2P_PEER_NAME, &priv->name },
{ NM_P2P_PEER_MANUFACTURER, &priv->manufacturer },
{ NM_P2P_PEER_MODEL, &priv->model },
{ NM_P2P_PEER_MODEL_NUMBER, &priv->model_number },
{ NM_P2P_PEER_SERIAL, &priv->serial },
{ NM_P2P_PEER_WFD_IES, &priv->wfd_ies },
{ NM_P2P_PEER_HW_ADDRESS, &priv->hw_address },
{ NM_P2P_PEER_STRENGTH, &priv->strength },
{ NM_P2P_PEER_LAST_SEEN, &priv->last_seen },
{ NULL },
};
NM_OBJECT_CLASS (nm_p2p_peer_parent_class)->init_dbus (object);
_nm_object_register_properties (object,
NM_DBUS_INTERFACE_P2P_PEER,
property_info);
}
static void
nm_p2p_peer_class_init (NMP2PPeerClass *peer_class)
{
GObjectClass *object_class = G_OBJECT_CLASS (peer_class);
NMObjectClass *nm_object_class = NM_OBJECT_CLASS (peer_class);
g_type_class_add_private (peer_class, sizeof (NMP2PPeerPrivate));
/* virtual methods */
object_class->get_property = get_property; object_class->get_property = get_property;
object_class->finalize = finalize; object_class->finalize = finalize;
nm_object_class->init_dbus = init_dbus; nm_object_class->init_dbus = init_dbus;
/* properties */
/** /**
* NMP2PPeer:flags: * NMP2PPeer:flags:
* *
@@ -460,13 +475,12 @@ nm_p2p_peer_class_init (NMP2PPeerClass *peer_class)
* *
* Since: 1.16 * Since: 1.16
**/ **/
g_object_class_install_property obj_properties[PROP_FLAGS] =
(object_class, PROP_FLAGS, g_param_spec_flags (NM_P2P_PEER_FLAGS, "", "",
g_param_spec_flags (NM_P2P_PEER_FLAGS, "", "", NM_TYPE_802_11_AP_FLAGS,
NM_TYPE_802_11_AP_FLAGS, NM_802_11_AP_FLAGS_NONE,
NM_802_11_AP_FLAGS_NONE, G_PARAM_READABLE |
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
G_PARAM_STATIC_STRINGS));
/** /**
* NMP2PPeer:name: * NMP2PPeer:name:
@@ -475,12 +489,11 @@ nm_p2p_peer_class_init (NMP2PPeerClass *peer_class)
* *
* Since: 1.16 * Since: 1.16
**/ **/
g_object_class_install_property obj_properties[PROP_NAME] =
(object_class, PROP_NAME, g_param_spec_string (NM_P2P_PEER_NAME, "", "",
g_param_spec_string (NM_P2P_PEER_NAME, "", "", NULL,
NULL, G_PARAM_READABLE |
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
G_PARAM_STATIC_STRINGS));
/** /**
* NMP2PPeer:manufacturer: * NMP2PPeer:manufacturer:
@@ -489,12 +502,11 @@ nm_p2p_peer_class_init (NMP2PPeerClass *peer_class)
* *
* Since: 1.16 * Since: 1.16
**/ **/
g_object_class_install_property obj_properties[PROP_MANUFACTURER] =
(object_class, PROP_MANUFACTURER, g_param_spec_string (NM_P2P_PEER_MANUFACTURER, "", "",
g_param_spec_string (NM_P2P_PEER_MANUFACTURER, "", "", NULL,
NULL, G_PARAM_READABLE |
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
G_PARAM_STATIC_STRINGS));
/** /**
* NMP2PPeer:model: * NMP2PPeer:model:
@@ -503,12 +515,11 @@ nm_p2p_peer_class_init (NMP2PPeerClass *peer_class)
* *
* Since: 1.16 * Since: 1.16
**/ **/
g_object_class_install_property obj_properties[PROP_MODEL] =
(object_class, PROP_MODEL, g_param_spec_string (NM_P2P_PEER_MODEL, "", "",
g_param_spec_string (NM_P2P_PEER_MODEL, "", "", NULL,
NULL, G_PARAM_READABLE |
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
G_PARAM_STATIC_STRINGS));
/** /**
* NMP2PPeer:model-number: * NMP2PPeer:model-number:
@@ -517,12 +528,11 @@ nm_p2p_peer_class_init (NMP2PPeerClass *peer_class)
* *
* Since: 1.16 * Since: 1.16
**/ **/
g_object_class_install_property obj_properties[PROP_MODEL_NUMBER] =
(object_class, PROP_MODEL_NUMBER, g_param_spec_string (NM_P2P_PEER_MODEL_NUMBER, "", "",
g_param_spec_string (NM_P2P_PEER_MODEL_NUMBER, "", "", NULL,
NULL, G_PARAM_READABLE |
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
G_PARAM_STATIC_STRINGS));
/** /**
* NMP2PPeer:serial: * NMP2PPeer:serial:
@@ -531,12 +541,11 @@ nm_p2p_peer_class_init (NMP2PPeerClass *peer_class)
* *
* Since: 1.16 * Since: 1.16
**/ **/
g_object_class_install_property obj_properties[PROP_SERIAL] =
(object_class, PROP_SERIAL, g_param_spec_string (NM_P2P_PEER_SERIAL, "", "",
g_param_spec_string (NM_P2P_PEER_SERIAL, "", "", NULL,
NULL, G_PARAM_READABLE |
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
G_PARAM_STATIC_STRINGS));
/** /**
* NMP2PPeer:wfd-ies: * NMP2PPeer:wfd-ies:
@@ -545,12 +554,11 @@ nm_p2p_peer_class_init (NMP2PPeerClass *peer_class)
* *
* Since: 1.16 * Since: 1.16
**/ **/
g_object_class_install_property obj_properties[PROP_WFD_IES] =
(object_class, PROP_WFD_IES, g_param_spec_boxed (NM_P2P_PEER_WFD_IES, "", "",
g_param_spec_boxed (NM_P2P_PEER_WFD_IES, "", "", G_TYPE_BYTES,
G_TYPE_BYTES, G_PARAM_READABLE |
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
G_PARAM_STATIC_STRINGS));
/** /**
* NMP2PPeer:hw-address: * NMP2PPeer:hw-address:
* *
@@ -558,12 +566,11 @@ nm_p2p_peer_class_init (NMP2PPeerClass *peer_class)
* *
* Since: 1.16 * Since: 1.16
**/ **/
g_object_class_install_property obj_properties[PROP_HW_ADDRESS] =
(object_class, PROP_HW_ADDRESS, g_param_spec_string (NM_P2P_PEER_HW_ADDRESS, "", "",
g_param_spec_string (NM_P2P_PEER_HW_ADDRESS, "", "", NULL,
NULL, G_PARAM_READABLE |
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
G_PARAM_STATIC_STRINGS));
/** /**
* NMP2PPeer:strength: * NMP2PPeer:strength:
@@ -572,12 +579,11 @@ nm_p2p_peer_class_init (NMP2PPeerClass *peer_class)
* *
* Since: 1.16 * Since: 1.16
**/ **/
g_object_class_install_property obj_properties[PROP_STRENGTH] =
(object_class, PROP_STRENGTH, g_param_spec_uchar (NM_P2P_PEER_STRENGTH, "", "",
g_param_spec_uchar (NM_P2P_PEER_STRENGTH, "", "", 0, G_MAXUINT8, 0,
0, G_MAXUINT8, 0, G_PARAM_READABLE |
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
G_PARAM_STATIC_STRINGS));
/** /**
* NMP2PPeer:last-seen: * NMP2PPeer:last-seen:
@@ -587,10 +593,11 @@ nm_p2p_peer_class_init (NMP2PPeerClass *peer_class)
* *
* Since: 1.16 * Since: 1.16
**/ **/
g_object_class_install_property obj_properties[PROP_LAST_SEEN] =
(object_class, PROP_LAST_SEEN, g_param_spec_int (NM_P2P_PEER_LAST_SEEN, "", "",
g_param_spec_int (NM_P2P_PEER_LAST_SEEN, "", "", -1, G_MAXINT, -1,
-1, G_MAXINT, -1, G_PARAM_READABLE |
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
G_PARAM_STATIC_STRINGS));
g_object_class_install_properties (object_class, _PROPERTY_ENUMS_LAST, obj_properties);
} }

View File

@@ -14,8 +14,7 @@
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301 USA. * Boston, MA 02110-1301 USA.
* *
* Copyright 2007 - 2008 Novell, Inc. * Copyright 2018 - 2019 Red Hat, Inc.
* Copyright 2007 - 2011 Red Hat, Inc.
*/ */
#ifndef __NM_P2P_PEER_H__ #ifndef __NM_P2P_PEER_H__
@@ -47,21 +46,7 @@ G_BEGIN_DECLS
#define NM_P2P_PEER_STRENGTH "strength" #define NM_P2P_PEER_STRENGTH "strength"
#define NM_P2P_PEER_LAST_SEEN "last-seen" #define NM_P2P_PEER_LAST_SEEN "last-seen"
/** typedef struct _NMP2PPeerClass NMP2PPeerClass;
* NMP2PPeer:
*/
NM_AVAILABLE_IN_1_16
struct _NMP2PPeer {
NMObject parent;
};
NM_AVAILABLE_IN_1_16
typedef struct {
NMObjectClass parent;
/*< private >*/
gpointer padding[4];
} NMP2PPeerClass;
NM_AVAILABLE_IN_1_16 NM_AVAILABLE_IN_1_16
GType nm_p2p_peer_get_type (void); GType nm_p2p_peer_get_type (void);