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 672076 - Show "Language" and "Language code" lists in wizard alphabetically ordered
Show "Language" and "Language code" lists in wizard alphabetically ordered
Status: RESOLVED FIXED
Product: gtranslator
Classification: Other
Component: Interface
HEAD
Other Linux
: Normal enhancement
: 2.0
Assigned To: gtranslator-maint
gtranslator-maint
Depends on:
Blocks:
 
 
Reported: 2012-03-14 15:43 UTC by Daniel Mustieles
Modified: 2013-04-13 16:47 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Patch that for showing language entry sorted. (1.96 KB, patch)
2013-04-11 16:57 UTC, Marcos Chavarria Teijeiro
needs-work Details | Review
New patch. Now it sorts both lists. (2.94 KB, patch)
2013-04-12 22:59 UTC, Marcos Chavarria Teijeiro
needs-work Details | Review
New patch. Solved review problems. (2.98 KB, patch)
2013-04-13 10:36 UTC, Marcos Chavarria Teijeiro
needs-work Details | Review
New patch. Solved indent problems. (2.98 KB, patch)
2013-04-13 10:49 UTC, Marcos Chavarria Teijeiro
accepted-commit_now Details | Review

Description Daniel Mustieles 2012-03-14 15:43:11 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 :)
Comment 1 chandan kumar 2012-09-03 11:17:54 UTC
Hello,
is this bug fixed?
i found it interesting.
i want to work on this.
Comment 2 Daniel Mustieles 2012-09-03 11:23:28 UTC
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 :)
Comment 3 Marcos Chavarria Teijeiro 2013-04-11 16:57:52 UTC
Created attachment 241280 [details] [review]
Patch that for showing language entry sorted.
Comment 4 Marcos Chavarria Teijeiro 2013-04-11 17:04:01 UTC
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.
Comment 5 Ignacio Casal Quinteiro (nacho) 2013-04-11 17:40:47 UTC
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 ,
Comment 6 Marcos Chavarria Teijeiro 2013-04-11 17:44:07 UTC
> +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?
Comment 7 Marcos Chavarria Teijeiro 2013-04-12 22:59:53 UTC
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.
Comment 8 Ignacio Casal Quinteiro (nacho) 2013-04-13 08:59:36 UTC
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
Comment 9 Marcos Chavarria Teijeiro 2013-04-13 10:36:02 UTC
Created attachment 241439 [details] [review]
New patch. Solved review problems.
Comment 10 Ignacio Casal Quinteiro (nacho) 2013-04-13 10:39:33 UTC
Review of attachment 241439 [details] [review]:

mmm just realized that in the new methods you are not using a 2 spaces indentation.
Comment 11 Marcos Chavarria Teijeiro 2013-04-13 10:49:32 UTC
Created attachment 241441 [details] [review]
New patch. Solved indent problems.
Comment 12 Ignacio Casal Quinteiro (nacho) 2013-04-13 13:49:11 UTC
Review of attachment 241441 [details] [review]:

Looks good.
Comment 13 Daniel Mustieles 2013-04-13 16:47:15 UTC
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.