[epiphany] Credits: Use standard about dialog functions



commit f720afcb121b31626152b67d6bf6bf4961e13b9f
Author: Jan-Michael Brummer <jan brummer tabos org>
Date:   Sun Jul 14 17:38:53 2019 +0200

    Credits: Use standard about dialog functions
    
    Fixes: https://gitlab.gnome.org/GNOME/epiphany/issues/850

 src/window-commands.c | 44 +++++++++++++++++++++++++++++++++++---------
 1 file changed, 35 insertions(+), 9 deletions(-)
---
diff --git a/src/window-commands.c b/src/window-commands.c
index 1575484d5..8c534c962 100644
--- a/src/window-commands.c
+++ b/src/window-commands.c
@@ -577,7 +577,11 @@ window_cmd_show_about (GSimpleAction *action,
   GKeyFile *key_file;
   GBytes *bytes;
   GError *error = NULL;
-  char **authors, **maintainers, **past_maintainers, **contributors, **artists, **documenters;
+  char **orig_authors, **maintainers, **past_maintainers, **contributors, **artists, **documenters;
+  char **authors = NULL;
+  guint index;
+  guint author_index = 0;
+  guint length;
 
   key_file = g_key_file_new ();
   bytes = g_resources_lookup_data ("/org/gnome/epiphany/about.ini", 0, NULL);
@@ -589,7 +593,7 @@ window_cmd_show_about (GSimpleAction *action,
   }
   g_bytes_unref (bytes);
 
-  authors = g_key_file_get_string_list (key_file, ABOUT_GROUP, "Author", NULL, NULL);
+  orig_authors = g_key_file_get_string_list (key_file, ABOUT_GROUP, "Author", NULL, NULL);
   maintainers = g_key_file_get_string_list (key_file, ABOUT_GROUP, "Maintainers", NULL, NULL);
   past_maintainers = g_key_file_get_string_list (key_file, ABOUT_GROUP, "PastMaintainers", NULL, NULL);
   contributors = g_key_file_get_string_list (key_file, ABOUT_GROUP, "Contributors", NULL, NULL);
@@ -624,15 +628,37 @@ window_cmd_show_about (GSimpleAction *action,
   gtk_about_dialog_set_website_label (dialog, _("Website"));
   gtk_about_dialog_set_logo_icon_name (dialog, APPLICATION_ID);
 
-  /* We have to use add_credit_section() for documenters and artists to
-   * ensure maintainers get sorted first. */
+  length = g_strv_length (orig_authors) +
+           g_strv_length (maintainers) +
+           g_strv_length (past_maintainers) +
+           g_strv_length (contributors) +
+           3;
+
+  authors = g_malloc0 (sizeof (char *) * (length + 1));
+
+  for (index = 0; index < g_strv_length (orig_authors); index++)
+    authors[author_index++] = g_strdup (orig_authors[index]);
+
+  authors[author_index++] = g_strdup ("");
+
+  for (index = 0; index < g_strv_length (maintainers); index++)
+    authors[author_index++] = g_strdup (maintainers[index]);
+
+  authors[author_index++] = g_strdup ("");
+
+  for (index = 0; index < g_strv_length (past_maintainers); index++)
+    authors[author_index++] = g_strdup (past_maintainers[index]);
+
+  authors[author_index++] = g_strdup ("");
+
+  for (index = 0; index < g_strv_length (contributors); index++) {
+    authors[author_index++] = g_strdup (contributors[index]);
+  }
+
   gtk_about_dialog_set_authors (dialog, (const char **)authors);
+  gtk_about_dialog_set_artists (dialog, (const char **)artists);
+  gtk_about_dialog_set_documenters (dialog, (const char **)documenters);
   gtk_about_dialog_set_translator_credits (dialog, _("translator-credits"));
-  gtk_about_dialog_add_credit_section (dialog, _("Current maintainers"), (const char **)maintainers);
-  gtk_about_dialog_add_credit_section (dialog, _("Past maintainers"), (const char **)past_maintainers);
-  gtk_about_dialog_add_credit_section (dialog, _("Documented by"), (const char **)documenters);
-  gtk_about_dialog_add_credit_section (dialog, _("Artwork by"), (const char **)artists);
-  gtk_about_dialog_add_credit_section (dialog, _("Contributors"), (const char **)contributors);
 
   gtk_dialog_run (GTK_DIALOG (dialog));
   gtk_widget_destroy (GTK_WIDGET (dialog));


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]