Skip to content
Permalink
Browse files

Read authors (updated) from engrampa.about gresource

  • Loading branch information...
rbuj authored and raveit65 committed Feb 19, 2019
1 parent 5ceee4c commit c9eb7cba9796105a4a5196ed7ef5b1ec1f2df27b
Showing with 107 additions and 10 deletions.
  1. +1 −0 src/Makefile.am
  2. +30 −7 src/actions.c
  3. +1 −0 src/engrampa.gresource.xml
  4. +2 −1 src/fr-window.c
  5. +2 −2 src/gtk-utils.c
  6. +1 −0 src/ui/Makefile.am
  7. +2 −0 src/ui/engrampa.about
  8. +68 −0 update-authors.pl
@@ -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)\" \
@@ -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 <paolo.bacchilega@libero.it>",
"Perberos <perberos@gmail.com>",
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);
}
@@ -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>
@@ -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);
}
@@ -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);
@@ -4,6 +4,7 @@ EXTRA_DIST = \
batch-add-files.ui \
batch-password.ui \
delete.ui \
engrampa.about \
menus-toolbars.ui \
new.ui \
password.ui \
@@ -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>;
@@ -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) . ';';

0 comments on commit c9eb7cb

Please sign in to comment.
You can’t perform that action at this time.