File gnome-power-manager-terminology.patch of Package gnome-power-manager
--- gnome-power-manager-2.14.0/data/gpm-prefs.glade
+++ gnome-power-manager-2.14.0/data/gpm-prefs.glade
@@ -914,63 +914,21 @@
<property name="spacing">6</property>
<child>
- <widget class="GtkTable" id="table8">
+ <widget class="GtkCheckButton" id="checkbutton_hibernate_idle">
<property name="visible">True</property>
- <property name="n_rows">1</property>
- <property name="n_columns">2</property>
- <property name="homogeneous">False</property>
- <property name="row_spacing">6</property>
- <property name="column_spacing">12</property>
-
- <child>
- <widget class="GtkLabel" id="label_sleep_type">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Sleep _type when inactive:</property>
- <property name="use_underline">True</property>
- <property name="use_markup">False</property>
- <property name="justify">GTK_JUSTIFY_LEFT</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0</property>
- <property name="yalign">0</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- <property name="mnemonic_widget">combobox_sleep_type</property>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">0</property>
- </widget>
- <packing>
- <property name="left_attach">0</property>
- <property name="right_attach">1</property>
- <property name="top_attach">0</property>
- <property name="bottom_attach">1</property>
- <property name="x_options">fill</property>
- <property name="y_options"></property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkComboBox" id="combobox_sleep_type">
- <property name="visible">True</property>
- <property name="items" translatable="yes"></property>
- <property name="add_tearoffs">False</property>
- <property name="focus_on_click">True</property>
- </widget>
- <packing>
- <property name="left_attach">1</property>
- <property name="right_attach">2</property>
- <property name="top_attach">0</property>
- <property name="bottom_attach">1</property>
- <property name="y_options">fill</property>
- </packing>
- </child>
+ <property name="can_focus">True</property>
+ <property name="label" translatable="yes">Hi_bernate instead of sleep when idle</property>
+ <property name="use_underline">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="focus_on_click">True</property>
+ <property name="active">False</property>
+ <property name="inconsistent">False</property>
+ <property name="draw_indicator">True</property>
</widget>
<packing>
<property name="padding">0</property>
- <property name="expand">True</property>
- <property name="fill">True</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
</packing>
</child>
--- gnome-power-manager-2.14.0/src/gpm-prefs.c
+++ gnome-power-manager-2.14.0/src/gpm-prefs.c
@@ -53,7 +53,7 @@
};
/* The text that should appear in the action combo boxes */
-#define ACTION_SUSPEND_TEXT _("Suspend")
+#define ACTION_SUSPEND_TEXT _("Sleep")
#define ACTION_SHUTDOWN_TEXT _("Shutdown")
#define ACTION_HIBERNATE_TEXT _("Hibernate")
#define ACTION_BLANK_TEXT _("Blank screen")
@@ -544,21 +544,66 @@
}
static void
+gpm_prefs_hibernate_idle_toggled (GtkWidget *widget, char *gpm_pref_key)
+{
+ char *action;
+ gboolean checked;
+ GConfClient *client;
+
+ checked = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget));
+ if(checked)
+ action = ACTION_HIBERNATE;
+ else
+ action = ACTION_SUSPEND;
+
+ client = gconf_client_get_default ();
+ gconf_client_set_string (client, gpm_pref_key, action, NULL);
+ g_object_unref (client);
+}
+
+
+
+static void
setup_sleep_type (GladeXML *xml)
{
- GtkWidget *label_sleep_type;
- GtkWidget *combo_sleep_type;
- GtkWidget *checkbutton_dim_idle;
- gboolean can_set_brightness;
- const char *sleep_type_actions[] = {ACTION_NOTHING, ACTION_SUSPEND, ACTION_HIBERNATE, NULL};
-
- /* Sleep Type Combo Box */
- label_sleep_type = glade_xml_get_widget (xml, "label_sleep_type");
- combo_sleep_type = glade_xml_get_widget (xml, "combobox_sleep_type");
-
- gpm_prefs_setup_action_combo (combo_sleep_type,
- GPM_PREF_SLEEP_TYPE,
- sleep_type_actions);
+ GtkWidget *checkbox_hibernate_idle;
+ GtkWidget *checkbutton_dim_idle;
+ gboolean can_set_brightness;
+ GConfClient *client;
+ char *value;
+ gboolean can_hibernate;
+ gboolean is_writable;
+
+ /* set up the hibernate checkbox */
+ checkbox_hibernate_idle = glade_xml_get_widget(xml,
+ "checkbutton_hibernate_idle");
+ can_hibernate = gpm_can_hibernate ();
+
+ client = gconf_client_get_default ();
+ value = gconf_client_get_string (client, GPM_PREF_SLEEP_TYPE, NULL);
+ is_writable = gconf_client_key_is_writable (client,
+ GPM_PREF_SLEEP_TYPE, NULL);
+ g_object_unref (client);
+
+ if(!is_writable || !can_hibernate)
+ {
+ gpm_debug ("Cannot hibernate or change, hiding hibernate button.");
+ gtk_widget_set_sensitive (checkbox_hibernate_idle, FALSE);
+ }
+
+ if(can_hibernate)
+ {
+ if(strcmp(value, ACTION_HIBERNATE) == 0) {
+ gtk_toggle_button_set_active (
+ GTK_TOGGLE_BUTTON (checkbox_hibernate_idle),
+ TRUE);
+ }
+
+ g_signal_connect (G_OBJECT (checkbox_hibernate_idle), "toggled",
+ G_CALLBACK (gpm_prefs_hibernate_idle_toggled),
+ GPM_PREF_SLEEP_TYPE);
+ }
+
/* set up the "do we dim screen on idle checkbox */
checkbutton_dim_idle = glade_xml_get_widget (xml, "checkbutton_dim_idle");
@@ -569,6 +614,7 @@
} else {
gtk_widget_hide_all (checkbutton_dim_idle);
}
+ g_free (value);
}
static void
--- gnome-power-manager-2.14.0/src/gpm-tray-icon.c
+++ gnome-power-manager-2.14.0/src/gpm-tray-icon.c
@@ -105,10 +105,10 @@
static GtkActionEntry gpm_tray_icon_action_entries [] =
{
- { "TraySuspend", GPM_STOCK_SUSPEND_TO_RAM, N_("_Suspend"),
- NULL, N_("Suspend the computer"), G_CALLBACK (gpm_tray_icon_suspend_cb) },
- { "TrayHibernate", GPM_STOCK_SUSPEND_TO_DISK, N_("Hi_bernate"),
- NULL, N_("Make the computer go to sleep"), G_CALLBACK (gpm_tray_icon_hibernate_cb) },
+ { "TraySuspend", GPM_STOCK_SUSPEND_TO_DISK, N_("_Sleep"),
+ NULL, N_("Suspends your session quickly, using minial power while the computer stands by."), G_CALLBACK (gpm_tray_icon_suspend_cb) },
+ { "TrayHibernate", GTK_STOCK_HARDDISK, N_("Hi_bernate"),
+ NULL, N_("Suspends your session, using no power until the computer is restarted."), G_CALLBACK (gpm_tray_icon_hibernate_cb) },
{ "TrayPreferences", GTK_STOCK_PREFERENCES, N_("_Preferences"),
NULL, NULL, G_CALLBACK (gpm_tray_icon_show_preferences_cb) },
{ "TrayInfo", GPM_STOCK_POWER_INFORMATION, N_("_Information"),