device/xi2: Blow the cached devices list

Every time we add or remove a device we should clear the cached list
that we return in get_devices(), so that it gets repopulated.
This commit is contained in:
Emmanuele Bassi 2011-01-18 13:01:27 +00:00
parent de93f721c1
commit 0075c45ca4

View File

@ -272,6 +272,10 @@ add_device (ClutterDeviceManagerXI2 *manager_xi2,
_clutter_input_device_add_slave (master, device); _clutter_input_device_add_slave (master, device);
} }
/* blow the cache */
g_slist_free (manager_xi2->all_devices);
manager_xi2->all_devices = NULL;
g_signal_emit_by_name (manager_xi2, "device-added", device); g_signal_emit_by_name (manager_xi2, "device-added", device);
} }
@ -294,6 +298,10 @@ remove_device (ClutterDeviceManagerXI2 *manager_xi2,
manager_xi2->slave_devices = manager_xi2->slave_devices =
g_list_remove (manager_xi2->slave_devices, device); g_list_remove (manager_xi2->slave_devices, device);
/* blow the cache */
g_slist_free (manager_xi2->all_devices);
manager_xi2->all_devices = NULL;
g_signal_emit_by_name (manager_xi2, "device-removed", device); g_signal_emit_by_name (manager_xi2, "device-removed", device);
g_object_run_dispose (G_OBJECT (device)); g_object_run_dispose (G_OBJECT (device));