From 770aff7cfae9822209e6bf45071c7473e628f7dd Mon Sep 17 00:00:00 2001 From: rbuj Date: Sun, 16 Feb 2020 10:09:54 +0100 Subject: Read authors (updated) from mate-power-manager.about --- data/Makefile.am | 4 +- data/mate-power-manager.about | 2 + data/org.mate.power-manager.manager.gresource.xml | 22 +++++++ src/Makefile.am | 10 +++ src/gpm-tray-icon.c | 36 +++++++++-- update-authors.pl | 78 +++++++++++++++++++++++ 6 files changed, 144 insertions(+), 8 deletions(-) create mode 100644 data/mate-power-manager.about create mode 100644 data/org.mate.power-manager.manager.gresource.xml create mode 100755 update-authors.pl diff --git a/data/Makefile.am b/data/Makefile.am index 7225949..03f40f2 100644 --- a/data/Makefile.am +++ b/data/Makefile.am @@ -41,10 +41,12 @@ EXTRA_DIST = \ $(gsettings_schemas_in_files) \ $(pkgdata_DATA) \ $(man_MANS) \ + org.mate.power-manager.manager.gresource.xml \ org.mate.power-manager.preferences.gresource.xml \ org.mate.power-manager.statistics.gresource.xml \ gpm-prefs.ui \ - gpm-statistics.ui + gpm-statistics.ui \ + mate-power-manager.about clean-local : rm -f *~ diff --git a/data/mate-power-manager.about b/data/mate-power-manager.about new file mode 100644 index 0000000..a04843c --- /dev/null +++ b/data/mate-power-manager.about @@ -0,0 +1,2 @@ +[About] +Authors=Antoine Jacoutot ;Anton V. Boyarshinov ;Brent Hull ;Clement Lefebvre ;Colomban Wendling ;Dan Mashal ;Denis Gorodnichev ;Edward Betts ;Elan Ruusamäe ;Fabio Erculiani ;György Balló ;Jack Steele ;Laine Walker-Avina ;Laurent Napias ;Marcel Dijkstra ;Martin Wimpress ;Matt Spaulding ;Matthew Pottage ;Mike Gabriel ;Mikhail Shevtsov ;Nelson Marques ;Nutchanon Wetchasit https://github.com/nachanon;Pablo Barciela ;Pedro Martinez-Julia ;Piotr Drąg ;Robert Buj ;Robert Nagy ;Roy Zhang ;Sander Sweers ;Sorokin Alexei ;Stefan Seyfried ;Stefano Karapetsas ;Stephen Kent ;Steve Zesch ;Victor Kareh ;Vlad Orlov ;William Brown ;Wolfgang Ulbrich ;Wu Xiaotian ;Yaakov Selkowitz ;Zhang Xianwei ;fhucho ;lukefromdc ; diff --git a/data/org.mate.power-manager.manager.gresource.xml b/data/org.mate.power-manager.manager.gresource.xml new file mode 100644 index 0000000..d880c9b --- /dev/null +++ b/data/org.mate.power-manager.manager.gresource.xml @@ -0,0 +1,22 @@ + + + + + mate-power-manager.about + + diff --git a/src/Makefile.am b/src/Makefile.am index aed9cc9..1778cef 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -151,6 +151,14 @@ mate_power_preferences_CFLAGS = \ $(WARN_CFLAGS) \ $(NULL) +mate-power-manager-resources.h mate-power-manager-resources.c: $(srcdir)/../data/org.mate.power-manager.manager.gresource.xml Makefile $(shell $(GLIB_COMPILE_RESOURCES) --generate-dependencies --sourcedir $(srcdir)/../data $(srcdir)/../data/org.mate.power-manager.manager.gresource.xml) + $(AM_V_GEN) XMLLINT=$(XMLLINT) $(GLIB_COMPILE_RESOURCES) --target $@ --sourcedir $(srcdir)/../data --generate --c-name preferences $< + +nodist_mate_power_manager_SOURCES = \ + mate-power-manager-resources.h \ + mate-power-manager-resources.c \ + $(NULL) + mate_power_manager_SOURCES = \ gpm-dpms.h \ gpm-dpms.c \ @@ -316,6 +324,8 @@ clean-local: CLEANFILES = \ $(BUILT_SOURCES) \ + mate-power-manager-resources.h \ + mate-power-manager-resources.c \ mate-power-preferences-resources.h \ mate-power-preferences-resources.c \ mate-power-statistics-resources.h \ diff --git a/src/gpm-tray-icon.c b/src/gpm-tray-icon.c index f87506f..56e87b4 100644 --- a/src/gpm-tray-icon.c +++ b/src/gpm-tray-icon.c @@ -165,6 +165,9 @@ gpm_tray_icon_show_preferences_cb (GtkMenuItem *item, gpointer data) egg_warning ("Couldn't execute command: %s", command); } +#define ABOUT_GROUP "About" +#define EMAILIFY(string) (g_strdelimit ((string), "%", '@')) + /** * gpm_tray_icon_show_about_cb: * @action: A valid GtkAction @@ -172,13 +175,30 @@ gpm_tray_icon_show_preferences_cb (GtkMenuItem *item, gpointer data) static void gpm_tray_icon_show_about_cb (GtkMenuItem *item, gpointer data) { - const gchar *authors[] = - { - "Perberos", - "Steve Zesch", - "Stefano Karapetsas", - NULL - }; + GKeyFile *key_file; + GBytes *bytes; + const guint8 *data_resource; + gsize data_resource_len; + GError *error = NULL; + char **authors; + gsize n_authors = 0, i; + + bytes = g_resources_lookup_data ("/org/mate/powermanager/manager/mate-power-manager.about", + G_RESOURCE_LOOKUP_FLAGS_NONE, &error); + g_assert_no_error (error); + + data_resource = g_bytes_get_data (bytes, &data_resource_len); + key_file = g_key_file_new (); + g_key_file_load_from_data (key_file, (const char *) data_resource, data_resource_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]); gtk_show_about_dialog (NULL, "program-name", _("Power Manager"), @@ -195,6 +215,8 @@ gpm_tray_icon_show_about_cb (GtkMenuItem *item, gpointer data) "logo-icon-name", "mate-power-manager", "website", "https://mate-desktop.org", NULL); + + g_strfreev (authors); } /** diff --git a/update-authors.pl b/update-authors.pl new file mode 100755 index 0000000..3fb9a9d --- /dev/null +++ b/update-authors.pl @@ -0,0 +1,78 @@ +#!/usr/bin/perl +=pod + + update-authors.pl is part of MATE Power Manager. + + MATE Power Manager 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 Power Manager 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 Power Manager. 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 'Nachanon Vetjasit ' and $_ = 'Nutchanon Wetchasit ' 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 'Victor Kareh 'and $_ = 'Victor Kareh ' for @authors; + $_ eq 'Wolfgang Ulbrich ' and $_ = 'Wolfgang Ulbrich ' for @authors; + $_ eq 'ZenWalker ' and $_ = 'Pablo Barciela ' for @authors; + return @authors; +} + +sub GetCurrentAuthors { + my @authors; + open(FILE,"data/mate-power-manager.about") or die "Can't open data/mate-power-manager.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; +for (@B) { + s/<\d+\+(.+?)%users\.noreply\.github\.com>/<$1%users\.noreply\.github\.com>/; + s/<(.+?)%users\.noreply\.github\.com>/https:\/\/github.com\/$1/; +} +my @merged = sort { $a cmp $b } keys %{{map {($_ => 1)} (@A, @B)}}; +print join(';',@merged) . ';'; -- cgit v1.2.1