[gnome-control-center] datetime: Use radio buttons for 24h time



commit 76783e8e27f73dc025bb74032aaf378ce3ffa1b7
Author: Bastien Nocera <hadess hadess net>
Date:   Fri Aug 26 17:01:23 2011 +0100

    datetime: Use radio buttons for 24h time
    
    Instead of a switch. For most locales "24h time" doesn't
    really have an opposite (as those don't use AM/PM).
    
    https://bugzilla.gnome.org/show_bug.cgi?id=640059

 panels/datetime/cc-datetime-panel.c |   14 +++---
 panels/datetime/datetime.ui         |   83 ++++++++++++++++++++---------------
 2 files changed, 55 insertions(+), 42 deletions(-)
---
diff --git a/panels/datetime/cc-datetime-panel.c b/panels/datetime/cc-datetime-panel.c
index 5863959..c369c78 100644
--- a/panels/datetime/cc-datetime-panel.c
+++ b/panels/datetime/cc-datetime-panel.c
@@ -209,7 +209,7 @@ change_clock_settings (GObject         *gobject,
   g_signal_handlers_block_by_func (priv->settings, clock_settings_changed_cb,
                                    panel);
 
-  if (gtk_switch_get_active (GTK_SWITCH (W ("24h_time_switch"))))
+  if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (W ("24h_button"))))
     value = G_DESKTOP_CLOCK_FORMAT_24H;
   else
     value = G_DESKTOP_CLOCK_FORMAT_12H;
@@ -229,24 +229,24 @@ clock_settings_changed_cb (GSettings       *settings,
                            CcDateTimePanel *panel)
 {
   CcDateTimePanelPrivate *priv = panel->priv;
-  GtkWidget *switch24h;
+  GtkWidget *button24h;
   gboolean use_24_hour;
   GDesktopClockFormat value;
 
   value = g_settings_get_enum (settings, CLOCK_FORMAT_KEY);
   priv->clock_format = value;
 
-  switch24h = W ("24h_time_switch");
+  button24h = W ("24h_button");
 
   use_24_hour = (value == G_DESKTOP_CLOCK_FORMAT_24H);
 
-  g_signal_handlers_block_by_func (switch24h, change_clock_settings, panel);
+  g_signal_handlers_block_by_func (button24h, change_clock_settings, panel);
 
-  gtk_switch_set_active (GTK_SWITCH (switch24h), use_24_hour);
+  gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button24h), use_24_hour);
 
   update_time (panel);
 
-  g_signal_handlers_unblock_by_func (switch24h, change_clock_settings, panel);
+  g_signal_handlers_unblock_by_func (button24h, change_clock_settings, panel);
 }
 
 static void
@@ -1003,7 +1003,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_time_switch"), "notify::active",
+  g_signal_connect (W("24h_button"), "notify::active",
                     G_CALLBACK (change_clock_settings), self);
 
   update_time (self);
diff --git a/panels/datetime/datetime.ui b/panels/datetime/datetime.ui
index 463f361..4d97d2b 100644
--- a/panels/datetime/datetime.ui
+++ b/panels/datetime/datetime.ui
@@ -374,41 +374,6 @@
                       </packing>
                     </child>
                     <child>
-                      <object class="GtkHBox" id="hbox23">
-                        <property name="visible">True</property>
-                        <property name="spacing">12</property>
-                        <child>
-                          <object class="GtkLabel" id="label33">
-                            <property name="visible">True</property>
-                            <property name="xalign">0</property>
-                            <property name="label" translatable="yes">24-_Hour Time</property>
-                            <property name="use_underline">True</property>
-                            <property name="mnemonic_widget">24h_time_switch</property>
-                          </object>
-                          <packing>
-                            <property name="position">1</property>
-                          </packing>
-                        </child>
-                        <child>
-                          <object class="GtkSwitch" id="24h_time_switch">
-                            <property name="visible">True</property>
-                            <property name="can_focus">True</property>
-                          </object>
-                          <packing>
-                            <property name="pack_type">end</property>
-                            <property name="position">2</property>
-                            <property name="expand">False</property>
-                          </packing>
-                        </child>
-                      </object>
-                      <packing>
-                        <property name="position">3</property>
-                        <property name="padding">6</property>
-                        <property name="expand">False</property>
-                        <property name="pack_type">end</property>
-                      </packing>
-                    </child>
-                    <child>
                       <object class="GtkHBox" id="table1">
                         <property name="visible">True</property>
                         <property name="spacing">12</property>
@@ -472,6 +437,54 @@
                         <property name="position">2</property>
                       </packing>
                     </child>
+                    <child>
+                      <object class="GtkBox" id="box1">
+                        <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="visible">True</property>
+                            <property name="can_focus">True</property>
+                            <property name="receives_default">False</property>
+                            <property name="use_action_appearance">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="visible">True</property>
+                            <property name="can_focus">True</property>
+                            <property name="receives_default">False</property>
+                            <property name="use_action_appearance">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>



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]