[evolution/webkit-composer: 131/150] Add e_spell_checker_new().



commit 06ba37a82706af7e1d6017beef12065d15581d0b
Author: Matthew Barnes <mbarnes redhat com>
Date:   Sun Jan 20 13:16:33 2013 -0500

    Add e_spell_checker_new().
    
    Use it instead of g_object_new() or e_spell_checker_instance().

 doc/reference/libeutil/libeutil-sections.txt |    1 +
 e-util/e-editor-widget.c                     |    2 +-
 e-util/e-spell-checker.c                     |   18 +++++++++++++++---
 e-util/e-spell-checker.h                     |    1 +
 e-util/e-spell-entry.c                       |    2 +-
 modules/mail/em-composer-prefs.c             |    2 +-
 6 files changed, 20 insertions(+), 6 deletions(-)
---
diff --git a/doc/reference/libeutil/libeutil-sections.txt b/doc/reference/libeutil/libeutil-sections.txt
index 25cd260..b355aae 100644
--- a/doc/reference/libeutil/libeutil-sections.txt
+++ b/doc/reference/libeutil/libeutil-sections.txt
@@ -3647,6 +3647,7 @@ e_source_util_remote_delete
 <TITLE>ESpellChecker</TITLE>
 ESpellChecker
 e_spell_checker_instance
+e_spell_checker_new
 e_spell_checker_list_available_dicts
 e_spell_checker_ref_dictionary
 e_spell_checker_get_enchant_dict
diff --git a/e-util/e-editor-widget.c b/e-util/e-editor-widget.c
index d01d5fa..6c12162 100644
--- a/e-util/e-editor-widget.c
+++ b/e-util/e-editor-widget.c
@@ -1000,7 +1000,7 @@ e_editor_widget_init (EEditorWidget *editor)
 	webkit_web_view_set_settings (WEBKIT_WEB_VIEW (editor), settings);
 
 	/* Override the spell-checker, use our own */
-	checker = g_object_new (E_TYPE_SPELL_CHECKER, NULL);
+	checker = e_spell_checker_new ();
 	webkit_set_text_checker (G_OBJECT (checker));
 	g_object_unref (checker);
 
diff --git a/e-util/e-spell-checker.c b/e-util/e-spell-checker.c
index 2988f02..db494c0 100644
--- a/e-util/e-spell-checker.c
+++ b/e-util/e-spell-checker.c
@@ -415,13 +415,25 @@ e_spell_checker_init (ESpellChecker *checker)
 ESpellChecker *
 e_spell_checker_instance (void)
 {
-	if (s_instance == NULL) {
-		s_instance = g_object_new (E_TYPE_SPELL_CHECKER, NULL);
-	}
+	if (s_instance == NULL)
+		s_instance = e_spell_checker_new ();
 
 	return s_instance;
 }
 
+/**
+ * e_spell_checker_new:
+ *
+ * Creates a new #ESpellChecker instance.
+ *
+ * Returns: a new #ESpellChecker
+ **/
+ESpellChecker *
+e_spell_checker_new (void)
+{
+	return g_object_new (E_TYPE_SPELL_CHECKER, NULL);
+}
+
 static void
 list_enchant_dicts (const gchar * const lang_tag,
                     const gchar * const provider_name,
diff --git a/e-util/e-spell-checker.h b/e-util/e-spell-checker.h
index 0bc0bc3..60a96e6 100644
--- a/e-util/e-spell-checker.h
+++ b/e-util/e-spell-checker.h
@@ -62,6 +62,7 @@ struct _ESpellCheckerClass {
 
 GType		e_spell_checker_get_type	(void) G_GNUC_CONST;
 ESpellChecker *	e_spell_checker_instance	(void);
+ESpellChecker *	e_spell_checker_new		(void);
 GList *		e_spell_checker_list_available_dicts
 						(ESpellChecker *checker);
 ESpellDictionary *
diff --git a/e-util/e-spell-entry.c b/e-util/e-spell-entry.c
index d99359b..831e578 100644
--- a/e-util/e-spell-entry.c
+++ b/e-util/e-spell-entry.c
@@ -839,7 +839,7 @@ e_spell_entry_init (ESpellEntry *spell_entry)
 	spell_entry->priv->attr_list = pango_attr_list_new ();
 	spell_entry->priv->dictionaries = NULL;
 	spell_entry->priv->checking_enabled = TRUE;
-	spell_entry->priv->spell_checker = g_object_new (E_TYPE_SPELL_CHECKER, NULL);
+	spell_entry->priv->spell_checker = e_spell_checker_new ();
 
 	g_signal_connect (
 		spell_entry, "popup-menu",
diff --git a/modules/mail/em-composer-prefs.c b/modules/mail/em-composer-prefs.c
index f9083f8..2ae0433 100644
--- a/modules/mail/em-composer-prefs.c
+++ b/modules/mail/em-composer-prefs.c
@@ -333,7 +333,7 @@ em_composer_prefs_construct (EMComposerPrefs *prefs,
 	prefs->builder = gtk_builder_new ();
 	e_load_ui_builder_definition (prefs->builder, "mail-config.ui");
 
-	prefs->spell_checker = e_spell_checker_instance ();
+	prefs->spell_checker = e_spell_checker_new ();
 
 	/** @HookPoint-EMConfig: Mail Composer Preferences
 	 * @Id: org.gnome.evolution.mail.composerPrefs



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