mirror of
https://gitlab.freedesktop.org/upower/upower.git
synced 2026-05-06 02:18:07 +02:00
device-list: Remove unnecessary native argument
We can simply look it up from within the function.
This commit is contained in:
parent
f961ec6154
commit
ddc739f38b
5 changed files with 15 additions and 12 deletions
|
|
@ -179,7 +179,7 @@ up_backend_device_new (UpBackend *backend, GUdevDevice *native)
|
||||||
|
|
||||||
/* not a power device, add it to the managed devices
|
/* not a power device, add it to the managed devices
|
||||||
* and don't return a power device */
|
* and don't return a power device */
|
||||||
up_device_list_insert (backend->priv->managed_devices, G_OBJECT (native), G_OBJECT (input));
|
up_device_list_insert (backend->priv->managed_devices, input);
|
||||||
device = NULL;
|
device = NULL;
|
||||||
}
|
}
|
||||||
g_object_unref (input);
|
g_object_unref (input);
|
||||||
|
|
|
||||||
|
|
@ -1032,7 +1032,7 @@ up_daemon_device_added_cb (UpBackend *backend, UpDevice *device, UpDaemon *daemo
|
||||||
g_return_if_fail (UP_IS_DEVICE (device));
|
g_return_if_fail (UP_IS_DEVICE (device));
|
||||||
|
|
||||||
/* add to device list */
|
/* add to device list */
|
||||||
up_device_list_insert (priv->power_devices, up_device_get_native (device), G_OBJECT (device));
|
up_device_list_insert (priv->power_devices, device);
|
||||||
|
|
||||||
/* connect, so we get changes */
|
/* connect, so we get changes */
|
||||||
g_signal_connect (device, "notify",
|
g_signal_connect (device, "notify",
|
||||||
|
|
@ -1064,7 +1064,7 @@ up_daemon_device_removed_cb (UpBackend *backend, UpDevice *device, UpDaemon *dae
|
||||||
g_return_if_fail (UP_IS_DEVICE (device));
|
g_return_if_fail (UP_IS_DEVICE (device));
|
||||||
|
|
||||||
/* remove from list */
|
/* remove from list */
|
||||||
up_device_list_remove (priv->power_devices, G_OBJECT(device));
|
up_device_list_remove (priv->power_devices, device);
|
||||||
|
|
||||||
/* emit */
|
/* emit */
|
||||||
object_path = up_device_get_object_path (device);
|
object_path = up_device_get_object_path (device);
|
||||||
|
|
|
||||||
|
|
@ -27,6 +27,7 @@
|
||||||
|
|
||||||
#include "up-native.h"
|
#include "up-native.h"
|
||||||
#include "up-device-list.h"
|
#include "up-device-list.h"
|
||||||
|
#include "up-device.h"
|
||||||
|
|
||||||
static void up_device_list_finalize (GObject *object);
|
static void up_device_list_finalize (GObject *object);
|
||||||
|
|
||||||
|
|
@ -71,14 +72,17 @@ up_device_list_lookup (UpDeviceList *list, GObject *native)
|
||||||
* into a list of devices.
|
* into a list of devices.
|
||||||
**/
|
**/
|
||||||
gboolean
|
gboolean
|
||||||
up_device_list_insert (UpDeviceList *list, GObject *native, GObject *device)
|
up_device_list_insert (UpDeviceList *list, gpointer device)
|
||||||
{
|
{
|
||||||
|
GObject *native;
|
||||||
const gchar *native_path;
|
const gchar *native_path;
|
||||||
|
|
||||||
g_return_val_if_fail (UP_IS_DEVICE_LIST (list), FALSE);
|
g_return_val_if_fail (UP_IS_DEVICE_LIST (list), FALSE);
|
||||||
g_return_val_if_fail (native != NULL, FALSE);
|
|
||||||
g_return_val_if_fail (device != NULL, FALSE);
|
g_return_val_if_fail (device != NULL, FALSE);
|
||||||
|
|
||||||
|
native = up_device_get_native (UP_DEVICE (device));
|
||||||
|
g_return_val_if_fail (native != NULL, FALSE);
|
||||||
|
|
||||||
native_path = up_native_get_native_path (native);
|
native_path = up_native_get_native_path (native);
|
||||||
if (native_path == NULL) {
|
if (native_path == NULL) {
|
||||||
g_warning ("failed to get native path");
|
g_warning ("failed to get native path");
|
||||||
|
|
@ -108,7 +112,7 @@ up_device_list_remove_cb (gpointer key, gpointer value, gpointer user_data)
|
||||||
* up_device_list_remove:
|
* up_device_list_remove:
|
||||||
**/
|
**/
|
||||||
gboolean
|
gboolean
|
||||||
up_device_list_remove (UpDeviceList *list, GObject *device)
|
up_device_list_remove (UpDeviceList *list, gpointer device)
|
||||||
{
|
{
|
||||||
g_return_val_if_fail (UP_IS_DEVICE_LIST (list), FALSE);
|
g_return_val_if_fail (UP_IS_DEVICE_LIST (list), FALSE);
|
||||||
g_return_val_if_fail (device != NULL, FALSE);
|
g_return_val_if_fail (device != NULL, FALSE);
|
||||||
|
|
|
||||||
|
|
@ -56,10 +56,9 @@ UpDeviceList *up_device_list_new (void);
|
||||||
GObject *up_device_list_lookup (UpDeviceList *list,
|
GObject *up_device_list_lookup (UpDeviceList *list,
|
||||||
GObject *native);
|
GObject *native);
|
||||||
gboolean up_device_list_insert (UpDeviceList *list,
|
gboolean up_device_list_insert (UpDeviceList *list,
|
||||||
GObject *native,
|
gpointer device);
|
||||||
GObject *device);
|
|
||||||
gboolean up_device_list_remove (UpDeviceList *list,
|
gboolean up_device_list_remove (UpDeviceList *list,
|
||||||
GObject *device);
|
gpointer device);
|
||||||
void up_device_list_clear (UpDeviceList *list,
|
void up_device_list_clear (UpDeviceList *list,
|
||||||
gboolean unref_it);
|
gboolean unref_it);
|
||||||
GPtrArray *up_device_list_get_array (UpDeviceList *list);
|
GPtrArray *up_device_list_get_array (UpDeviceList *list);
|
||||||
|
|
|
||||||
|
|
@ -88,7 +88,7 @@ up_test_device_list_func (void)
|
||||||
{
|
{
|
||||||
UpDeviceList *list;
|
UpDeviceList *list;
|
||||||
GObject *native;
|
GObject *native;
|
||||||
GObject *device;
|
UpDevice *device;
|
||||||
GObject *found;
|
GObject *found;
|
||||||
gboolean ret;
|
gboolean ret;
|
||||||
|
|
||||||
|
|
@ -97,8 +97,8 @@ up_test_device_list_func (void)
|
||||||
|
|
||||||
/* add device */
|
/* add device */
|
||||||
native = g_object_new (G_TYPE_OBJECT, NULL);
|
native = g_object_new (G_TYPE_OBJECT, NULL);
|
||||||
device = g_object_new (G_TYPE_OBJECT, NULL);
|
device = up_device_new (NULL, native);
|
||||||
ret = up_device_list_insert (list, native, device);
|
ret = up_device_list_insert (list, device);
|
||||||
g_assert (ret);
|
g_assert (ret);
|
||||||
|
|
||||||
/* find device */
|
/* find device */
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue