summaryrefslogtreecommitdiff
path: root/src/math-window.c
diff options
context:
space:
mode:
authorrbuj <[email protected]>2020-02-15 17:34:52 -0500
committerraveit65 <[email protected]>2020-02-25 00:36:10 +0100
commita4a6cc277bb959b0345efc5158576e6db2b7b1e0 (patch)
tree564e34337ced508f0d9a8a279a24c146db749085 /src/math-window.c
parentf7b4543c6de19395cc0b58df4a8c32adf0178982 (diff)
downloadmate-calc-a4a6cc277bb959b0345efc5158576e6db2b7b1e0.tar.bz2
mate-calc-a4a6cc277bb959b0345efc5158576e6db2b7b1e0.tar.xz
Read authors (updated) from mate-calc.about
Diffstat (limited to 'src/math-window.c')
-rw-r--r--src/math-window.c36
1 files changed, 29 insertions, 7 deletions
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 <[email protected]>",
- "Robert Ancell <[email protected]>",
- "Klaus Niederkrüger <[email protected]>",
- 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);
}