X-Git-Url: https://git.llucax.com/software/sadba.git/blobdiff_plain/b2e9c12eccaf55ff2388e146ac723fad46e39387..HEAD:/src/lib-display-blanking-status-menu-widget.c?ds=inline diff --git a/src/lib-display-blanking-status-menu-widget.c b/src/lib-display-blanking-status-menu-widget.c index bb8ca6f..61844ca 100644 --- a/src/lib-display-blanking-status-menu-widget.c +++ b/src/lib-display-blanking-status-menu-widget.c @@ -79,6 +79,7 @@ GType display_blanking_status_plugin_get_type (void); #define HOURS_GCONF_KEY "/apps/Maemo/sadba/timed_inhibit_hours" #define MINUTES_GCONF_KEY "/apps/Maemo/sadba/timed_inhibit_minutes" +#define BANNER_DURATION 5000 // in milliseconds #define INHIBIT_MSG_INTERVAL 30 // in seconds #define GETTEXT_DOM "status-area-displayblanking-applet" @@ -178,12 +179,18 @@ disable_inhibition (DisplayBlankingStatusPluginPrivate *priv) HD_STATUS_PLUGIN_ITEM (priv->plugin), NULL); } -static gboolean -on_inhibit_timeout (DisplayBlankingStatusPluginPrivate *priv) +static void +inhibit_display_blanking (DisplayBlankingStatusPluginPrivate *priv) { dbus_bool_t ok = dbus_connection_send (priv->dbus_conn, priv->dbus_msg, NULL); g_assert (ok == TRUE); +} + +static gboolean +on_inhibit_timeout (DisplayBlankingStatusPluginPrivate *priv) +{ + inhibit_display_blanking (priv); return TRUE; } @@ -202,7 +209,7 @@ on_timed_inhibit_timeout (DisplayBlankingStatusPluginPrivate *priv) GtkWidget *banner = hildon_banner_show_information ( priv->timed_inhibit_button, NULL, _ ("Display blanking inhibition disabled")); - hildon_banner_set_timeout (HILDON_BANNER (banner), 5000); + hildon_banner_set_timeout (HILDON_BANNER (banner), BANNER_DURATION); return FALSE; } @@ -210,6 +217,8 @@ on_timed_inhibit_timeout (DisplayBlankingStatusPluginPrivate *priv) static void enable_inhibition (DisplayBlankingStatusPluginPrivate *priv) { + inhibit_display_blanking (priv); + g_assert (priv->inhibit_timer_id == 0); priv->inhibit_timer_id = g_timeout_add_seconds (INHIBIT_MSG_INTERVAL, (GSourceFunc) on_inhibit_timeout, priv); @@ -412,7 +421,7 @@ on_mode_dialog_button_clicked (GtkWidget *button, GtkDialog *dialog) { const gchar *title = hildon_button_get_title (HILDON_BUTTON (button)); - gint *mode = (gint *) g_object_get_data (G_OBJECT(dialog), "mode"); + gint *mode = (gint *) g_object_get_data (G_OBJECT (dialog), "mode"); g_assert (mode != NULL); for (*mode = 0; *mode < BLANKING_MODES; (*mode)++) { @@ -570,7 +579,7 @@ inhibit_button_new (const gchar *icon_name, GtkWidget *b = hildon_gtk_toggle_button_new (HILDON_SIZE_FINGER_HEIGHT | HILDON_SIZE_AUTO_WIDTH); - gtk_toggle_button_set_mode (GTK_TOGGLE_BUTTON(b), FALSE); + gtk_toggle_button_set_mode (GTK_TOGGLE_BUTTON (b), FALSE); GtkWidget *icon = gtk_image_new_from_icon_name (icon_name, GTK_ICON_SIZE_DIALOG); gtk_button_set_image (GTK_BUTTON (b), icon);