[gtk+] GtkFileChooserWidget: Use ratio in formatted times



commit 683a7f14294d5b2e09fb69a5070df4ba1bb24683
Author: Matthias Clasen <mclasen redhat com>
Date:   Fri Aug 22 01:47:21 2014 -0400

    GtkFileChooserWidget: Use ratio in formatted times
    
    This matches what we do in other places now.

 gtk/gtkfilechooserwidget.c |   24 ++++++++++++++++++++++++
 1 files changed, 24 insertions(+), 0 deletions(-)
---
diff --git a/gtk/gtkfilechooserwidget.c b/gtk/gtkfilechooserwidget.c
index 57f0072..b994904 100644
--- a/gtk/gtkfilechooserwidget.c
+++ b/gtk/gtkfilechooserwidget.c
@@ -3717,6 +3717,22 @@ stop_loading_and_clear_list_model (GtkFileChooserWidget *impl,
     gtk_tree_view_set_model (GTK_TREE_VIEW (priv->browse_files_tree_view), NULL);
 }
 
+/* Replace 'target' with 'replacement' in the input string. */
+static gchar *
+string_replace (const gchar *input,
+                const gchar *target,
+                const gchar *replacement)
+{
+  gchar **pieces;
+  gchar *output;
+
+  pieces = g_strsplit (input, target, -1);
+  output = g_strjoinv (replacement, pieces);
+  g_strfreev (pieces);
+
+  return output;
+}
+
 static char *
 my_g_format_time_for_display (GtkFileChooserWidget *impl,
                               glong secs)
@@ -3750,6 +3766,14 @@ my_g_format_time_for_display (GtkFileChooserWidget *impl,
 
   date_str = g_date_time_format (time, format);
 
+  if (g_get_charset (NULL))
+    {
+      gchar *ret;
+      ret = string_replace (date_str, ":", "\xE2\x80\x8E∶");
+      g_free (date_str);
+      date_str = ret;
+    }
+
   g_date_time_unref (time);
   g_date_time_unref (now);
 


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