[gnome-power-manager] Move the power control panel to the gnome-control-center project
- From: Richard Hughes <rhughes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-power-manager] Move the power control panel to the gnome-control-center project
- Date: Thu, 18 Nov 2010 19:41:01 +0000 (UTC)
commit 593773f233d0350be4992eb519ebb026bf805f67
Author: Richard Hughes <richard hughsie com>
Date: Thu Nov 18 19:23:37 2010 +0000
Move the power control panel to the gnome-control-center project
data/org.gnome.power-manager.gschema.migrate | 7 -
data/org.gnome.power-manager.gschema.xml | 58 ---
po/POTFILES.in | 1 -
src/Makefile.am | 27 --
src/cc-power-panel.c | 579 --------------------------
src/cc-power-panel.h | 54 ---
src/gpm-common.h | 22 +-
src/gpm-manager.c | 45 ++-
8 files changed, 39 insertions(+), 754 deletions(-)
---
diff --git a/data/org.gnome.power-manager.gschema.migrate b/data/org.gnome.power-manager.gschema.migrate
index 2c82231..9a7c984 100644
--- a/data/org.gnome.power-manager.gschema.migrate
+++ b/data/org.gnome.power-manager.gschema.migrate
@@ -1,8 +1,5 @@
[org.gnome.power-manager]
-action-sleep-type-battery = /apps/gnome-power-manager/actions/sleep_type_battery
-action-critical-battery = /apps/gnome-power-manager/actions/critical_battery
event-when-closed-battery = /apps/gnome-power-manager/actions/event_when_closed_battery
-action-sleep-type-ac = /apps/gnome-power-manager/actions/sleep_type_ac
backlight-enable = /apps/gnome-power-manager/backlight/enable
backlight-battery-reduce = /apps/gnome-power-manager/backlight/battery_reduce
brightness-dim-battery = /apps/gnome-power-manager/backlight/brightness_dim_battery
@@ -12,8 +9,6 @@ brightness-ac" = /apps/gnome-power-manager/backlight/brightness_ac
button-suspend = /apps/gnome-power-manager/buttons/suspend
button-hibernate = /apps/gnome-power-manager/buttons/hibernate
button-power = /apps/gnome-power-manager/buttons/power
-button-lid-battery = /apps/gnome-power-manager/buttons/lid_battery
-button-lid-ac = /apps/gnome-power-manager/buttons/lid_ac
schema-version = /apps/gnome-power-manager/general/installed_schema
use-profile-time = /apps/gnome-power-manager/general/use_profile_time
use-time-for-policy = /apps/gnome-power-manager/general/use_time_for_policy
@@ -45,8 +40,6 @@ percentage-action = /apps/gnome-power-manager/thresholds/percentage_action
time-low = /apps/gnome-power-manager/thresholds/time_low
time-critical = /apps/gnome-power-manager/thresholds/time_critical
time-action = /apps/gnome-power-manager/thresholds/time_action
-sleep-computer-battery = /apps/gnome-power-manager/timeout/sleep_computer_battery
-sleep-computer-ac = /apps/gnome-power-manager/timeout/sleep_computer_ac
enable-sound = /apps/gnome-power-manager/ui/enable_sound
show-actions = /apps/gnome-power-manager/ui/show_actions
icon-policy = /apps/gnome-power-manager/ui/icon_policy
diff --git a/data/org.gnome.power-manager.gschema.xml b/data/org.gnome.power-manager.gschema.xml
index 139985b..1f2f20c 100644
--- a/data/org.gnome.power-manager.gschema.xml
+++ b/data/org.gnome.power-manager.gschema.xml
@@ -1,12 +1,4 @@
<schemalist>
- <enum id="org.gnome.power-manager.ActionType">
- <value nick="blank" value="0"/>
- <value nick="suspend" value="1"/>
- <value nick="shutdown" value="2"/>
- <value nick="hibernate" value="3"/>
- <value nick="interactive" value="4"/>
- <value nick="nothing" value="5"/>
- </enum>
<enum id="org.gnome.power-manager.IconPolicy">
<value nick="present" value="0"/>
<value nick="charge" value="1"/>
@@ -20,26 +12,11 @@
<value nick="off" value="3"/>
</enum>
<schema id="org.gnome.power-manager" path="/apps/gnome-power-manager/">
- <key name="action-sleep-type-battery" enum="org.gnome.power-manager.ActionType">
- <default>'hibernate'</default>
- <summary>Whether to hibernate, suspend or do nothing when inactive</summary>
- <description>The type of sleeping that should be performed when the computer is inactive.</description>
- </key>
- <key name="action-critical-battery" enum="org.gnome.power-manager.ActionType">
- <default>'hibernate'</default>
- <summary>Battery critical low action</summary>
- <description>The action to take when the battery is critically low.</description>
- </key>
<key name="event-when-closed-battery" type="b">
<default>true</default>
<summary>If the battery event should occur when the lid is shut and the power disconnected</summary>
<description>If the battery lid close event should occur (for example 'Suspend when lid closed on battery') when the lid is previously shut and the AC power disconnected at a later time.</description>
</key>
- <key name="action-sleep-type-ac" enum="org.gnome.power-manager.ActionType">
- <default>'suspend'</default>
- <summary>Whether to hibernate, suspend or do nothing when inactive</summary>
- <description>The type of sleeping that should be performed when the computer is inactive.</description>
- </key>
<key name="backlight-enable" type="b">
<default>true</default>
<summary>Allow backlight brightness adjustment</summary>
@@ -70,31 +47,6 @@
<summary>LCD brightness when on AC</summary>
<description>The brightness of the display when on AC power. Possible values are between 0.0 and 1.0.</description>
</key>
- <key name="button-suspend" enum="org.gnome.power-manager.ActionType">
- <default>'suspend'</default>
- <summary>Suspend button action</summary>
- <description>The action to take when the system suspend button is pressed.</description>
- </key>
- <key name="button-hibernate" enum="org.gnome.power-manager.ActionType">
- <default>'hibernate'</default>
- <summary>Hibernate button action</summary>
- <description>The action to take when the system hibernate button is pressed.</description>
- </key>
- <key name="button-power" enum="org.gnome.power-manager.ActionType">
- <default>'interactive'</default>
- <summary>Power button action</summary>
- <description>The action to take when the system power button is pressed.</description>
- </key>
- <key name="button-lid-battery" enum="org.gnome.power-manager.ActionType">
- <default>'suspend'</default>
- <summary>Laptop lid close action on battery</summary>
- <description>The action to take when the laptop lid is closed and the laptop is on battery power.</description>
- </key>
- <key name="button-lid-ac" enum="org.gnome.power-manager.ActionType">
- <default>'suspend'</default>
- <summary>Laptop lid close action when on AC</summary>
- <description>The action to take when the laptop lid is closed and the laptop is on AC power.</description>
- </key>
<key name="schema-version" type="i">
<default>3</default>
<summary>The default configuration version.</summary>
@@ -280,16 +232,6 @@
<summary>The time remaining when action is taken</summary>
<description>The time remaining in seconds of the battery when critical action is taken. Only valid when use-time-for-policy is true.</description>
</key>
- <key name="sleep-computer-battery" type="i">
- <default>0</default>
- <summary>Sleep timeout computer when on battery</summary>
- <description>The amount of time in seconds the computer on battery power needs to be inactive before it goes to sleep.</description>
- </key>
- <key name="sleep-computer-ac" type="i">
- <default>0</default>
- <summary>Sleep timeout computer when on AC</summary>
- <description>The amount of time in seconds the computer on AC power needs to be inactive before it goes to sleep.</description>
- </key>
<key name="enable-sound" type="b">
<default>true</default>
<summary>If sounds should be used</summary>
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 230f8c2..c283858 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -9,7 +9,6 @@ data/gnome-power-statistics.desktop.in.in
[type: gettext/glade]data/gpm-statistics.ui
[type: gettext/glade]data/gpm-prefs.ui
policy/org.gnome.power.policy.in2
-src/cc-power-panel.c
src/gpm-backlight.c
src/gpm-backlight-helper.c
src/gpm-button.c
diff --git a/src/Makefile.am b/src/Makefile.am
index 8069b1d..0a8ee9b 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -27,9 +27,6 @@ INCLUDES = \
-DG_LOG_DOMAIN=\"PowerManager\" \
-I$(top_srcdir)
-ccpanelsdir = $(PANELS_DIR)
-ccpanels_LTLIBRARIES = libpower.la
-
bin_PROGRAMS = \
gnome-power-manager \
gnome-power-statistics
@@ -89,30 +86,6 @@ gnome_power_statistics_LDADD = \
gnome_power_statistics_CFLAGS = \
$(WARNINGFLAGS)
-libpower_la_SOURCES = \
- egg-console-kit.h \
- egg-console-kit.c \
- gpm-debug.h \
- gpm-debug.c \
- gpm-brightness.h \
- gpm-brightness.c \
- gpm-common.h \
- gpm-common.c \
- cc-power-panel.c \
- cc-power-panel.h
-
-libpower_la_LIBADD = \
- $(GLIB_LIBS) \
- $(CONTROL_CENTER_LIBS) \
- $(X11_LIBS) \
- $(GNOME_LIBS) \
- $(GPM_EXTRA_LIBS) \
- $(UPOWER_LIBS) \
- -lm
-
-libpower_la_LDFLAGS = -avoid-version -module
-libpower_la_CFLAGS = $(WARNINGFLAGS)
-
gnome_power_manager_SOURCES = \
gpm-dpms.h \
gpm-dpms.c \
diff --git a/src/gpm-common.h b/src/gpm-common.h
index 8385da6..46e996e 100644
--- a/src/gpm-common.h
+++ b/src/gpm-common.h
@@ -47,9 +47,9 @@ G_BEGIN_DECLS
#define GSD_SETTINGS_SCHEMA "org.gnome.settings-daemon.plugins.power"
/* actions */
-#define GPM_SETTINGS_ACTION_CRITICAL_BATT "action-critical-battery"
-#define GPM_SETTINGS_ACTION_SLEEP_TYPE_AC "action-sleep-type-ac"
-#define GPM_SETTINGS_ACTION_SLEEP_TYPE_BATT "action-sleep-type-battery"
+#define GSD_SETTINGS_ACTION_CRITICAL_BATT "critical-battery-action"
+#define GSD_SETTINGS_ACTION_SLEEP_TYPE_AC "sleep-inactive-ac-type"
+#define GSD_SETTINGS_ACTION_SLEEP_TYPE_BATT "sleep-inactive-battery-type"
#define GPM_SETTINGS_SLEEP_WHEN_CLOSED "event-when-closed-battery"
/* backlight stuff */
@@ -65,11 +65,11 @@ G_BEGIN_DECLS
#define GPM_SETTINGS_BRIGHTNESS_DIM_BATT "brightness-dim-battery"
/* buttons */
-#define GPM_SETTINGS_BUTTON_LID_AC "button-lid-ac"
-#define GPM_SETTINGS_BUTTON_LID_BATT "button-lid-battery"
-#define GPM_SETTINGS_BUTTON_SUSPEND "button-suspend"
-#define GPM_SETTINGS_BUTTON_HIBERNATE "button-hibernate"
-#define GPM_SETTINGS_BUTTON_POWER "button-power"
+#define GSD_SETTINGS_BUTTON_LID_AC "lid-close-ac-action"
+#define GSD_SETTINGS_BUTTON_LID_BATT "lid-close-battery-action"
+#define GSD_SETTINGS_BUTTON_SUSPEND "button-suspend"
+#define GSD_SETTINGS_BUTTON_HIBERNATE "button-hibernate"
+#define GSD_SETTINGS_BUTTON_POWER "button-power"
/* general */
#define GPM_SETTINGS_SCHEMA_VERSION "schema-version"
@@ -111,8 +111,10 @@ G_BEGIN_DECLS
#define GPM_SETTINGS_TIME_ACTION "time-action"
/* timeout */
-#define GPM_SETTINGS_SLEEP_COMPUTER_AC "sleep-computer-ac"
-#define GPM_SETTINGS_SLEEP_COMPUTER_BATT "sleep-computer-battery"
+#define GSD_SETTINGS_SLEEP_COMPUTER_AC "sleep-inactive-ac-timeout"
+#define GSD_SETTINGS_SLEEP_COMPUTER_BATT "sleep-inactive-battery-timeout"
+#define GSD_SETTINGS_SLEEP_COMPUTER_AC_EN "sleep-inactive-ac"
+#define GSD_SETTINGS_SLEEP_COMPUTER_BATT_EN "sleep-inactive-battery"
#define GSD_SETTINGS_SLEEP_DISPLAY_AC "sleep-display-ac"
#define GSD_SETTINGS_SLEEP_DISPLAY_BATT "sleep-display-battery"
diff --git a/src/gpm-manager.c b/src/gpm-manager.c
index 117dcde..d4f4e37 100644
--- a/src/gpm-manager.c
+++ b/src/gpm-manager.c
@@ -371,10 +371,16 @@ gpm_manager_sync_policy_sleep (GpmManager *manager)
guint sleep_computer;
if (!manager->priv->on_battery) {
- sleep_computer = g_settings_get_int (manager->priv->settings, GPM_SETTINGS_SLEEP_COMPUTER_AC);
+ sleep_computer = g_settings_get_int (manager->priv->settings_gsd, GSD_SETTINGS_SLEEP_COMPUTER_AC);
+ /* hack around new gsettings key */
+ if (!g_settings_get_boolean (manager->priv->settings_gsd, GSD_SETTINGS_SLEEP_COMPUTER_AC_EN))
+ sleep_computer = 0;
sleep_display = g_settings_get_int (manager->priv->settings_gsd, GSD_SETTINGS_SLEEP_DISPLAY_AC);
} else {
- sleep_computer = g_settings_get_int (manager->priv->settings, GPM_SETTINGS_SLEEP_COMPUTER_BATT);
+ sleep_computer = g_settings_get_int (manager->priv->settings_gsd, GSD_SETTINGS_SLEEP_COMPUTER_BATT);
+ /* hack around new gsettings key */
+ if (!g_settings_get_boolean (manager->priv->settings_gsd, GSD_SETTINGS_SLEEP_COMPUTER_BATT_EN))
+ sleep_computer = 0;
sleep_display = g_settings_get_int (manager->priv->settings_gsd, GSD_SETTINGS_SLEEP_DISPLAY_BATT);
}
@@ -748,7 +754,7 @@ gpm_manager_perform_policy (GpmManager *manager, const gchar *policy_key, const
if (gpm_manager_is_inhibit_valid (manager, FALSE, "policy action") == FALSE)
return FALSE;
- policy = g_settings_get_enum (manager->priv->settings, policy_key);
+ policy = g_settings_get_enum (manager->priv->settings_gsd, policy_key);
g_debug ("action: %s set to %i (%s)", policy_key, policy, reason);
if (policy == GPM_ACTION_POLICY_NOTHING) {
g_debug ("doing nothing, reason: %s", reason);
@@ -790,9 +796,9 @@ gpm_manager_idle_do_sleep (GpmManager *manager)
GpmActionPolicy policy;
if (!manager->priv->on_battery)
- policy = g_settings_get_enum (manager->priv->settings, GPM_SETTINGS_ACTION_SLEEP_TYPE_AC);
+ policy = g_settings_get_enum (manager->priv->settings_gsd, GSD_SETTINGS_ACTION_SLEEP_TYPE_AC);
else
- policy = g_settings_get_enum (manager->priv->settings, GPM_SETTINGS_ACTION_SLEEP_TYPE_BATT);
+ policy = g_settings_get_enum (manager->priv->settings_gsd, GSD_SETTINGS_ACTION_SLEEP_TYPE_BATT);
if (policy == GPM_ACTION_POLICY_NOTHING) {
g_debug ("doing nothing as system idle action");
@@ -907,13 +913,13 @@ gpm_manager_lid_button_pressed (GpmManager *manager, gboolean pressed)
if (!manager->priv->on_battery) {
g_debug ("Performing AC policy");
- gpm_manager_perform_policy (manager, GPM_SETTINGS_BUTTON_LID_AC,
+ gpm_manager_perform_policy (manager, GSD_SETTINGS_BUTTON_LID_AC,
"Lid closed on AC power.");
return;
}
g_debug ("Performing battery policy");
- gpm_manager_perform_policy (manager, GPM_SETTINGS_BUTTON_LID_BATT,
+ gpm_manager_perform_policy (manager, GSD_SETTINGS_BUTTON_LID_BATT,
"Lid closed on battery power.");
}
@@ -996,13 +1002,13 @@ gpm_manager_button_pressed_cb (GpmButton *button, const gchar *type, GpmManager
}
if (g_strcmp0 (type, GPM_BUTTON_POWER) == 0) {
- gpm_manager_perform_policy (manager, GPM_SETTINGS_BUTTON_POWER, "The power button has been pressed.");
+ gpm_manager_perform_policy (manager, GSD_SETTINGS_BUTTON_POWER, "The power button has been pressed.");
} else if (g_strcmp0 (type, GPM_BUTTON_SLEEP) == 0) {
- gpm_manager_perform_policy (manager, GPM_SETTINGS_BUTTON_SUSPEND, "The suspend button has been pressed.");
+ gpm_manager_perform_policy (manager, GSD_SETTINGS_BUTTON_SUSPEND, "The suspend button has been pressed.");
} else if (g_strcmp0 (type, GPM_BUTTON_SUSPEND) == 0) {
- gpm_manager_perform_policy (manager, GPM_SETTINGS_BUTTON_SUSPEND, "The suspend button has been pressed.");
+ gpm_manager_perform_policy (manager, GSD_SETTINGS_BUTTON_SUSPEND, "The suspend button has been pressed.");
} else if (g_strcmp0 (type, GPM_BUTTON_HIBERNATE) == 0) {
- gpm_manager_perform_policy (manager, GPM_SETTINGS_BUTTON_HIBERNATE, "The hibernate button has been pressed.");
+ gpm_manager_perform_policy (manager, GSD_SETTINGS_BUTTON_HIBERNATE, "The hibernate button has been pressed.");
} else if (g_strcmp0 (type, GPM_BUTTON_LID_OPEN) == 0) {
gpm_manager_lid_button_pressed (manager, FALSE);
} else if (g_strcmp0 (type, GPM_BUTTON_LID_CLOSED) == 0) {
@@ -1122,7 +1128,7 @@ gpm_manager_client_changed_cb (UpClient *client, GpmManager *manager)
lid close on battery action if the ac adapter is removed when the laptop
is closed. Fixes #331655 */
if (event_when_closed && on_battery && lid_is_closed) {
- gpm_manager_perform_policy (manager, GPM_SETTINGS_BUTTON_LID_BATT,
+ gpm_manager_perform_policy (manager, GSD_SETTINGS_BUTTON_LID_BATT,
"The lid has been closed, and the ac adapter "
"removed (and GSettings is okay).");
}
@@ -1144,7 +1150,7 @@ manager_critical_action_do (GpmManager *manager)
if (manager->priv->critical_alert_timeout_id)
gpm_manager_play_loop_stop (manager);
- gpm_manager_perform_policy (manager, GPM_SETTINGS_ACTION_CRITICAL_BATT, "Battery is critically low.");
+ gpm_manager_perform_policy (manager, GSD_SETTINGS_ACTION_CRITICAL_BATT, "Battery is critically low.");
return FALSE;
}
@@ -1168,8 +1174,10 @@ gpm_manager_class_init (GpmManagerClass *klass)
static void
gpm_manager_settings_changed_cb (GSettings *settings, const gchar *key, GpmManager *manager)
{
- if (g_strcmp0 (key, GPM_SETTINGS_SLEEP_COMPUTER_BATT) == 0 ||
- g_strcmp0 (key, GPM_SETTINGS_SLEEP_COMPUTER_AC) == 0 ||
+ if (g_strcmp0 (key, GSD_SETTINGS_SLEEP_COMPUTER_BATT) == 0 ||
+ g_strcmp0 (key, GSD_SETTINGS_SLEEP_COMPUTER_AC) == 0 ||
+ g_strcmp0 (key, GSD_SETTINGS_SLEEP_COMPUTER_BATT_EN) == 0 ||
+ g_strcmp0 (key, GSD_SETTINGS_SLEEP_COMPUTER_AC_EN) == 0 ||
g_strcmp0 (key, GSD_SETTINGS_SLEEP_DISPLAY_BATT) == 0 ||
g_strcmp0 (key, GSD_SETTINGS_SLEEP_DISPLAY_AC) == 0)
gpm_manager_sync_policy_sleep (manager);
@@ -1703,7 +1711,7 @@ gpm_manager_engine_charge_critical_cb (GpmEngine *engine, UpDevice *device, GpmM
}
/* we have to do different warnings depending on the policy */
- policy = g_settings_get_enum (manager->priv->settings, GPM_SETTINGS_ACTION_CRITICAL_BATT);
+ policy = g_settings_get_enum (manager->priv->settings_gsd, GSD_SETTINGS_ACTION_CRITICAL_BATT);
/* use different text for different actions */
if (policy == GPM_ACTION_POLICY_NOTHING) {
@@ -1859,7 +1867,7 @@ gpm_manager_engine_charge_action_cb (GpmEngine *engine, UpDevice *device, GpmMan
title = _("Laptop battery critically low");
/* we have to do different warnings depending on the policy */
- policy = g_settings_get_enum (manager->priv->settings, GPM_SETTINGS_ACTION_CRITICAL_BATT);
+ policy = g_settings_get_enum (manager->priv->settings_gsd, GSD_SETTINGS_ACTION_CRITICAL_BATT);
/* use different text for different actions */
if (policy == GPM_ACTION_POLICY_NOTHING) {
@@ -1895,7 +1903,7 @@ gpm_manager_engine_charge_action_cb (GpmEngine *engine, UpDevice *device, GpmMan
title = _("UPS critically low");
/* we have to do different warnings depending on the policy */
- policy = g_settings_get_enum (manager->priv->settings, GPM_SETTINGS_ACTION_CRITICAL_BATT);
+ policy = g_settings_get_enum (manager->priv->settings_gsd, GSD_SETTINGS_ACTION_CRITICAL_BATT);
/* use different text for different actions */
if (policy == GPM_ACTION_POLICY_NOTHING) {
@@ -2014,6 +2022,7 @@ gpm_manager_device_to_variant_blob (UpDevice *device)
"state", &state,
"time-to-empty", &time_empty,
"time-to-full", &time_full,
+ /* need icon! */
NULL);
/* only return time for these simple states */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]