+static gboolean
+flashlight_status_plugin_status (gpointer data)
+{
+ FlashlightPlugin *plugin = data;
+ FlashlightPluginPrivate *priv = FLASHLIGHT_STATUS_PLUGIN_GET_PRIVATE (plugin);
+ int status = 0;
+
+ if (flashlight_get_status (priv->flashlight, &status) < 0) {
+ flashlight_status_plugin_show_notification (plugin,
+ _("Unable to read status from driver."));
+ return FALSE;
+ }
+
+ /* ops, something is wrong */
+ if (status) {
+ /* turn off flashlight */
+ flashlight_status_plugin_enable (plugin, FALSE);
+
+ if (status & FLASHLIGHT_STATUS_SHORT_CIRCUT_FAULT) {
+ flashlight_status_plugin_show_notification (plugin,
+ _("Short-circut fault detected!\nTurning off flashlight."));
+ } else if (status & FLASHLIGHT_STATUS_OVERTEMPERATURE_FAULT) {
+ flashlight_status_plugin_show_notification (plugin,
+ _("Overtemperature fault detected!\nTurning off flashlight."));
+ } else if (status & FLASHLIGHT_STATUS_TIMEOUT_FAULT) {
+ flashlight_status_plugin_show_notification (plugin,
+ _("Timeout fault detected!\nTurning off flashlight."));
+ } else if (status & FLASHLIGHT_STATUS_OVERVOLTAGE_FAULT) {
+ flashlight_status_plugin_show_notification (plugin,
+ _("Overvoltage fault detected!\nTurning off flashlight."));
+ }
+ }
+
+ return TRUE;
+}
+