static void device_changed_cb (UrfDevice *device, UrfKillswitch *killswitch) { g_message("device_changed_cb: %s", urf_device_get_name(device)); urf_killswitch_state_refresh (killswitch); }
/** * urf_killswitch_del_device: **/ void urf_killswitch_del_device (UrfKillswitch *killswitch, UrfDevice *device) { UrfKillswitchPrivate *priv = killswitch->priv; if (urf_device_get_device_type (device) != priv->type || g_list_find (priv->devices, (gconstpointer)device) == NULL) return; priv->devices = g_list_remove (priv->devices, (gpointer)device); g_object_unref (device); urf_killswitch_state_refresh (killswitch); }
/** * urf_killswitch_add_device: **/ void urf_killswitch_add_device (UrfKillswitch *killswitch, UrfDevice *device) { UrfKillswitchPrivate *priv = killswitch->priv; if (urf_device_get_device_type (device) != priv->type || g_list_find (priv->devices, (gconstpointer)device) != NULL) return; priv->devices = g_list_prepend (priv->devices, (gpointer)g_object_ref (device)); g_signal_connect (G_OBJECT (device), "state-changed", G_CALLBACK (device_changed_cb), killswitch); urf_killswitch_state_refresh (killswitch); }
KillswitchState urf_killswitch_get_state (UrfKillswitch *killswitch) { urf_killswitch_state_refresh (killswitch); return killswitch->priv->state; }
static void device_changed_cb (UrfDevice *device, UrfKillswitch *killswitch) { urf_killswitch_state_refresh (killswitch); }