diff options
author | Ignacio Casal Quinteiro <icq@gnome.org> | 2015-01-08 12:18:47 +0100 |
---|---|---|
committer | Ignacio Casal Quinteiro <icq@gnome.org> | 2015-01-08 12:18:47 +0100 |
commit | ffe7d790e778f52e62c72b536eaa9140bf3b5e40 (patch) | |
tree | 812d50b9bdc1f0ffb84c2fe9d3ecae5e23ebb578 /gusb/gusb-device.c | |
parent | dd4c51280e5fbcc56d3d46669377542c6589e87d (diff) | |
download | gusb-ffe7d790e778f52e62c72b536eaa9140bf3b5e40.tar.gz |
device: move new methods with the rest of public ones
Also adds the Since tags
Diffstat (limited to 'gusb/gusb-device.c')
-rw-r--r-- | gusb/gusb-device.c | 114 |
1 files changed, 59 insertions, 55 deletions
diff --git a/gusb/gusb-device.c b/gusb/gusb-device.c index 49d7e86..815e3bb 100644 --- a/gusb/gusb-device.c +++ b/gusb/gusb-device.c @@ -71,61 +71,6 @@ G_DEFINE_TYPE_WITH_CODE (GUsbDevice, g_usb_device, G_TYPE_OBJECT, g_usb_device_initable_iface_init)) /** - * g_usb_device_get_parent: - * @device: a #GUsbDevice instance - * - * Gets the device parent if one exists. - * - * Return value: (transfer full): #GUsbDevice or %NULL - **/ -GUsbDevice * -g_usb_device_get_parent (GUsbDevice *device) -{ - GUsbDevicePrivate *priv = device->priv; - libusb_device *parent; - - parent = libusb_get_parent (priv->device); - if (parent == NULL) - return NULL; - - return g_usb_context_find_by_bus_address (priv->context, - libusb_get_bus_number (parent), - libusb_get_device_address (parent), - NULL); -} - -/** - * g_usb_device_get_children: - * @device: a #GUsbDevice instance - * - * Gets the device children if any exist. - * - * Return value: (transfer full): an array of #GUsbDevice - **/ -GPtrArray * -g_usb_device_get_children (GUsbDevice *device) -{ - GPtrArray *children; - GUsbDevice *device_tmp; - GUsbDevicePrivate *priv = device->priv; - guint i; - GPtrArray *devices = NULL; - - /* find any devices that have @device as a parent */ - children = g_ptr_array_new_with_free_func ((GDestroyNotify) g_object_unref); - devices = g_usb_context_get_devices (priv->context); - for (i = 0; i < devices->len; i++) { - device_tmp = g_ptr_array_index (devices, i); - if (priv->device == libusb_get_parent (device_tmp->priv->device)) - g_ptr_array_add (children, g_object_ref (device_tmp)); - } - - g_ptr_array_unref (devices); - - return children; -} - -/** * g_usb_device_error_quark: * * Return value: Our personal error quark. @@ -1402,6 +1347,65 @@ g_usb_device_get_platform_id (GUsbDevice *device) } /** + * g_usb_device_get_parent: + * @device: a #GUsbDevice instance + * + * Gets the device parent if one exists. + * + * Return value: (transfer full): #GUsbDevice or %NULL + * + * Since: 0.2.4 + **/ +GUsbDevice * +g_usb_device_get_parent (GUsbDevice *device) +{ + GUsbDevicePrivate *priv = device->priv; + libusb_device *parent; + + parent = libusb_get_parent (priv->device); + if (parent == NULL) + return NULL; + + return g_usb_context_find_by_bus_address (priv->context, + libusb_get_bus_number (parent), + libusb_get_device_address (parent), + NULL); +} + +/** + * g_usb_device_get_children: + * @device: a #GUsbDevice instance + * + * Gets the device children if any exist. + * + * Return value: (transfer full): an array of #GUsbDevice + * + * Since: 0.2.4 + **/ +GPtrArray * +g_usb_device_get_children (GUsbDevice *device) +{ + GPtrArray *children; + GUsbDevice *device_tmp; + GUsbDevicePrivate *priv = device->priv; + guint i; + GPtrArray *devices = NULL; + + /* find any devices that have @device as a parent */ + children = g_ptr_array_new_with_free_func ((GDestroyNotify) g_object_unref); + devices = g_usb_context_get_devices (priv->context); + for (i = 0; i < devices->len; i++) { + device_tmp = g_ptr_array_index (devices, i); + if (priv->device == libusb_get_parent (device_tmp->priv->device)) + g_ptr_array_add (children, g_object_ref (device_tmp)); + } + + g_ptr_array_unref (devices); + + return children; +} + +/** * g_usb_device_get_bus: * @device: a #GUsbDevice * |