summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorrbuj <[email protected]>2019-02-19 08:58:55 +0100
committerraveit65 <[email protected]>2019-02-19 12:30:56 +0100
commitc9eb7cba9796105a4a5196ed7ef5b1ec1f2df27b (patch)
treea8bbeee9bf88e09f4b6e6ea48551debf13d220bb /src
parent5ceee4ccc6d317dabc7fd9c8e56e5c76be955297 (diff)
downloadengrampa-c9eb7cba9796105a4a5196ed7ef5b1ec1f2df27b.tar.bz2
engrampa-c9eb7cba9796105a4a5196ed7ef5b1ec1f2df27b.tar.xz
Read authors (updated) from engrampa.about gresource
Diffstat (limited to 'src')
-rw-r--r--src/Makefile.am1
-rw-r--r--src/actions.c37
-rw-r--r--src/engrampa.gresource.xml1
-rw-r--r--src/fr-window.c3
-rw-r--r--src/gtk-utils.c4
-rw-r--r--src/ui/Makefile.am1
-rw-r--r--src/ui/engrampa.about2
7 files changed, 39 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>;