[gnome-power-manager] Remove all the UPS specific UI, and just use the battery critical action for the UPS critical state
- From: Richard Hughes <rhughes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-power-manager] Remove all the UPS specific UI, and just use the battery critical action for the UPS critical state
- Date: Thu, 18 Nov 2010 12:27:33 +0000 (UTC)
commit 2b5881bae375eeb15bc5eeb17393f4bcdafbb56b
Author: Richard Hughes <richard hughsie com>
Date: Thu Nov 18 12:25:00 2010 +0000
Remove all the UPS specific UI, and just use the battery critical action for the UPS critical state
data/gpm-prefs.ui | 133 --------------------------
data/org.gnome.power-manager.gschema.migrate | 4 -
data/org.gnome.power-manager.gschema.xml | 20 ----
src/cc-power-panel.c | 51 +----------
src/gpm-common.h | 4 -
src/gpm-manager.c | 2 +-
6 files changed, 3 insertions(+), 211 deletions(-)
---
diff --git a/data/gpm-prefs.ui b/data/gpm-prefs.ui
index 76c633c..f1ba5a7 100644
--- a/data/gpm-prefs.ui
+++ b/data/gpm-prefs.ui
@@ -233,132 +233,6 @@
</packing>
</child>
<child>
- <object class="GtkVBox" id="vbox_ups">
- <property name="visible">True</property>
- <property name="border_width">12</property>
- <property name="spacing">9</property>
- <child>
- <object class="GtkHBox" id="hbox_ups_computer">
- <property name="visible">True</property>
- <property name="spacing">12</property>
- <child>
- <object class="GtkLabel" id="label_ups_computer">
- <property name="visible">True</property>
- <property name="xalign">0</property>
- <property name="label" translatable="yes">Put computer to _sleep when inactive for:</property>
- <property name="use_underline">True</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkComboBoxText" id="combobox_ups_computer">
- <property name="entry-text-column">0</property>
- <property name="visible">True</property>
- </object>
- <packing>
- <property name="expand">True</property>
- <property name="fill">True</property>
- <property name="position">1</property>
- </packing>
- </child>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">1</property>
- </packing>
- </child>
- <child>
- <object class="GtkHBox" id="hbox18">
- <property name="visible">True</property>
- <property name="spacing">12</property>
- <child>
- <object class="GtkLabel" id="label_ups_low">
- <property name="visible">True</property>
- <property name="xalign">0</property>
- <property name="label" translatable="yes">When UPS power is l_ow:</property>
- <property name="use_underline">True</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkComboBoxText" id="combobox_ups_low">
- <property name="entry-text-column">0</property>
- <property name="visible">True</property>
- </object>
- <packing>
- <property name="expand">True</property>
- <property name="fill">True</property>
- <property name="position">1</property>
- </packing>
- </child>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">2</property>
- </packing>
- </child>
- <child>
- <object class="GtkHBox" id="hbox19">
- <property name="visible">True</property>
- <property name="spacing">12</property>
- <child>
- <object class="GtkLabel" id="label_ups_critical">
- <property name="visible">True</property>
- <property name="xalign">0</property>
- <property name="label" translatable="yes">When UPS power is _critically low:</property>
- <property name="use_underline">True</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkComboBoxText" id="combobox_ups_critical">
- <property name="entry-text-column">0</property>
- <property name="visible">True</property>
- </object>
- <packing>
- <property name="expand">True</property>
- <property name="fill">True</property>
- <property name="position">1</property>
- </packing>
- </child>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">3</property>
- </packing>
- </child>
- </object>
- <packing>
- <property name="position">2</property>
- <property name="tab_fill">False</property>
- </packing>
- </child>
- <child type="tab">
- <object class="GtkLabel" id="label_tab_ups">
- <property name="visible">True</property>
- <property name="label" translatable="yes">On UPS Power</property>
- </object>
- <packing>
- <property name="position">2</property>
- <property name="tab_fill">False</property>
- </packing>
- </child>
- <child>
<object class="GtkVBox" id="vbox_general">
<property name="visible">True</property>
<property name="border_width">12</property>
@@ -495,23 +369,16 @@
</object>
</child>
<action-widgets>
- <action-widget response="0">button_help</action-widget>
<action-widget response="0">button_defaults</action-widget>
</action-widgets>
</object>
<object class="GtkSizeGroup" id="sizegroup_labels">
<widgets>
- <widget name="label_ups_critical"/>
- <widget name="label_ups_low"/>
- <widget name="label_ups_computer"/>
- <widget name="label_ups_display"/>
<widget name="label121"/>
<widget name="label_battery_lid"/>
<widget name="label_battery_computer"/>
- <widget name="label_battery_display"/>
<widget name="label_ac_lid"/>
<widget name="label_ac_computer"/>
- <widget name="label_ac_display"/>
<widget name="label_general_power"/>
<widget name="label_general_suspend"/>
</widgets>
diff --git a/data/org.gnome.power-manager.gschema.migrate b/data/org.gnome.power-manager.gschema.migrate
index a981227..2c82231 100644
--- a/data/org.gnome.power-manager.gschema.migrate
+++ b/data/org.gnome.power-manager.gschema.migrate
@@ -3,8 +3,6 @@ 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
-action-critical-ups = /apps/gnome-power-manager/actions/critical_ups
-action-low-ups = /apps/gnome-power-manager/actions/low_ups
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
@@ -49,8 +47,6 @@ 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
-sleep-computer-ups = /apps/gnome-power-manager/timeout/sleep_computer_ups
-sleep-display-ups = /apps/gnome-power-manager/timeout/sleep_display_ups
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 b2dca23..139985b 100644
--- a/data/org.gnome.power-manager.gschema.xml
+++ b/data/org.gnome.power-manager.gschema.xml
@@ -40,16 +40,6 @@
<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-ups" enum="org.gnome.power-manager.ActionType">
- <default>'shutdown'</default>
- <summary>UPS critical low action</summary>
- <description>The action to take when the UPS is critically low.</description>
- </key>
- <key name="action-low-ups" enum="org.gnome.power-manager.ActionType">
- <default>'hibernate'</default>
- <summary>UPS low power action</summary>
- <description>The action to take when the UPS is low.</description>
- </key>
<key name="backlight-enable" type="b">
<default>true</default>
<summary>Allow backlight brightness adjustment</summary>
@@ -300,16 +290,6 @@
<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="sleep-computer-ups" type="i">
- <default>0</default>
- <summary>Sleep timeout computer when on UPS</summary>
- <description>The amount of time in seconds the computer on UPS power needs to be inactive before it goes to sleep.</description>
- </key>
- <key name="sleep-display-ups" type="i">
- <default>600</default>
- <summary>Sleep timeout display when on UPS</summary>
- <description>The amount of time in seconds the computer on UPS power needs to be inactive before the display goes to sleep.</description>
- </key>
<key name="enable-sound" type="b">
<default>true</default>
<summary>If sounds should be used</summary>
diff --git a/src/cc-power-panel.c b/src/cc-power-panel.c
index b0848d2..71c2076 100644
--- a/src/cc-power-panel.c
+++ b/src/cc-power-panel.c
@@ -39,7 +39,6 @@ struct _CcPowerPanelPrivate {
GtkBuilder *builder;
gboolean has_batteries;
gboolean has_lcd;
- gboolean has_ups;
gboolean has_button_lid;
gboolean has_button_suspend;
gboolean can_shutdown;
@@ -365,50 +364,6 @@ cc_power_panel_setup_battery (CcPowerPanel *panel)
}
/**
- * cc_power_panel_setup_ups:
- **/
-static void
-cc_power_panel_setup_ups (CcPowerPanel *panel)
-{
- GtkWidget *widget;
- GtkNotebook *notebook;
- gint page;
-
- const GpmActionPolicy ups_low_actions[] =
- {GPM_ACTION_POLICY_NOTHING,
- GPM_ACTION_POLICY_HIBERNATE,
- GPM_ACTION_POLICY_SHUTDOWN,
- -1};
-
- static const gint computer_times[] =
- {10*60,
- 30*60,
- 1*60*60,
- 2*60*60,
- 0, /* never */
- -1};
-
- cc_power_panel_setup_time_combo (panel, "combobox_ups_computer",
- GPM_SETTINGS_SLEEP_COMPUTER_UPS,
- computer_times);
-
- if (panel->priv->has_ups == FALSE) {
- notebook = GTK_NOTEBOOK (gtk_builder_get_object (panel->priv->builder, "notebook_preferences"));
- widget = GTK_WIDGET (gtk_builder_get_object (panel->priv->builder, "vbox_ups"));
- page = gtk_notebook_page_num (notebook, GTK_WIDGET (widget));
- gtk_notebook_remove_page (notebook, page);
- return;
- }
-
- cc_power_panel_setup_action_combo (panel, "combobox_ups_low",
- GPM_SETTINGS_ACTION_LOW_UPS,
- ups_low_actions);
- cc_power_panel_setup_action_combo (panel, "combobox_ups_critical",
- GPM_SETTINGS_ACTION_CRITICAL_UPS,
- ups_low_actions);
-}
-
-/**
* cc_power_panel_setup_general:
**/
static void
@@ -563,10 +518,9 @@ cc_power_panel_init (CcPowerPanel *panel)
g_object_get (device,
"kind", &kind,
NULL);
- if (kind == UP_DEVICE_KIND_BATTERY)
+ if (kind == UP_DEVICE_KIND_BATTERY ||
+ kind == UP_DEVICE_KIND_UPS)
panel->priv->has_batteries = TRUE;
- if (kind == UP_DEVICE_KIND_UPS)
- panel->priv->has_ups = TRUE;
}
g_ptr_array_unref (devices);
@@ -588,7 +542,6 @@ cc_power_panel_init (CcPowerPanel *panel)
cc_power_panel_setup_ac (panel);
cc_power_panel_setup_battery (panel);
- cc_power_panel_setup_ups (panel);
cc_power_panel_setup_general (panel);
out:
diff --git a/src/gpm-common.h b/src/gpm-common.h
index 08b9cd7..8385da6 100644
--- a/src/gpm-common.h
+++ b/src/gpm-common.h
@@ -47,9 +47,7 @@ G_BEGIN_DECLS
#define GSD_SETTINGS_SCHEMA "org.gnome.settings-daemon.plugins.power"
/* actions */
-#define GPM_SETTINGS_ACTION_CRITICAL_UPS "action-critical-ups"
#define GPM_SETTINGS_ACTION_CRITICAL_BATT "action-critical-battery"
-#define GPM_SETTINGS_ACTION_LOW_UPS "action-low-ups"
#define GPM_SETTINGS_ACTION_SLEEP_TYPE_AC "action-sleep-type-ac"
#define GPM_SETTINGS_ACTION_SLEEP_TYPE_BATT "action-sleep-type-battery"
#define GPM_SETTINGS_SLEEP_WHEN_CLOSED "event-when-closed-battery"
@@ -115,10 +113,8 @@ G_BEGIN_DECLS
/* timeout */
#define GPM_SETTINGS_SLEEP_COMPUTER_AC "sleep-computer-ac"
#define GPM_SETTINGS_SLEEP_COMPUTER_BATT "sleep-computer-battery"
-#define GPM_SETTINGS_SLEEP_COMPUTER_UPS "sleep-computer-ups"
#define GSD_SETTINGS_SLEEP_DISPLAY_AC "sleep-display-ac"
#define GSD_SETTINGS_SLEEP_DISPLAY_BATT "sleep-display-battery"
-#define GPM_SETTINGS_SLEEP_DISPLAY_UPS "sleep-display-ups"
/* ui */
#define GPM_SETTINGS_ICON_POLICY "icon-policy"
diff --git a/src/gpm-manager.c b/src/gpm-manager.c
index 1af548a..117dcde 100644
--- a/src/gpm-manager.c
+++ b/src/gpm-manager.c
@@ -1895,7 +1895,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_UPS);
+ policy = g_settings_get_enum (manager->priv->settings, GPM_SETTINGS_ACTION_CRITICAL_BATT);
/* use different text for different actions */
if (policy == GPM_ACTION_POLICY_NOTHING) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]