2024-11-26 11:55:01 +00:00
|
|
|
From 47d7a4b03e576e696e97fc3e7e90812833ecb671 Mon Sep 17 00:00:00 2001
|
2024-08-12 08:28:45 +00:00
|
|
|
From: Felipe Borges <felipeborges@gnome.org>
|
|
|
|
Date: Tue, 10 Sep 2024 14:29:56 +0200
|
|
|
|
Subject: [PATCH] power: Read downstream sleep-inactive-ac-type-server gsetting
|
|
|
|
|
|
|
|
We have a downstream side-setting for when the hostnamed chassis
|
|
|
|
type is "server". This allows for having a different "default" in
|
|
|
|
each chassis-type.
|
|
|
|
---
|
2024-11-26 11:55:01 +00:00
|
|
|
panels/power/cc-power-panel.c | 12 +++++++++---
|
|
|
|
1 file changed, 9 insertions(+), 3 deletions(-)
|
2024-08-12 08:28:45 +00:00
|
|
|
|
|
|
|
diff --git a/panels/power/cc-power-panel.c b/panels/power/cc-power-panel.c
|
2024-11-26 11:55:01 +00:00
|
|
|
index a17e8490c..f7bf72be1 100644
|
2024-08-12 08:28:45 +00:00
|
|
|
--- a/panels/power/cc-power-panel.c
|
|
|
|
+++ b/panels/power/cc-power-panel.c
|
2024-11-26 11:55:01 +00:00
|
|
|
@@ -462,8 +462,11 @@ update_automatic_suspend_label (CcPowerPanel *self)
|
2024-08-12 08:28:45 +00:00
|
|
|
gint ac_timeout;
|
|
|
|
gint battery_timeout;
|
|
|
|
const gchar *s;
|
|
|
|
+ gboolean is_server = FALSE;
|
|
|
|
|
|
|
|
- ac_action = g_settings_get_enum (self->gsd_settings, "sleep-inactive-ac-type");
|
|
|
|
+ is_server = g_strcmp0 (self->chassis_type, "server") == 0;
|
|
|
|
+
|
|
|
|
+ ac_action = g_settings_get_enum (self->gsd_settings, is_server ? "sleep-inactive-ac-type-server" : "sleep-inactive-ac-type");
|
|
|
|
battery_action = g_settings_get_enum (self->gsd_settings, "sleep-inactive-battery-type");
|
|
|
|
ac_timeout = g_settings_get_int (self->gsd_settings, "sleep-inactive-ac-timeout");
|
|
|
|
battery_timeout = g_settings_get_int (self->gsd_settings, "sleep-inactive-battery-timeout");
|
2024-11-26 11:55:01 +00:00
|
|
|
@@ -621,6 +624,9 @@ setup_power_saving (CcPowerPanel *self)
|
|
|
|
{
|
2024-08-12 08:28:45 +00:00
|
|
|
g_autoptr(GDBusConnection) connection = NULL;
|
|
|
|
g_autoptr(GError) error = NULL;
|
|
|
|
+ gboolean is_server = FALSE;
|
|
|
|
+
|
|
|
|
+ is_server = g_strcmp0 (self->chassis_type, "server") == 0;
|
|
|
|
|
|
|
|
/* ambient light sensor */
|
|
|
|
self->iio_proxy_watch_id =
|
2024-11-26 11:55:01 +00:00
|
|
|
@@ -674,7 +680,7 @@ setup_power_saving (CcPowerPanel *self)
|
2024-08-12 08:28:45 +00:00
|
|
|
*/
|
|
|
|
if (g_settings_get_int (self->gsd_settings, "sleep-inactive-ac-timeout") == 0)
|
|
|
|
{
|
|
|
|
- g_settings_set_enum (self->gsd_settings, "sleep-inactive-ac-type", GSD_POWER_ACTION_NOTHING);
|
|
|
|
+ g_settings_set_enum (self->gsd_settings, is_server ? "sleep-inactive-ac-type-server" : "sleep-inactive-ac-type", GSD_POWER_ACTION_NOTHING);
|
|
|
|
g_settings_set_int (self->gsd_settings, "sleep-inactive-ac-timeout", 3600);
|
|
|
|
}
|
|
|
|
if (g_settings_get_int (self->gsd_settings, "sleep-inactive-battery-timeout") == 0)
|
2024-11-26 11:55:01 +00:00
|
|
|
@@ -696,7 +702,7 @@ setup_power_saving (CcPowerPanel *self)
|
2024-08-12 08:28:45 +00:00
|
|
|
G_SETTINGS_BIND_DEFAULT,
|
|
|
|
get_sleep_type, set_sleep_type, NULL, NULL);
|
|
|
|
|
|
|
|
- g_settings_bind_with_mapping (self->gsd_settings, "sleep-inactive-ac-type",
|
|
|
|
+ g_settings_bind_with_mapping (self->gsd_settings, is_server ? "sleep-inactive-ac-type-server" : "sleep-inactive-ac-type",
|
|
|
|
self->suspend_on_ac_switch_row, "active",
|
|
|
|
G_SETTINGS_BIND_DEFAULT,
|
|
|
|
get_sleep_type, set_sleep_type, NULL, NULL);
|
|
|
|
--
|
2024-11-26 11:55:01 +00:00
|
|
|
2.46.2
|
2024-08-12 08:28:45 +00:00
|
|
|
|