void
ide_device_provider_emit_device_removed (IdeDeviceProvider *provider,
                                         IdeDevice         *device)
{
  g_return_if_fail (IDE_IS_DEVICE_PROVIDER (provider));
  g_return_if_fail (IDE_IS_DEVICE (device));

  g_signal_emit (provider, signals [DEVICE_REMOVED], 0, device);
}
static void
ide_device_provider_real_device_added (IdeDeviceProvider *self,
                                       IdeDevice         *device)
{
  IdeDeviceProviderPrivate *priv = ide_device_provider_get_instance_private (self);

  g_assert (IDE_IS_DEVICE_PROVIDER (self));
  g_assert (IDE_IS_DEVICE (device));

  if (priv->devices == NULL)
    priv->devices = g_ptr_array_new_with_free_func (g_object_unref);
  g_ptr_array_add (priv->devices, g_object_ref (device));
}
void
ide_configuration_set_device (IdeConfiguration *self,
                              IdeDevice        *device)
{
  const gchar *device_id = "local";

  g_return_if_fail (IDE_IS_CONFIGURATION (self));
  g_return_if_fail (!device || IDE_IS_DEVICE (device));

  if (device != NULL)
    device_id = ide_device_get_id (device);

  ide_configuration_set_device_id (self, device_id);
}
static void
ide_device_provider_real_device_removed (IdeDeviceProvider *self,
                                         IdeDevice         *device)
{
  IdeDeviceProviderPrivate *priv = ide_device_provider_get_instance_private (self);

  g_assert (IDE_IS_DEVICE_PROVIDER (self));
  g_assert (IDE_IS_DEVICE (device));

  /* Maybe we just disposed */
  if (priv->devices == NULL)
    return;

  if (!g_ptr_array_remove (priv->devices, device))
    g_warning ("No such device \"%s\" found in \"%s\"",
               G_OBJECT_TYPE_NAME (device),
               G_OBJECT_TYPE_NAME (self));
}