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:37:06 +0100
commit49e8bf7b13b204cb2793028f0b3babe76e2b6eaa (patch)
tree82f544ccc1c59b93af7f5a877d0687385e86ed3c /src/math-window.c
parentac3cec59df7080416a3a0152bbf5f103524ac514 (diff)
downloadmate-calc-49e8bf7b13b204cb2793028f0b3babe76e2b6eaa.tar.bz2
mate-calc-49e8bf7b13b204cb2793028f0b3babe76e2b6eaa.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);
}