[gnome-control-center] power: Simplify update_automatic_suspend_label()
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-control-center] power: Simplify update_automatic_suspend_label()
- Date: Tue, 20 Sep 2016 08:34:10 +0000 (UTC)
commit cc4e1349e9e01b98d544d5808dd30266145204bb
Author: Bastien Nocera <hadess hadess net>
Date: Fri Sep 16 17:31:53 2016 +0200
power: Simplify update_automatic_suspend_label()
By replacing the magic 0 by its meaning ("never") as explained in the
gnome-settings-daemon GSettings schemas.
https://bugzilla.gnome.org/show_bug.cgi?id=771542
panels/power/cc-power-panel.c | 14 ++++++++------
1 files changed, 8 insertions(+), 6 deletions(-)
---
diff --git a/panels/power/cc-power-panel.c b/panels/power/cc-power-panel.c
index ce6b10f..e85ce2f 100644
--- a/panels/power/cc-power-panel.c
+++ b/panels/power/cc-power-panel.c
@@ -1934,6 +1934,8 @@ add_power_saving_section (CcPowerPanel *self)
gtk_widget_show_all (widget);
}
+#define NEVER 0
+
static void
update_automatic_suspend_label (CcPowerPanel *self)
{
@@ -1950,24 +1952,24 @@ update_automatic_suspend_label (CcPowerPanel *self)
battery_timeout = g_settings_get_int (priv->gsd_settings, "sleep-inactive-battery-timeout");
if (ac_action == GSD_POWER_ACTION_NOTHING)
- ac_timeout = 0;
+ ac_timeout = NEVER;
if (battery_action == GSD_POWER_ACTION_NOTHING)
- battery_timeout = 0;
+ battery_timeout = NEVER;
if (priv->has_batteries)
{
- if (ac_timeout == 0 && battery_timeout == 0)
+ if (ac_timeout == NEVER && battery_timeout == NEVER)
s = _("Off");
- else if (ac_timeout == 0 && battery_timeout != 0)
+ else if (ac_timeout == NEVER && battery_timeout > 0)
s = _("When on battery power");
- else if (ac_timeout != 0 && battery_timeout == 0)
+ else if (ac_timeout > 0 && battery_timeout == NEVER)
s = _("When plugged in");
else
s = _("On");
}
else
{
- if (ac_timeout == 0)
+ if (ac_timeout == NEVER)
s = _("Off");
else
s = _("On");
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]