[epiphany] Reorganize webkit_pref_callback_enable_spell_checking



commit 3cc9ca43b7599da914e6149685cd9b43f0971012
Author: Michael Catanzaro <mcatanzaro gnome org>
Date:   Fri Jan 16 18:10:04 2015 -0600

    Reorganize webkit_pref_callback_enable_spell_checking
    
    Notably, don't call webkit_web_context_set_spell_checking_languages with
    NULL, to avoid a critical warning.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=697095

 embed/ephy-embed-prefs.c |   20 ++++++++------------
 1 files changed, 8 insertions(+), 12 deletions(-)
---
diff --git a/embed/ephy-embed-prefs.c b/embed/ephy-embed-prefs.c
index 3e2b1ea..0cc4114 100644
--- a/embed/ephy-embed-prefs.c
+++ b/embed/ephy-embed-prefs.c
@@ -451,26 +451,22 @@ webkit_pref_callback_enable_spell_checking (GSettings *settings,
 {
   WebKitWebContext *web_context;
   gboolean value = FALSE;
-  char **languages = NULL;
   EphyEmbedShell *shell = ephy_embed_shell_get_default ();
 
+  web_context = ephy_embed_shell_get_web_context (shell);
   value = g_settings_get_boolean (settings, key);
 
+  webkit_web_context_set_spell_checking_enabled (web_context, value);
+
   if (value) {
-    char **normalized;
+    char **languages = g_settings_get_strv (settings, EPHY_PREFS_WEB_LANGUAGE);
+    char **normalized = normalize_languages (languages);
 
-    languages = g_settings_get_strv (settings, EPHY_PREFS_WEB_LANGUAGE);
-    normalized = normalize_languages (languages);
-    g_strfreev (languages);
+    webkit_web_context_set_spell_checking_languages (web_context, (const char* const *)normalized);
 
-    languages = normalized;
+    g_strfreev (languages);
+    g_strfreev (normalized);
   }
-
-  web_context = ephy_embed_shell_get_web_context (shell);
-  webkit_web_context_set_spell_checking_enabled (web_context, value);
-  webkit_web_context_set_spell_checking_languages (web_context, (const char* const *)languages);
-
-  g_strfreev (languages);
 }
 
 static const PrefData webkit_pref_entries[] =


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