[gnome-settings-daemon] power: Stop the alert sound before taking action
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-settings-daemon] power: Stop the alert sound before taking action
- Date: Thu, 17 Oct 2013 15:44:04 +0000 (UTC)
commit b9218005c034f977c2964b2efc662035e216f784
Author: Bastien Nocera <hadess hadess net>
Date: Thu Oct 17 11:55:47 2013 +0200
power: Stop the alert sound before taking action
As it's UPower taking action, make sure that we stop the alert
sound before the action is taken. We might wake up to the sound
otherwise.
plugins/power/gsd-power-manager.c | 17 ++++++++---------
1 files changed, 8 insertions(+), 9 deletions(-)
---
diff --git a/plugins/power/gsd-power-manager.c b/plugins/power/gsd-power-manager.c
index d144659..6fa66fa 100644
--- a/plugins/power/gsd-power-manager.c
+++ b/plugins/power/gsd-power-manager.c
@@ -76,11 +76,10 @@
#define SYSTEMD_DBUS_PATH "/org/freedesktop/login1"
#define SYSTEMD_DBUS_INTERFACE "org.freedesktop.login1.Manager"
-/* Time between notifying the user about a critical action and executing it.
- * This can be changed with the GSD_ACTION_DELAY constant. */
-#ifndef GSD_ACTION_DELAY
+/* Time between notifying the user about a critical action and the action itself in UPower. */
#define GSD_ACTION_DELAY 20
-#endif /* !GSD_ACTION_DELAY */
+/* And the time before we stop the warning sound */
+#define GSD_STOP_SOUND_DELAY GSD_ACTION_DELAY - 2
static const gchar introspection_xml[] =
"<node>"
@@ -385,7 +384,7 @@ manager_critical_action_get (GsdPowerManager *manager)
}
static gboolean
-manager_critical_action_do_cb (GsdPowerManager *manager)
+manager_critical_action_stop_sound_cb (GsdPowerManager *manager)
{
/* stop playing the alert as it's too late to do anything now */
play_loop_stop (&manager->priv->critical_alert_timeout_id);
@@ -722,8 +721,8 @@ engine_charge_action (GsdPowerManager *manager, UpDevice *device)
}
/* wait 20 seconds for user-panic */
- timer_id = g_timeout_add_seconds (GSD_ACTION_DELAY,
- (GSourceFunc) manager_critical_action_do_cb,
+ timer_id = g_timeout_add_seconds (GSD_STOP_SOUND_DELAY,
+ (GSourceFunc) manager_critical_action_stop_sound_cb,
manager);
g_source_set_name_by_id (timer_id, "[GsdPowerManager] battery critical-action");
@@ -747,8 +746,8 @@ engine_charge_action (GsdPowerManager *manager, UpDevice *device)
}
/* wait 20 seconds for user-panic */
- timer_id = g_timeout_add_seconds (GSD_ACTION_DELAY,
- (GSourceFunc) manager_critical_action_do_cb,
+ timer_id = g_timeout_add_seconds (GSD_STOP_SOUND_DELAY,
+ (GSourceFunc) manager_critical_action_stop_sound_cb,
manager);
g_source_set_name_by_id (timer_id, "[GsdPowerManager] ups critical-action");
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]