[gnome-control-center] datetime: Move the 24h/12h selection to the main overview
- From: Kalev Lember <klember src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-control-center] datetime: Move the 24h/12h selection to the main overview
- Date: Tue, 20 Aug 2013 00:24:57 +0000 (UTC)
commit 60e448b77a5f92e00d699d43e35fb332356208d1
Author: Kalev Lember <kalevlember gmail com>
Date: Sat Aug 3 01:51:13 2013 +0200
datetime: Move the 24h/12h selection to the main overview
... and use a combobox for choosing between the options.
https://bugzilla.gnome.org/show_bug.cgi?id=694985
panels/datetime/cc-datetime-panel.c | 27 ++++-----
panels/datetime/datetime.ui | 120 +++++++++++++++++++++--------------
2 files changed, 84 insertions(+), 63 deletions(-)
---
diff --git a/panels/datetime/cc-datetime-panel.c b/panels/datetime/cc-datetime-panel.c
index 30de737..2561216 100644
--- a/panels/datetime/cc-datetime-panel.c
+++ b/panels/datetime/cc-datetime-panel.c
@@ -183,11 +183,13 @@ change_clock_settings (GObject *gobject,
{
CcDateTimePanelPrivate *priv = panel->priv;
GDesktopClockFormat value;
+ const char *active_id;
g_signal_handlers_block_by_func (priv->settings, clock_settings_changed_cb,
panel);
- if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (W ("24h_button"))))
+ active_id = gtk_combo_box_get_active_id (GTK_COMBO_BOX (W ("format_combobox")));
+ if (!g_strcmp0 (active_id, "24h"))
value = G_DESKTOP_CLOCK_FORMAT_24H;
else
value = G_DESKTOP_CLOCK_FORMAT_12H;
@@ -207,26 +209,24 @@ clock_settings_changed_cb (GSettings *settings,
CcDateTimePanel *panel)
{
CcDateTimePanelPrivate *priv = panel->priv;
- GtkWidget *button24h;
- GtkWidget *button12h;
+ GtkWidget *format_combo;
GDesktopClockFormat value;
value = g_settings_get_enum (settings, CLOCK_FORMAT_KEY);
priv->clock_format = value;
- button24h = W ("24h_button");
- button12h = W ("12h_button");
+ format_combo = W ("format_combobox");
- g_signal_handlers_block_by_func (button24h, change_clock_settings, panel);
+ g_signal_handlers_block_by_func (format_combo, change_clock_settings, panel);
if (value == G_DESKTOP_CLOCK_FORMAT_24H)
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button24h), TRUE);
+ gtk_combo_box_set_active_id (GTK_COMBO_BOX (format_combo), "24h");
else
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button12h), TRUE);
+ gtk_combo_box_set_active_id (GTK_COMBO_BOX (format_combo), "12h");
update_time (panel);
- g_signal_handlers_unblock_by_func (button24h, change_clock_settings, panel);
+ g_signal_handlers_unblock_by_func (format_combo, change_clock_settings, panel);
}
static void
@@ -1179,15 +1179,12 @@ cc_date_time_panel_init (CcDateTimePanel *self)
* offer the 24 hr clock as the only option */
if (ampm == NULL || ampm[0] == '\0')
{
- gtk_widget_set_visible (W("ampm_up_button"), FALSE);
- gtk_widget_set_visible (W("ampm_label"), FALSE);
- gtk_widget_set_visible (W("ampm_down_button"), FALSE);
- gtk_widget_set_visible (W("24h_box"), FALSE);
+ gtk_widget_set_visible (W("timeformat-frame"), FALSE);
priv->ampm_available = FALSE;
}
else
{
- priv->ampm_available = TRUE;
+ priv->ampm_available = TRUE;
}
widget = W ("vbox_datetime");
@@ -1201,7 +1198,7 @@ cc_date_time_panel_init (CcDateTimePanel *self)
g_signal_connect (priv->settings, "changed::" CLOCK_FORMAT_KEY,
G_CALLBACK (clock_settings_changed_cb), self);
- g_signal_connect (W("24h_button"), "notify::active",
+ g_signal_connect (W("format_combobox"), "notify::active-id",
G_CALLBACK (change_clock_settings), self);
update_time (self);
diff --git a/panels/datetime/datetime.ui b/panels/datetime/datetime.ui
index d12bcdc..96ee2dd 100644
--- a/panels/datetime/datetime.ui
+++ b/panels/datetime/datetime.ui
@@ -432,54 +432,6 @@
<property name="position">1</property>
</packing>
</child>
- <child>
- <object class="GtkBox" id="24h_box">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="orientation">vertical</property>
- <child>
- <object class="GtkRadioButton" id="24h_button">
- <property name="label" translatable="yes">24-hour</property>
- <property name="use_action_appearance">False</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="xalign">0</property>
- <property name="active">True</property>
- <property name="draw_indicator">True</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkRadioButton" id="12h_button">
- <property name="label" translatable="yes">AM/PM</property>
- <property name="use_action_appearance">False</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="xalign">0</property>
- <property name="active">True</property>
- <property name="draw_indicator">True</property>
- <property name="group">24h_button</property>
- </object>
- <packing>
- <property name="expand">False</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="pack_type">end</property>
- <property name="position">3</property>
- </packing>
- </child>
</object>
<packing>
<property name="expand">False</property>
@@ -660,6 +612,7 @@
<property name="margin_top">24</property>
<property name="margin_bottom">24</property>
<property name="orientation">vertical</property>
+ <property name="spacing">24</property>
<child>
<object class="GtkFrame" id="frame">
<property name="visible">True</property>
@@ -925,12 +878,83 @@
<property name="position">0</property>
</packing>
</child>
+ <child>
+ <object class="GtkFrame" id="timeformat-frame">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label_xalign">0</property>
+ <property name="shadow_type">in</property>
+ <child>
+ <object class="GtkListBox" id="listbox1">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="selection_mode">none</property>
+ <child>
+ <object class="GtkListBoxRow" id="timeformat-row">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <child>
+ <object class="GtkBox" id="box1">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="spacing">50</property>
+ <child>
+ <object class="GtkLabel" id="format_label">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="margin_left">20</property>
+ <property name="margin_right">20</property>
+ <property name="margin_top">6</property>
+ <property name="margin_bottom">6</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">Time _Format</property>
+ <property name="use_underline">True</property>
+ <property name="mnemonic_widget">format_combobox</property>
+ </object>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkComboBoxText" id="format_combobox">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="valign">center</property>
+ <property name="margin_left">20</property>
+ <property name="margin_right">20</property>
+ <items>
+ <item id="24h" translatable="yes">24-hour</item>
+ <item id="12h" translatable="yes">AM / PM</item>
+ </items>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ </object>
+ </child>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
</object>
</child>
</object>
<object class="GtkSizeGroup" id="row_sizegroup">
<property name="mode">vertical</property>
<widgets>
+ <widget name="box1"/>
<widget name="box2"/>
<widget name="box3"/>
<widget name="box4"/>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]