[gnome-control-center] datetime: Respect the date endianess



commit 6279dcd0a6813fc521f79d7d1231c2e39615ea32
Author: Bastien Nocera <hadess hadess net>
Date:   Thu Jun 11 17:39:02 2015 +0200

    datetime: Respect the date endianess
    
    When the user changes the date, order the widgets in the same order as
    how the date is printed in that locale.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=750799

 panels/datetime/big.ui                 |  106 ++++++++++++++++++++++++++++
 panels/datetime/cc-datetime-panel.c    |   25 +++++++
 panels/datetime/datetime.gresource.xml |    4 +
 panels/datetime/datetime.ui            |  121 --------------------------------
 panels/datetime/little.ui              |  106 ++++++++++++++++++++++++++++
 panels/datetime/middle.ui              |  106 ++++++++++++++++++++++++++++
 panels/datetime/ydm.ui                 |  106 ++++++++++++++++++++++++++++
 7 files changed, 453 insertions(+), 121 deletions(-)
---
diff --git a/panels/datetime/big.ui b/panels/datetime/big.ui
new file mode 100644
index 0000000..42ccda8
--- /dev/null
+++ b/panels/datetime/big.ui
@@ -0,0 +1,106 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Generated with glade 3.18.3 -->
+<interface>
+  <requires lib="gtk+" version="3.12"/>
+  <object class="GtkGrid" id="date_grid">
+    <property name="visible">True</property>
+    <property name="can_focus">False</property>
+    <property name="valign">center</property>
+    <property name="row_spacing">9</property>
+    <property name="column_spacing">6</property>
+    <property name="row_homogeneous">True</property>
+    <child>
+      <object class="GtkLabel" id="day_label">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="label" translatable="yes">Day</property>
+        <property name="mnemonic_widget">day-spinbutton</property>
+        <property name="xalign">1</property>
+        <style>
+          <class name="dim-label"/>
+        </style>
+      </object>
+      <packing>
+        <property name="left_attach">0</property>
+        <property name="top_attach">2</property>
+      </packing>
+    </child>
+    <child>
+      <object class="GtkLabel" id="month_label">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="label" translatable="yes">Month</property>
+        <property name="mnemonic_widget">month-combobox</property>
+        <property name="xalign">1</property>
+        <style>
+          <class name="dim-label"/>
+        </style>
+      </object>
+      <packing>
+        <property name="left_attach">0</property>
+        <property name="top_attach">1</property>
+      </packing>
+    </child>
+    <child>
+      <object class="GtkLabel" id="year_label">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="label" translatable="yes">Year</property>
+        <property name="mnemonic_widget">year-spinbutton</property>
+        <property name="xalign">1</property>
+        <style>
+          <class name="dim-label"/>
+        </style>
+      </object>
+      <packing>
+        <property name="left_attach">0</property>
+        <property name="top_attach">0</property>
+      </packing>
+    </child>
+    <child>
+      <object class="GtkSpinButton" id="day-spinbutton">
+        <property name="visible">True</property>
+        <property name="can_focus">True</property>
+        <property name="invisible_char">•</property>
+        <property name="width_chars">3</property>
+        <property name="numeric">True</property>
+        <property name="wrap">True</property>
+      </object>
+      <packing>
+        <property name="left_attach">1</property>
+        <property name="top_attach">2</property>
+      </packing>
+    </child>
+    <child>
+      <object class="GtkComboBox" id="month-combobox">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="model">month-liststore</property>
+        <child>
+          <object class="GtkCellRendererText" id="cellrenderertext3"/>
+          <attributes>
+            <attribute name="text">0</attribute>
+          </attributes>
+        </child>
+      </object>
+      <packing>
+        <property name="left_attach">1</property>
+        <property name="top_attach">1</property>
+      </packing>
+    </child>
+    <child>
+      <object class="GtkSpinButton" id="year-spinbutton">
+        <property name="visible">True</property>
+        <property name="can_focus">True</property>
+        <property name="invisible_char">•</property>
+        <property name="width_chars">5</property>
+        <property name="numeric">True</property>
+        <property name="wrap">True</property>
+      </object>
+      <packing>
+        <property name="left_attach">1</property>
+        <property name="top_attach">0</property>
+      </packing>
+    </child>
+  </object>
+</interface>
diff --git a/panels/datetime/cc-datetime-panel.c b/panels/datetime/cc-datetime-panel.c
index f787e30..c1a795e 100644
--- a/panels/datetime/cc-datetime-panel.c
+++ b/panels/datetime/cc-datetime-panel.c
@@ -1208,6 +1208,8 @@ cc_date_time_panel_init (CcDateTimePanel *self)
   GtkTreeModelSort *city_modelsort;
   const char *ampm;
   int ret;
