[epiphany] uri-tester: Steal adblock filters from default profile in app mode



commit 03d53f0149f65d379206fe4e6c90da7d71271b32
Author: Michael Catanzaro <mcatanzaro gnome org>
Date:   Sat Oct 29 16:10:22 2016 -0500

    uri-tester: Steal adblock filters from default profile in app mode
    
    Since adblock filters are big, we don't want to keep a separate copy for
    each app. This became easy to implement after moving EphyUriTester to
    the UI process.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=755379

 embed/ephy-uri-tester.c |   18 +++++++++++++++++-
 1 files changed, 17 insertions(+), 1 deletions(-)
---
diff --git a/embed/ephy-uri-tester.c b/embed/ephy-uri-tester.c
index c05cd7e..61428f5 100644
--- a/embed/ephy-uri-tester.c
+++ b/embed/ephy-uri-tester.c
@@ -1209,5 +1209,21 @@ ephy_uri_tester_class_init (EphyUriTesterClass *klass)
 EphyUriTester *
 ephy_uri_tester_new (void)
 {
-  return g_object_new (EPHY_TYPE_URI_TESTER, "base-data-dir", ephy_dot_dir (), NULL);
+  EphyEmbedShell *shell;
+  EphyEmbedShellMode mode;
+  EphyUriTester *tester;
+  char *data_dir;
+
+  shell = ephy_embed_shell_get_default ();
+  mode = ephy_embed_shell_get_mode (shell);
+
+  /* The filters list is large, so we don't want to store a separate copy per
+   * web app, but users should otherwise be able to configure different filters
+   * per profile directory. */
+  data_dir = mode == EPHY_EMBED_SHELL_MODE_APPLICATION ? ephy_default_dot_dir ()
+                                                       : g_strdup (ephy_dot_dir ());
+
+  tester = g_object_new (EPHY_TYPE_URI_TESTER, "base-data-dir", data_dir, NULL);
+  g_free (data_dir);
+  return tester;
 }


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