aboutsummaryrefslogtreecommitdiff
path: root/development/poedit/poedit-gtkspell.patch
blob: a1299755fd13e494f7cb2d22dbe35b9dc6a90364 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
Index: src/edframe.cpp
===================================================================
--- src/edframe.cpp	(revision 1450)
+++ src/edframe.cpp	(working copy)
@@ -829,14 +829,26 @@
     wxASSERT_MSG( textview, _T("wxTextCtrl is supposed to use GtkTextView") );
     GtkSpell *spell = gtkspell_get_from_text_view(textview);
 
-    if (spell)
-        gtkspell_detach(spell);
+    printf("init spellchecker for %s\n", (const char*)lang.ToAscii());
 
     if (enable)
     {
         GError *err = NULL;
-        if (!gtkspell_new_attach(textview, lang.ToAscii(), &err))
+        bool ok;
+
+        if (spell)
         {
+            printf("gtkspell_set_language\n");
+            ok = gtkspell_set_language(spell, lang.ToAscii(), &err);
+        }
+        else
+        {
+            printf("gtkspell_new_attach\n");
+            ok = gtkspell_new_attach(textview, lang.ToAscii(), &err) != NULL;
+        }
+
+        if (!ok)
+        {
 #if 0
             // FIXME: report the failure in some less intrusive way than the
             //        code that was used here; say for which language, too
@@ -846,6 +858,14 @@
             g_error_free(err);
         }
     }
+    else
+    {
+        if (spell)
+        {
+            printf("gtkspell_detach\n");
+            gtkspell_detach(spell);
+        }
+    }
 }
 #endif // __WXGTK__