Gentoo Archives: gentoo-commits

From: "Gilles Dartiguelongue (eva)" <eva@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] gentoo-x86 commit in app-text/gnome-spell/files: gnome-spell-1.0.8-enchant.patch digest-gnome-spell-1.0.8
Date: Sat, 22 Dec 2007 15:15:50
Message-Id: E1J664l-0006Nk-Jt@stork.gentoo.org
1 eva 07/12/22 15:15:43
2
3 Added: gnome-spell-1.0.8-enchant.patch
4 digest-gnome-spell-1.0.8
5 Log:
6 bump to 1.0.8, remove static USE flag and fix quotes in 1.0.7-r1 ebuild
7 (Portage version: 2.1.4_rc10)
8
9 Revision Changes Path
10 1.1 app-text/gnome-spell/files/gnome-spell-1.0.8-enchant.patch
11
12 file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/app-text/gnome-spell/files/gnome-spell-1.0.8-enchant.patch?rev=1.1&view=markup
13 plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/app-text/gnome-spell/files/gnome-spell-1.0.8-enchant.patch?rev=1.1&content-type=text/plain
14
15 Index: gnome-spell-1.0.8-enchant.patch
16 ===================================================================
17 Index: gnome-spell/dictionary.c
18 ===================================================================
19 --- gnome-spell/dictionary.c (révision 424)
20 +++ gnome-spell/dictionary.c (copie de travail)
21 @@ -30,16 +30,21 @@
22 #include <glib.h>
23 #include <libgnome/gnome-i18n.h>
24 #include <libgnome/gnome-config.h>
25 -#include <gconf/gconf-client.h>
26 #include <bonobo.h>
27
28 #include "Spell.h"
29 #include "dictionary.h"
30
31 +#include <enchant.h>
32 +
33 +typedef struct {
34 + EnchantBroker * config;
35 + EnchantDict * speller;
36 +} SpellEngine;
37 +
38 static BonoboObjectClass *dictionary_parent_class;
39
40 #define DICT_DEBUG(x)
41 -#define GNOME_SPELL_GCONF_DIR "/GNOME/Spell"
42
43 static void release_engines (GNOMESpellDictionary *dict);
44
45 @@ -72,12 +77,24 @@
46 {
47 GNOMESpellDictionary *dict = GNOME_SPELL_DICTIONARY (object);
48
49 - dict->changed = TRUE;
50 dict->engines = NULL;
51 dict->languages = g_hash_table_new (g_str_hash, g_str_equal);
52 dict->engines_ht = g_hash_table_new (NULL, NULL);
53 }
54
55 +static char **
56 +dup_string_list (char ** str_list, size_t list_len)
57 +{
58 + char ** new_str_list;
59 + size_t i;
60 +
61 + new_str_list = g_new0 (char *, list_len + 1);
62 + for (i = 0; i < list_len; i++)
63 + new_str_list [i] = g_strdup (str_list [i]);
64 +
65 + return new_str_list;
66 +}
67 +
68 static void
69 dictionary_finalize (GObject *object)
70 {
71 @@ -93,15 +110,16 @@
72 }
73
74 static SpellEngine *
75 -new_engine (const gchar *language)
76 +new_engine (const gchar *language, CORBA_Environment *ev)
77 {
78 SpellEngine *se;
79
80 se = g_new0 (SpellEngine, 1);
81 - se->config = new_aspell_config ();
82 - aspell_config_replace (se->config, "language-tag", language);
83 - aspell_config_replace (se->config, "encoding", "utf-8");
84 - se->changed = TRUE;
85 + se->config = enchant_broker_init ();
86 + se->speller = enchant_broker_request_dict (se->config, language);
87 +
88 + if(se->speller == NULL)
89 + raise_error (ev, enchant_broker_get_error (se->config));
90
91 return se;
92 }
93 @@ -129,9 +147,9 @@
94 SpellEngine *se = dict->engines->data;
95
96 if (se->speller)
97 - delete_aspell_speller (se->speller);
98 + enchant_broker_free_dict (se->config, se->speller);
99 if (se->config)
100 - delete_aspell_config (se->config);
101 + enchant_broker_free (se->config);
102 g_free (se);
103 dict->engines = g_slist_remove (dict->engines, se);
104 }
105 @@ -140,7 +158,6 @@
106 g_hash_table_foreach_remove (dict->languages, remove_engine_ht, NULL);
107
108 dict->engines = NULL;
109 - dict->changed = TRUE;
110 }
111
112 static LangInfo known_languages [] = {
113 @@ -352,88 +369,31 @@
114 };
115
116 static GSList *
117 -get_languages_real (gint *ln)
118 +get_languages (gint *ln)
119 {
120 GSList *langs;
121 - AspellCanHaveError *err;
122 - AspellConfig *config;
123 - AspellSpeller *speller;
124 - gint i;
125 + EnchantBroker *broker;
126 + gint i, nb_langs;
127
128 - DICT_DEBUG (printf ("get_languages_real\n"));
129 + DICT_DEBUG (printf ("get_languages\n"));
130
131 + /* todo: this could probably be better done by enchant_broker_list_dicts(), but let's keep
132 + the initial code change to a minimum */
133 +
134 + broker = enchant_broker_init ();
135 langs = NULL;
136 - *ln = 0;
137 + nb_langs = 0;
138 for (i=0; i < G_N_ELEMENTS (known_languages); i++) {
139 - config = new_aspell_config ();
140 - aspell_config_replace (config, "language-tag", known_languages [i].abbreviation);
141 - err = new_aspell_speller (config);
142 - if (aspell_error_number (err) == 0) {
143 - speller = to_aspell_speller (err);
144 + if (enchant_broker_dict_exists (broker, known_languages [i].abbreviation)) {
145 DICT_DEBUG (printf ("Language: %s\n", known_languages [i].name));
146 - delete_aspell_speller (speller);
147 langs = g_slist_prepend (langs, GINT_TO_POINTER (i));
148 - (*ln) ++;
149 + nb_langs++;
150 }
151 }
152
153 - return langs;
154 -}
155 -
156 -static GSList *
157 -get_languages_load (GConfClient *gc, gint *ln)
158 -{
159 - GString *str;
160 - GSList *langs = NULL;
161 - gint i, lang_num;
162 -
163 - /* printf ("get_languages_load\n"); */
164 -
165 - str = g_string_new (NULL);
166 - *ln = gconf_client_get_int (gc, GNOME_SPELL_GCONF_DIR "/languages", NULL);
167 - for (i = 0; i < *ln; i++) {
168 - g_string_sprintf (str, GNOME_SPELL_GCONF_DIR "/language%d", i);
169 - lang_num = gconf_client_get_int (gc, str->str, NULL);
170 - langs = g_slist_prepend (langs, GINT_TO_POINTER (lang_num));
171 - }
172 -
173 - return langs;
174 -}
175 -
176 -static GSList *
177 -get_languages (gint *ln)
178 -{
179 - GSList *langs, *l;
180 - GConfClient *gc;
181 - time_t mtime;
182 - struct stat buf;
183 - gint i, kl;
184 -
185 - gc = gconf_client_get_default ();
186 -
187 - mtime = gconf_client_get_int (gc, GNOME_SPELL_GCONF_DIR "/mtime", NULL);
188 - kl = gconf_client_get_int (gc, GNOME_SPELL_GCONF_DIR "/known_languages", NULL);
189 -
190 - if (stat (ASPELL_DICT, &buf) || buf.st_mtime != mtime || kl != G_N_ELEMENTS(known_languages)) {
191 - GString *str;
192 - langs = get_languages_real (ln);
193 -
194 - str = g_string_new (NULL);
195 - gconf_client_set_int (gc, GNOME_SPELL_GCONF_DIR "/languages", *ln, NULL);
196 - for (l = langs, i = 0; i < *ln; i ++) {
197 - g_string_sprintf (str, GNOME_SPELL_GCONF_DIR "/language%d", *ln - i - 1);
198 - gconf_client_set_int (gc, str->str, GPOINTER_TO_INT (l->data), NULL);
199 - l = l->next;
200 - }
201 - gconf_client_set_int (gc, GNOME_SPELL_GCONF_DIR "/mtime", buf.st_mtime, NULL);
202 - gconf_client_set_int (gc, GNOME_SPELL_GCONF_DIR "/known_languages", G_N_ELEMENTS(known_languages), NULL);
203 - g_string_free (str, TRUE);
204 - gnome_config_sync ();
205 - } else
206 - langs = get_languages_load (gc, ln);
207 + *ln = nb_langs;
208
209 - gconf_client_suggest_sync (gc, NULL);
210 - g_object_unref (gc);
211 + enchant_broker_free (broker);
212
213 return langs;
214 }
215 @@ -504,59 +464,19 @@
216 SpellEngine *se;
217
218 one_language = g_strndup (begin, len);
219 - se = new_engine (one_language);
220 + se = new_engine (one_language, ev);
221 dict->engines = g_slist_prepend (dict->engines, se);
222 g_hash_table_insert (dict->languages, one_language, se);
223 g_hash_table_insert (dict->engines_ht, se, g_strdup (one_language));
224 -
225 - dict->changed = TRUE;
226 - }
227 - }
228 -}
229 -
230 -static void
231 -update_engine (SpellEngine *se, CORBA_Environment * ev)
232 -{
233 - AspellCanHaveError *err;
234 -
235 - DICT_DEBUG (printf ("Dictionary: creating new aspell speller\n"));
236 -
237 - if (se->changed) {
238 - if (se->speller)
239 - delete_aspell_speller (se->speller);
240 - err = new_aspell_speller (se->config);
241 - if (aspell_error_number (err) != 0) {
242 - g_warning ("aspell error: %s\n", aspell_error_message (err));
243 - se->speller = NULL;
244 - raise_error (ev, aspell_error_message (err));
245 - } else {
246 - se->speller = to_aspell_speller (err);
247 - se->changed = FALSE;
248 }
249 }
250 }
251
252 -static void
253 -update_engines (GNOMESpellDictionary *dict, CORBA_Environment * ev)
254 -{
255 - g_return_if_fail (IS_GNOME_SPELL_DICTIONARY (dict));
256 -
257 - if (dict->changed) {
258 - GSList *l;
259 -
260 - for (l = dict->engines; l; l = l->next) {
261 - update_engine ((SpellEngine *) l->data, ev);
262 - }
263 -
264 - dict->changed = FALSE;
265 - }
266 -}
267 -
268 static CORBA_boolean
269 engine_check_word (SpellEngine *se, const gchar *word, CORBA_Environment *ev)
270 {
271 - CORBA_boolean result = CORBA_TRUE;
272 - gint aspell_result;
273 + CORBA_boolean result = CORBA_FALSE;
274 + gint enchant_result;
275
276 #ifndef G_DISABLE_CHECKS
277 g_return_val_if_fail (se->speller, CORBA_TRUE);
278 @@ -564,12 +484,12 @@
279 if (!se->speller)
280 return CORBA_TRUE;
281 #endif
282 - aspell_result = aspell_speller_check (se->speller, word, strlen (word));
283 - if (aspell_result == 0)
284 - result = CORBA_FALSE;
285 - if (aspell_result == -1) {
286 - g_warning ("aspell error: %s\n", aspell_speller_error_message (se->speller));
287 - raise_error (ev, aspell_speller_error_message (se->speller));
288 + enchant_result = enchant_dict_check (se->speller, word, strlen (word));
289 + if (enchant_result == 0)
290 + result = CORBA_TRUE;
291 + if (enchant_result == -1) {
292 + g_warning ("enchant error: %s\n", enchant_dict_get_error (se->speller));
293 + raise_error (ev, enchant_dict_get_error (se->speller));
294 }
295
296 return result;
297 @@ -592,7 +512,6 @@
298 if (!strcmp (word, "Ximian"))
299 return CORBA_TRUE;
300
301 - update_engines (dict, ev);
302 for (l = dict->engines; l; l = l->next) {
303 if (((SpellEngine *) l->data)->speller) {
304 valid_speller = TRUE;
305 @@ -621,11 +540,10 @@
306 if (!word)
307 return;
308 #endif
309 - update_engines (dict, ev);
310 DICT_DEBUG (printf ("Dictionary add_word_to_session: %s\n", word));
311 for (l = dict->engines; l; l = l->next) {
312 if (((SpellEngine *) l->data)->speller)
313 - aspell_speller_add_to_session (((SpellEngine *) l->data)->speller, word, strlen (word));
314 + enchant_dict_add_to_session (((SpellEngine *) l->data)->speller, word, strlen (word));
315 }
316 }
317
318 @@ -642,13 +560,11 @@
319 if (!word || !language)
320 return;
321 #endif
322 - update_engines (dict, ev);
323 DICT_DEBUG (printf ("Dictionary add_word_to_personal: %s (%s)\n", word, language));
324 se = (SpellEngine *) g_hash_table_lookup (dict->languages, language);
325
326 if (se && se->speller) {
327 - aspell_speller_add_to_personal (se->speller, word, strlen (word));
328 - aspell_speller_save_all_word_lists (se->speller);
329 + enchant_dict_add_to_pwl (se->speller, word, strlen (word));
330 DICT_DEBUG (printf ("Added and saved.\n"));
331 }
332 }
333 @@ -666,14 +582,12 @@
334 if (!word || !replacement)
335 return;
336 #endif
337 - update_engines (dict, ev);
338 DICT_DEBUG (printf ("Dictionary correction: %s <-- %s\n", word, replacement));
339 se = (SpellEngine *) g_hash_table_lookup (dict->languages, language);
340
341 if (se && se->speller) {
342 - aspell_speller_store_replacement (se->speller, word, strlen (word),
343 - replacement, strlen (replacement));
344 - aspell_speller_save_all_word_lists (se->speller);
345 + enchant_dict_store_replacement (se->speller, word, strlen (word),
346 + replacement, strlen (replacement));
347 DICT_DEBUG (printf ("Set and saved.\n"));
348 }
349 }
350 @@ -683,8 +597,8 @@
351 const CORBA_char *word, CORBA_Environment *ev)
352 {
353 GNOMESpellDictionary *dict = GNOME_SPELL_DICTIONARY (bonobo_object_from_servant (servant));
354 - const AspellWordList *suggestions;
355 - AspellStringEnumeration *elements;
356 + char **suggestions;
357 + size_t number_of_suggestions;
358 GNOME_Spell_StringSeq *seq = NULL;
359 GSList *l, *suggestion_list = NULL;
360 gint i, len, pos;
361 @@ -696,17 +610,19 @@
362 return NULL;
363 #endif
364 DICT_DEBUG (printf ("Dictionary correction: %s\n", word));
365 - update_engines (dict, ev);
366
367 len = 0;
368 for (l = dict->engines; l; l = l->next) {
369 SpellEngine *se = (SpellEngine *) l->data;
370
371 if (se->speller) {
372 - suggestions = aspell_speller_suggest (se->speller, word, strlen (word));
373 - suggestion_list = g_slist_prepend (suggestion_list, (gpointer) suggestions);
374 - len += 2*aspell_word_list_size (suggestions);
375 + suggestions = enchant_dict_suggest (se->speller, word, strlen (word), &number_of_suggestions);
376 + suggestion_list = g_slist_prepend (suggestion_list,
377 + (gpointer) dup_string_list (suggestions, number_of_suggestions));
378 + len += 2*number_of_suggestions;
379 suggestion_list = g_slist_prepend (suggestion_list, engine_to_language (dict, se));
380 + suggestion_list = g_slist_prepend (suggestion_list, GINT_TO_POINTER (number_of_suggestions));
381 + enchant_dict_free_string_list (se->speller, suggestions);
382 }
383 }
384
385 @@ -723,17 +639,18 @@
386 gint list_len;
387 gchar *language;
388
389 + list_len = GPOINTER_TO_INT (l->data);
390 + l = l->next;
391 language = (gchar *) l->data;
392 l = l->next;
393 - suggestions = (const AspellWordList *) l->data;
394 - elements = aspell_word_list_elements (suggestions);
395 - list_len = aspell_word_list_size (suggestions);
396 + suggestions = (char **) l->data;
397 for (i = 0; i < list_len; i ++, pos ++) {
398 - seq->_buffer [pos] = CORBA_string_dup (aspell_string_enumeration_next (elements));
399 + seq->_buffer [pos] = CORBA_string_dup (suggestions [i]);
400 pos ++;
401 seq->_buffer [pos] = CORBA_string_dup (language);
402 }
403 - delete_aspell_string_enumeration (elements);
404 +
405 + g_strfreev (suggestions);
406 }
407 CORBA_sequence_set_release (seq, CORBA_TRUE);
408 g_slist_free (suggestion_list);
409 Index: gnome-spell/dictionary.h
410 ===================================================================
411 --- gnome-spell/dictionary.h (révision 424)
412 +++ gnome-spell/dictionary.h (copie de travail)
413 @@ -26,7 +26,6 @@
414 G_BEGIN_DECLS
415
416 #include <bonobo/bonobo-object.h>
417 -#include <aspell.h>
418
419 #define GNOME_SPELL_DICTIONARY_TYPE (gnome_spell_dictionary_get_type ())
420 #define GNOME_SPELL_DICTIONARY(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), \
421 @@ -37,12 +36,6 @@
422 #define IS_GNOME_SPELL_DICTIONARY_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), GNOME_SPELL_DICTIONARY_TYPE))
423
424 typedef struct {
425 - AspellConfig *config;
426 - AspellSpeller *speller;
427 - gboolean changed;
428 -} SpellEngine;
429 -
430 -typedef struct {
431 gchar *abbreviation;
432 gchar *name;
433 } LangInfo;
434 @@ -50,7 +43,6 @@
435 typedef struct {
436 BonoboObject parent;
437
438 - gboolean changed;
439 GSList *engines;
440 GHashTable *languages;
441 GHashTable *engines_ht;
442 Index: gnome-spell/Makefile.am
443 ===================================================================
444 --- gnome-spell/Makefile.am (révision 424)
445 +++ gnome-spell/Makefile.am (copie de travail)
446 @@ -7,13 +7,11 @@
447
448 INCLUDES = \
449 -I$(srcdir) \
450 - $(ASPELL_INC) \
451 -DPREFIX=\""$(prefix)"\" \
452 -DGNOMEDATADIR=\""$(datadir)"\" \
453 -DGNOMELOCALEDIR=\""$(datadir)/locale"\" \
454 -DGLADE_DATADIR=\"$(gladedir)\" \
455 -DPLUGIN_DIR=\""$(PLUGIN_DIR)"\" \
456 - -DASPELL_DICT=\""$(ASPELL_DICT)"\" \
457 $(GNOME_SPELL_CFLAGS) \
458 $(END)
459
460 @@ -55,7 +53,6 @@
461 libgnome_spell_component_la_LDFLAGS = -release $(API_VERSION) $(NO_UNDEFINED)
462 libgnome_spell_component_la_LIBADD = \
463 libgnome-spell-idl.la \
464 - $(ASPELL_LIBS) \
465 $(GNOME_SPELL_LIBS) \
466 $(END)
467
468 @@ -69,7 +66,6 @@
469
470 test_gnome_spell_component_LDADD = \
471 libgnome-spell-idl.la \
472 - $(ASPELL_LIBS) \
473 $(GNOME_SPELL_LIBS) \
474 $(END)
475
476 Index: gnome-spell/test-spell.c
477 ===================================================================
478 --- gnome-spell/test-spell.c (révision 424)
479 +++ gnome-spell/test-spell.c (copie de travail)
480 @@ -52,7 +52,6 @@
481 * test dictionary
482 */
483
484 - GNOME_Spell_Dictionary_getLanguages (en, &ev);
485 GNOME_Spell_Dictionary_setLanguage (en, "en", &ev);
486
487 printf ("check: %s --> %d\n",
488 Index: configure.in
489 ===================================================================
490 --- configure.in (révision 424)
491 +++ configure.in (copie de travail)
492 @@ -68,34 +68,6 @@
493 AC_SUBST(API_VERSION)
494
495 dnl
496 -dnl aspell
497 -dnl
498 -
499 -AC_ARG_WITH(aspell-prefix, [ --with-aspell-prefix=DIR
500 - specify under which prefix aspell is installed.], with_aspell_prefix="$withval", )
501 -
502 -if test "x$with_aspell_prefix" != "x"; then
503 - saved_LDFLAGS=$LDFLAGS
504 - LDFLAGS="-L$with_aspell_prefix/lib "$LDFLAGS
505 - ASPELL_INC="-I$with_aspell_prefix/include"
506 - ASPELL_LIBS="-L$with_aspell_prefix/lib -laspell"
507 - ASPELL_DATA="$with_aspell_prefix/lib/aspell"
508 -else
509 - LDFLAGS="-L`aspell config prefix`/lib "$LDFLAGS
510 - ASPELL_INC="-I`aspell config prefix`/include"
511 - ASPELL_LIBS="-L`aspell config prefix`/lib -laspell"
512 - ASPELL_DICT="`aspell config dict-dir`"
513 -fi
514 -AC_CHECK_LIB(aspell,new_aspell_config,,AC_MSG_ERROR([gnome-spell cannot be built without aspell library]),)
515 -if test "x$with_aspell_prefix" != "x"; then
516 - LDFLAGS=$saved_LDFLAGS
517 -fi
518 -
519 -AC_SUBST(ASPELL_DICT)
520 -AC_SUBST(ASPELL_INC)
521 -AC_SUBST(ASPELL_LIBS)
522 -
523 -dnl
524 dnl flags
525 dnl
526
527 @@ -104,7 +76,7 @@
528 AC_SUBST(CPPFLAGS)
529 AC_SUBST(LDFLAGS)
530
531 -GNOME_SPELL_MODULES="libgnomeui-2.0 >= 1.112.1 libbonoboui-2.0 >= 1.112.1 libglade-2.0 >= 1.99.9"
532 +GNOME_SPELL_MODULES="libgnome-2.0 >= 1.112.1 libbonoboui-2.0 >= 1.112.1 libglade-2.0 >= 1.99.9 enchant >= 1.2.5"
533 PKG_CHECK_MODULES(GNOME_SPELL, $GNOME_SPELL_MODULES)
534 AC_SUBST(GNOME_SPELL_CFLAGS)
535 AC_SUBST(GNOME_SPELL_LIBS)
536
537
538
539 1.1 app-text/gnome-spell/files/digest-gnome-spell-1.0.8
540
541 file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/app-text/gnome-spell/files/digest-gnome-spell-1.0.8?rev=1.1&view=markup
542 plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/app-text/gnome-spell/files/digest-gnome-spell-1.0.8?rev=1.1&content-type=text/plain
543
544 Index: digest-gnome-spell-1.0.8
545 ===================================================================
546 MD5 6ccc46b4e3dc7cb1c6d413358e35d445 gnome-spell-1.0.8.tar.bz2 417076
547 RMD160 57928ce88e642c9414f8307dba34f8a989fe13fc gnome-spell-1.0.8.tar.bz2 417076
548 SHA256 04393bef844a92a18c9e6a676355d89b21cdc1b3111a407299108507eb9763a2 gnome-spell-1.0.8.tar.bz2 417076
549
550
551
552 --
553 gentoo-commits@g.o mailing list