[evolution/webkit-composer: 133/185] Add e_spell_checker_new().



commit a8a4455c8414d7be302c2b457f51d588f7d43b56
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 46a9ae6..3552db4 100644
--- a/doc/reference/libeutil/libeutil-sections.txt
+++ b/doc/reference/libeutil/libeutil-sections.txt
@@ -3770,6 +3770,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 905abc2..a2fba5a 100644
--- a/e-util/e-editor-widget.c
+++ b/e-util/e-editor-widget.c
@@ -992,7 +992,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 7195758..8753f6c 100644
--- a/e-util/e-spell-entry.c
+++ b/e-util/e-spell-entry.c
@@ -863,7 +863,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 85ca47c..e1c1fd0 100644
--- a/modules/mail/em-composer-prefs.c
+++ b/modules/mail/em-composer-prefs.c
@@ -262,7 +262,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]