*
* You should have received a copy of the GNU General Public
* License along with this program; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301 USA
*
* Authors: Martyn Russell <martyn@imendio.com>
* Richard Hult <richard@imendio.com>
#include <string.h>
#include <stdlib.h>
-#include <glib/gi18n.h>
+#include <glib/gi18n-lib.h>
#ifdef HAVE_ENCHANT
#include <enchant.h>
#endif
-#include <libempathy/empathy-debug.h>
-
#include "empathy-spell.h"
#include "empathy-conf.h"
-#define DEBUG_DOMAIN "Spell"
+#define DEBUG_FLAG EMPATHY_DEBUG_OTHER
+#include <libempathy/empathy-debug.h>
#ifdef HAVE_ENCHANT
{
GList *l;
- empathy_debug (DEBUG_DOMAIN, "Resetting languages due to config change");
+ DEBUG ("Resetting languages due to config change");
/* We just reset the languages list. */
for (l = languages; l; l = l->next) {
enchant_broker_free_dict (lang->config, lang->speller);
enchant_broker_free (lang->config);
-
+
g_slice_free (SpellLanguage, lang);
}
while (strv && strv[i]) {
SpellLanguage *lang;
- empathy_debug (DEBUG_DOMAIN, "Setting up language:'%s'", strv[i]);
+ DEBUG ("Setting up language:'%s'", strv[i]);
lang = g_slice_new0 (SpellLanguage);
lang->config = enchant_broker_init ();
lang->speller = enchant_broker_request_dict (lang->config, strv[i]);
- languages = g_list_append (languages, lang);
+ if (lang->speller == NULL) {
+ DEBUG ("language '%s' has no valid dict", strv[i]);
+ } else {
+ languages = g_list_append (languages, lang);
+ }
+
i++;
}
spell_setup_languages ();
if (!languages) {
- empathy_debug (DEBUG_DOMAIN, "No languages to check against");
return TRUE;
}
if (digit) {
/* We don't spell check digits. */
- empathy_debug (DEBUG_DOMAIN, "Not spell checking word:'%s', it is all digits", word);
+ DEBUG ("Not spell checking word:'%s', it is all digits", word);
return TRUE;
}
suggestions = enchant_dict_suggest (lang->speller, word, len,
&number_of_suggestions);
-
+
for (i = 0; i < number_of_suggestions; i++) {
suggestion_list = g_list_append (suggestion_list,
g_strdup (suggestions[i]));
empathy_spell_supported (void)
{
if (g_getenv ("EMPATHY_SPELL_DISABLED")) {
- empathy_debug (DEBUG_DOMAIN, "EMPATHY_SPELL_DISABLE env variable defined");
+ DEBUG ("EMPATHY_SPELL_DISABLE env variable defined");
return FALSE;
}
GList *
empathy_spell_get_suggestions (const gchar *word)
{
- empathy_debug (DEBUG_DOMAIN, "Support disabled, could not get suggestions");
+ DEBUG ("Support disabled, could not get suggestions");
return NULL;
}
gboolean
empathy_spell_check (const gchar *word)
{
- empathy_debug (DEBUG_DOMAIN, "Support disabled, could not check spelling");
+ DEBUG ("Support disabled, could not check spelling");
return TRUE;
}
const gchar *
empathy_spell_get_language_name (const gchar *lang)
{
- empathy_debug (DEBUG_DOMAIN, "Support disabled, could not get language name");
+ DEBUG ("Support disabled, could not get language name");
return NULL;
}
GList *
empathy_spell_get_language_codes (void)
{
- empathy_debug (DEBUG_DOMAIN, "Support disabled, could not get language codes");
+ DEBUG ("Support disabled, could not get language codes");
return NULL;
}