[evolution/wip/webkit-composer: 114/262] Add e_spell_dictionary_hash().
- From: Tomas Popela <tpopela src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution/wip/webkit-composer: 114/262] Add e_spell_dictionary_hash().
- Date: Thu, 16 Jan 2014 09:57:27 +0000 (UTC)
commit c3a7d29066973c34261efa1c2e5b429e26e6bce2
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 7e3b9e3..5aa561b 100644
--- a/doc/reference/evolution-util/evolution-util-sections.txt
+++ b/doc/reference/evolution-util/evolution-util-sections.txt
@@ -3936,6 +3936,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]