Bug 532832 - Spelling propositions when multi language support
Spelling propositions when multi language support
Status: RESOLVED FIXED
Product: empathy
Classification: Core
Component: Chat
unspecified
Other Linux
: Normal normal
: ---
Assigned To: empathy-maint
:
Depends on:
Blocks:
  Show dependency tree
 
Reported: 2008-05-12 19:59 UTC by Laurent Claessens
Modified: 2011-08-29 10:12 UTC (History)
4 users (show)

See Also:
GNOME target: ---
GNOME version: ---


Attachments
proposed fix (8.19 KB, patch)
2010-09-24 23:17 UTC, Vitaly Minko
reviewed Details | Diff | Review
updated patch (8.26 KB, patch)
2010-10-13 17:39 UTC, Vitaly Minko
reviewed Details | Diff | Review
updated updated patch (10.98 KB, patch)
2010-10-14 18:30 UTC, Vitaly Minko
committed Details | Diff | Review

Description Laurent Claessens 2008-05-12 19:59:42 UTC
I ask Empathy to check the spelling in English and French. Now, in a french speaking chat, the spelling propositions (right button on a red word) Empathy proposes in the same time propositions in English and in French.

As example, the spelling propositions for "deformatino" are (amon others):

deformation 
déformation (notice the accent : this is a French proposition)
deforming
...

It would be better to select a "default" language for spelling correction, and to be able to change it in each single conversation windows. Even better : the possibility to select a prefered language for each contact.

Thank for all
Comment 1 Xavier Claessens 2008-05-21 09:44:07 UTC
I often use English words inside a French conversation. I think it would be great to just split propositions for each language, like xchat-gnome does.
Comment 2 Frederic Peters 2008-06-22 17:01:32 UTC
Most easy would just be to remove gtk_tree_view_column_set_sort_column_id (column, COL_SPELL_WORD) in empathy-spell-dialog.c; so that suggestions will be sorted by languages (it would miss a separator between languages, but this is harder to do).

Also I like the way xchat-gnome uses a submenu instead of a dialog to provide suggestions.
Comment 3 Guillaume Desmottes 2008-11-23 21:08:43 UTC
Strong +1 do to it as xchat-gnome.
Comment 4 Vitaly Minko 2010-09-24 23:17:19 UTC
Created attachment 171070 [details] [review]
proposed fix
Comment 5 Guillaume Desmottes 2010-09-27 08:22:09 UTC
Thanks for the patch. I totally want it for 3.0. I'll review it soonish.
Comment 6 Guillaume Desmottes 2010-10-12 08:50:56 UTC
Review of attachment 171070 [details] [review]:

Hey, sorry for the late review.

It looks pretty good! I inlined some comments. I think it would be good to unsensitive langage sub menu which don't have any proposition.

::: empathy-2.31.92/libempathy-gtk/empathy-chat.c
@@ +1782,3 @@
+
+		for (l = suggestions; l; l = l->next) {
+		menu_item = gtk_menu_item_new_with_label (l->data);

This block should be aligned.

::: empathy-2.31.92/libempathy-gtk/empathy-spell.c
@@ +51,2 @@
 static GHashTable  *iso_code_names = NULL;
+static GHashTable  *languages = NULL;

Please add a comment explalining the the type and semantic of the keys and the values.

@@ +307,3 @@
+		codes = g_list_append (codes, g_strdup (code));
+	}
+

You can use g_hash_table_get_keys(). Note that then you won't have to free the keys any more (just the list).
Comment 7 Vitaly Minko 2010-10-13 17:39:18 UTC
Created attachment 172292 [details] [review]
updated patch
Comment 8 Guillaume Desmottes 2010-10-14 09:28:58 UTC
Review of attachment 172292 [details] [review]:

You didn't make the change to unsensitive the langage menu if there is no suggestion.
So instead of having: English -> (No Suggestion)   just insensitive "English".

I hit this crash while testing your patch.
To reproduce:
- Type something
- Righ click on it to open the spell menu
- Change your spelling settings (add or remove a lang)
- Right click on the word again

ERROR:empathy-chat.c:1807:chat_spelling_build_menu: assertion failed: (codes != NULL)

