[gnome-control-center/gnome-3-2] power: Update the UI to reflect the new mockup
- From: Richard Hughes <rhughes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-control-center/gnome-3-2] power: Update the UI to reflect the new mockup
- Date: Mon, 5 Sep 2011 11:14:41 +0000 (UTC)
commit 477bfa6bd78d943372bfe1648a8f50eeaca81531
Author: Richard Hughes <richard hughsie com>
Date: Fri Sep 2 16:35:08 2011 +0100
power: Update the UI to reflect the new mockup
panels/power/cc-power-panel.c | 78 ++--------
panels/power/power.ui | 354 ++++++++++++++++-------------------------
2 files changed, 150 insertions(+), 282 deletions(-)
---
diff --git a/panels/power/cc-power-panel.c b/panels/power/cc-power-panel.c
index e7d3efb..c069187 100644
--- a/panels/power/cc-power-panel.c
+++ b/panels/power/cc-power-panel.c
@@ -388,6 +388,7 @@ combo_time_changed_cb (GtkWidget *widget, CcPowerPanel *self)
gint value;
gboolean ret;
const gchar *key = (const gchar *)g_object_get_data (G_OBJECT(widget), "_gsettings_key");
+ gchar *key_timeout;
/* no selection */
ret = gtk_combo_box_get_active_iter (GTK_COMBO_BOX(widget), &iter);
@@ -400,8 +401,11 @@ combo_time_changed_cb (GtkWidget *widget, CcPowerPanel *self)
1, &value,
-1);
- /* set both battery and ac keys */
- g_settings_set_int (self->priv->gsd_settings, key, value);
+ /* set both keys */
+ key_timeout = g_strdup_printf ("%s-timeout", key);
+ g_settings_set_int (self->priv->gsd_settings, key_timeout, value);
+ g_settings_set_boolean (self->priv->gsd_settings, key, value != 0);
+ g_free (key_timeout);
}
static void
@@ -542,14 +546,11 @@ set_ac_battery_ui_mode (CcPowerPanel *self)
g_ptr_array_unref (devices);
out:
widget = GTK_WIDGET (gtk_builder_get_object (priv->builder,
- "vbox_actions"));
+ "box_header"));
gtk_widget_set_visible (widget, has_batteries);
widget = GTK_WIDGET (gtk_builder_get_object (priv->builder,
- "vbox_battery"));
+ "combobox_sleep_battery"));
gtk_widget_set_visible (widget, has_batteries);
- widget = GTK_WIDGET (gtk_builder_get_object (priv->builder,
- "hbox_ac"));
- gtk_widget_set_visible (widget, !has_batteries);
}
static void
@@ -557,7 +558,6 @@ cc_power_panel_init (CcPowerPanel *self)
{
GError *error;
GtkWidget *widget;
- GtkWidget *target;
gint value;
self->priv = POWER_PANEL_PRIVATE (self);
@@ -600,70 +600,12 @@ cc_power_panel_init (CcPowerPanel *self)
G_CALLBACK (on_lock_settings_changed),
self);
- /* setup the checkboxes correcty */
- widget = GTK_WIDGET (gtk_builder_get_object (self->priv->builder,
- "checkbutton_sleep_ac"));
- target = GTK_WIDGET (gtk_builder_get_object (self->priv->builder,
- "combobox_sleep_ac"));
- g_object_bind_property (widget, "active",
- target, "sensitive",
- G_BINDING_SYNC_CREATE);
- gtk_widget_set_sensitive (widget,
- up_client_get_can_suspend (self->priv->up_client));
-
- widget = GTK_WIDGET (gtk_builder_get_object (self->priv->builder,
- "checkbutton_sleep_battery"));
- target = GTK_WIDGET (gtk_builder_get_object (self->priv->builder,
- "combobox_sleep_battery"));
- g_object_bind_property (widget, "active",
- target, "sensitive",
- G_BINDING_SYNC_CREATE);
- gtk_widget_set_sensitive (widget,
- up_client_get_can_suspend (self->priv->up_client));
-
- widget = GTK_WIDGET (gtk_builder_get_object (self->priv->builder,
- "checkbutton_sleep"));
- target = GTK_WIDGET (gtk_builder_get_object (self->priv->builder,
- "combobox_sleep"));
- g_object_bind_property (widget, "active",
- target, "sensitive",
- G_BINDING_SYNC_CREATE);
- gtk_widget_set_sensitive (widget,
- up_client_get_can_suspend (self->priv->up_client));
-
- /* bind the checkboxes */
- widget = GTK_WIDGET (gtk_builder_get_object (self->priv->builder,
- "checkbutton_sleep_ac"));
- g_settings_bind (self->priv->gsd_settings,
- "sleep-inactive-ac",
- widget, "active",
- G_SETTINGS_BIND_DEFAULT);
- widget = GTK_WIDGET (gtk_builder_get_object (self->priv->builder,
- "checkbutton_sleep_battery"));
- g_settings_bind (self->priv->gsd_settings,
- "sleep-inactive-battery",
- widget, "active",
- G_SETTINGS_BIND_DEFAULT);
- widget = GTK_WIDGET (gtk_builder_get_object (self->priv->builder,
- "checkbutton_sleep"));
- g_settings_bind (self->priv->gsd_settings,
- "sleep-inactive-ac",
- widget, "active",
- G_SETTINGS_BIND_DEFAULT);
-
/* auto-sleep time */
value = g_settings_get_int (self->priv->gsd_settings, "sleep-inactive-ac-timeout");
widget = GTK_WIDGET (gtk_builder_get_object (self->priv->builder,
"combobox_sleep_ac"));
set_value_for_combo (GTK_COMBO_BOX (widget), value);
- g_object_set_data (G_OBJECT(widget), "_gsettings_key", "sleep-inactive-ac-timeout");
- g_signal_connect (widget, "changed",
- G_CALLBACK (combo_time_changed_cb),
- self);
- widget = GTK_WIDGET (gtk_builder_get_object (self->priv->builder,
- "combobox_sleep"));
- set_value_for_combo (GTK_COMBO_BOX (widget), value);
- g_object_set_data (G_OBJECT(widget), "_gsettings_key", "sleep-inactive-ac-timeout");
+ g_object_set_data (G_OBJECT(widget), "_gsettings_key", "sleep-inactive-ac");
g_signal_connect (widget, "changed",
G_CALLBACK (combo_time_changed_cb),
self);
@@ -671,7 +613,7 @@ cc_power_panel_init (CcPowerPanel *self)
widget = GTK_WIDGET (gtk_builder_get_object (self->priv->builder,
"combobox_sleep_battery"));
set_value_for_combo (GTK_COMBO_BOX (widget), value);
- g_object_set_data (G_OBJECT(widget), "_gsettings_key", "sleep-inactive-battery-timeout");
+ g_object_set_data (G_OBJECT(widget), "_gsettings_key", "sleep-inactive-battery");
g_signal_connect (widget, "changed",
G_CALLBACK (combo_time_changed_cb),
self);
diff --git a/panels/power/power.ui b/panels/power/power.ui
index 6b505ba..3d71281 100644
--- a/panels/power/power.ui
+++ b/panels/power/power.ui
@@ -1,8 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<requires lib="gtk+" version="2.20"/>
- <!-- interface-naming-policy project-wide -->
- <object class="GtkListStore" id="liststore_sleep">
+ <object class="GtkListStore" id="liststore_critical">
<columns>
<!-- column-name name -->
<column type="gchararray"/>
@@ -13,13 +12,13 @@
</columns>
<data>
<row>
- <col id="0" translatable="yes">Suspend</col>
- <col id="1">1</col>
+ <col id="0" translatable="yes">Hibernate</col>
+ <col id="1">3</col>
<col id="2">True</col>
</row>
<row>
- <col id="0" translatable="yes">Hibernate</col>
- <col id="1">3</col>
+ <col id="0" translatable="yes">Shutdown</col>
+ <col id="1">2</col>
<col id="2">True</col>
</row>
</data>
@@ -61,7 +60,7 @@
</row>
</data>
</object>
- <object class="GtkListStore" id="liststore_critical">
+ <object class="GtkListStore" id="liststore_sleep">
<columns>
<!-- column-name name -->
<column type="gchararray"/>
@@ -72,243 +71,172 @@
</columns>
<data>
<row>
- <col id="0" translatable="yes">Hibernate</col>
- <col id="1">3</col>
+ <col id="0" translatable="yes">Suspend</col>
+ <col id="1">1</col>
<col id="2">True</col>
</row>
<row>
- <col id="0" translatable="yes">Shutdown</col>
- <col id="1">2</col>
+ <col id="0" translatable="yes">Hibernate</col>
+ <col id="1">3</col>
<col id="2">True</col>
</row>
</data>
</object>
- <object class="GtkSizeGroup" id="sizegroup_combos">
- <widgets>
- <widget name="combobox_critical"/>
- <widget name="combobox_sleep"/>
- <widget name="combobox_sleep_battery"/>
- <widget name="combobox_sleep_ac"/>
- </widgets>
+ <object class="GtkListStore" id="liststore_time">
+ <columns>
+ <!-- column-name name -->
+ <column type="gchararray"/>
+ <!-- column-name value -->
+ <column type="gint"/>
+ </columns>
+ <data>
+ <row>
+ <col id="0" translatable="yes">5 minutes</col>
+ <col id="1">300</col>
+ </row>
+ <row>
+ <col id="0" translatable="yes">10 minutes</col>
+ <col id="1">600</col>
+ </row>
+ <row>
+ <col id="0" translatable="yes">30 minutes</col>
+ <col id="1">1800</col>
+ </row>
+ <row>
+ <col id="0" translatable="yes">1 hour</col>
+ <col id="1">3600</col>
+ </row>
+ <row>
+ <col id="0" translatable="yes">Don't suspend</col>
+ <col id="1">0</col>
+ </row>
+ </data>
</object>
<object class="GtkWindow" id="window_power">
+ <property name="can_focus">False</property>
<property name="resizable">False</property>
<child>
<object class="GtkVBox" id="vbox_power">
<property name="visible">True</property>
+ <property name="can_focus">False</property>
<property name="border_width">12</property>
<property name="spacing">12</property>
<child>
- <object class="GtkVBox" id="vbox_ac_batt">
+ <object class="GtkBox" id="box1">
<property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="orientation">vertical</property>
+ <property name="spacing">9</property>
<child>
- <object class="GtkVBox" id="vbox_battery">
+ <object class="GtkBox" id="box_header">
<property name="visible">True</property>
- <property name="spacing">6</property>
+ <property name="can_focus">False</property>
+ <property name="spacing">9</property>
<child>
- <object class="GtkHBox" id="hbox11">
+ <object class="GtkLabel" id="label_header_padding">
<property name="visible">True</property>
- <child>
- <object class="GtkLabel" id="label6">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label" translatable="yes">Put the computer to sleep when inactive:</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">0</property>
- </packing>
- </child>
+ <property name="can_focus">False</property>
</object>
<packing>
<property name="expand">False</property>
- <property name="fill">False</property>
+ <property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
- <object class="GtkVBox" id="vbox30">
+ <object class="GtkLabel" id="label_header_battery">
<property name="visible">True</property>
- <property name="spacing">6</property>
- <child>
- <object class="GtkHBox" id="hbox12">
- <property name="visible">True</property>
- <property name="spacing">6</property>
- <child>
- <object class="GtkHBox" id="hbox14">
- <property name="visible">True</property>
- <child>
- <object class="GtkCheckButton" id="checkbutton_sleep_ac">
- <property name="label" translatable="yes">On AC _power:</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="use_action_appearance">False</property>
- <property name="use_underline">True</property>
- <property name="draw_indicator">True</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="padding">12</property>
- <property name="position">0</property>
- </packing>
- </child>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkComboBoxText" id="combobox_sleep_ac">
- <property name="visible">True</property>
- <property name="model">liststore_time</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">1</property>
- </packing>
- </child>
- </object>
- <packing>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkHBox" id="hbox13">
- <property name="visible">True</property>
- <property name="spacing">6</property>
- <child>
- <object class="GtkHBox" id="hbox15">
- <property name="visible">True</property>
- <child>
- <object class="GtkCheckButton" id="checkbutton_sleep_battery">
- <property name="label" translatable="yes">On _battery power:</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="use_action_appearance">False</property>
- <property name="use_underline">True</property>
- <property name="draw_indicator">True</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="padding">12</property>
- <property name="position">0</property>
- </packing>
- </child>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkComboBoxText" id="combobox_sleep_battery">
- <property name="visible">True</property>
- <property name="model">liststore_time</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">1</property>
- </packing>
- </child>
- </object>
- <packing>
- <property name="position">1</property>
- </packing>
- </child>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">On battery power</property>
</object>
<packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
+ <child>
+ <object class="GtkLabel" id="label_header_ac">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">When plugged in</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
</object>
<packing>
<property name="expand">False</property>
- <property name="fill">False</property>
+ <property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
- <object class="GtkHBox" id="hbox_ac">
+ <object class="GtkBox" id="box3">
<property name="visible">True</property>
- <property name="spacing">6</property>
+ <property name="can_focus">False</property>
+ <property name="spacing">9</property>
<child>
- <object class="GtkHBox" id="hbox10">
+ <object class="GtkLabel" id="label7">
<property name="visible">True</property>
- <child>
- <object class="GtkCheckButton" id="checkbutton_sleep">
- <property name="label" translatable="yes">Put the computer to sleep when inactive:</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="use_action_appearance">False</property>
- <property name="draw_indicator">True</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">0</property>
- </packing>
- </child>
+ <property name="can_focus">False</property>
+ <property name="xalign">1</property>
+ <property name="label" translatable="yes">Suspend when inactive for:</property>
</object>
<packing>
<property name="expand">False</property>
- <property name="fill">False</property>
+ <property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
- <object class="GtkComboBoxText" id="combobox_sleep">
+ <object class="GtkComboBoxText" id="combobox_sleep_battery">
<property name="visible">True</property>
+ <property name="can_focus">False</property>
<property name="model">liststore_time</property>
</object>
<packing>
<property name="expand">False</property>
- <property name="fill">False</property>
+ <property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
+ <child>
+ <object class="GtkComboBoxText" id="combobox_sleep_ac">
+ <property name="width_request">150</property>
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="model">liststore_time</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
</object>
<packing>
<property name="expand">False</property>
- <property name="fill">False</property>
+ <property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkVBox" id="vbox_actions">
- <property name="visible">True</property>
<child>
- <object class="GtkHBox" id="hbox5">
+ <object class="GtkBox" id="box2">
<property name="visible">True</property>
- <property name="spacing">6</property>
+ <property name="can_focus">False</property>
+ <property name="spacing">9</property>
<child>
- <object class="GtkHBox" id="hbox6">
+ <object class="GtkLabel" id="label5">
<property name="visible">True</property>
- <child>
- <object class="GtkLabel" id="label5">
- <property name="visible">True</property>
- <property name="label" translatable="yes">When power is _critically low:</property>
- <property name="use_underline">True</property>
- <property name="mnemonic_widget">combobox_critical</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">0</property>
- </packing>
- </child>
+ <property name="can_focus">False</property>
+ <property name="xalign">1</property>
+ <property name="label" translatable="yes">When power is _critically low:</property>
+ <property name="use_underline">True</property>
+ <property name="mnemonic_widget">combobox_critical</property>
</object>
<packing>
<property name="expand">False</property>
@@ -319,38 +247,42 @@
<child>
<object class="GtkComboBox" id="combobox_critical">
<property name="visible">True</property>
+ <property name="can_focus">False</property>
<property name="model">liststore_critical</property>
</object>
<packing>
<property name="expand">False</property>
- <property name="fill">False</property>
+ <property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">0</property>
+ <property name="fill">True</property>
+ <property name="position">2</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
- <property name="position">1</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkHBox" id="hbox_status">
- <property name="visible">False</property>
+ <property name="can_focus">False</property>
<child>
<object class="GtkHBox" id="hbox2">
<property name="visible">True</property>
+ <property name="can_focus">False</property>
<property name="border_width">12</property>
<property name="spacing">6</property>
<child>
<object class="GtkImage" id="image_status">
<property name="visible">True</property>
+ <property name="can_focus">False</property>
<property name="stock">gtk-dialog-authentication</property>
<property name="icon-size">6</property>
</object>
@@ -363,43 +295,55 @@
<child>
<object class="GtkVBox" id="vbox4">
<property name="visible">True</property>
+ <property name="can_focus">False</property>
<child>
<object class="GtkHBox" id="hbox3">
<property name="visible">True</property>
+ <property name="can_focus">False</property>
<child>
<object class="GtkLabel" id="label_title">
<property name="visible">True</property>
+ <property name="can_focus">False</property>
<property name="label">Battery charging</property>
<attributes>
- <attribute name="scale" value="1.500000"/>
+ <attribute name="scale" value="1.5"/>
</attributes>
</object>
<packing>
<property name="expand">False</property>
+ <property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
</object>
<packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label_description">
<property name="visible">True</property>
+ <property name="can_focus">False</property>
<property name="label">55 minutes until fully charged (6%)</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">True</property>
+ <property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
+ <property name="expand">True</property>
<property name="fill">False</property>
<property name="position">0</property>
</packing>
@@ -407,46 +351,28 @@
</object>
<packing>
<property name="expand">False</property>
- <property name="position">3</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
</packing>
</child>
</object>
</child>
</object>
- <object class="GtkSizeGroup" id="sizegroup_labels">
- <property name="mode">horizontal</property>
- <property name="ignore-hidden">True</property>
+ <object class="GtkSizeGroup" id="sizegroup_combos">
<widgets>
- <widget name="hbox6"/>
- <widget name="hbox10"/>
- <widget name="hbox15"/>
- <widget name="hbox14"/>
+ <widget name="combobox_critical"/>
+ <widget name="combobox_sleep_battery"/>
+ <widget name="combobox_sleep_ac"/>
+ <widget name="label_header_battery"/>
+ <widget name="label_header_ac"/>
</widgets>
</object>
- <object class="GtkListStore" id="liststore_time">
- <columns>
- <!-- column-name name -->
- <column type="gchararray"/>
- <!-- column-name value -->
- <column type="gint"/>
- </columns>
- <data>
- <row>
- <col id="0" translatable="yes">5 minutes</col>
- <col id="1">300</col>
- </row>
- <row>
- <col id="0" translatable="yes">10 minutes</col>
- <col id="1">600</col>
- </row>
- <row>
- <col id="0" translatable="yes">30 minutes</col>
- <col id="1">1800</col>
- </row>
- <row>
- <col id="0" translatable="yes">1 hour</col>
- <col id="1">3600</col>
- </row>
- </data>
+ <object class="GtkSizeGroup" id="sizegroup_labels">
+ <property name="ignore_hidden">True</property>
+ <widgets>
+ <widget name="label5"/>
+ <widget name="label7"/>
+ <widget name="label_header_padding"/>
+ </widgets>
</object>
</interface>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]