]> git.0d.be Git - empathy.git/blobdiff - libempathy-gtk/empathy-spell.c
individual-menu: stop creating single_individual
[empathy.git] / libempathy-gtk / empathy-spell.c
index b9abcd5f732b369fdbaefacabb2e94d02207fdc3..27f27f902f034f0b05a4a27db803a7b8db63f2c9 100644 (file)
@@ -22,9 +22,7 @@
  */
 
 #include "config.h"
-
-#include <string.h>
-#include <stdlib.h>
+#include "empathy-spell.h"
 
 #include <glib/gi18n-lib.h>
 
 #include <enchant.h>
 #endif
 
-#include "empathy-spell.h"
+#include "empathy-gsettings.h"
 
 #define DEBUG_FLAG EMPATHY_DEBUG_OTHER
-#include <libempathy/empathy-debug.h>
-#include <libempathy/empathy-gsettings.h>
+#include "empathy-debug.h"
 
 #ifdef HAVE_ENCHANT
 
@@ -169,7 +166,7 @@ spell_notify_languages_cb (GSettings   *gsettings,
 
        /* We just reset the languages list. */
        if (languages != NULL) {
-               g_hash_table_destroy (languages);
+               g_hash_table_unref (languages);
                languages = NULL;
        }
 }
@@ -284,7 +281,7 @@ enumerate_dicts (const gchar * const lang_tag,
                return;
        }
 
-       *list = g_list_append (*list, g_strdup (lang));
+       *list = g_list_append (*list, lang);
 }
 
 GList *
@@ -359,7 +356,8 @@ empathy_spell_check (const gchar *word)
 }
 
 GList *
-empathy_spell_get_suggestions (const gchar *code, const gchar *word)
+empathy_spell_get_suggestions (const gchar *code,
+                              const gchar *word)
 {
        gint   len;
        GList *suggestion_list = NULL;
@@ -409,6 +407,26 @@ empathy_spell_supported (void)
        return TRUE;
 }
 
+void
+empathy_spell_add_to_dictionary (const gchar *code,
+                                const gchar *word)
+{
+       SpellLanguage *lang;
+
+       g_return_if_fail (code != NULL);
+       g_return_if_fail (word != NULL);
+
+       spell_setup_languages ();
+       if (languages == NULL)
+               return;
+
+       lang = g_hash_table_lookup (languages, code);
+       if (lang == NULL)
+               return;
+
+       enchant_dict_add_to_pwl (lang->speller, word, strlen (word));
+}
+
 #else /* not HAVE_ENCHANT */
 
 gboolean
@@ -418,7 +436,8 @@ empathy_spell_supported (void)
 }
 
 GList *
-empathy_spell_get_suggestions (const gchar *word)
+empathy_spell_get_suggestions (const gchar *code,
+                               const gchar *word)
 {
        DEBUG ("Support disabled, could not get suggestions");
 
@@ -454,6 +473,21 @@ empathy_spell_free_language_codes (GList *codes)
 {
 }
 
+void
+empathy_spell_add_to_dictionary (const gchar *code,
+                                const gchar *word)
+{
+       DEBUG ("Support disabled, could not expand the dictionary");
+}
+
+GList *
+empathy_spell_get_enabled_language_codes (void)
+{
+       DEBUG ("Support disabled, could not get enabled language codes");
+
+       return NULL;
+}
+
 #endif /* HAVE_ENCHANT */