summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIgnacio Casal Quinteiro <nacho.resa@gmail.com>2014-12-26 15:09:54 +0100
committerIgnacio Casal Quinteiro <nacho.resa@gmail.com>2014-12-26 15:09:54 +0100
commitb67cba631c01812190a1b0b196f2d157e6938423 (patch)
tree3729cb14c4d5c5e90491478689acfc71e3bde4dd
parent9b9e65a8ae2aa94f4c907013b83d76bbf0893b02 (diff)
downloadgusb-b67cba631c01812190a1b0b196f2d157e6938423.tar.gz
device: use g_object_class_install_properties
-rw-r--r--gusb/gusb-device.c39
1 files changed, 20 insertions, 19 deletions
diff --git a/gusb/gusb-device.c b/gusb/gusb-device.c
index 941db3c..905ebef 100644
--- a/gusb/gusb-device.c
+++ b/gusb/gusb-device.c
@@ -56,9 +56,12 @@ enum {
PROP_0,
PROP_LIBUSB_DEVICE,
PROP_CONTEXT,
- PROP_PLATFORM_ID
+ PROP_PLATFORM_ID,
+ N_PROPERTIES
};
+static GParamSpec *pspecs[N_PROPERTIES] = { NULL, };
+
static void g_usb_device_initable_iface_init (GInitableIface *iface);
G_DEFINE_TYPE_WITH_CODE (GUsbDevice, g_usb_device, G_TYPE_OBJECT,
@@ -167,7 +170,6 @@ g_usb_device_constructed (GObject *object)
static void
g_usb_device_class_init (GUsbDeviceClass *klass)
{
- GParamSpec *pspec;
GObjectClass *object_class = G_OBJECT_CLASS (klass);
object_class->finalize = g_usb_device_finalize;
@@ -179,31 +181,30 @@ g_usb_device_class_init (GUsbDeviceClass *klass)
/**
* GUsbDevice:libusb_device:
*/
- pspec = g_param_spec_pointer ("libusb-device", NULL, NULL,
- G_PARAM_CONSTRUCT_ONLY|
- G_PARAM_READWRITE);
- g_object_class_install_property (object_class, PROP_LIBUSB_DEVICE,
- pspec);
+ pspecs[PROP_LIBUSB_DEVICE] =
+ g_param_spec_pointer ("libusb-device", NULL, NULL,
+ G_PARAM_CONSTRUCT_ONLY|
+ G_PARAM_READWRITE);
/**
* GUsbDevice:context:
*/
- pspec = g_param_spec_object ("context", NULL, NULL,
- G_USB_TYPE_CONTEXT,
- G_PARAM_CONSTRUCT_ONLY|
- G_PARAM_WRITABLE);
- g_object_class_install_property (object_class, PROP_CONTEXT,
- pspec);
+ pspecs[PROP_CONTEXT] =
+ g_param_spec_object ("context", NULL, NULL,
+ G_USB_TYPE_CONTEXT,
+ G_PARAM_CONSTRUCT_ONLY|
+ G_PARAM_WRITABLE);
/**
* GUsbDevice:platform-id:
*/
- pspec = g_param_spec_string ("platform-id", NULL, NULL,
- NULL,
- G_PARAM_CONSTRUCT_ONLY|
- G_PARAM_WRITABLE);
- g_object_class_install_property (object_class, PROP_PLATFORM_ID,
- pspec);
+ pspecs[PROP_PLATFORM_ID] =
+ g_param_spec_string ("platform-id", NULL, NULL,
+ NULL,
+ G_PARAM_CONSTRUCT_ONLY|
+ G_PARAM_WRITABLE);
+
+ g_object_class_install_properties (object_class, N_PROPERTIES, pspecs);
}
static void