core: make nm-properties-changed-signal always export the right properties
Change the way that nm-properties-changed-signal works, and parse the dbus-binding-tool-generated info to get the exact list of properties that it's expected to export. This makes NM_PROPERTY_PARAM_NO_EXPORT unnecessary, and also fixes the problem of properties like NMDevice:hw-address being exported on classes where it shouldn't be.
This commit is contained in:
@@ -36,12 +36,12 @@
|
||||
|
||||
#include "nm-device-adsl.h"
|
||||
#include "nm-device-private.h"
|
||||
#include "nm-properties-changed-signal.h"
|
||||
#include "NetworkManagerUtils.h"
|
||||
#include "nm-logging.h"
|
||||
#include "nm-enum-types.h"
|
||||
#include "nm-system.h"
|
||||
#include "nm-netlink-monitor.h"
|
||||
#include "nm-dbus-manager.h"
|
||||
|
||||
#include "ppp-manager/nm-ppp-manager.h"
|
||||
#include "nm-setting-adsl.h"
|
||||
@@ -84,13 +84,6 @@ typedef struct {
|
||||
char * nas_ifname;
|
||||
} NMDeviceAdslPrivate;
|
||||
|
||||
enum {
|
||||
PROPERTIES_CHANGED,
|
||||
LAST_SIGNAL
|
||||
};
|
||||
|
||||
static guint signals[LAST_SIGNAL] = { 0 };
|
||||
|
||||
enum {
|
||||
PROP_0,
|
||||
PROP_CARRIER,
|
||||
@@ -798,11 +791,7 @@ nm_device_adsl_class_init (NMDeviceAdslClass *klass)
|
||||
FALSE,
|
||||
G_PARAM_READABLE));
|
||||
|
||||
/* Signals */
|
||||
signals[PROPERTIES_CHANGED] =
|
||||
nm_properties_changed_signal_new (object_class,
|
||||
G_STRUCT_OFFSET (NMDeviceAdslClass, properties_changed));
|
||||
|
||||
dbus_g_object_type_install_info (G_TYPE_FROM_CLASS (klass),
|
||||
nm_dbus_manager_register_exported_type (nm_dbus_manager_get (),
|
||||
G_TYPE_FROM_CLASS (klass),
|
||||
&dbus_glib_nm_device_adsl_object_info);
|
||||
}
|
||||
|
@@ -51,8 +51,6 @@ typedef struct {
|
||||
typedef struct {
|
||||
NMDeviceClass parent;
|
||||
|
||||
/* Signals */
|
||||
void (*properties_changed) (NMDeviceAdsl *device, GHashTable *properties);
|
||||
} NMDeviceAdslClass;
|
||||
|
||||
GType nm_device_adsl_get_type (void);
|
||||
|
@@ -27,12 +27,12 @@
|
||||
|
||||
#include "nm-device-bond.h"
|
||||
#include "nm-logging.h"
|
||||
#include "nm-properties-changed-signal.h"
|
||||
#include "nm-utils.h"
|
||||
#include "NetworkManagerUtils.h"
|
||||
#include "nm-device-private.h"
|
||||
#include "nm-netlink-monitor.h"
|
||||
#include "nm-dbus-glib-types.h"
|
||||
#include "nm-dbus-manager.h"
|
||||
#include "nm-enum-types.h"
|
||||
#include "nm-system.h"
|
||||
|
||||
@@ -49,14 +49,6 @@ typedef struct {
|
||||
int dummy;
|
||||
} NMDeviceBondPrivate;
|
||||
|
||||
enum {
|
||||
PROPERTIES_CHANGED,
|
||||
|
||||
LAST_SIGNAL
|
||||
};
|
||||
|
||||
static guint signals[LAST_SIGNAL] = { 0 };
|
||||
|
||||
enum {
|
||||
PROP_0,
|
||||
PROP_CARRIER,
|
||||
@@ -398,12 +390,8 @@ nm_device_bond_class_init (NMDeviceBondClass *klass)
|
||||
DBUS_TYPE_G_ARRAY_OF_OBJECT_PATH,
|
||||
G_PARAM_READABLE));
|
||||
|
||||
/* Signals */
|
||||
signals[PROPERTIES_CHANGED] =
|
||||
nm_properties_changed_signal_new (object_class,
|
||||
G_STRUCT_OFFSET (NMDeviceBondClass, properties_changed));
|
||||
|
||||
dbus_g_object_type_install_info (G_TYPE_FROM_CLASS (klass),
|
||||
nm_dbus_manager_register_exported_type (nm_dbus_manager_get (),
|
||||
G_TYPE_FROM_CLASS (klass),
|
||||
&dbus_glib_nm_device_bond_object_info);
|
||||
|
||||
dbus_g_error_domain_register (NM_BOND_ERROR, NULL, NM_TYPE_BOND_ERROR);
|
||||
|
@@ -50,8 +50,6 @@ typedef struct {
|
||||
typedef struct {
|
||||
NMDeviceWiredClass parent;
|
||||
|
||||
/* Signals */
|
||||
void (*properties_changed) (NMDeviceBond *device, GHashTable *properties);
|
||||
} NMDeviceBondClass;
|
||||
|
||||
|
||||
|
@@ -27,12 +27,12 @@
|
||||
|
||||
#include "nm-device-bridge.h"
|
||||
#include "nm-logging.h"
|
||||
#include "nm-properties-changed-signal.h"
|
||||
#include "nm-utils.h"
|
||||
#include "NetworkManagerUtils.h"
|
||||
#include "nm-device-private.h"
|
||||
#include "nm-netlink-monitor.h"
|
||||
#include "nm-dbus-glib-types.h"
|
||||
#include "nm-dbus-manager.h"
|
||||
#include "nm-enum-types.h"
|
||||
#include "nm-system.h"
|
||||
|
||||
@@ -49,14 +49,6 @@ typedef struct {
|
||||
int dummy;
|
||||
} NMDeviceBridgePrivate;
|
||||
|
||||
enum {
|
||||
PROPERTIES_CHANGED,
|
||||
|
||||
LAST_SIGNAL
|
||||
};
|
||||
|
||||
static guint signals[LAST_SIGNAL] = { 0 };
|
||||
|
||||
enum {
|
||||
PROP_0,
|
||||
PROP_CARRIER,
|
||||
@@ -430,12 +422,8 @@ nm_device_bridge_class_init (NMDeviceBridgeClass *klass)
|
||||
DBUS_TYPE_G_ARRAY_OF_OBJECT_PATH,
|
||||
G_PARAM_READABLE));
|
||||
|
||||
/* Signals */
|
||||
signals[PROPERTIES_CHANGED] =
|
||||
nm_properties_changed_signal_new (object_class,
|
||||
G_STRUCT_OFFSET (NMDeviceBridgeClass, properties_changed));
|
||||
|
||||
dbus_g_object_type_install_info (G_TYPE_FROM_CLASS (klass),
|
||||
nm_dbus_manager_register_exported_type (nm_dbus_manager_get (),
|
||||
G_TYPE_FROM_CLASS (klass),
|
||||
&dbus_glib_nm_device_bridge_object_info);
|
||||
|
||||
dbus_g_error_domain_register (NM_BRIDGE_ERROR, NULL, NM_TYPE_BRIDGE_ERROR);
|
||||
|
@@ -50,8 +50,6 @@ typedef struct {
|
||||
typedef struct {
|
||||
NMDeviceWiredClass parent;
|
||||
|
||||
/* Signals */
|
||||
void (*properties_changed) (NMDeviceBridge *device, GHashTable *properties);
|
||||
} NMDeviceBridgeClass;
|
||||
|
||||
|
||||
|
@@ -34,7 +34,6 @@
|
||||
#include "nm-device-private.h"
|
||||
#include "nm-logging.h"
|
||||
#include "ppp-manager/nm-ppp-manager.h"
|
||||
#include "nm-properties-changed-signal.h"
|
||||
#include "nm-setting-connection.h"
|
||||
#include "nm-setting-bluetooth.h"
|
||||
#include "nm-setting-cdma.h"
|
||||
@@ -89,7 +88,6 @@ enum {
|
||||
|
||||
enum {
|
||||
PPP_STATS,
|
||||
PROPERTIES_CHANGED,
|
||||
|
||||
LAST_SIGNAL
|
||||
};
|
||||
@@ -1311,11 +1309,8 @@ nm_device_bt_class_init (NMDeviceBtClass *klass)
|
||||
G_TYPE_NONE, 2,
|
||||
G_TYPE_UINT, G_TYPE_UINT);
|
||||
|
||||
signals[PROPERTIES_CHANGED] =
|
||||
nm_properties_changed_signal_new (object_class,
|
||||
G_STRUCT_OFFSET (NMDeviceBtClass, properties_changed));
|
||||
|
||||
dbus_g_object_type_install_info (G_TYPE_FROM_CLASS (klass),
|
||||
nm_dbus_manager_register_exported_type (nm_dbus_manager_get (),
|
||||
G_TYPE_FROM_CLASS (klass),
|
||||
&dbus_glib_nm_device_bt_object_info);
|
||||
|
||||
dbus_g_error_domain_register (NM_BT_ERROR, NULL, NM_TYPE_BT_ERROR);
|
||||
|
@@ -51,7 +51,6 @@ typedef struct {
|
||||
|
||||
/* Signals */
|
||||
void (*ppp_stats) (NMDeviceBt *device, guint32 in_bytes, guint32 out_bytes);
|
||||
void (*properties_changed) (NMDeviceBt *device, GHashTable *properties);
|
||||
} NMDeviceBtClass;
|
||||
|
||||
GType nm_device_bt_get_type (void);
|
||||
|
@@ -51,10 +51,10 @@
|
||||
#include "nm-setting-bond.h"
|
||||
#include "ppp-manager/nm-ppp-manager.h"
|
||||
#include "nm-logging.h"
|
||||
#include "nm-properties-changed-signal.h"
|
||||
#include "nm-utils.h"
|
||||
#include "nm-enum-types.h"
|
||||
#include "nm-netlink-monitor.h"
|
||||
#include "nm-dbus-manager.h"
|
||||
|
||||
#include "nm-device-ethernet-glue.h"
|
||||
|
||||
@@ -98,14 +98,6 @@ typedef struct {
|
||||
NMIP4Config *pending_ip4_config;
|
||||
} NMDeviceEthernetPrivate;
|
||||
|
||||
enum {
|
||||
PROPERTIES_CHANGED,
|
||||
|
||||
LAST_SIGNAL
|
||||
};
|
||||
|
||||
static guint signals[LAST_SIGNAL] = { 0 };
|
||||
|
||||
enum {
|
||||
PROP_0,
|
||||
PROP_PERM_HW_ADDRESS,
|
||||
@@ -1432,12 +1424,8 @@ nm_device_ethernet_class_init (NMDeviceEthernetClass *klass)
|
||||
FALSE,
|
||||
G_PARAM_READABLE));
|
||||
|
||||
/* Signals */
|
||||
signals[PROPERTIES_CHANGED] =
|
||||
nm_properties_changed_signal_new (object_class,
|
||||
G_STRUCT_OFFSET (NMDeviceEthernetClass, properties_changed));
|
||||
|
||||
dbus_g_object_type_install_info (G_TYPE_FROM_CLASS (klass),
|
||||
nm_dbus_manager_register_exported_type (nm_dbus_manager_get (),
|
||||
G_TYPE_FROM_CLASS (klass),
|
||||
&dbus_glib_nm_device_ethernet_object_info);
|
||||
|
||||
dbus_g_error_domain_register (NM_ETHERNET_ERROR, NULL, NM_TYPE_ETHERNET_ERROR);
|
||||
|
@@ -53,8 +53,6 @@ typedef struct {
|
||||
typedef struct {
|
||||
NMDeviceWiredClass parent;
|
||||
|
||||
/* Signals */
|
||||
void (*properties_changed) (NMDeviceEthernet *device, GHashTable *properties);
|
||||
} NMDeviceEthernetClass;
|
||||
|
||||
|
||||
|
@@ -24,9 +24,9 @@
|
||||
#include "nm-device-private.h"
|
||||
#include "nm-enum-types.h"
|
||||
#include "nm-platform.h"
|
||||
#include "nm-properties-changed-signal.h"
|
||||
#include "nm-utils.h"
|
||||
#include "nm-glib-compat.h"
|
||||
#include "nm-dbus-manager.h"
|
||||
|
||||
#include "nm-device-generic-glue.h"
|
||||
|
||||
@@ -38,14 +38,6 @@ typedef struct {
|
||||
char *type_description;
|
||||
} NMDeviceGenericPrivate;
|
||||
|
||||
enum {
|
||||
PROPERTIES_CHANGED,
|
||||
|
||||
LAST_SIGNAL
|
||||
};
|
||||
|
||||
static guint signals[LAST_SIGNAL] = { 0 };
|
||||
|
||||
enum {
|
||||
PROP_0,
|
||||
PROP_TYPE_DESCRIPTION,
|
||||
@@ -217,12 +209,8 @@ nm_device_generic_class_init (NMDeviceGenericClass *klass)
|
||||
NULL,
|
||||
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
|
||||
|
||||
/* signals */
|
||||
signals[PROPERTIES_CHANGED] =
|
||||
nm_properties_changed_signal_new (object_class,
|
||||
G_STRUCT_OFFSET (NMDeviceGenericClass, properties_changed));
|
||||
|
||||
dbus_g_object_type_install_info (G_TYPE_FROM_CLASS (klass),
|
||||
nm_dbus_manager_register_exported_type (nm_dbus_manager_get (),
|
||||
G_TYPE_FROM_CLASS (klass),
|
||||
&dbus_glib_nm_device_generic_object_info);
|
||||
|
||||
dbus_g_error_domain_register (NM_DEVICE_GENERIC_ERROR, NULL, NM_TYPE_DEVICE_GENERIC_ERROR);
|
||||
|
@@ -50,8 +50,6 @@ typedef struct {
|
||||
typedef struct {
|
||||
NMDeviceClass parent;
|
||||
|
||||
/* Signals */
|
||||
void (*properties_changed) (NMDeviceGeneric *device, GHashTable *properties);
|
||||
} NMDeviceGenericClass;
|
||||
|
||||
GType nm_device_generic_get_type (void);
|
||||
|
@@ -28,11 +28,11 @@
|
||||
|
||||
#include "nm-device-infiniband.h"
|
||||
#include "nm-logging.h"
|
||||
#include "nm-properties-changed-signal.h"
|
||||
#include "nm-utils.h"
|
||||
#include "NetworkManagerUtils.h"
|
||||
#include "nm-device-private.h"
|
||||
#include "nm-enum-types.h"
|
||||
#include "nm-dbus-manager.h"
|
||||
|
||||
#include "nm-device-infiniband-glue.h"
|
||||
|
||||
@@ -47,14 +47,6 @@ typedef struct {
|
||||
int dummy;
|
||||
} NMDeviceInfinibandPrivate;
|
||||
|
||||
enum {
|
||||
PROPERTIES_CHANGED,
|
||||
|
||||
LAST_SIGNAL
|
||||
};
|
||||
|
||||
static guint signals[LAST_SIGNAL] = { 0 };
|
||||
|
||||
enum {
|
||||
PROP_0,
|
||||
PROP_CARRIER,
|
||||
@@ -360,12 +352,8 @@ nm_device_infiniband_class_init (NMDeviceInfinibandClass *klass)
|
||||
FALSE,
|
||||
G_PARAM_READABLE));
|
||||
|
||||
/* Signals */
|
||||
signals[PROPERTIES_CHANGED] =
|
||||
nm_properties_changed_signal_new (object_class,
|
||||
G_STRUCT_OFFSET (NMDeviceInfinibandClass, properties_changed));
|
||||
|
||||
dbus_g_object_type_install_info (G_TYPE_FROM_CLASS (klass),
|
||||
nm_dbus_manager_register_exported_type (nm_dbus_manager_get (),
|
||||
G_TYPE_FROM_CLASS (klass),
|
||||
&dbus_glib_nm_device_infiniband_object_info);
|
||||
|
||||
dbus_g_error_domain_register (NM_INFINIBAND_ERROR, NULL, NM_TYPE_INFINIBAND_ERROR);
|
||||
|
@@ -49,8 +49,6 @@ typedef struct {
|
||||
typedef struct {
|
||||
NMDeviceWiredClass parent;
|
||||
|
||||
/* Signals */
|
||||
void (*properties_changed) (NMDeviceInfiniband *device, GHashTable *properties);
|
||||
} NMDeviceInfinibandClass;
|
||||
|
||||
|
||||
|
@@ -27,10 +27,10 @@
|
||||
#include "nm-modem-cdma.h"
|
||||
#include "nm-modem-gsm.h"
|
||||
#include "nm-device-private.h"
|
||||
#include "nm-properties-changed-signal.h"
|
||||
#include "nm-rfkill.h"
|
||||
#include "nm-logging.h"
|
||||
#include "nm-system.h"
|
||||
#include "nm-dbus-manager.h"
|
||||
|
||||
#if WITH_MODEM_MANAGER_1
|
||||
#include "nm-modem-broadband.h"
|
||||
@@ -56,8 +56,8 @@ enum {
|
||||
};
|
||||
|
||||
enum {
|
||||
PROPERTIES_CHANGED,
|
||||
ENABLE_CHANGED,
|
||||
|
||||
LAST_SIGNAL
|
||||
};
|
||||
static guint signals[LAST_SIGNAL] = { 0 };
|
||||
@@ -506,7 +506,7 @@ nm_device_modem_class_init (NMDeviceModemClass *mclass)
|
||||
"Modem",
|
||||
"Modem",
|
||||
NM_TYPE_MODEM,
|
||||
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | NM_PROPERTY_PARAM_NO_EXPORT));
|
||||
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
|
||||
|
||||
g_object_class_install_property (object_class, PROP_CAPABILITIES,
|
||||
g_param_spec_uint (NM_DEVICE_MODEM_CAPABILITIES,
|
||||
@@ -523,10 +523,6 @@ nm_device_modem_class_init (NMDeviceModemClass *mclass)
|
||||
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
|
||||
|
||||
/* Signals */
|
||||
signals[PROPERTIES_CHANGED] =
|
||||
nm_properties_changed_signal_new (object_class,
|
||||
G_STRUCT_OFFSET (NMDeviceModemClass, properties_changed));
|
||||
|
||||
signals[ENABLE_CHANGED] =
|
||||
g_signal_new (NM_DEVICE_MODEM_ENABLE_CHANGED,
|
||||
G_OBJECT_CLASS_TYPE (object_class),
|
||||
@@ -535,6 +531,7 @@ nm_device_modem_class_init (NMDeviceModemClass *mclass)
|
||||
g_cclosure_marshal_VOID__VOID,
|
||||
G_TYPE_NONE, 0);
|
||||
|
||||
dbus_g_object_type_install_info (G_TYPE_FROM_CLASS (mclass),
|
||||
nm_dbus_manager_register_exported_type (nm_dbus_manager_get (),
|
||||
G_TYPE_FROM_CLASS (mclass),
|
||||
&dbus_glib_nm_device_modem_object_info);
|
||||
}
|
||||
|
@@ -47,7 +47,6 @@ typedef struct {
|
||||
typedef struct {
|
||||
NMDeviceClass parent;
|
||||
|
||||
void (*properties_changed) (NMDeviceModem *self, GHashTable *properties);
|
||||
} NMDeviceModemClass;
|
||||
|
||||
GType nm_device_modem_get_type (void);
|
||||
|
@@ -48,12 +48,12 @@
|
||||
#include "nm-logging.h"
|
||||
#include "NetworkManagerUtils.h"
|
||||
#include "nm-activation-request.h"
|
||||
#include "nm-properties-changed-signal.h"
|
||||
#include "nm-setting-connection.h"
|
||||
#include "nm-setting-olpc-mesh.h"
|
||||
#include "nm-system.h"
|
||||
#include "nm-manager.h"
|
||||
#include "nm-enum-types.h"
|
||||
#include "nm-dbus-manager.h"
|
||||
#include "wifi-utils.h"
|
||||
#if HAVE_WEXT
|
||||
#include "wifi-utils-wext.h"
|
||||
@@ -78,14 +78,6 @@ enum {
|
||||
LAST_PROP
|
||||
};
|
||||
|
||||
enum {
|
||||
PROPERTIES_CHANGED,
|
||||
|
||||
LAST_SIGNAL
|
||||
};
|
||||
|
||||
static guint signals[LAST_SIGNAL] = { 0 };
|
||||
|
||||
#define NM_OLPC_MESH_ERROR (nm_olpc_mesh_error_quark ())
|
||||
|
||||
|
||||
@@ -516,11 +508,9 @@ nm_device_olpc_mesh_class_init (NMDeviceOlpcMeshClass *klass)
|
||||
0, G_MAXUINT32, 0,
|
||||
G_PARAM_READABLE));
|
||||
|
||||
signals[PROPERTIES_CHANGED] =
|
||||
nm_properties_changed_signal_new (object_class,
|
||||
G_STRUCT_OFFSET (NMDeviceOlpcMeshClass, properties_changed));
|
||||
|
||||
dbus_g_object_type_install_info (G_TYPE_FROM_CLASS (klass), &dbus_glib_nm_device_olpc_mesh_object_info);
|
||||
nm_dbus_manager_register_exported_type (nm_dbus_manager_get (),
|
||||
G_TYPE_FROM_CLASS (klass),
|
||||
&dbus_glib_nm_device_olpc_mesh_object_info);
|
||||
|
||||
dbus_g_error_domain_register (NM_OLPC_MESH_ERROR, NULL,
|
||||
NM_TYPE_OLPC_MESH_ERROR);
|
||||
|
@@ -70,9 +70,6 @@ struct _NMDeviceOlpcMeshClass
|
||||
{
|
||||
NMDeviceClass parent;
|
||||
|
||||
/* Signals */
|
||||
void (*properties_changed) (NMDeviceOlpcMesh *device,
|
||||
GHashTable *properties);
|
||||
};
|
||||
|
||||
|
||||
|
@@ -29,13 +29,13 @@
|
||||
|
||||
#include "nm-device-vlan.h"
|
||||
#include "nm-logging.h"
|
||||
#include "nm-properties-changed-signal.h"
|
||||
#include "nm-utils.h"
|
||||
#include "NetworkManagerUtils.h"
|
||||
#include "nm-device-private.h"
|
||||
#include "nm-netlink-monitor.h"
|
||||
#include "nm-enum-types.h"
|
||||
#include "nm-system.h"
|
||||
#include "nm-dbus-manager.h"
|
||||
|
||||
#include "nm-device-vlan-glue.h"
|
||||
|
||||
@@ -60,14 +60,6 @@ typedef struct {
|
||||
gulong link_disconnected_id;
|
||||
} NMDeviceVlanPrivate;
|
||||
|
||||
enum {
|
||||
PROPERTIES_CHANGED,
|
||||
|
||||
LAST_SIGNAL
|
||||
};
|
||||
|
||||
static guint signals[LAST_SIGNAL] = { 0 };
|
||||
|
||||
enum {
|
||||
PROP_0,
|
||||
PROP_CARRIER,
|
||||
@@ -591,12 +583,8 @@ nm_device_vlan_class_init (NMDeviceVlanClass *klass)
|
||||
0, 4095, 0,
|
||||
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
|
||||
|
||||
/* Signals */
|
||||
signals[PROPERTIES_CHANGED] =
|
||||
nm_properties_changed_signal_new (object_class,
|
||||
G_STRUCT_OFFSET (NMDeviceVlanClass, properties_changed));
|
||||
|
||||
dbus_g_object_type_install_info (G_TYPE_FROM_CLASS (klass),
|
||||
nm_dbus_manager_register_exported_type (nm_dbus_manager_get (),
|
||||
G_TYPE_FROM_CLASS (klass),
|
||||
&dbus_glib_nm_device_vlan_object_info);
|
||||
|
||||
dbus_g_error_domain_register (NM_VLAN_ERROR, NULL, NM_TYPE_VLAN_ERROR);
|
||||
|
@@ -50,8 +50,6 @@ typedef struct {
|
||||
typedef struct {
|
||||
NMDeviceClass parent;
|
||||
|
||||
/* Signals */
|
||||
void (*properties_changed) (NMDeviceVlan *device, GHashTable *properties);
|
||||
} NMDeviceVlanClass;
|
||||
|
||||
|
||||
|
@@ -37,6 +37,7 @@
|
||||
#include <errno.h>
|
||||
|
||||
#include "nm-glib-compat.h"
|
||||
#include "nm-dbus-manager.h"
|
||||
#include "nm-device.h"
|
||||
#include "nm-device-wifi.h"
|
||||
#include "nm-device-private.h"
|
||||
@@ -47,7 +48,6 @@
|
||||
#include "nm-supplicant-manager.h"
|
||||
#include "nm-supplicant-interface.h"
|
||||
#include "nm-supplicant-config.h"
|
||||
#include "nm-properties-changed-signal.h"
|
||||
#include "nm-setting-connection.h"
|
||||
#include "nm-setting-wireless.h"
|
||||
#include "nm-setting-wireless-security.h"
|
||||
@@ -100,7 +100,6 @@ enum {
|
||||
ACCESS_POINT_ADDED,
|
||||
ACCESS_POINT_REMOVED,
|
||||
HIDDEN_AP_FOUND,
|
||||
PROPERTIES_CHANGED,
|
||||
SCANNING_ALLOWED,
|
||||
|
||||
LAST_SIGNAL
|
||||
@@ -3724,14 +3723,14 @@ nm_device_wifi_class_init (NMDeviceWifiClass *klass)
|
||||
"Scanning",
|
||||
"Scanning",
|
||||
FALSE,
|
||||
G_PARAM_READABLE | NM_PROPERTY_PARAM_NO_EXPORT));
|
||||
G_PARAM_READABLE));
|
||||
|
||||
g_object_class_install_property (object_class, PROP_IPW_RFKILL_STATE,
|
||||
g_param_spec_uint (NM_DEVICE_WIFI_IPW_RFKILL_STATE,
|
||||
"IpwRfkillState",
|
||||
"ipw rf-kill state",
|
||||
RFKILL_UNBLOCKED, RFKILL_HARD_BLOCKED, RFKILL_UNBLOCKED,
|
||||
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | NM_PROPERTY_PARAM_NO_EXPORT));
|
||||
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
|
||||
|
||||
/* Signals */
|
||||
signals[ACCESS_POINT_ADDED] =
|
||||
@@ -3761,10 +3760,6 @@ nm_device_wifi_class_init (NMDeviceWifiClass *klass)
|
||||
G_TYPE_NONE, 1,
|
||||
G_TYPE_OBJECT);
|
||||
|
||||
signals[PROPERTIES_CHANGED] =
|
||||
nm_properties_changed_signal_new (object_class,
|
||||
G_STRUCT_OFFSET (NMDeviceWifiClass, properties_changed));
|
||||
|
||||
signals[SCANNING_ALLOWED] =
|
||||
g_signal_new ("scanning-allowed",
|
||||
G_OBJECT_CLASS_TYPE (object_class),
|
||||
@@ -3773,7 +3768,9 @@ nm_device_wifi_class_init (NMDeviceWifiClass *klass)
|
||||
scanning_allowed_accumulator, NULL, NULL,
|
||||
G_TYPE_BOOLEAN, 0);
|
||||
|
||||
dbus_g_object_type_install_info (G_TYPE_FROM_CLASS (klass), &dbus_glib_nm_device_wifi_object_info);
|
||||
nm_dbus_manager_register_exported_type (nm_dbus_manager_get (),
|
||||
G_TYPE_FROM_CLASS (klass),
|
||||
&dbus_glib_nm_device_wifi_object_info);
|
||||
|
||||
dbus_g_error_domain_register (NM_WIFI_ERROR, NULL, NM_TYPE_WIFI_ERROR);
|
||||
}
|
||||
|
@@ -83,7 +83,6 @@ struct _NMDeviceWifiClass
|
||||
void (*access_point_added) (NMDeviceWifi *device, NMAccessPoint *ap);
|
||||
void (*access_point_removed) (NMDeviceWifi *device, NMAccessPoint *ap);
|
||||
void (*hidden_ap_found) (NMDeviceWifi *device, NMAccessPoint *ap);
|
||||
void (*properties_changed) (NMDeviceWifi *device, GHashTable *properties);
|
||||
gboolean (*scanning_allowed) (NMDeviceWifi *device);
|
||||
};
|
||||
|
||||
|
@@ -5025,7 +5025,7 @@ nm_device_class_init (NMDeviceClass *klass)
|
||||
"DeviceType",
|
||||
"DeviceType",
|
||||
0, G_MAXUINT32, NM_DEVICE_TYPE_UNKNOWN,
|
||||
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | NM_PROPERTY_PARAM_NO_EXPORT));
|
||||
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
|
||||
|
||||
g_object_class_install_property
|
||||
(object_class, PROP_MANAGED,
|
||||
@@ -5057,7 +5057,7 @@ nm_device_class_init (NMDeviceClass *klass)
|
||||
"Type Description",
|
||||
"Device type description",
|
||||
NULL,
|
||||
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | NM_PROPERTY_PARAM_NO_EXPORT));
|
||||
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
|
||||
|
||||
g_object_class_install_property
|
||||
(object_class, PROP_RFKILL_TYPE,
|
||||
@@ -5067,7 +5067,7 @@ nm_device_class_init (NMDeviceClass *klass)
|
||||
RFKILL_TYPE_WLAN,
|
||||
RFKILL_TYPE_MAX,
|
||||
RFKILL_TYPE_UNKNOWN,
|
||||
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | NM_PROPERTY_PARAM_NO_EXPORT));
|
||||
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
|
||||
|
||||
g_object_class_install_property
|
||||
(object_class, PROP_IFINDEX,
|
||||
@@ -5075,7 +5075,7 @@ nm_device_class_init (NMDeviceClass *klass)
|
||||
"Ifindex",
|
||||
"Ifindex",
|
||||
0, G_MAXINT, 0,
|
||||
G_PARAM_READABLE | NM_PROPERTY_PARAM_NO_EXPORT));
|
||||
G_PARAM_READABLE));
|
||||
|
||||
g_object_class_install_property
|
||||
(object_class, PROP_AVAILABLE_CONNECTIONS,
|
||||
@@ -5141,7 +5141,8 @@ nm_device_class_init (NMDeviceClass *klass)
|
||||
0, NULL, NULL, NULL,
|
||||
G_TYPE_NONE, 2, G_TYPE_OBJECT, G_TYPE_OBJECT);
|
||||
|
||||
dbus_g_object_type_install_info (G_TYPE_FROM_CLASS (klass),
|
||||
nm_dbus_manager_register_exported_type (nm_dbus_manager_get (),
|
||||
G_TYPE_FROM_CLASS (klass),
|
||||
&dbus_glib_nm_device_object_info);
|
||||
|
||||
dbus_g_error_domain_register (NM_DEVICE_ERROR, NULL, NM_TYPE_DEVICE_ERROR);
|
||||
|
@@ -37,7 +37,7 @@
|
||||
#include "nm-device-private.h"
|
||||
#include "nm-system.h"
|
||||
#include "NetworkManagerUtils.h"
|
||||
#include "nm-properties-changed-signal.h"
|
||||
#include "nm-dbus-manager.h"
|
||||
#include "nm-connection.h"
|
||||
#include "nm-setting-connection.h"
|
||||
#include "nm-setting-wimax.h"
|
||||
@@ -67,7 +67,6 @@ enum {
|
||||
enum {
|
||||
NSP_ADDED,
|
||||
NSP_REMOVED,
|
||||
PROPERTIES_CHANGED,
|
||||
|
||||
LAST_SIGNAL
|
||||
};
|
||||
@@ -1501,11 +1500,8 @@ nm_device_wimax_class_init (NMDeviceWimaxClass *klass)
|
||||
G_TYPE_NONE, 1,
|
||||
G_TYPE_OBJECT);
|
||||
|
||||
signals[PROPERTIES_CHANGED] =
|
||||
nm_properties_changed_signal_new (object_class, G_STRUCT_OFFSET (NMDeviceWimaxClass, properties_changed));
|
||||
|
||||
|
||||
dbus_g_object_type_install_info (G_TYPE_FROM_CLASS (klass),
|
||||
nm_dbus_manager_register_exported_type (nm_dbus_manager_get (),
|
||||
G_TYPE_FROM_CLASS (klass),
|
||||
&dbus_glib_nm_device_wimax_object_info);
|
||||
|
||||
dbus_g_error_domain_register (NM_WIMAX_ERROR, NULL, NM_TYPE_WIMAX_ERROR);
|
||||
|
@@ -23,20 +23,11 @@
|
||||
#include "NetworkManager.h"
|
||||
#include "nm-dbus-manager.h"
|
||||
#include "nm-setting-wimax.h"
|
||||
#include "nm-properties-changed-signal.h"
|
||||
#include "nm-wimax-nsp-glue.h"
|
||||
#include "nm-utils.h"
|
||||
|
||||
G_DEFINE_TYPE (NMWimaxNsp, nm_wimax_nsp, G_TYPE_OBJECT)
|
||||
|
||||
enum {
|
||||
PROPERTIES_CHANGED,
|
||||
|
||||
LAST_SIGNAL
|
||||
};
|
||||
|
||||
static guint signals[LAST_SIGNAL] = { 0 };
|
||||
|
||||
enum {
|
||||
PROP_0,
|
||||
|
||||
@@ -245,11 +236,7 @@ nm_wimax_nsp_class_init (NMWimaxNspClass *klass)
|
||||
NM_WIMAX_NSP_NETWORK_TYPE_UNKNOWN,
|
||||
G_PARAM_READWRITE));
|
||||
|
||||
/* Signals */
|
||||
signals[PROPERTIES_CHANGED] =
|
||||
nm_properties_changed_signal_new (object_class,
|
||||
G_STRUCT_OFFSET (NMWimaxNspClass, properties_changed));
|
||||
|
||||
dbus_g_object_type_install_info (G_TYPE_FROM_CLASS (klass),
|
||||
nm_dbus_manager_register_exported_type (nm_dbus_manager_get (),
|
||||
G_TYPE_FROM_CLASS (klass),
|
||||
&dbus_glib_nm_wimax_nsp_object_info);
|
||||
}
|
||||
|
@@ -42,8 +42,6 @@ typedef struct {
|
||||
typedef struct {
|
||||
NMActiveConnectionClass parent;
|
||||
|
||||
/* Signals */
|
||||
void (*properties_changed) (NMActRequest *req, GHashTable *properties);
|
||||
} NMActRequestClass;
|
||||
|
||||
GType nm_act_request_get_type (void);
|
||||
|
@@ -25,7 +25,6 @@
|
||||
#include "nm-logging.h"
|
||||
#include "nm-dbus-glib-types.h"
|
||||
#include "nm-dbus-manager.h"
|
||||
#include "nm-properties-changed-signal.h"
|
||||
#include "nm-device.h"
|
||||
#include "nm-settings-connection.h"
|
||||
|
||||
@@ -77,12 +76,6 @@ enum {
|
||||
LAST_PROP
|
||||
};
|
||||
|
||||
enum {
|
||||
PROPERTIES_CHANGED,
|
||||
LAST_SIGNAL
|
||||
};
|
||||
static guint signals[LAST_SIGNAL] = { 0 };
|
||||
|
||||
/****************************************************************/
|
||||
|
||||
NMActiveConnectionState
|
||||
@@ -379,11 +372,11 @@ dispose (GObject *object)
|
||||
}
|
||||
|
||||
static void
|
||||
nm_active_connection_class_init (NMActiveConnectionClass *vpn_class)
|
||||
nm_active_connection_class_init (NMActiveConnectionClass *ac_class)
|
||||
{
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (vpn_class);
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (ac_class);
|
||||
|
||||
g_type_class_add_private (vpn_class, sizeof (NMActiveConnectionPrivate));
|
||||
g_type_class_add_private (ac_class, sizeof (NMActiveConnectionPrivate));
|
||||
|
||||
/* virtual methods */
|
||||
object_class->get_property = get_property;
|
||||
@@ -462,49 +455,45 @@ nm_active_connection_class_init (NMActiveConnectionClass *vpn_class)
|
||||
"Internal Connection",
|
||||
"Internal connection",
|
||||
NM_TYPE_CONNECTION,
|
||||
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | NM_PROPERTY_PARAM_NO_EXPORT));
|
||||
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
|
||||
|
||||
g_object_class_install_property (object_class, PROP_INT_DEVICE,
|
||||
g_param_spec_object (NM_ACTIVE_CONNECTION_INT_DEVICE,
|
||||
"Internal device",
|
||||
"Internal device",
|
||||
NM_TYPE_DEVICE,
|
||||
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | NM_PROPERTY_PARAM_NO_EXPORT));
|
||||
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
|
||||
|
||||
g_object_class_install_property (object_class, PROP_INT_USER_REQUESTED,
|
||||
g_param_spec_boolean (NM_ACTIVE_CONNECTION_INT_USER_REQUESTED,
|
||||
"User requested",
|
||||
"User requested",
|
||||
FALSE,
|
||||
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | NM_PROPERTY_PARAM_NO_EXPORT));
|
||||
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
|
||||
|
||||
g_object_class_install_property (object_class, PROP_INT_USER_UID,
|
||||
g_param_spec_ulong (NM_ACTIVE_CONNECTION_INT_USER_UID,
|
||||
"User UID",
|
||||
"User UID (if user requested)",
|
||||
0, G_MAXULONG, 0,
|
||||
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | NM_PROPERTY_PARAM_NO_EXPORT));
|
||||
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
|
||||
|
||||
g_object_class_install_property (object_class, PROP_INT_ASSUMED,
|
||||
g_param_spec_boolean (NM_ACTIVE_CONNECTION_INT_ASSUMED,
|
||||
"Assumed",
|
||||
"Assumed",
|
||||
FALSE,
|
||||
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | NM_PROPERTY_PARAM_NO_EXPORT));
|
||||
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
|
||||
|
||||
g_object_class_install_property (object_class, PROP_INT_MASTER,
|
||||
g_param_spec_object (NM_ACTIVE_CONNECTION_INT_MASTER,
|
||||
"Internal master device",
|
||||
"Internal device",
|
||||
NM_TYPE_DEVICE,
|
||||
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | NM_PROPERTY_PARAM_NO_EXPORT));
|
||||
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
|
||||
|
||||
/* Signals */
|
||||
signals[PROPERTIES_CHANGED] =
|
||||
nm_properties_changed_signal_new (object_class,
|
||||
G_STRUCT_OFFSET (NMActiveConnectionClass, properties_changed));
|
||||
|
||||
dbus_g_object_type_install_info (G_TYPE_FROM_CLASS (vpn_class),
|
||||
nm_dbus_manager_register_exported_type (nm_dbus_manager_get (),
|
||||
G_TYPE_FROM_CLASS (ac_class),
|
||||
&dbus_glib_nm_active_connection_object_info);
|
||||
}
|
||||
|
||||
|
@@ -59,8 +59,6 @@ typedef struct {
|
||||
typedef struct {
|
||||
GObjectClass parent;
|
||||
|
||||
/* Signals */
|
||||
void (*properties_changed) (NMActiveConnection *active, GHashTable *properties);
|
||||
} NMActiveConnectionClass;
|
||||
|
||||
GType nm_active_connection_get_type (void);
|
||||
|
@@ -27,6 +27,7 @@
|
||||
#include "NetworkManager.h"
|
||||
#include "nm-dbus-manager.h"
|
||||
#include "nm-glib-compat.h"
|
||||
#include "nm-properties-changed-signal.h"
|
||||
|
||||
#include <dbus/dbus.h>
|
||||
#include <dbus/dbus-glib.h>
|
||||
@@ -781,6 +782,33 @@ object_destroyed (NMDBusManager *self, gpointer object)
|
||||
g_hash_table_remove (NM_DBUS_MANAGER_GET_PRIVATE (self)->exported, object);
|
||||
}
|
||||
|
||||
void
|
||||
nm_dbus_manager_register_exported_type (NMDBusManager *self,
|
||||
GType object_type,
|
||||
const DBusGObjectInfo *info)
|
||||
{
|
||||
const char *properties_info, *dbus_name, *gobject_name, *access;
|
||||
|
||||
dbus_g_object_type_install_info (object_type, info);
|
||||
if (!info->exported_properties)
|
||||
return;
|
||||
|
||||
properties_info = info->exported_properties;
|
||||
while (*properties_info) {
|
||||
/* The format is: "interface\0DBusPropertyName\0gobject_property_name\0access\0" */
|
||||
dbus_name = strchr (properties_info, '\0') + 1;
|
||||
gobject_name = strchr (dbus_name, '\0') + 1;
|
||||
access = strchr (gobject_name, '\0') + 1;
|
||||
properties_info = strchr (access, '\0') + 1;
|
||||
|
||||
/* Note that nm-properties-changed-signal takes advantage of the
|
||||
* fact that @dbus_name and @gobject_name are static data that won't
|
||||
* ever be freed.
|
||||
*/
|
||||
nm_properties_changed_signal_add_property (object_type, dbus_name, gobject_name);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
nm_dbus_manager_register_object (NMDBusManager *self,
|
||||
const char *path,
|
||||
|
@@ -99,6 +99,10 @@ gboolean nm_dbus_manager_get_caller_info_from_message (NMDBusManager *self,
|
||||
char **out_sender,
|
||||
gulong *out_uid);
|
||||
|
||||
void nm_dbus_manager_register_exported_type (NMDBusManager *self,
|
||||
GType object_type,
|
||||
const DBusGObjectInfo *info);
|
||||
|
||||
void nm_dbus_manager_register_object (NMDBusManager *self,
|
||||
const char *path,
|
||||
gpointer object);
|
||||
|
@@ -26,7 +26,6 @@
|
||||
#include "nm-dhcp4-config.h"
|
||||
#include "nm-dhcp4-config-glue.h"
|
||||
#include "nm-dbus-glib-types.h"
|
||||
#include "nm-properties-changed-signal.h"
|
||||
#include "nm-utils.h"
|
||||
|
||||
|
||||
@@ -47,14 +46,6 @@ enum {
|
||||
LAST_PROP
|
||||
};
|
||||
|
||||
enum {
|
||||
PROPERTIES_CHANGED,
|
||||
|
||||
LAST_SIGNAL
|
||||
};
|
||||
|
||||
static guint signals[LAST_SIGNAL] = { 0 };
|
||||
|
||||
|
||||
NMDHCP4Config *
|
||||
nm_dhcp4_config_new (void)
|
||||
@@ -194,11 +185,7 @@ nm_dhcp4_config_class_init (NMDHCP4ConfigClass *config_class)
|
||||
DBUS_TYPE_G_MAP_OF_VARIANT,
|
||||
G_PARAM_READABLE));
|
||||
|
||||
/* Signals */
|
||||
signals[PROPERTIES_CHANGED] =
|
||||
nm_properties_changed_signal_new (object_class,
|
||||
G_STRUCT_OFFSET (NMDHCP4ConfigClass, properties_changed));
|
||||
|
||||
dbus_g_object_type_install_info (G_TYPE_FROM_CLASS (config_class),
|
||||
nm_dbus_manager_register_exported_type (nm_dbus_manager_get (),
|
||||
G_TYPE_FROM_CLASS (config_class),
|
||||
&dbus_glib_nm_dhcp4_config_object_info);
|
||||
}
|
||||
|
@@ -38,8 +38,6 @@ typedef struct {
|
||||
typedef struct {
|
||||
GObjectClass parent;
|
||||
|
||||
/* Signals */
|
||||
void (*properties_changed) (NMDHCP4Config *config, GHashTable *properties);
|
||||
} NMDHCP4ConfigClass;
|
||||
|
||||
#define NM_DHCP4_CONFIG_OPTIONS "options"
|
||||
|
@@ -26,7 +26,6 @@
|
||||
#include "nm-dhcp6-config.h"
|
||||
#include "nm-dhcp6-config-glue.h"
|
||||
#include "nm-dbus-glib-types.h"
|
||||
#include "nm-properties-changed-signal.h"
|
||||
#include "nm-utils.h"
|
||||
|
||||
|
||||
@@ -47,14 +46,6 @@ enum {
|
||||
LAST_PROP
|
||||
};
|
||||
|
||||
enum {
|
||||
PROPERTIES_CHANGED,
|
||||
|
||||
LAST_SIGNAL
|
||||
};
|
||||
|
||||
static guint signals[LAST_SIGNAL] = { 0 };
|
||||
|
||||
|
||||
NMDHCP6Config *
|
||||
nm_dhcp6_config_new (void)
|
||||
@@ -194,11 +185,7 @@ nm_dhcp6_config_class_init (NMDHCP6ConfigClass *config_class)
|
||||
DBUS_TYPE_G_MAP_OF_VARIANT,
|
||||
G_PARAM_READABLE));
|
||||
|
||||
/* Signals */
|
||||
signals[PROPERTIES_CHANGED] =
|
||||
nm_properties_changed_signal_new (object_class,
|
||||
G_STRUCT_OFFSET (NMDHCP6ConfigClass, properties_changed));
|
||||
|
||||
dbus_g_object_type_install_info (G_TYPE_FROM_CLASS (config_class),
|
||||
nm_dbus_manager_register_exported_type (nm_dbus_manager_get (),
|
||||
G_TYPE_FROM_CLASS (config_class),
|
||||
&dbus_glib_nm_dhcp6_config_object_info);
|
||||
}
|
||||
|
@@ -38,8 +38,6 @@ typedef struct {
|
||||
typedef struct {
|
||||
GObjectClass parent;
|
||||
|
||||
/* Signals */
|
||||
void (*properties_changed) (NMDHCP6Config *config, GHashTable *properties);
|
||||
} NMDHCP6ConfigClass;
|
||||
|
||||
#define NM_DHCP6_CONFIG_OPTIONS "options"
|
||||
|
@@ -52,7 +52,6 @@
|
||||
#include "nm-device-adsl.h"
|
||||
#include "nm-device-generic.h"
|
||||
#include "nm-system.h"
|
||||
#include "nm-properties-changed-signal.h"
|
||||
#include "nm-setting-bluetooth.h"
|
||||
#include "nm-setting-connection.h"
|
||||
#include "nm-setting-wireless.h"
|
||||
@@ -262,7 +261,6 @@ enum {
|
||||
DEVICE_ADDED,
|
||||
DEVICE_REMOVED,
|
||||
STATE_CHANGED,
|
||||
PROPERTIES_CHANGED,
|
||||
CHECK_PERMISSIONS,
|
||||
USER_PERMISSIONS_CHANGED,
|
||||
ACTIVE_CONNECTION_ADDED,
|
||||
@@ -4630,7 +4628,7 @@ nm_manager_class_init (NMManagerClass *manager_class)
|
||||
"Hostname",
|
||||
"Hostname",
|
||||
NULL,
|
||||
G_PARAM_READABLE | NM_PROPERTY_PARAM_NO_EXPORT));
|
||||
G_PARAM_READABLE));
|
||||
|
||||
/* Sleeping is not exported over D-Bus */
|
||||
g_object_class_install_property
|
||||
@@ -4639,7 +4637,7 @@ nm_manager_class_init (NMManagerClass *manager_class)
|
||||
"Sleeping",
|
||||
"Sleeping",
|
||||
FALSE,
|
||||
G_PARAM_READABLE | NM_PROPERTY_PARAM_NO_EXPORT));
|
||||
G_PARAM_READABLE));
|
||||
|
||||
/* signals */
|
||||
signals[DEVICE_ADDED] =
|
||||
@@ -4666,10 +4664,6 @@ nm_manager_class_init (NMManagerClass *manager_class)
|
||||
NULL, NULL, NULL,
|
||||
G_TYPE_NONE, 1, G_TYPE_UINT);
|
||||
|
||||
signals[PROPERTIES_CHANGED] =
|
||||
nm_properties_changed_signal_new (object_class,
|
||||
G_STRUCT_OFFSET (NMManagerClass, properties_changed));
|
||||
|
||||
signals[CHECK_PERMISSIONS] =
|
||||
g_signal_new ("check-permissions",
|
||||
G_OBJECT_CLASS_TYPE (object_class),
|
||||
@@ -4698,7 +4692,8 @@ nm_manager_class_init (NMManagerClass *manager_class)
|
||||
0, NULL, NULL, NULL,
|
||||
G_TYPE_NONE, 1, G_TYPE_OBJECT);
|
||||
|
||||
dbus_g_object_type_install_info (G_TYPE_FROM_CLASS (manager_class),
|
||||
nm_dbus_manager_register_exported_type (nm_dbus_manager_get (),
|
||||
G_TYPE_FROM_CLASS (manager_class),
|
||||
&dbus_glib_nm_manager_object_info);
|
||||
|
||||
dbus_g_error_domain_register (NM_MANAGER_ERROR, NULL, NM_TYPE_MANAGER_ERROR);
|
||||
|
@@ -80,7 +80,6 @@ typedef struct {
|
||||
void (*device_added) (NMManager *manager, NMDevice *device);
|
||||
void (*device_removed) (NMManager *manager, NMDevice *device);
|
||||
void (*state_changed) (NMManager *manager, guint state);
|
||||
void (*properties_changed) (NMManager *manager, GHashTable *properties);
|
||||
} NMManagerClass;
|
||||
|
||||
GType nm_manager_get_type (void);
|
||||
|
@@ -23,19 +23,31 @@
|
||||
#include <stdio.h>
|
||||
|
||||
#include <dbus/dbus-glib.h>
|
||||
#ifdef DEBUG
|
||||
#include "nm-logging.h"
|
||||
#endif
|
||||
#include "nm-properties-changed-signal.h"
|
||||
#include "nm-dbus-glib-types.h"
|
||||
|
||||
#define NM_DBUS_PROPERTY_CHANGED "NM_DBUS_PROPERTY_CHANGED"
|
||||
typedef struct {
|
||||
GHashTable *exported_props;
|
||||
guint signal_id;
|
||||
} NMPropertiesChangedClassInfo;
|
||||
|
||||
typedef struct {
|
||||
GHashTable *hash;
|
||||
gulong signal_id;
|
||||
guint signal_id;
|
||||
guint idle_id;
|
||||
} PropertiesChangedInfo;
|
||||
} NMPropertiesChangedInfo;
|
||||
|
||||
static GQuark
|
||||
nm_properties_changed_signal_quark (void)
|
||||
{
|
||||
static GQuark q;
|
||||
|
||||
if (G_UNLIKELY (q == 0))
|
||||
q = g_quark_from_static_string ("nm-properties-changed-signal");
|
||||
|
||||
return q;
|
||||
}
|
||||
|
||||
static void
|
||||
destroy_value (gpointer data)
|
||||
@@ -46,35 +58,23 @@ destroy_value (gpointer data)
|
||||
g_slice_free (GValue, val);
|
||||
}
|
||||
|
||||
static PropertiesChangedInfo *
|
||||
properties_changed_info_new (void)
|
||||
{
|
||||
PropertiesChangedInfo *info;
|
||||
|
||||
info = g_slice_new0 (PropertiesChangedInfo);
|
||||
info->hash = g_hash_table_new_full (g_str_hash, g_str_equal,
|
||||
(GDestroyNotify) g_free,
|
||||
destroy_value);
|
||||
return info;
|
||||
}
|
||||
|
||||
static void
|
||||
properties_changed_info_destroy (gpointer data)
|
||||
{
|
||||
PropertiesChangedInfo *info = (PropertiesChangedInfo *) data;
|
||||
NMPropertiesChangedInfo *info = data;
|
||||
|
||||
if (info->idle_id)
|
||||
g_source_remove (info->idle_id);
|
||||
|
||||
g_hash_table_destroy (info->hash);
|
||||
g_slice_free (PropertiesChangedInfo, info);
|
||||
g_slice_free (NMPropertiesChangedInfo, info);
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
static void
|
||||
add_to_string (gpointer key, gpointer value, gpointer user_data)
|
||||
{
|
||||
char *buf = (char *) user_data;
|
||||
const char *name = (const char *) key;
|
||||
GString *buf = user_data;
|
||||
GValue str_val = G_VALUE_INIT;
|
||||
|
||||
g_value_init (&str_val, G_TYPE_STRING);
|
||||
@@ -82,36 +82,33 @@ add_to_string (gpointer key, gpointer value, gpointer user_data)
|
||||
if (G_VALUE_HOLDS_OBJECT (value)) {
|
||||
GObject *obj = g_value_get_object (value);
|
||||
|
||||
if (g_value_get_object (value)) {
|
||||
sprintf (buf + strlen (buf), "{%s: %p (%s)}, ",
|
||||
(const char *) key, obj, G_OBJECT_TYPE_NAME (obj));
|
||||
} else {
|
||||
sprintf (buf + strlen (buf), "{%s: %p}, ", (const char *) key, obj);
|
||||
}
|
||||
if (obj) {
|
||||
g_string_append_printf (buf, "{%s: %p (%s)}, ", name, obj,
|
||||
G_OBJECT_TYPE_NAME (obj));
|
||||
} else
|
||||
sprintf (buf + strlen (buf), "{%s: <transform error>}, ", (const char *) key);
|
||||
} else {
|
||||
sprintf (buf + strlen (buf), "{%s: %s}, ", (const char *) key, g_value_get_string (&str_val));
|
||||
}
|
||||
g_string_append_printf (buf, "{%s: %p}, ", name, obj);
|
||||
} else
|
||||
g_string_append_printf (buf, "{%s: <transform error>}, ", name);
|
||||
} else
|
||||
g_string_append_printf (buf, "{%s: %s}, ", name, g_value_get_string (&str_val));
|
||||
g_value_unset (&str_val);
|
||||
}
|
||||
#endif
|
||||
|
||||
static gboolean
|
||||
properties_changed (gpointer data)
|
||||
{
|
||||
GObject *object = G_OBJECT (data);
|
||||
PropertiesChangedInfo *info = (PropertiesChangedInfo *) g_object_get_data (object, NM_DBUS_PROPERTY_CHANGED);
|
||||
NMPropertiesChangedInfo *info = g_object_get_qdata (object, nm_properties_changed_signal_quark ());
|
||||
|
||||
g_assert (info);
|
||||
|
||||
#ifdef DEBUG
|
||||
{
|
||||
char buf[2048] = { 0, };
|
||||
g_hash_table_foreach (info->hash, add_to_string, &buf);
|
||||
nm_log_dbg (LOGD_CORE, "%s -> %s", G_OBJECT_TYPE_NAME (object), buf);
|
||||
if (nm_logging_level_enabled (LOGL_DEBUG)) {
|
||||
GString *buf = g_string_new (NULL);
|
||||
|
||||
g_hash_table_foreach (info->hash, add_to_string, buf);
|
||||
nm_log_dbg (LOGD_CORE, "%s -> %s", G_OBJECT_TYPE_NAME (object), buf->str);
|
||||
g_string_free (buf, TRUE);
|
||||
}
|
||||
#endif
|
||||
|
||||
g_signal_emit (object, info->signal_id, 0, info->hash);
|
||||
g_hash_table_remove_all (info->hash);
|
||||
@@ -123,82 +120,122 @@ static void
|
||||
idle_id_reset (gpointer data)
|
||||
{
|
||||
GObject *object = G_OBJECT (data);
|
||||
PropertiesChangedInfo *info = (PropertiesChangedInfo *) g_object_get_data (object, NM_DBUS_PROPERTY_CHANGED);
|
||||
NMPropertiesChangedInfo *info = g_object_get_qdata (object, nm_properties_changed_signal_quark ());
|
||||
|
||||
/* info is unset when the object is being destroyed */
|
||||
if (info)
|
||||
info->idle_id = 0;
|
||||
}
|
||||
|
||||
static char*
|
||||
uscore_to_wincaps (const char *uscore)
|
||||
{
|
||||
const char *p;
|
||||
GString *str;
|
||||
gboolean last_was_uscore;
|
||||
|
||||
last_was_uscore = TRUE;
|
||||
|
||||
str = g_string_new (NULL);
|
||||
p = uscore;
|
||||
while (p && *p) {
|
||||
if (*p == '-' || *p == '_')
|
||||
last_was_uscore = TRUE;
|
||||
else {
|
||||
if (last_was_uscore) {
|
||||
g_string_append_c (str, g_ascii_toupper (*p));
|
||||
last_was_uscore = FALSE;
|
||||
} else
|
||||
g_string_append_c (str, *p);
|
||||
}
|
||||
++p;
|
||||
}
|
||||
|
||||
return g_string_free (str, FALSE);
|
||||
}
|
||||
|
||||
static void
|
||||
notify (GObject *object, GParamSpec *pspec)
|
||||
{
|
||||
PropertiesChangedInfo *info;
|
||||
NMPropertiesChangedClassInfo *classinfo;
|
||||
NMPropertiesChangedInfo *info;
|
||||
const char *dbus_property_name = NULL;
|
||||
GValue *value;
|
||||
GType type;
|
||||
|
||||
/* Ignore properties that shouldn't be exported */
|
||||
if (pspec->flags & NM_PROPERTY_PARAM_NO_EXPORT)
|
||||
for (type = G_OBJECT_TYPE (object); type; type = g_type_parent (type)) {
|
||||
classinfo = g_type_get_qdata (type, nm_properties_changed_signal_quark ());
|
||||
if (!classinfo)
|
||||
continue;
|
||||
|
||||
dbus_property_name = g_hash_table_lookup (classinfo->exported_props, pspec->name);
|
||||
if (dbus_property_name)
|
||||
break;
|
||||
}
|
||||
if (!dbus_property_name) {
|
||||
nm_log_dbg (LOGD_CORE, "ignoring notification for prop %s on type %s",
|
||||
pspec->name, G_OBJECT_TYPE_NAME (object));
|
||||
return;
|
||||
}
|
||||
|
||||
info = (PropertiesChangedInfo *) g_object_get_data (object, NM_DBUS_PROPERTY_CHANGED);
|
||||
info = g_object_get_qdata (object, nm_properties_changed_signal_quark ());
|
||||
if (!info) {
|
||||
info = properties_changed_info_new ();
|
||||
g_object_set_data_full (object, NM_DBUS_PROPERTY_CHANGED, info, properties_changed_info_destroy);
|
||||
info->signal_id = g_signal_lookup ("properties-changed", G_OBJECT_TYPE (object));
|
||||
g_assert (info->signal_id);
|
||||
info = g_slice_new0 (NMPropertiesChangedInfo);
|
||||
info->hash = g_hash_table_new_full (g_str_hash, g_str_equal,
|
||||
NULL, destroy_value);
|
||||
info->signal_id = classinfo->signal_id;
|
||||
|
||||
g_object_set_qdata_full (object, nm_properties_changed_signal_quark (),
|
||||
info, properties_changed_info_destroy);
|
||||
}
|
||||
|
||||
value = g_slice_new0 (GValue);
|
||||
g_value_init (value, pspec->value_type);
|
||||
g_object_get_property (object, pspec->name, value);
|
||||
g_hash_table_insert (info->hash, uscore_to_wincaps (pspec->name), value);
|
||||
g_hash_table_insert (info->hash, (char *) dbus_property_name, value);
|
||||
|
||||
if (!info->idle_id)
|
||||
info->idle_id = g_idle_add_full (G_PRIORITY_DEFAULT_IDLE, properties_changed, object, idle_id_reset);
|
||||
}
|
||||
|
||||
guint
|
||||
nm_properties_changed_signal_new (GObjectClass *object_class,
|
||||
guint class_offset)
|
||||
static NMPropertiesChangedClassInfo *
|
||||
nm_properties_changed_signal_setup_type (GType type)
|
||||
{
|
||||
guint id;
|
||||
NMPropertiesChangedClassInfo *classinfo;
|
||||
NMPropertiesChangedClassInfo *parent_classinfo = NULL;
|
||||
GObjectClass *object_class;
|
||||
GType parent;
|
||||
|
||||
classinfo = g_slice_new (NMPropertiesChangedClassInfo);
|
||||
g_type_set_qdata (type, nm_properties_changed_signal_quark (), classinfo);
|
||||
|
||||
object_class = g_type_class_ref (type);
|
||||
object_class->notify = notify;
|
||||
g_type_class_unref (object_class);
|
||||
|
||||
id = g_signal_new ("properties-changed",
|
||||
G_OBJECT_CLASS_TYPE (object_class),
|
||||
classinfo->exported_props = g_hash_table_new (g_str_hash, g_str_equal);
|
||||
|
||||
/* See if we've already added the signal to a parent class. (We can't just use
|
||||
* g_signal_lookup() here because it prints a warning if the signal doesn't exist!)
|
||||
*/
|
||||
parent = g_type_parent (type);
|
||||
while (parent) {
|
||||
parent_classinfo = g_type_get_qdata (parent, nm_properties_changed_signal_quark ());
|
||||
if (parent_classinfo)
|
||||
break;
|
||||
parent = g_type_parent (parent);
|
||||
}
|
||||
|
||||
if (parent_classinfo)
|
||||
classinfo->signal_id = parent_classinfo->signal_id;
|
||||
else {
|
||||
classinfo->signal_id = g_signal_new ("properties-changed",
|
||||
type,
|
||||
G_SIGNAL_RUN_FIRST,
|
||||
class_offset,
|
||||
0,
|
||||
NULL, NULL,
|
||||
g_cclosure_marshal_VOID__BOXED,
|
||||
G_TYPE_NONE, 1, DBUS_TYPE_G_MAP_OF_VARIANT);
|
||||
|
||||
return id;
|
||||
}
|
||||
|
||||
return classinfo;
|
||||
}
|
||||
|
||||
void
|
||||
nm_properties_changed_signal_add_property (GType type,
|
||||
const char *dbus_property_name,
|
||||
const char *gobject_property_name)
|
||||
{
|
||||
NMPropertiesChangedClassInfo *classinfo;
|
||||
char *hyphen_name, *p;
|
||||
|
||||
classinfo = g_type_get_qdata (type, nm_properties_changed_signal_quark ());
|
||||
if (!classinfo)
|
||||
classinfo = nm_properties_changed_signal_setup_type (type);
|
||||
|
||||
g_hash_table_insert (classinfo->exported_props,
|
||||
(char *) gobject_property_name,
|
||||
(char *) dbus_property_name);
|
||||
|
||||
hyphen_name = g_strdup (gobject_property_name);
|
||||
for (p = hyphen_name; *p; p++) {
|
||||
if (*p == '_')
|
||||
*p = '-';
|
||||
}
|
||||
g_hash_table_insert (classinfo->exported_props,
|
||||
hyphen_name,
|
||||
(char *) dbus_property_name);
|
||||
}
|
||||
|
@@ -24,9 +24,8 @@
|
||||
|
||||
#include <glib-object.h>
|
||||
|
||||
#define NM_PROPERTY_PARAM_NO_EXPORT (1 << (0 + G_PARAM_USER_SHIFT))
|
||||
|
||||
guint nm_properties_changed_signal_new (GObjectClass *object_class,
|
||||
guint class_offset);
|
||||
void nm_properties_changed_signal_add_property (GType type,
|
||||
const char *dbus_property_name,
|
||||
const char *gobject_property_name);
|
||||
|
||||
#endif /* _NM_PROPERTIES_CHANGED_SIGNAL_H_ */
|
||||
|
@@ -30,7 +30,6 @@
|
||||
#include "nm-logging.h"
|
||||
#include "nm-dbus-manager.h"
|
||||
|
||||
#include "nm-properties-changed-signal.h"
|
||||
#include "nm-setting-wireless.h"
|
||||
#include "nm-glib-compat.h"
|
||||
|
||||
@@ -67,14 +66,6 @@ typedef struct
|
||||
|
||||
G_DEFINE_TYPE (NMAccessPoint, nm_ap, G_TYPE_OBJECT)
|
||||
|
||||
enum {
|
||||
PROPERTIES_CHANGED,
|
||||
|
||||
LAST_SIGNAL
|
||||
};
|
||||
|
||||
static guint signals[LAST_SIGNAL] = { 0 };
|
||||
|
||||
enum {
|
||||
PROP_0,
|
||||
PROP_FLAGS,
|
||||
@@ -304,12 +295,8 @@ nm_ap_class_init (NMAccessPointClass *ap_class)
|
||||
G_MININT8, G_MAXINT8, 0,
|
||||
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
|
||||
|
||||
/* Signals */
|
||||
signals[PROPERTIES_CHANGED] =
|
||||
nm_properties_changed_signal_new (object_class,
|
||||
G_STRUCT_OFFSET (NMAccessPointClass, properties_changed));
|
||||
|
||||
dbus_g_object_type_install_info (G_TYPE_FROM_CLASS (ap_class),
|
||||
nm_dbus_manager_register_exported_type (nm_dbus_manager_get (),
|
||||
G_TYPE_FROM_CLASS (ap_class),
|
||||
&dbus_glib_nm_access_point_object_info);
|
||||
}
|
||||
|
||||
|
@@ -51,8 +51,6 @@ typedef struct {
|
||||
typedef struct {
|
||||
GObjectClass parent;
|
||||
|
||||
/* Signals */
|
||||
void (*properties_changed) (NMAccessPoint *ap, GHashTable *properties);
|
||||
} NMAccessPointClass;
|
||||
|
||||
GType nm_ap_get_type (void);
|
||||
|
Reference in New Issue
Block a user