[gtranslator] Set default required header if it doesn't exists
- From: Daniel Garcia Moreno <danigm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtranslator] Set default required header if it doesn't exists
- Date: Sun, 6 Jan 2019 12:04:43 +0000 (UTC)
commit 6c11c33e23ff7a77c79fb67e93b9c5dceca902e9
Author: Daniel GarcĂa Moreno <danigm wadobo com>
Date: Sun Jan 6 13:03:09 2019 +0100
Set default required header if it doesn't exists
Close #45
src/gtr-header.c | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
---
diff --git a/src/gtr-header.c b/src/gtr-header.c
index b1953c72..42df65e9 100644
--- a/src/gtr-header.c
+++ b/src/gtr-header.c
@@ -184,6 +184,20 @@ gtr_header_class_init (GtrHeaderClass * klass)
object_class->dispose = gtr_header_dispose;
}
+static void
+gtr_header_set_defaults (GtrHeader *header)
+{
+ g_autofree gchar* mime_version = gtr_header_get_mime_version (header);
+ g_autofree gchar* prj_id_version = gtr_header_get_prj_id_version (header);
+
+ if (!mime_version || *mime_version == '\0')
+ gtr_header_set_mime_version (header, "1.0");
+ if (!prj_id_version || *prj_id_version == '\0')
+ gtr_header_set_prj_id_version (header, "0.1");
+
+}
+
+
/* Public methods */
/**
@@ -206,6 +220,8 @@ gtr_header_new (po_message_iterator_t iter, po_message_t message)
/* We have to parse the number of plurals */
parse_nplurals (header);
+ gtr_header_set_defaults (header);
+
return header;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]