[geany/geany-plugins] cff154: pohelper: Update X-Generator header if present

Colomban Wendling git-noreply at xxxxx
Mon Feb 19 06:22:50 UTC 2018


Branch:      refs/heads/master
Author:      Colomban Wendling <ban at herbesfolles.org>
Committer:   Colomban Wendling <ban at herbesfolles.org>
Date:        Mon, 19 Feb 2018 06:22:50 UTC
Commit:      cff154c3ba7aac703ae1bcd901a1177252934051
             https://github.com/geany/geany-plugins/commit/cff154c3ba7aac703ae1bcd901a1177252934051

Log Message:
-----------
pohelper: Update X-Generator header if present

Don't leave another editor's X-Generator field, but don't bother adding
the field if it's not already there.


Modified Paths:
--------------
    pohelper/src/gph-plugin.c

Modified: pohelper/src/gph-plugin.c
7 lines changed, 7 insertions(+), 0 deletions(-)
===================================================================
@@ -1229,11 +1229,14 @@ on_document_save (GObject        *obj,
     gchar *mail = escape_string (geany_data->template_prefs->mail);
     gchar *date;
     gchar *translator;
+    gchar *generator;
     
     date = utils_get_date_time ("\"PO-Revision-Date: %Y-%m-%d %H:%M%z\\n\"",
                                 NULL);
     translator = g_strdup_printf ("\"Last-Translator: %s <%s>\\n\"",
                                   name, mail);
+    generator = g_strdup_printf ("\"X-Generator: Geany / PoHelper %s\\n\"",
+                                 VERSION);
     
     sci_start_undo_action (doc->editor->sci);
     regex_replace (doc->editor->sci,
@@ -1242,10 +1245,14 @@ on_document_save (GObject        *obj,
     regex_replace (doc->editor->sci,
                    header_start, find_msgstr_end_at (doc, header_start) + 1,
                    "^\"Last-Translator: .*\"$", translator);
+    regex_replace (doc->editor->sci,
+                   header_start, find_msgstr_end_at (doc, header_start) + 1,
+                   "^\"X-Generator: .*\"$", generator);
     sci_end_undo_action (doc->editor->sci);
     
     g_free (date);
     g_free (translator);
+    g_free (generator);
     g_free (name);
     g_free (mail);
   }



--------------
This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).


More information about the Plugins-Commits mailing list