From 49e8bf7b13b204cb2793028f0b3babe76e2b6eaa Mon Sep 17 00:00:00 2001 From: rbuj Date: Sat, 15 Feb 2020 17:34:52 -0500 Subject: Read authors (updated) from mate-calc.about --- src/Makefile.am | 1 + src/mate-calc.about | 2 + src/math-window.c | 36 ++++++++++++++---- src/org.mate.calculator.gresource.xml | 1 + update-authors.pl | 71 +++++++++++++++++++++++++++++++++++ 5 files changed, 104 insertions(+), 7 deletions(-) create mode 100644 src/mate-calc.about create mode 100755 update-authors.pl diff --git a/src/Makefile.am b/src/Makefile.am index b6690a1..df5fccd 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -190,6 +190,7 @@ EXTRA_DIST = \ buttons-basic.ui \ buttons-financial.ui \ buttons-programming.ui \ + mate-calc.about \ mp-enums.c.template \ mp-enums.h.template \ org.mate.calculator.gresource.xml \ diff --git a/src/mate-calc.about b/src/mate-calc.about new file mode 100644 index 0000000..ba1664a --- /dev/null +++ b/src/mate-calc.about @@ -0,0 +1,2 @@ +[About] +Authors=Abel McClendon ;Adam Erdman ;Alexander von Gluck IV ;Alexei Sorokin ;Allan Nordhøy ;Christopher Fujino ;Clement Lefebvre ;Friedel Wolff ;JP Cimalando ;Klaus Niederkrüger ;Laszlo Boros ;Laurent Napias ;Marcel Dijkstra ;Mark Thomas ;Martin Wimpress ;Michael Terry ;Mike Gabriel ;Nikolay Martynov ;Pablo Barciela ;Perberos ;Piotr Drąg ;Rich Burridge ;Robert Ancell ;Robert Buj ;Sander Sweers ;Scott Balneaves ;Sorokin Alexei ;Stefan Tauner ;Stefano Karapetsas ;Stephen Krauth ;Steve Zesch ;Victor Kareh ;Vlad Orlov ;Wolfgang Ulbrich ;Wu Xiaotian ; diff --git a/src/math-window.c b/src/math-window.c index ca31f4e..9030893 100644 --- a/src/math-window.c +++ b/src/math-window.c @@ -221,15 +221,11 @@ static void help_cb(GtkWidget *widget, MathWindow *window) } } +#define ABOUT_GROUP "About" +#define EMAILIFY(string) (g_strdelimit ((string), "%", '@')) + static void about_cb(GtkWidget* widget, MathWindow* window) { - const char* authors[] = { - "Rich Burridge ", - "Robert Ancell ", - "Klaus Niederkrüger ", - NULL - }; - const char* documenters[] = { N_("Sun Microsystems"), N_("MATE Documentation Team"), @@ -252,6 +248,31 @@ static void about_cb(GtkWidget* widget, MathWindow* window) }; char *license_trans = g_strjoin ("\n\n", _(license[0]), _(license[1]), _(license[2]), NULL); + + GKeyFile *key_file; + GBytes *bytes; + const guint8 *data; + gsize data_len; + GError *error = NULL; + char **authors; + gsize n_authors = 0, i; + + bytes = g_resources_lookup_data ("/org/mate/calculator/ui/mate-calc.about", G_RESOURCE_LOOKUP_FLAGS_NONE, &error); + g_assert_no_error (error); + + data = g_bytes_get_data (bytes, &data_len); + key_file = g_key_file_new (); + g_key_file_load_from_data (key_file, (const char *) data, data_len, 0, &error); + g_assert_no_error (error); + + authors = g_key_file_get_string_list (key_file, ABOUT_GROUP, "Authors", &n_authors, NULL); + + g_key_file_free (key_file); + g_bytes_unref (bytes); + + for (i = 0; i < n_authors; ++i) + authors[i] = EMAILIFY (authors[i]); + const char **p; for (p = documenters; *p; ++p) @@ -274,6 +295,7 @@ static void about_cb(GtkWidget* widget, MathWindow* window) "logo-icon-name", "accessories-calculator", NULL); + g_strfreev (authors); g_free (license_trans); } diff --git a/src/org.mate.calculator.gresource.xml b/src/org.mate.calculator.gresource.xml index c31c1ba..6766402 100644 --- a/src/org.mate.calculator.gresource.xml +++ b/src/org.mate.calculator.gresource.xml @@ -21,6 +21,7 @@ buttons-basic.ui buttons-financial.ui buttons-programming.ui + mate-calc.about preferences.ui diff --git a/update-authors.pl b/update-authors.pl new file mode 100755 index 0000000..4d5ede1 --- /dev/null +++ b/update-authors.pl @@ -0,0 +1,71 @@ +#!/usr/bin/perl +=pod + + update-authors.pl is part of mate-calc. + + mate-calc is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 2 of the License, or + (at your option) any later version. + + mate-calc is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with mate-calc. If not, see . + +=cut +use strict; +use warnings; + +sub ReplaceAuthors { + my @authors = @_; + $_ eq 'Alexander ' and $_ = 'Alexander Ovchinnikov ' for @authors; + $_ eq 'bl0ckeduser ' and $_ = 'Gabriel Cormier-Affleck ' for @authors; + $_ eq 'Glorf ' and $_ = 'Michał Bień ' for @authors; + $_ eq 'hekel ' and $_ = 'Adam Erdman ' for @authors; + $_ eq 'infirit ' and $_ = 'Sander Sweers ' for @authors; + $_ eq 'Jason Crain ' and $_ = 'Jason Crain ' for @authors; + $_ eq 'José Aliste ' and $_ = 'José Aliste ' for @authors; + $_ eq 'leigh123linux ' and $_ = 'Leigh Scott ' for @authors; + $_ eq 'lyokha ' and $_ = 'Alexey Radkov ' for @authors; + $_ eq 'Martin Wimpress ' and $_ = 'Martin Wimpress ' for @authors; + $_ eq 'monsta ' and $_ = 'Vlad Orlov ' for @authors; + $_ eq 'Monsta ' and $_ = 'Vlad Orlov ' for @authors; + $_ eq 'oz123 ' and $_ = 'Oz N Tiram ' for @authors; + $_ eq 'Piiit ' and $_ = 'Peter Moser ' for @authors; + $_ eq 'rootavish ' and $_ = 'Avishkar Gupta ' for @authors; + $_ eq 'rootavish ' and $_ = 'Avishkar Gupta ' for @authors; + $_ eq 'raveit ' and $_ = 'Wolfgang Ulbrich ' for @authors; + $_ eq 'raveit65 ' and $_ = 'Wolfgang Ulbrich ' for @authors; + $_ eq 'raveit65 ' and $_ = 'Wolfgang Ulbrich ' for @authors; + $_ eq 'rbuj ' and $_ = 'Robert Buj ' for @authors; + $_ eq 'Scott Balneaves ' and $_ = 'Scott Balneaves ' for @authors; + $_ eq 'Wolfgang Ulbrich ' and $_ = 'Wolfgang Ulbrich ' for @authors; + return @authors; +} + +sub GetCurrentAuthors { + my @authors; + open(FILE,"src/mate-calc.about") or die "Can't open src/mate-calc.about""; + while () { + if (/^Authors=*(.+)$/) { + @authors=split(";",$1); + } + } + close FILE; + return ReplaceAuthors(@authors); +} + +sub GetNewAuthors { + my @authors = `git log --pretty="%an <%ae>" --since "2012-01-01" -- . "_.h" "_.c" | sort | uniq | sed 's/@/%/g' | sed '/^mate-i18n.*/d'`; + chomp @authors; + return ReplaceAuthors(@authors); +} + +my @A = GetCurrentAuthors; +my @B = GetNewAuthors; +my @merged = sort { $a cmp $b } keys %{{map {($_ => 1)} (@A, @B)}}; +print join(';',@merged) . ';'; -- cgit v1.2.1