Program received signal SIGABRT, Aborted.
0x00007fffeeccdba5 in raise (sig=<value optimized out>) at ../nptl/sysdeps/unix/sysv/linux/raise.c:64
64	../nptl/sysdeps/unix/sysv/linux/raise.c: Aucun fichier ou dossier de ce type.
	in ../nptl/sysdeps/unix/sysv/linux/raise.c
(gdb) bt
  • #0 raise
    at ../nptl/sysdeps/unix/sysv/linux/raise.c line 64
  • #1 abort
    at abort.c line 92
  • #2 g_assertion_message
  • #3 g_assertion_message_expr
    at gtestutils.c line 1369
  • #4 chat_spelling_build_menu
    at empathy-chat.c line 1807
  • #5 chat_input_populate_popup_cb
    at empathy-chat.c line 1930
  • #6 g_cclosure_marshal_VOID__OBJECT
    at gmarshal.c line 638
  • #7 g_closure_invoke
    at gclosure.c line 766
  • #8 signal_emit_unlocked_R
    at gsignal.c line 3252
  • #9 g_signal_emit_valist
    at gsignal.c line 2983
  • #10 g_signal_emit
    at gsignal.c line 3040
  • #11 popup_targets_received
    at gtktextview.c line 8275
  • #12 selection_received
    at gtkclipboard.c line 867
  • #13 _gtk_marshal_VOID__BOXED_UINT
    at gtkmarshalers.c line 1462
  • #14 g_closure_invoke
    at gclosure.c line 766
  • #15 signal_emit_unlocked_R
    at gsignal.c line 3252
  • #16 g_signal_emit_valist
    at gsignal.c line 2983
  • #17 g_signal_emit_by_name
    at gsignal.c line 3077
  • #18 gtk_selection_retrieval_report
    at gtkselection.c line 2936
  • #19 _gtk_selection_notify
    at gtkselection.c line 2740
  • #20 _gtk_marshal_BOOLEAN__BOXED
    at gtkmarshalers.c line 85
  • #21 g_type_class_meta_marshal
    at gclosure.c line 877
  • #22 g_closure_invoke
    at gclosure.c line 766
  • #23 signal_emit_unlocked_R
    at gsignal.c line 3290
  • #24 g_signal_emit_valist
    at gsignal.c line 2993
  • #25 g_signal_emit
    at gsignal.c line 3040
  • #26 gtk_widget_event_internal
    at gtkwidget.c line 5704
  • #27 gtk_widget_event
    at gtkwidget.c line 5414
  • #28 gtk_main_do_event
    at gtkmain.c line 1706
  • #29 gdk_event_source_dispatch
    at gdkeventsource.c line 302
  • #30 g_main_dispatch
    at gmain.c line 2149
  • #31 g_main_context_dispatch
    at gmain.c line 2702
  • #32 g_main_context_iterate
    at gmain.c line 2780
  • #33 g_main_loop_run
    at gmain.c line 2988
  • #34 gtk_main
    at gtkmain.c line 1320
  • #35 main
    at empathy.c line 550

::: empathy-2.32.0.1/libempathy-gtk/empathy-chat.c
@@ +1804,3 @@
+	GList     *codes, *l;
+
+	codes = empathy_spell_get_enabled_language_codes ();

You leak this list. You have to free it using g_list_free() when you're done.

@@ +1831,2 @@
         }
+        empathy_spell_free_language_codes (codes);

alignement is wrong.
Comment 9 Guillaume Desmottes 2010-10-14 09:29:03 UTC
Review of attachment 172292 [details] [review]:

You didn't make the change to unsensitive the langage menu if there is no suggestion.
So instead of having: English -> (No Suggestion)   just insensitive "English".

I hit this crash while testing your patch.
To reproduce:
- Type something
- Righ click on it to open the spell menu
- Change your spelling settings (add or remove a lang)
- Right click on the word again

ERROR:empathy-chat.c:1807:chat_spelling_build_menu: assertion failed: (codes != NULL)

