After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 484693 - Make about dialog credits section extensible
Make about dialog credits section extensible
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Widget: Other
unspecified
Other All
: Normal enhancement
: 3.4
Assigned To: gtk-bugs
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2007-10-08 12:13 UTC by peter sikking
Modified: 2012-01-25 23:26 UTC
See Also:
GNOME target: ---
GNOME version: Unversioned Enhancement


Attachments
First patch (4.08 KB, patch)
2012-01-22 10:29 UTC, Timm Bäder
reviewed Details | Review
Second version (4.40 KB, patch)
2012-01-24 11:17 UTC, Timm Bäder
needs-work Details | Review
All suggestions + GSList (4.06 KB, patch)
2012-01-24 16:33 UTC, Timm Bäder
reviewed Details | Review
Moved the declaration of new_entry to the top (4.08 KB, patch)
2012-01-24 17:05 UTC, Timm Bäder
accepted-commit_now Details | Review
Added the method to gtk3-sections.txt and gtk.symbols (4.86 KB, patch)
2012-01-24 19:41 UTC, Timm Bäder
none Details | Review
GtkAboutDialog: Make credits section extensible (5.67 KB, patch)
2012-01-25 23:25 UTC, Matthias Clasen
committed Details | Review

Description peter sikking 2007-10-08 12:13:01 UTC
At the GIMP project, user interaction and usability professionals have started contributing with evaluations, solutions, concepts, UI specifications and user tests.

The problem is crediting these people in the About dialog. The categories "author", "artist" or "documenter" do not describe the role they have.

In the About->Credits box another tab is needed. This is best added centrally by gtk, because more and more projects will see the involvement of user interaction and usability professionals.

Provisional label for the new tab: "UI design by"

Thanks.
Comment 1 peter sikking 2008-11-24 18:12:03 UTC
looking at this again, a more neutral labelling for the tab is needed.

new proposal: "Usability by"

Comment 2 Michael Natterer 2008-11-24 18:14:34 UTC
I think a small infrastructure is needed to add persons which don't fit
into any of the given categories. Adding yet another random catrgory
doesn't fix the actual problem.

