GNOME Bugzilla – Bug 672076
Show "Language" and "Language code" lists in wizard alphabetically ordered
Last modified: 2013-04-13 16:47:15 UTC
There are two lists in the initial wizard (Language an Language code) that are not ordered. It would be more easier to the final user to have this lists ordered. Thanks :)
Hello, is this bug fixed? i found it interesting. i want to work on this.
Hi! It isn't fixed, so you are really welcome to help with this issue. Please feel free to add comments or patches in this bug. Many thanks for your help :)
Created attachment 241280 [details] [review] Patch that for showing language entry sorted.
Now the "Language" list is sorted but the "Language code" box is not. The problems is the way this items are added to the list_store. Both fields come from a list of Language objects. This list can be sorted using language name and then language name list will be sorted or it can be sorted using language codes and then the language code list will be sorted. I take the first option.
Review of attachment 241280 [details] [review]: See inline comments. ::: src/gtr-languages-fetcher.c @@ +51,3 @@ static guint signals[LAST_SIGNAL] = { 0 }; +gint _compare_languages (gconstpointer a, gconstpointer b); no need for prototype if you put the method in the right place @@ +80,3 @@ +gint +_compare_languages (gconstpointer a, gconstpointer b) do not add underscore @@ +85,3 @@ + const gchar *name1, *name2; + + lang1 = (GtrLanguage *) a; use GTR_LANGUAGE (a) @@ +104,2 @@ languages = gtr_language_get_languages (); + languages = g_slist_sort(languages,_compare_languages); missing space before ( and after ,
> +gint _compare_languages (gconstpointer a, gconstpointer b); > > no need for prototype if you put the method in the right place > What is the right place?
Created attachment 241421 [details] [review] New patch. Now it sorts both lists. I have solved almost all problems of the last review. GTR_LANGUAGE (a) notation isn't used by any file and it isn't defined.
Review of attachment 241421 [details] [review]: See comments inline. ::: src/gtr-languages-fetcher.c @@ +78,3 @@ +static gint +compare_languages_name (gconstpointer a, gconstpointer b) here the parameters should be splitted into one per line. @@ +93,3 @@ + +static gint +compare_languages_code (gconstpointer a, gconstpointer b) same here. @@ +132,3 @@ + languages = g_slist_sort (languages, compare_languages_code); + + for (l = languages; l != NULL; l = (const GSList *)g_list_next (l)) this is wrong, you should not cast and you should use g_slist_next
Created attachment 241439 [details] [review] New patch. Solved review problems.
Review of attachment 241439 [details] [review]: mmm just realized that in the new methods you are not using a 2 spaces indentation.
Created attachment 241441 [details] [review] New patch. Solved indent problems.
Review of attachment 241441 [details] [review]: Looks good.
This problem has been fixed in the development version. The fix will be available in the next major software release. Thank you for your bug report.