/*
* Flashlight applet (widget) for Maemo.
- * Copyright (C) 2009 Roman Moravcik
+ * Copyright (C) 2009, 2010 Roman Moravcik
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
g_return_if_fail (priv);
banner = hildon_banner_show_information (GTK_WIDGET (priv->button), NULL, text);
- hildon_banner_set_timeout (HILDON_BANNER (banner), 9000);
+ hildon_banner_set_timeout (HILDON_BANNER (banner), 3000);
}
static void
if (flashlight_open (priv->flashlight, "/dev/video0") < 0) {
flashlight_status_plugin_show_notification (plugin,
_("Unable to initialize flashlight.\nCamera in use by another application."));
+ flashlight_close (priv->flashlight);
return;
}
if (flashlight_set_intensity (priv->flashlight, 1) < 0) {
flashlight_status_plugin_show_notification (plugin,
_("Unable to turn on flashlight."));
+ flashlight_close (priv->flashlight);
return;
}
{
GtkWidget *button;
+ g_return_val_if_fail (plugin, NULL);
+
button = hildon_button_new (HILDON_SIZE_FINGER_HEIGHT, HILDON_BUTTON_ARRANGEMENT_VERTICAL);
gtk_button_set_alignment (GTK_BUTTON (button), 0.0, 0.5);
hildon_button_set_title (HILDON_BUTTON (button), _("Flashlight"));
}
libhal_ctx_set_user_data (priv->hal, NULL);
libhal_ctx_free (priv->hal);
+ priv->hal = NULL;
+ return;
}
libhal_device_add_property_watch (priv->hal, CAM_COVER_UDI, NULL);
FlashlightPlugin *plugin = FLASHLIGHT_STATUS_PLUGIN (object);
FlashlightPluginPrivate *priv = FLASHLIGHT_STATUS_PLUGIN_GET_PRIVATE (plugin);
+ g_return_if_fail (priv);
+
/* deinitialize hal */
if (priv->hal) {
libhal_device_remove_property_watch (priv->hal, CAM_COVER_UDI, NULL);
libhal_ctx_set_user_data (priv->hal, NULL);
+ libhal_ctx_shutdown (priv->hal, NULL);
libhal_ctx_free (priv->hal);
}
+ priv->hal = NULL;
/* cancel status timer */
if (priv->status_timer) {