summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Catanzaro <mcatanzaro@igalia.com>2018-05-21 23:43:00 -0500
committerMichael Catanzaro <mcatanzaro@igalia.com>2018-05-21 23:44:15 -0500
commit6f5ceb0b60754eb0f0498dbfa702e411733d09d3 (patch)
treebc81b5bcb9da5b9e34b9cc81064b01a67553d2cc
parent7a38ff15bfa34d08fd468f553d75206ba0bfc91b (diff)
downloadepiphany-6f5ceb0b60754eb0f0498dbfa702e411733d09d3.tar.gz
Add migrator to remove annoyance filters
https://bugzilla.gnome.org/show_bug.cgi?id=796245
-rw-r--r--lib/ephy-profile-utils.h2
-rw-r--r--src/profile-migrator/ephy-profile-migrator.c26
2 files changed, 26 insertions, 2 deletions
diff --git a/lib/ephy-profile-utils.h b/lib/ephy-profile-utils.h
index dfbd2a54e..c5432e11b 100644
--- a/lib/ephy-profile-utils.h
+++ b/lib/ephy-profile-utils.h
@@ -24,7 +24,7 @@
G_BEGIN_DECLS
-#define EPHY_PROFILE_MIGRATION_VERSION 27
+#define EPHY_PROFILE_MIGRATION_VERSION 28
#define EPHY_INSECURE_PASSWORDS_MIGRATION_VERSION 11
#define EPHY_SETTINGS_MIGRATION_VERSION 16
#define EPHY_FIREFOX_SYNC_PASSWORDS_MIGRATION_VERSION 19
diff --git a/src/profile-migrator/ephy-profile-migrator.c b/src/profile-migrator/ephy-profile-migrator.c
index 79dfcde85..724b3f96c 100644
--- a/src/profile-migrator/ephy-profile-migrator.c
+++ b/src/profile-migrator/ephy-profile-migrator.c
@@ -30,6 +30,7 @@
#include "ephy-search-engine-manager.h"
#include "ephy-settings.h"
#include "ephy-sqlite-connection.h"
+#include "ephy-string.h"
#include "ephy-sync-debug.h"
#include "ephy-sync-utils.h"
#include "ephy-uri-tester-shared.h"
@@ -1193,6 +1194,28 @@ out:
}
static void
+migrate_annoyance_list (void)
+{
+ GVariant *user_value;
+ const char **filters;
+ char **modified_filters;
+
+ /* Has the filters setting been modified? If not, we're done. */
+ user_value = g_settings_get_user_value (EPHY_SETTINGS_MAIN, EPHY_PREFS_ADBLOCK_FILTERS);
+ if (!user_value)
+ return;
+
+ /* The annoyance list was causing a bunch of problems. Forcibly remove it. */
+ filters = g_variant_get_strv (user_value, NULL);
+ modified_filters = ephy_strv_remove (filters, "https://easylist.to/easylist/fanboy-annoyance.txt");
+ g_settings_set_strv (EPHY_SETTINGS_MAIN, EPHY_PREFS_ADBLOCK_FILTERS, (const char * const *)modified_filters);
+
+ g_variant_unref (user_value);
+ g_free (filters);
+ g_strfreev (modified_filters);
+}
+
+static void
migrate_nothing (void)
{
/* Used to replace migrators that have been removed. Only remove migrators
@@ -1232,7 +1255,8 @@ const EphyProfileMigrator migrators[] = {
/* 24 */ migrate_bookmarks_timestamp,
/* 25 */ migrate_passwords_timestamp,
/* 26 */ migrate_nothing,
- /* 27 */ migrate_search_engines
+ /* 27 */ migrate_search_engines,
+ /* 28 */ migrate_annoyance_list
};
static gboolean