+  const char *date_grid_name;
+  char *tmp;
 
   priv = self->priv = DATE_TIME_PANEL_PRIVATE (self);
   g_resources_register (cc_datetime_get_resource ());
@@ -1239,6 +1241,29 @@ cc_date_time_panel_init (CcDateTimePanel *self)
       return;
     }
 
+  switch (date_endian_get_default (FALSE)) {
+  case DATE_ENDIANESS_BIG:
+    date_grid_name = "big";
+    break;
+  case DATE_ENDIANESS_LITTLE:
+    date_grid_name = "little";
+    break;
+  case DATE_ENDIANESS_MIDDLE:
+    date_grid_name = "middle";
+    break;
+  case DATE_ENDIANESS_YDM:
+    date_grid_name = "ydm";
+    break;
+  default:
+    g_assert_not_reached ();
+  }
+
+  tmp = g_strdup_printf ("/org/gnome/control-center/datetime/%s.ui", date_grid_name);
+  ret = gtk_builder_add_from_resource (priv->builder, tmp, NULL);
+  g_free (tmp);
+
+  gtk_box_pack_end (GTK_BOX (W ("time-box")), W ("date_grid"), FALSE, TRUE, 0);
+
   /* add the lock button */
   priv->permission = polkit_permission_new_sync (DATETIME_PERMISSION, NULL, NULL, NULL);
   if (priv->permission != NULL)
diff --git a/panels/datetime/datetime.gresource.xml b/panels/datetime/datetime.gresource.xml
index 9b55358..f4d3b23 100644
--- a/panels/datetime/datetime.gresource.xml
+++ b/panels/datetime/datetime.gresource.xml
@@ -2,6 +2,10 @@
 <gresources>
   <gresource prefix="/org/gnome/control-center/datetime">
     <file preprocess="xml-stripblanks">datetime.ui</file>
+    <file preprocess="xml-stripblanks">little.ui</file>
+    <file preprocess="xml-stripblanks">big.ui</file>
+    <file preprocess="xml-stripblanks">middle.ui</file>
+    <file preprocess="xml-stripblanks">ydm.ui</file>
     <file alias="bg.png">data/bg.png</file>
     <file alias="bg_dim.png">data/bg_dim.png</file>
     <file alias="cc.png">data/cc.png</file>
diff --git a/panels/datetime/datetime.ui b/panels/datetime/datetime.ui
index abefa3c..5de8807 100644
--- a/panels/datetime/datetime.ui
+++ b/panels/datetime/datetime.ui
@@ -193,127 +193,6 @@
                 <property name="position">0</property>
               </packing>
             </child>
-            <child>
-              <object class="GtkGrid" id="grid1">
-                <property name="visible">True</property>
-                <property name="can_focus">False</property>
-                <property name="valign">center</property>
-                <property name="row_spacing">9</property>
-                <property name="column_spacing">6</property>
-                <property name="row_homogeneous">True</property>
-                <child>
-                  <object class="GtkLabel" id="day_label">
-                    <property name="visible">True</property>
-                    <property name="can_focus">False</property>
-                    <property name="xalign">1</property>
-                    <property name="label" translatable="yes">Day</property>
-                    <property name="mnemonic_widget">day-spinbutton</property>
-                    <style>
-                      <class name="dim-label"/>
-                    </style>
-                  </object>
-                  <packing>
-                    <property name="left_attach">0</property>
-                    <property name="top_attach">0</property>
-                    <property name="width">1</property>
-                    <property name="height">1</property>
-                  </packing>
-                </child>
-                <child>
-                  <object class="GtkLabel" id="month_label">
-                    <property name="visible">True</property>
-                    <property name="can_focus">False</property>
-                    <property name="is_focus">True</property>
-                    <property name="xalign">1</property>
-                    <property name="label" translatable="yes">Month</property>
-                    <property name="mnemonic_widget">month-combobox</property>
-                    <style>
-                      <class name="dim-label"/>
-                    </style>
-                  </object>
-                  <packing>
-                    <property name="left_attach">0</property>
-                    <property name="top_attach">1</property>
-                    <property name="width">1</property>
-                    <property name="height">1</property>
-                  </packing>
-                </child>
-                <child>
-                  <object class="GtkLabel" id="year_label">
-                    <property name="visible">True</property>
-                    <property name="can_focus">False</property>
-                    <property name="xalign">1</property>
-                    <property name="label" translatable="yes">Year</property>
-                    <property name="mnemonic_widget">year-spinbutton</property>
-                    <style>
-                      <class name="dim-label"/>
-                    </style>
-                  </object>
-                  <packing>
-                    <property name="left_attach">0</property>
-                    <property name="top_attach">2</property>
-                    <property name="width">1</property>
-                    <property name="height">1</property>
-                  </packing>
-                </child>
-                <child>
-                  <object class="GtkSpinButton" id="day-spinbutton">
-                    <property name="visible">True</property>
-                    <property name="can_focus">True</property>
-                    <property name="invisible_char">•</property>
-                    <property name="width_chars">3</property>
-                    <property name="numeric">True</property>
-                    <property name="wrap">True</property>
-                  </object>
-                  <packing>
-                    <property name="left_attach">1</property>
-                    <property name="top_attach">0</property>
-                    <property name="width">1</property>
-                    <property name="height">1</property>
-                  </packing>
-                </child>
-                <child>
-                  <object class="GtkComboBox" id="month-combobox">
-                    <property name="visible">True</property>
-                    <property name="can_focus">False</property>
-                    <property name="model">month-liststore</property>
-                    <child>
-                      <object class="GtkCellRendererText" id="cellrenderertext3"/>
-                      <attributes>
-                        <attribute name="text">0</attribute>
-                      </attributes>
-                    </child>
-                  </object>
-                  <packing>
-                    <property name="left_attach">1</property>
-                    <property name="top_attach">1</property>
-                    <property name="width">1</property>
-                    <property name="height">1</property>
-                  </packing>
-                </child>
-                <child>
-                  <object class="GtkSpinButton" id="year-spinbutton">
-                    <property name="visible">True</property>
-                    <property name="can_focus">True</property>
-                    <property name="invisible_char">•</property>
-                    <property name="width_chars">5</property>
-                    <property name="numeric">True</property>
-                    <property name="wrap">True</property>
-                  </object>
-                  <packing>
-                    <property name="left_attach">1</property>
-                    <property name="top_attach">2</property>
-                    <property name="width">1</property>
-                    <property name="height">1</property>
-                  </packing>
-                </child>
-              </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>
diff --git a/panels/datetime/little.ui b/panels/datetime/little.ui
new file mode 100644
index 0000000..b4e9aed
--- /dev/null
+++ b/panels/datetime/little.ui
@@ -0,0 +1,106 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Generated with glade 3.18.3 -->
+<interface>
+  <requires lib="gtk+" version="3.12"/>
+  <object class="GtkGrid" id="date_grid">
+    <property name="visible">True</property>
+    <property name="can_focus">False</property>
+    <property name="valign">center</property>
+    <property name="row_spacing">9</property>
+    <property name="column_spacing">6</property>
+    <property name="row_homogeneous">True</property>
+    <child>
+      <object class="GtkLabel" id="day_label">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="label" translatable="yes">Day</property>
+        <property name="mnemonic_widget">day-spinbutton</property>
+        <property name="xalign">1</property>
+        <style>
+          <class name="dim-label"/>
+        </style>
+      </object>
+      <packing>
+        <property name="left_attach">0</property>
+        <property name="top_attach">0</property>
+      </packing>
+    </child>
+    <child>
+      <object class="GtkLabel" id="month_label">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="label" translatable="yes">Month</property>
+        <property name="mnemonic_widget">month-combobox</property>
+        <property name="xalign">1</property>
+        <style>
+          <class name="dim-label"/>
+        </style>
+      </object>
+      <packing>
+        <property name="left_attach">0</property>
+        <property name="top_attach">1</property>
+      </packing>
+    </child>
+    <child>
+      <object class="GtkLabel" id="year_label">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="label" translatable="yes">Year</property>
+        <property name="mnemonic_widget">year-spinbutton</property>
+        <property name="xalign">1</property>
+        <style>
+          <class name="dim-label"/>
+        </style>
+      </object>
+      <packing>
+        <property name="left_attach">0</property>
+        <property name="top_attach">2</property>
+      </packing>
+    </child>
+    <child>
+      <object class="GtkSpinButton" id="day-spinbutton">
+        <property name="visible">True</property>
+        <property name="can_focus">True</property>
+        <property name="invisible_char">•</property>
+        <property name="width_chars">3</property>
+        <property name="numeric">True</property>
+        <property name="wrap">True</property>
+      </object>
+      <packing>
+        <property name="left_attach">1</property>
+        <property name="top_attach">0</property>
+      </packing>
+    </child>
+    <child>
+      <object class="GtkComboBox" id="month-combobox">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="model">month-liststore</property>
+        <child>
+          <object class="GtkCellRendererText" id="cellrenderertext3"/>
+          <attributes>
+            <attribute name="text">0</attribute>
+          </attributes>
+        </child>
+      </object>
+      <packing>
+        <property name="left_attach">1</property>
+        <property name="top_attach">1</property>
+      </packing>
+    </child>
+    <child>
+      <object class="GtkSpinButton" id="year-spinbutton">
+        <property name="visible">True</property>
+        <property name="can_focus">True</property>
+        <property name="invisible_char">•</property>
+        <property name="width_chars">5</property>
+        <property name="numeric">True</property>
+        <property name="wrap">True</property>
+      </object>
+      <packing>
+        <property name="left_attach">1</property>
+        <property name="top_attach">2</property>
+      </packing>
+    </child>
+  </object>
+</interface>
diff --git a/panels/datetime/middle.ui b/panels/datetime/middle.ui
new file mode 100644
index 0000000..54c3975
--- /dev/null
+++ b/panels/datetime/middle.ui
@@ -0,0 +1,106 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Generated with glade 3.18.3 -->
+<interface>
+  <requires lib="gtk+" version="3.12"/>
+  <object class="GtkGrid" id="date_grid">
+    <property name="visible">True</property>
+    <property name="can_focus">False</property>
+    <property name="valign">center</property>
+    <property name="row_spacing">9</property>
+    <property name="column_spacing">6</property>
+    <property name="row_homogeneous">True</property>
+    <child>
+      <object class="GtkLabel" id="day_label">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="label" translatable="yes">Day</property>
+        <property name="mnemonic_widget">day-spinbutton</property>
+        <property name="xalign">1</property>
+        <style>
+          <class name="dim-label"/>
+        </style>
+      </object>
+      <packing>
+        <property name="left_attach">0</property>
+        <property name="top_attach">1</property>
+      </packing>
+    </child>
+    <child>
+      <object class="GtkLabel" id="month_label">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="label" translatable="yes">Month</property>
+        <property name="mnemonic_widget">month-combobox</property>
+        <property name="xalign">1</property>
+        <style>
+          <class name="dim-label"/>
+        </style>
+      </object>
+      <packing>
+        <property name="left_attach">0</property>
+        <property name="top_attach">0</property>
+      </packing>
+    </child>
+    <child>
+      <object class="GtkLabel" id="year_label">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="label" translatable="yes">Year</property>
+        <property name="mnemonic_widget">year-spinbutton</property>
+        <property name="xalign">1</property>
+        <style>
+          <class name="dim-label"/>
+        </style>
+      </object>
+      <packing>
+        <property name="left_attach">0</property>
+        <property name="top_attach">2</property>
+      </packing>
+    </child>
+    <child>
+      <object class="GtkSpinButton" id="day-spinbutton">
+        <property name="visible">True</property>
+        <property name="can_focus">True</property>
+        <property name="invisible_char">•</property>
+        <property name="width_chars">3</property>
+        <property name="numeric">True</property>
+        <property name="wrap">True</property>
+      </object>
+      <packing>
+        <property name="left_attach">1</property>
+        <property name="top_attach">1</property>
+      </packing>
+    </child>
+    <child>
+      <object class="GtkComboBox" id="month-combobox">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="model">month-liststore</property>
+        <child>
+          <object class="GtkCellRendererText" id="cellrenderertext3"/>
+          <attributes>
+            <attribute name="text">0</attribute>
+          </attributes>
+        </child>
+      </object>
+      <packing>
+        <property name="left_attach">1</property>
+        <property name="top_attach">0</property>
+      </packing>
+    </child>
+    <child>
+      <object class="GtkSpinButton" id="year-spinbutton">
+        <property name="visible">True</property>
+        <property name="can_focus">True</property>
+        <property name="invisible_char">•</property>
+        <property name="width_chars">5</property>
+        <property name="numeric">True</property>
+        <property name="wrap">True</property>
+      </object>
+      <packing>
+        <property name="left_attach">1</property>
+        <property name="top_attach">2</property>
+      </packing>
+    </child>
+  </object>
+</interface>
diff --git a/panels/datetime/ydm.ui b/panels/datetime/ydm.ui
new file mode 100644
index 0000000..358aea5
--- /dev/null
+++ b/panels/datetime/ydm.ui
@@ -0,0 +1,106 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Generated with glade 3.18.3 -->
+<interface>
+  <requires lib="gtk+" version="3.12"/>
+  <object class="GtkGrid" id="date_grid">
+    <property name="visible">True</property>
+    <property name="can_focus">False</property>
+    <property name="valign">center</property>
+    <property name="row_spacing">9</property>
+    <property name="column_spacing">6</property>
+    <property name="row_homogeneous">True</property>
+    <child>
+      <object class="GtkLabel" id="day_label">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="label" translatable="yes">Day</property>
+        <property name="mnemonic_widget">day-spinbutton</property>
+        <property name="xalign">1</property>
+        <style>
+          <class name="dim-label"/>
+        </style>
+      </object>
+      <packing>
+        <property name="left_attach">0</property>
+        <property name="top_attach">1</property>
+      </packing>
+    </child>
+    <child>
+      <object class="GtkLabel" id="month_label">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="label" translatable="yes">Month</property>
+        <property name="mnemonic_widget">month-combobox</property>
+        <property name="xalign">1</property>
+        <style>
+          <class name="dim-label"/>
+        </style>
+      </object>
+      <packing>
+        <property name="left_attach">0</property>
+        <property name="top_attach">2</property>
+      </packing>
+    </child>
+    <child>
+      <object class="GtkLabel" id="year_label">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="label" translatable="yes">Year</property>
+        <property name="mnemonic_widget">year-spinbutton</property>
+        <property name="xalign">1</property>
+        <style>
+          <class name="dim-label"/>
+        </style>
+      </object>
+      <packing>
+        <property name="left_attach">0</property>
+        <property name="top_attach">0</property>
+      </packing>
+    </child>
+    <child>
+      <object class="GtkSpinButton" id="day-spinbutton">
+        <property name="visible">True</property>
+        <property name="can_focus">True</property>
+        <property name="invisible_char">•</property>
+        <property name="width_chars">3</property>
+        <property name="numeric">True</property>
+        <property name="wrap">True</property>
+      </object>
+      <packing>
+        <property name="left_attach">1</property>
+        <property name="top_attach">1</property>
+      </packing>
+    </child>
+    <child>
+      <object class="GtkComboBox" id="month-combobox">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="model">month-liststore</property>
+        <child>
+          <object class="GtkCellRendererText" id="cellrenderertext3"/>
+          <attributes>
+            <attribute name="text">0</attribute>
+          </attributes>
+        </child>
+      </object>
+      <packing>
+        <property name="left_attach">1</property>
+        <property name="top_attach">2</property>
+      </packing>
+    </child>
+    <child>
+      <object class="GtkSpinButton" id="year-spinbutton">
+        <property name="visible">True</property>
+        <property name="can_focus">True</property>
+        <property name="invisible_char">•</property>
+        <property name="width_chars">5</property>
+        <property name="numeric">True</property>
+        <property name="wrap">True</property>
+      </object>
+      <packing>
+        <property name="left_attach">1</property>
+        <property name="top_attach">0</property>
+      </packing>
+    </child>
+  </object>
+</interface>


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