diff options
author | rbuj <[email protected]> | 2020-02-16 10:09:54 +0100 |
---|---|---|
committer | raveit65 <[email protected]> | 2020-02-27 11:59:49 +0100 |
commit | 770aff7cfae9822209e6bf45071c7473e628f7dd (patch) | |
tree | e79d1e7a0527aa79a483f3fc8a55f289837a804c /src/gpm-tray-icon.c | |
parent | 919f39972c45a501606680fb6f6c1fe5a6b8a27c (diff) | |
download | mate-power-manager-770aff7cfae9822209e6bf45071c7473e628f7dd.tar.bz2 mate-power-manager-770aff7cfae9822209e6bf45071c7473e628f7dd.tar.xz |
Read authors (updated) from mate-power-manager.about
Diffstat (limited to 'src/gpm-tray-icon.c')
-rw-r--r-- | src/gpm-tray-icon.c | 36 |
1 files changed, 29 insertions, 7 deletions
diff --git a/src/gpm-tray-icon.c b/src/gpm-tray-icon.c index f87506f..56e87b4 100644 --- a/src/gpm-tray-icon.c +++ b/src/gpm-tray-icon.c @@ -165,6 +165,9 @@ gpm_tray_icon_show_preferences_cb (GtkMenuItem *item, gpointer data) egg_warning ("Couldn't execute command: %s", command); } +#define ABOUT_GROUP "About" +#define EMAILIFY(string) (g_strdelimit ((string), "%", '@')) + /** * gpm_tray_icon_show_about_cb: * @action: A valid GtkAction @@ -172,13 +175,30 @@ gpm_tray_icon_show_preferences_cb (GtkMenuItem *item, gpointer data) static void gpm_tray_icon_show_about_cb (GtkMenuItem *item, gpointer data) { - const gchar *authors[] = - { - "Perberos", - "Steve Zesch", - "Stefano Karapetsas", - NULL - }; + GKeyFile *key_file; + GBytes *bytes; + const guint8 *data_resource; + gsize data_resource_len; + GError *error = NULL; + char **authors; + gsize n_authors = 0, i; + + bytes = g_resources_lookup_data ("/org/mate/powermanager/manager/mate-power-manager.about", + G_RESOURCE_LOOKUP_FLAGS_NONE, &error); + g_assert_no_error (error); + + data_resource = g_bytes_get_data (bytes, &data_resource_len); + key_file = g_key_file_new (); + g_key_file_load_from_data (key_file, (const char *) data_resource, data_resource_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]); gtk_show_about_dialog (NULL, "program-name", _("Power Manager"), @@ -195,6 +215,8 @@ gpm_tray_icon_show_about_cb (GtkMenuItem *item, gpointer data) "logo-icon-name", "mate-power-manager", "website", "https://mate-desktop.org", NULL); + + g_strfreev (authors); } /** |