Program received signal SIGABRT, Aborted.
0x00007fffeeccdba5 in raise (sig=<value optimized out>) at ../nptl/sysdeps/unix/sysv/linux/raise.c:64
64	../nptl/sysdeps/unix/sysv/linux/raise.c: Aucun fichier ou dossier de ce type.
	in ../nptl/sysdeps/unix/sysv/linux/raise.c
(gdb) bt
  • #0 raise
    at ../nptl/sysdeps/unix/sysv/linux/raise.c line 64
  • #1 abort
    at abort.c line 92
  • #2 g_assertion_message
  • #3 g_assertion_message_expr
    at gtestutils.c line 1369
  • #4 chat_spelling_build_menu
    at empathy-chat.c line 1807
  • #5 chat_input_populate_popup_cb
    at empathy-chat.c line 1930
  • #6 g_cclosure_marshal_VOID__OBJECT
    at gmarshal.c line 638
  • #7 g_closure_invoke
    at gclosure.c line 766
  • #8 signal_emit_unlocked_R
    at gsignal.c line 3252
  • #9 g_signal_emit_valist
    at gsignal.c line 2983
  • #10 g_signal_emit
    at gsignal.c line 3040
  • #11 popup_targets_received
    at gtktextview.c line 8275
  • #12 selection_received
    at gtkclipboard.c line 867
  • #13 _gtk_marshal_VOID__BOXED_UINT
    at gtkmarshalers.c line 1462
  • #14 g_closure_invoke
    at gclosure.c line 766
  • #15 signal_emit_unlocked_R
    at gsignal.c line 3252
  • #16 g_signal_emit_valist
    at gsignal.c line 2983
  • #17 g_signal_emit_by_name
    at gsignal.c line 3077
  • #18 gtk_selection_retrieval_report
    at gtkselection.c line 2936
  • #19 _gtk_selection_notify
    at gtkselection.c line 2740
  • #20 _gtk_marshal_BOOLEAN__BOXED
    at gtkmarshalers.c line 85
  • #21 g_type_class_meta_marshal
    at gclosure.c line 877
  • #22 g_closure_invoke
    at gclosure.c line 766
  • #23 signal_emit_unlocked_R
    at gsignal.c line 3290
  • #24 g_signal_emit_valist
    at gsignal.c line 2993
  • #25 g_signal_emit
    at gsignal.c line 3040
  • #26 gtk_widget_event_internal
    at gtkwidget.c line 5704
  • #27 gtk_widget_event
    at gtkwidget.c line 5414
  • #28 gtk_main_do_event
    at gtkmain.c line 1706
  • #29 gdk_event_source_dispatch
    at gdkeventsource.c line 302
  • #30 g_main_dispatch
    at gmain.c line 2149
  • #31 g_main_context_dispatch
    at gmain.c line 2702
  • #32 g_main_context_iterate
    at gmain.c line 2780
  • #33 g_main_loop_run
    at gmain.c line 2988
  • #34 gtk_main
    at gtkmain.c line 1320
  • #35 main
    at empathy.c line 550

::: empathy-2.32.0.1/libempathy-gtk/empathy-chat.c
@@ +1804,3 @@
+	GList     *codes, *l;
+
+	codes = empathy_spell_get_enabled_language_codes ();

You leak this list. You have to free it using g_list_free() when you're done.

@@ +1831,2 @@
         }
+        empathy_spell_free_language_codes (codes);

alignement is wrong.
Comment 10 Vitaly Minko 2010-10-14 18:30:20 UTC
Created attachment 172379 [details] [review]
updated updated patch
Comment 11 Vitaly Minko 2010-10-14 18:31:09 UTC
I've updated the patch in accordance with your notes.

>You didn't make the change to unsensitive the langage menu if there is no
suggestion.

Sorry, I forgot about this.

>I hit this crash while testing your patch.

This crash was caused by another spelling-related issue in the original code: 
We were enabling spell checker each time preferences got initialized (even
when there were no enabled languages). See the changes in empathy-preferences.c for details.
Comment 12 Guillaume Desmottes 2010-10-15 09:20:00 UTC
Yeah, merged to master \o/ Thanks a lot for your work.

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.

Note You need to log in before you can comment on or make changes to this bug.