]> ToastFreeware Gitweb - gregoa/zavai.git/blobdiff - src/log.vala
Notes about remotising devices
[gregoa/zavai.git] / src / log.vala
index cd912fddf79334cf5842cc6bd460b30634ba2d29..eb78363990ba2f2e26a2df82b115c9f355abd83d 100644 (file)
@@ -90,13 +90,15 @@ public class Log : Object
 {
     public uint id;
     public string tag;
+    public string title;
     public List<LogEntry> entries;
     public List<TrackEntry> track;
 
-    public Log(uint id, string tag)
+    public Log(uint id, string tag, string title)
     {
         this.id = id;
         this.tag = tag;
+        this.title = title;
         entries = null;
         track = null;
     }
@@ -169,6 +171,9 @@ public class Log : Object
         outfd.puts("     xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n");
         outfd.puts("     xmlns=\"http://www.topografix.com/GPX/1/0\"\n");
         outfd.puts("     xsi:schemaLocation=\"http://www.topografix.com/GPX/1/0 http://www.topografix.com/GPX/1/0/gpx.xsd\">\n");
+        outfd.puts("  <metadata>\n");
+        outfd.printf("    <name>%s</name>\n", Markup.escape_text(title));
+        outfd.puts("  </metadata>\n");
         if (track != null) writeTrack(outfd);
         if (entries != null) writeEntries(outfd);
         outfd.puts(" </gpx>\n");
@@ -244,11 +249,11 @@ public class Logger : Resource, Object
         return null;
     }
 
-    public uint start(string tag)
+    public uint start(string tag, string title)
     {
         bool was_empty = (logs == null);
         uint id = gen_seq();
-        logs.append(new Log(id, tag));
+        logs.append(new Log(id, tag, title));
         if (was_empty) start_trace();
         return id;
     }
@@ -269,7 +274,7 @@ public class Logger : Resource, Object
 
     public void instant(string tag, string msg)
     {
-        var log = new Log(0, tag);
+        var log = new Log(0, tag, msg);
         log.add(msg);
         log.save();
     }