[gnome-control-center] datetime: 12h time format is now always available



commit 85cd910af5e021f4ad1e34b4ae539a38aa712a61
Author: Bastien Nocera <hadess hadess net>
Date:   Mon Apr 3 11:28:20 2017 +0200

    datetime: 12h time format is now always available
    
    Following a change in GDateTime, AM/PM format is now always available
    even if the support is missing in the locale used.
    
    Remove the code used to detect AM/PM support in the locale, and bump the
    GLib requirements to the version that includes this GDateTime change.
    
    See https://bugzilla.gnome.org/show_bug.cgi?id=761889
    
    https://bugzilla.gnome.org/show_bug.cgi?id=780863

 configure.ac                        |    2 +-
 libgd                               |    2 +-
 panels/datetime/cc-datetime-panel.c |   23 ++++-------------------
 3 files changed, 6 insertions(+), 21 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index dff3893..c1b2ef2 100644
--- a/configure.ac
+++ b/configure.ac
@@ -86,7 +86,7 @@ dnl ==============================================
 dnl Check that we meet the  dependencies
 dnl ==============================================
 
-GLIB_REQUIRED_VERSION=2.44.0
+GLIB_REQUIRED_VERSION=2.53.0
 GTK_REQUIRED_VERSION=3.22.0
 PA_REQUIRED_VERSION=2.0
 CANBERRA_REQUIRED_VERSION=0.13
diff --git a/libgd b/libgd
index 2899de0..752f65e 160000
--- a/libgd
+++ b/libgd
@@ -1 +1 @@
-Subproject commit 2899de073fdc2af496f5c9d7d9b108fbe15f0ddc
+Subproject commit 752f65e91ea0d9a2ee8a2d21343bbd97bd0d038a
diff --git a/panels/datetime/cc-datetime-panel.c b/panels/datetime/cc-datetime-panel.c
index 8c12212..df76f0f 100644
--- a/panels/datetime/cc-datetime-panel.c
+++ b/panels/datetime/cc-datetime-panel.c
@@ -87,7 +87,6 @@ struct _CcDateTimePanelPrivate
   GSettings *datetime_settings;
   GSettings *filechooser_settings;
   GDesktopClockFormat clock_format;
-  gboolean ampm_available;
   GtkWidget *am_label;
   GtkWidget *pm_label;
   GtkWidget *am_pm_stack;
@@ -289,7 +288,7 @@ update_time (CcDateTimePanel *self)
   g_signal_handlers_block_by_func (m_spinbutton, change_time, self);
   g_signal_handlers_block_by_func (am_pm_button, am_pm_button_clicked, self);
 
-  if (priv->clock_format == G_DESKTOP_CLOCK_FORMAT_12H && priv->ampm_available)
+  if (priv->clock_format == G_DESKTOP_CLOCK_FORMAT_12H)
     use_ampm = TRUE;
   else
     use_ampm = FALSE;
@@ -541,7 +540,7 @@ update_timezone (CcDateTimePanel *self)
   char *tz_desc;
   gboolean use_ampm;
 
-  if (priv->clock_format == G_DESKTOP_CLOCK_FORMAT_12H && priv->ampm_available)
+  if (priv->clock_format == G_DESKTOP_CLOCK_FORMAT_12H)
     use_ampm = TRUE;
   else
     use_ampm = FALSE;
@@ -715,7 +714,7 @@ change_time (CcDateTimePanel *panel)
   h = gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (W ("h_spinbutton")));
   m = gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (W ("m_spinbutton")));
 
-  if (priv->clock_format == G_DESKTOP_CLOCK_FORMAT_12H && priv->ampm_available)
+  if (priv->clock_format == G_DESKTOP_CLOCK_FORMAT_12H)
     {
       gboolean is_pm_time;
       GtkWidget *visible_child;
@@ -1003,7 +1002,7 @@ format_hours_combobox (GtkSpinButton   *spin,
   int hour;
   gboolean use_ampm;
 
-  if (priv->clock_format == G_DESKTOP_CLOCK_FORMAT_12H && priv->ampm_available)
+  if (priv->clock_format == G_DESKTOP_CLOCK_FORMAT_12H)
     use_ampm = TRUE;
   else
     use_ampm = FALSE;
@@ -1206,7 +1205,6 @@ cc_date_time_panel_init (CcDateTimePanel *self)
   GtkWidget *widget;
   GError *error;
   GtkTreeModelSort *city_modelsort;
-  const char *ampm;
   int ret;
   const char *date_grid_name;
   char *tmp;
@@ -1315,19 +1313,6 @@ cc_date_time_panel_init (CcDateTimePanel *self)
   /* Clock settings */
   priv->clock_settings = g_settings_new (CLOCK_SCHEMA);
 
-  ampm = nl_langinfo (AM_STR);
-  /* There are no AM/PM indicators for this locale, so
-   * offer the 24 hr clock as the only option */
-  if (ampm == NULL || ampm[0] == '\0')
-    {
-      gtk_widget_set_visible (W("timeformat-frame"), FALSE);
-      priv->ampm_available = FALSE;
-    }
-  else
-    {
-      priv->ampm_available = TRUE;
-    }
-
   widget = W ("vbox_datetime");
   gtk_container_add (GTK_CONTAINER (self), widget);
 


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