I'll hack up a patch for this.
Comment 3 Matthias Clasen 2010-08-11 04:51:10 UTC
patch never came ?
Comment 4 Michael Natterer 2010-08-11 12:18:19 UTC
I simply forgot, will try to get this done after vacation, but clearly
before 3.0 freeze.
Comment 5 Javier Jardón (IRC: jjardon) 2011-01-04 13:44:07 UTC
With the About dialog redesign there is no tabs anymore. Should this be vlosed as OBSOLETE?
Comment 6 Christian Persch 2011-01-04 13:55:23 UTC
Of course not; now it should mean to need to add another section to the credits display.
Comment 7 Javier Jardón (IRC: jjardon) 2011-05-11 15:33:15 UTC
(In reply to comment #4)
> I simply forgot, will try to get this done after vacation, but clearly
> before 3.0 freeze.

Hey Mitch, do you plan to work on this for 3.2?
Comment 8 Matthias Clasen 2011-12-20 16:34:54 UTC
Maybe this is a bit big for a gnome-love task, but who knows.

Task is to implement an api like

void
gtk_about_dialog_add_credits (GtkAboutDialog  *dialog,
                              const gchar     *section_heading,
                              const gchar    **people);
Comment 9 Timm Bäder 2012-01-12 23:10:22 UTC
I'm currently looking into this and have a few questions:
- After adding that method, what about get_documenters, set_documenters, etc.? removing them is no option I guess, at least not for a 3.x release.
- Are set_documenters, etc. supposed to work WITH add_credits (-> the Credits page shows people added with both add_credits and set_documenters, etc.)?
- Is add_credits supposed to be called only once? (That would be easier to implement, but the name kinda suggests that it will be called more than once)
Comment 10 Matthias Clasen 2012-01-13 05:13:41 UTC
Leave existing calls (get_documenters/set_documenters) alone. We can't remove them, and they do no harm.
Yes, add_credits is supposed to be callable multiple times, to add multiple sections, and it should not interfere with set_documenters, etc
Comment 11 Timm Bäder 2012-01-22 10:29:25 UTC
Created attachment 205794 [details] [review]
First patch
Comment 12 Timm Bäder 2012-01-23 12:35:37 UTC
(Aww, where did my message go?)
So, that patch above should work, but I'm not sure if the g_list_free_full is enough in gtk_about_dialog_finalize. I'm also not sure about the struct I introduced, is there something missing/required when doing that?
add_credits could also replace all the set_documenters, etc. returning the documenters would be harder.
Comment 13 Matthias Clasen 2012-01-24 03:51:05 UTC
Review of attachment 205794 [details] [review]:

Apart from the minor things mentioned below, and a missing doc comment for the new api, the patch looks about right.

::: gtk/gtkaboutdialog.c
@@ +809,3 @@
   g_strfreev (priv->artists);
 
+  g_list_free_full (priv->credit_sections, NULL);

You need a destroy notify here that frees the CreditSections

::: gtk/gtkaboutdialog.h
@@ +44,3 @@
 typedef struct _GtkAboutDialogClass   GtkAboutDialogClass;
 typedef struct _GtkAboutDialogPrivate GtkAboutDialogPrivate;
+typedef struct _CreditSection         CreditSection;

That typedef should go into the .c file, since the type is not otherwise used in the api at all.

@@ +161,3 @@
 void                   gtk_about_dialog_set_logo_icon_name     (GtkAboutDialog  *about,
                                                                 const gchar     *icon_name);
+void                  gtk_about_dialog_add_credits             (GtkAboutDialog  *about,

gtk_about_dialog_add_credit_section might be a better name, after all
Comment 14 Timm Bäder 2012-01-24 11:17:17 UTC
Created attachment 205963 [details] [review]
Second version
Comment 15 Timm Bäder 2012-01-24 11:20:05 UTC
Comment on attachment 205963 [details] [review]
Second version

Tried to implement all the suggestions
Comment 16 Emmanuele Bassi (:ebassi) 2012-01-24 11:57:37 UTC
Review of attachment 205963 [details] [review]:

thanks for the new patch.

looks about right, except for a couple of leaks still, and a couple of style issues.

once the patch is corrected we can definitely land it. thanks again!

::: gtk/gtkaboutdialog.c
@@ +667,3 @@
 
+  priv->credit_sections = NULL;
+

I know it's been done right above, but there is no need to NULL-ify stuff here: the private data structure is zero filled by default, like the instance structure.

@@ +793,3 @@
+void destroy_credit_section (gpointer data)
+{
+	CreditSection *cs = (CreditSection *)data;

no need to cast: gpointer is void*

@@ +795,3 @@
+	CreditSection *cs = (CreditSection *)data;
+  g_free (cs->heading);
+  g_free (cs->people);

cs->people is a gchar**: g_free() is not enough, since you're copying it using g_strdupv(). you need g_strfreev() instead.

also, you're missing a call to "g_slice_free(CreditSection, data)" here.

@@ +2422,3 @@
+      GList *cs = NULL;
+      CreditSection *section = NULL;
+      for (cs = g_list_first (priv->credit_sections); cs; cs = g_list_next (cs))

you can use:

  GList *cs;

  for (cs = priv->credit_sections; cs != NULL; cs = cs->next)
    {
      CreditSection *section = cs->data;
      ...
    }

i.e. no need to use g_list_first() and g_list_last(); no need to cast to CreditSection*; and no need to declare (and initialize to NULL) the variables.

I also wonder if you need a GList: given that you just iterate it in one direction, a GSList would be enough.

@@ +2689,3 @@
+  new_entry->heading = g_strdup ((gchar *)section_name);
+  new_entry->people = g_strdupv ((gchar **)people);
+gtk_about_dialog_add_credit_section (GtkAboutDialog *about,

too much whitespace here.

@@ +2694,3 @@
+
+  update_credits_button_visibility (about);
+{

and too much whitespace here as well.
Comment 17 Timm Bäder 2012-01-24 16:33:34 UTC
Created attachment 205997 [details] [review]
All suggestions + GSList

That's it, I hope :)
Comment 18 Emmanuele Bassi (:ebassi) 2012-01-24 16:40:29 UTC
Review of attachment 205997 [details] [review]:

looks good to me now.

::: gtk/gtkaboutdialog.c
@@ +2683,3 @@
+  priv = about->priv;
+
+*/

last minor thing, sorry for not noticing it before: gtk does not allow C99, so no declarations after statements are allowed.
Comment 19 Timm Bäder 2012-01-24 17:05:50 UTC
Created attachment 205998 [details] [review]
Moved the declaration of new_entry to the top

I hope this was the change you wanted to see(seems totally clear now that you mention it)
Comment 20 Emmanuele Bassi (:ebassi) 2012-01-24 17:08:55 UTC
Review of attachment 205998 [details] [review]:

yes. looks good to me.
Comment 21 Matthias Clasen 2012-01-24 18:23:49 UTC
Review of attachment 205998 [details] [review]:

Yes, looks fine. 

Two final things that need to be done are to add the new function to gtk/gtk.symbols and docs/reference/gtk/gtk-sections.txt at a suitable place.
Comment 22 Timm Bäder 2012-01-24 19:41:13 UTC
Created attachment 206008 [details] [review]
Added the method to gtk3-sections.txt and gtk.symbols

Complete patch. gtk_about_dialog_add_credit_section is at the top of the gtk.symbols(because it looks like everything is ordered alphabetially) and just above gtk_show_about_dialog in the gtk3-sections.txt
Comment 23 Michael Natterer 2012-01-24 22:32:22 UTC
Yes, look good, but IMP gtk_about_dialog_add_credit_section() should
return_if_fail on section_name and people != NULL. It makes zero sense
to add empty sections.

I have some more stylistic comments, but we can play the review game
forever. Perhaps I should simply go over it once it's in git ;)
Comment 24 Matthias Clasen 2012-01-25 23:25:34 UTC
The following fix has been pushed:
d00368c GtkAboutDialog: Make credits section extensible
Comment 25 Matthias Clasen 2012-01-25 23:25:39 UTC
Created attachment 206140 [details] [review]
GtkAboutDialog: Make credits section extensible

This commit adds API that allows to add new named sections
to the Credits part of GtkAboutDialog, in addition to the
hardcoded sections for authors, documenters, artists and
translators.
Comment 26 Matthias Clasen 2012-01-25 23:26:12 UTC
Thanks for the patch, committed!