Commit 1c3357fb authored by Philip Withnall's avatar Philip Withnall
Browse files

inspect: Implement pretty printing of GDateTime

The new Zeitgeist work in the Telepathy backend makes use of nullable
GDateTimes, so this implements pretty printing of them in folks-inspect.

Everyone prefers reading well-formatted ISO 8601 date/times over reading
error messages saying the conversion wasn’t possible, right?
parent 0e729d7b
......@@ -39,6 +39,8 @@ private class Folks.Inspect.Utils
typeof (string), Utils.transform_persona_store_to_string);
Value.register_transform_func (typeof (string[]), typeof (string),
Value.register_transform_func (typeof (DateTime), typeof (string),
private static void transform_object_to_string (Value src,
......@@ -74,6 +76,18 @@ private class Folks.Inspect.Utils
dest = (owned) output;
private static void transform_date_time_to_string (Value src, out Value dest)
unowned DateTime? date_time = (DateTime?) src;
string output = "(null)";
if (date_time != null)
output = ((!) date_time).format ("%FT%T%z");
dest = (owned) output;
public static void indent ()
/* We indent in increments of two spaces */
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment