[evolution/webkit-composer: 114/231] Add e_spell_dictionary_hash().



commit 061b70a1112be0273c23fb3dfa1b3c7f5f033403
Author: Matthew Barnes <mbarnes redhat com>
Date:   Thu Jan 17 07:38:13 2013 -0500

    Add e_spell_dictionary_hash().
    
    Generates a hash value for a dictionary based on its ISO code.

 .../evolution-util/evolution-util-sections.txt     |    1 +
 e-util/e-spell-dictionary.c                        |   22 ++++++++++++++++++++
 e-util/e-spell-dictionary.h                        |    1 +
 3 files changed, 24 insertions(+), 0 deletions(-)
---
diff --git a/doc/reference/evolution-util/evolution-util-sections.txt 
b/doc/reference/evolution-util/evolution-util-sections.txt
index 28afc45..0e0521c 100644
--- a/doc/reference/evolution-util/evolution-util-sections.txt
+++ b/doc/reference/evolution-util/evolution-util-sections.txt
@@ -3828,6 +3828,7 @@ ESpellCheckerPrivate
 <TITLE>ESpellDictionary</TITLE>
 ESpellDictionary
 e_spell_dictionary_new
+e_spell_dictionary_hash
 e_spell_dictionary_get_name
 e_spell_dictionary_get_code
 e_spell_dictionary_check
diff --git a/e-util/e-spell-dictionary.c b/e-util/e-spell-dictionary.c
index 8a88253..e098e98 100644
--- a/e-util/e-spell-dictionary.c
+++ b/e-util/e-spell-dictionary.c
@@ -481,6 +481,28 @@ e_spell_dictionary_new (ESpellChecker *parent_checker,
 }
 
 /**
+ * e_spell_dictionary_hash:
+ * @dictionary: an #ESpellDictionary
+ *
+ * Generates a hash value for @dictionary based on its ISO code.
+ * This function is intended for easily hashing an #ESpellDictionary
+ * to add to a #GHashTable or similar data structure.
+ *
+ * Returns: a hash value for @dictionary
+ **/
+guint
+e_spell_dictionary_hash (ESpellDictionary *dictionary)
+{
+       const gchar *code;
+
+       g_return_val_if_fail (E_IS_SPELL_DICTIONARY (dictionary), 0);
+
+       code = e_spell_dictionary_get_code (dictionary);
+
+       return g_str_hash (code);
+}
+
+/**
  * e_spell_dictionary_get_name:
  * @dictionary: an #ESpellDictionary
  *
diff --git a/e-util/e-spell-dictionary.h b/e-util/e-spell-dictionary.h
index 9f8d2e9..c46f4a7 100644
--- a/e-util/e-spell-dictionary.h
+++ b/e-util/e-spell-dictionary.h
@@ -65,6 +65,7 @@ GType         e_spell_dictionary_get_type     (void) G_GNUC_CONST;
 ESpellDictionary *
                e_spell_dictionary_new          (ESpellChecker *parent_checker,
                                                 EnchantDict *enchant_dict);
+guint          e_spell_dictionary_hash         (ESpellDictionary *dictionary);
 const gchar *  e_spell_dictionary_get_name     (ESpellDictionary *dictionary);
 const gchar *  e_spell_dictionary_get_code     (ESpellDictionary *dictionary);
 gboolean       e_spell_dictionary_check        (ESpellDictionary *dictionary,


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]