[seahorse] common: Move seahorse_util_get_date_string() to vala



commit d4d7be577b6a180754dfa2923d372fab73706069
Author: Stef Walter <stefw gnome org>
Date:   Thu Jun 20 16:50:27 2013 +0200

    common: Move seahorse_util_get_date_string() to vala

 common/util.vala            |   10 ++++++++++
 libseahorse/seahorse-util.c |   25 -------------------------
 2 files changed, 10 insertions(+), 25 deletions(-)
---
diff --git a/common/util.vala b/common/util.vala
index d2ffa5b..beebc7d 100644
--- a/common/util.vala
+++ b/common/util.vala
@@ -52,6 +52,16 @@ namespace Util {
                dialog.destroy();
        }
 
+       public string get_display_date_string (long time)
+       {
+               if (time == 0)
+                       return "";
+               var created_date = GLib.Date();
+               created_date.set_time_t (time);
+               var buffer = new char[128];
+               created_date.strftime(buffer, _("%Y-%m-%d"));
+               return (string)buffer;
+       }
 }
 
 }
diff --git a/libseahorse/seahorse-util.c b/libseahorse/seahorse-util.c
index 881aac7..94261e2 100644
--- a/libseahorse/seahorse-util.c
+++ b/libseahorse/seahorse-util.c
@@ -134,31 +134,6 @@ seahorse_util_get_date_string (const time_t time)
        return created_string;
 }
 
-/** 
- * seahorse_util_get_display_date_string:
- * @time: Time value to parse
- *
- * Creates a string representation of @time for display in the UI.
- *
- * Returns: A string representing @time. The returned string should be freed 
- * with #g_free when no longer needed.
- **/
-gchar*
-seahorse_util_get_display_date_string (const time_t time)
-{
-       GDate *created_date;
-       gchar *created_string;
-       
-       if (time == 0)
-               return g_strdup ("");
-       
-       created_date = g_date_new ();
-       g_date_set_time_t (created_date, time);
-       created_string = g_new (gchar, 11);
-       g_date_strftime (created_string, 11, _("%Y-%m-%d"), created_date);
-       return created_string;
-}
-
 /**
  * seahorse_util_read_to_memory:
  * @input: Data to read. The #GInputStream is read till the end.


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