diff options
author | rbuj <[email protected]> | 2019-02-19 08:58:55 +0100 |
---|---|---|
committer | raveit65 <[email protected]> | 2019-02-19 12:30:56 +0100 |
commit | c9eb7cba9796105a4a5196ed7ef5b1ec1f2df27b (patch) | |
tree | a8bbeee9bf88e09f4b6e6ea48551debf13d220bb | |
parent | 5ceee4ccc6d317dabc7fd9c8e56e5c76be955297 (diff) | |
download | engrampa-c9eb7cba9796105a4a5196ed7ef5b1ec1f2df27b.tar.bz2 engrampa-c9eb7cba9796105a4a5196ed7ef5b1ec1f2df27b.tar.xz |
Read authors (updated) from engrampa.about gresource
-rw-r--r-- | src/Makefile.am | 1 | ||||
-rw-r--r-- | src/actions.c | 37 | ||||
-rw-r--r-- | src/engrampa.gresource.xml | 1 | ||||
-rw-r--r-- | src/fr-window.c | 3 | ||||
-rw-r--r-- | src/gtk-utils.c | 4 | ||||
-rw-r--r-- | src/ui/Makefile.am | 1 | ||||
-rw-r--r-- | src/ui/engrampa.about | 2 | ||||
-rwxr-xr-x | update-authors.pl | 68 |
8 files changed, 107 insertions, 10 deletions
diff --git a/src/Makefile.am b/src/Makefile.am index 49adf26..383a4c2 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -26,6 +26,7 @@ AM_CPPFLAGS = \ -I$(top_srcdir)/copy-n-paste/ \ -I$(top_srcdir) \ -I$(top_builddir) \ + -DENGRAMPA_RESOURCE_UI_PATH="\"/org/mate/Engrampa/ui\"" \ -DFR_PREFIX=\"$(prefix)\" \ -DFR_SYSCONFDIR=\"$(sysconfdir)\" \ -DFR_DATADIR=\"$(datadir)\" \ diff --git a/src/actions.c b/src/actions.c index 0287b40..974af9f 100644 --- a/src/actions.c +++ b/src/actions.c @@ -21,6 +21,7 @@ */ #include <config.h> +#include <glib.h> #include <string.h> #include <math.h> #include <sys/types.h> @@ -841,16 +842,14 @@ activate_action_manual (GtkAction *action, } +#define ABOUT_GROUP "About" +#define EMAILIFY(string) (g_strdelimit ((string), "%", '@')) + void activate_action_about (GtkAction *action, - gpointer data) + gpointer gp) { - FrWindow *window = data; - const char *authors[] = { - "Paolo Bacchilega <[email protected]>", - "Perberos <[email protected]>", - NULL - }; + FrWindow *window = gp; const char *documenters [] = { "Alexander Kirillov", "Breda McColgan", @@ -870,6 +869,29 @@ activate_action_about (GtkAction *action, "51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA") }; char *license_text; + 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 (ENGRAMPA_RESOURCE_UI_PATH G_DIR_SEPARATOR_S "engrampa.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]); license_text = g_strjoin ("\n\n", _(license[0]), _(license[1]), _(license[2]), NULL); @@ -887,5 +909,6 @@ activate_action_about (GtkAction *action, "website", "http://mate-desktop.org", NULL); + g_strfreev (authors); g_free (license_text); } diff --git a/src/engrampa.gresource.xml b/src/engrampa.gresource.xml index 0b944bf..41d4c2e 100644 --- a/src/engrampa.gresource.xml +++ b/src/engrampa.gresource.xml @@ -6,6 +6,7 @@ <file compressed="true">ui/batch-add-files.ui</file> <file compressed="true">ui/batch-password.ui</file> <file compressed="true">ui/delete.ui</file> + <file compressed="true">ui/engrampa.about</file> <file compressed="true">ui/menus-toolbars.ui</file> <file compressed="true">ui/new.ui</file> <file compressed="true">ui/password.ui</file> diff --git a/src/fr-window.c b/src/fr-window.c index 7162441..2fc9736 100644 --- a/src/fr-window.c +++ b/src/fr-window.c @@ -23,6 +23,7 @@ #include <math.h> #include <string.h> +#include <glib.h> #include <glib/gi18n.h> #include <gio/gio.h> #include <gdk/gdk.h> @@ -5997,7 +5998,7 @@ fr_window_construct (FrWindow *window) g_cclosure_new_swap (G_CALLBACK (fr_window_close), window, NULL)); - if (! gtk_ui_manager_add_ui_from_resource (ui, "/org/mate/Engrampa/ui/menus-toolbars.ui", &error)) { + if (! gtk_ui_manager_add_ui_from_resource (ui, ENGRAMPA_RESOURCE_UI_PATH G_DIR_SEPARATOR_S "menus-toolbars.ui", &error)) { g_message ("building menus failed: %s", error->message); g_error_free (error); } diff --git a/src/gtk-utils.c b/src/gtk-utils.c index 533a335..b8e3263 100644 --- a/src/gtk-utils.c +++ b/src/gtk-utils.c @@ -22,11 +22,11 @@ #include <config.h> #include <string.h> +#include <glib.h> #include <gtk/gtk.h> #include "gtk-utils.h" #define LOAD_BUFFER_SIZE 65536 -#define ENGRAMPA_RESOURCE_UI_PATH "/org/mate/Engrampa/ui/" static void count_selected (GtkTreeModel *model, @@ -783,7 +783,7 @@ _gtk_builder_new_from_resource (const char *resource_path) GError *error = NULL; builder = gtk_builder_new (); - full_path = g_strconcat (ENGRAMPA_RESOURCE_UI_PATH, resource_path, NULL); + full_path = g_strconcat (ENGRAMPA_RESOURCE_UI_PATH G_DIR_SEPARATOR_S, resource_path, NULL); if (! gtk_builder_add_from_resource (builder, full_path, &error)) { g_warning ("%s\n", error->message); g_clear_error (&error); diff --git a/src/ui/Makefile.am b/src/ui/Makefile.am index 5f1cd54..84cbd90 100644 --- a/src/ui/Makefile.am +++ b/src/ui/Makefile.am @@ -4,6 +4,7 @@ EXTRA_DIST = \ batch-add-files.ui \ batch-password.ui \ delete.ui \ + engrampa.about \ menus-toolbars.ui \ new.ui \ password.ui \ diff --git a/src/ui/engrampa.about b/src/ui/engrampa.about new file mode 100644 index 0000000..a397e2c --- /dev/null +++ b/src/ui/engrampa.about @@ -0,0 +1,2 @@ +[About] +Authors=Adam Erdman <hekel%archlinux.info>;Alexander von Gluck IV <kallisti5%unixzen.com>;Balló György <ballogyor%gmail.com>;Dmitry Mikhirev <mikhirev%users.noreply.github.com>;Elias Aebi <user142%hotmail.com>;Iain Nicol <iainn%src.gnome.org>;Ingo Saitz <Ingo.Saitz%stud.uni-hannover.de>;Leigh Scott <leigh123linux%googlemail.com>;Martin Wimpress <martin.wimpress%canonical.com>;Nelson Marques <nmo.marques%gmail.com>;Oz N Tiram <nahumoz%gmail.com>;Pablo Barciela <scow%riseup.net>;Paolo Bacchilega <paobac%gnome.org>;Perberos <perberos%gmail.com>;Piotr Drąg <piotrdrag%gmail.com>;Robert Buj <robert.buj%gmail.com>;Sander Sweers <infirit%gmail.com>;Scott Balneaves <sbalneav%alburg.net>;Sergey Ponomarev <stokito%gmail.com>;Stefano Karapetsas <stefano%karapetsas.com>;Steve Zesch <stevezesch2%gmail.com>;Victor Kareh <vkareh%vkareh.net>;Vlad Orlov <monsta%inbox.ru>;Wolfgang Ulbrich <mate%raveit.de>;Wu Xiaotian <yetist%gmail.com>;ZenWalker <scow%riseup.net>; diff --git a/update-authors.pl b/update-authors.pl new file mode 100755 index 0000000..9d7b44e --- /dev/null +++ b/update-authors.pl @@ -0,0 +1,68 @@ +#!/usr/bin/perl +=pod + + update-authors.pl is part of Engrampa. + + Engrampa 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. + + Engrampa 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 Engrampa. If not, see <http://www.gnu.org/licenses/>. + +=cut +use strict; +use warnings; + +sub ReplaceAuthors { + my @authors = @_; + $_ eq 'bl0ckeduser <bl0ckedusersoft%gmail.com>' and $_ = 'Gabriel Cormier-Affleck <bl0ckedusersoft%gmail.com>' for @authors; + $_ eq 'hekel <hekel%archlinux.info>' and $_ = 'Adam Erdman <hekel%archlinux.info>' for @authors; + $_ eq 'infirit <infirit%gmail.com>' and $_ = 'Sander Sweers <infirit%gmail.com>' for @authors; + $_ eq 'leigh123linux <leigh123linux%googlemail.com>' and $_ = 'Leigh Scott <leigh123linux%googlemail.com>' for @authors; + $_ eq 'lyokha <alexey.radkov%gmail.com>' and $_ = 'Alexey Radkov <alexey.radkov%gmail.com>' for @authors; + $_ eq 'Martin Wimpress <martin%mate-desktop.org>' and $_ = 'Martin Wimpress <martin.wimpress%canonical.com>' for @authors; + $_ eq 'Martin Wimpress <code%flexion.org>' and $_ = 'Martin Wimpress <martin.wimpress%canonical.com>' for @authors; + $_ eq 'monsta <monsta%inbox.ru>' and $_ = 'Vlad Orlov <monsta%inbox.ru>' for @authors; + $_ eq 'Monsta <monsta%inbox.ru>' and $_ = 'Vlad Orlov <monsta%inbox.ru>' for @authors; + $_ eq 'Oz <nahumoz%gmail.com>' and $_ = 'Oz N Tiram <nahumoz%gmail.com>' for @authors; + $_ eq 'Paolo Bacchilega <paobac%src.gnome.org>' and $_ = 'Paolo Bacchilega <paobac%gnome.org>' for @authors; + $_ eq 'Paolo Bacchilega <paolo.bacchilega%libero.it>' and $_ = 'Paolo Bacchilega <paobac%gnome.org>' for @authors; + $_ eq 'raveit <chat-to-me%raveit.de>' and $_ = 'Wolfgang Ulbrich <mate%raveit.de>' for @authors; + $_ eq 'raveit65 <chat-to-me%raveit.de>' and $_ = 'Wolfgang Ulbrich <mate%raveit.de>' for @authors; + $_ eq 'raveit65 <mate%raveit.de>' and $_ = 'Wolfgang Ulbrich <mate%raveit.de>' for @authors; + $_ eq 'rbuj <robert.buj%gmail.com>' and $_ = 'Robert Buj <robert.buj%gmail.com>' for @authors; + $_ eq 'Scott Balneaves <sbalneav%ltsp.org>' and $_ = 'Scott Balneaves <sbalneav%mate-desktop.org>' for @authors; + $_ eq 'sc0w <scow%riseup.net>' and $_ = 'ZenWalker <scow%riseup.net>' for @authors; + $_ eq 'Wolfgang Ulbrich <chat-to-me%raveit.de>' and $_ = 'Wolfgang Ulbrich <mate%raveit.de>' for @authors; + return @authors; +} + +sub GetCurrentAuthors { + my @authors; + open(FILE,"src/ui/engrampa.about") or die "Can't open src/ui/engrampa.about"; + while (<FILE>) { + 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) . ';'; |