[epiphany] prefs-dialog: share web context and settings with embed



commit 2172fe8012035aa27edac5fa425024840ba7e99b
Author: Michael Catanzaro <mcatanzaro gnome org>
Date:   Sat Oct 8 15:02:55 2016 -0500

    prefs-dialog: share web context and settings with embed
    
    This means we get nice things like accept languages and user agent set
    properly, and use all the right Epiphany data directories instead of the
    global WebKit ones.

 src/prefs-dialog.c |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)
---
diff --git a/src/prefs-dialog.c b/src/prefs-dialog.c
index f48d676..b85f203 100644
--- a/src/prefs-dialog.c
+++ b/src/prefs-dialog.c
@@ -318,6 +318,7 @@ out:
 static void
 setup_fxa_sign_in_view (PrefsDialog *dialog)
 {
+  EphyEmbedShell *shell;
   const char *js = "\"use strict\";"
                    "function handleAccountsCommand(evt) {"
                    "  let j = {type: evt.type, detail: evt.detail};"
@@ -325,6 +326,8 @@ setup_fxa_sign_in_view (PrefsDialog *dialog)
                    "};"
                    "window.addEventListener(\"FirefoxAccountsCommand\", handleAccountsCommand);";
 
+  shell = ephy_embed_shell_get_default ();
+
   dialog->fxa_script = webkit_user_script_new (js,
                                                WEBKIT_USER_CONTENT_INJECT_TOP_FRAME,
                                                WEBKIT_USER_SCRIPT_INJECT_AT_DOCUMENT_END,
@@ -338,7 +341,12 @@ setup_fxa_sign_in_view (PrefsDialog *dialog)
   webkit_user_content_manager_register_script_message_handler (dialog->fxa_manager,
                                                                "accountsCommandHandler");
 
-  dialog->fxa_web_view = WEBKIT_WEB_VIEW (webkit_web_view_new_with_user_content_manager 
(dialog->fxa_manager));
+  dialog->fxa_web_view = WEBKIT_WEB_VIEW (g_object_new (WEBKIT_TYPE_WEB_VIEW,
+                                                        "web-context", ephy_embed_shell_get_web_context 
(shell),
+                                                        "user-content-manager", dialog->fxa_manager,
+                                                        "settings", ephy_embed_prefs_get_settings (),
+                                                        NULL));
+
   gtk_widget_set_visible (GTK_WIDGET (dialog->fxa_web_view), TRUE);
   gtk_widget_set_size_request (GTK_WIDGET (dialog->fxa_web_view), 450, 450);
   webkit_web_view_load_uri (dialog->fxa_web_view, FXA_IFRAME_URL);


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