[epiphany/mcatanzaro/cookies-prefs: 2/7] Move adblock and popup blocking to general page



commit 34dbd4689f8fb730507553dfb064c7729d6fe3c5
Author: Michael Catanzaro <mcatanzaro gnome org>
Date:   Sun Jul 19 10:41:27 2020 -0500

    Move adblock and popup blocking to general page
    
    The adblock setting is kinda related to privacy, but it's primarily a
    user experience setting. It will make more sense on the general page.
    
    The popup blocking is not in any way related to privacy, so having it
    under privacy really doesn't make sense. Move it too.

 src/preferences/prefs-general-page.c    | 23 ++++++++++++++++++++++
 src/preferences/prefs-privacy-page.c    | 21 +++-----------------
 src/resources/gtk/prefs-general-page.ui | 34 +++++++++++++++++++++++++++++++++
 src/resources/gtk/prefs-privacy-page.ui | 30 +----------------------------
 4 files changed, 61 insertions(+), 47 deletions(-)
---
diff --git a/src/preferences/prefs-general-page.c b/src/preferences/prefs-general-page.c
index 855412fbc..e64da0ebc 100644
--- a/src/preferences/prefs-general-page.c
+++ b/src/preferences/prefs-general-page.c
@@ -53,6 +53,10 @@ struct _PrefsGeneralPage {
   GtkWidget *webapp_url;
   GtkWidget *webapp_title;
 
+  /* Web Content */
+  GtkWidget *adblock_allow_switch;
+  GtkWidget *popups_allow_switch;
+
   /* Homepage */
   GtkWidget *homepage_box;
   GtkWidget *new_tab_homepage_radiobutton;
@@ -1122,6 +1126,10 @@ prefs_general_page_class_init (PrefsGeneralPageClass *klass)
   gtk_widget_class_bind_template_child (widget_class, PrefsGeneralPage, webapp_url);
   gtk_widget_class_bind_template_child (widget_class, PrefsGeneralPage, webapp_title);
 
+  /* Web Content */
+  gtk_widget_class_bind_template_child (widget_class, PrefsGeneralPage, adblock_allow_switch);
+  gtk_widget_class_bind_template_child (widget_class, PrefsGeneralPage, popups_allow_switch);
+
   /* Homepage */
   gtk_widget_class_bind_template_child (widget_class, PrefsGeneralPage, homepage_box);
   gtk_widget_class_bind_template_child (widget_class, PrefsGeneralPage, new_tab_homepage_radiobutton);
@@ -1241,6 +1249,21 @@ setup_general_page (PrefsGeneralPage *general_page)
     gtk_entry_set_text (GTK_ENTRY (general_page->webapp_title), general_page->webapp->name);
   }
 
+  /* ======================================================================== */
+  /* ========================== Web Content ================================= */
+  /* ======================================================================== */
+  g_settings_bind (web_settings,
+                   EPHY_PREFS_WEB_ENABLE_ADBLOCK,
+                   general_page->adblock_allow_switch,
+                   "active",
+                   G_SETTINGS_BIND_DEFAULT);
+
+  g_settings_bind (web_settings,
+                   EPHY_PREFS_WEB_ENABLE_POPUPS,
+                   general_page->popups_allow_switch,
+                   "active",
+                   G_SETTINGS_BIND_INVERT_BOOLEAN);
+
   /* ======================================================================== */
   /* ========================== Homepage ==================================== */
   /* ======================================================================== */
diff --git a/src/preferences/prefs-privacy-page.c b/src/preferences/prefs-privacy-page.c
index 2af88d151..5fffb914a 100644
--- a/src/preferences/prefs-privacy-page.c
+++ b/src/preferences/prefs-privacy-page.c
@@ -35,9 +35,7 @@ enum {
 struct _PrefsPrivacyPage {
   HdyPreferencesPage parent_instance;
 
-  /* Web Content */
-  GtkWidget *popups_allow_switch;
-  GtkWidget *adblock_allow_switch;
+  /* Web Safety */
   GtkWidget *enable_safe_browsing_switch;
   GtkWidget *enable_itp_switch;
 
@@ -69,19 +67,8 @@ setup_privacy_page (PrefsPrivacyPage *privacy_page)
   GSettings *web_settings = ephy_settings_get (EPHY_PREFS_WEB_SCHEMA);
 
   /* ======================================================================== */
-  /* ========================== Web Content ================================= */
+  /* ========================== Web Safety ================================== */
   /* ======================================================================== */
-  g_settings_bind (web_settings,
-                   EPHY_PREFS_WEB_ENABLE_ADBLOCK,
-                   privacy_page->adblock_allow_switch,
-                   "active",
-                   G_SETTINGS_BIND_DEFAULT);
-
-  g_settings_bind (web_settings,
-                   EPHY_PREFS_WEB_ENABLE_POPUPS,
-                   privacy_page->popups_allow_switch,
-                   "active",
-                   G_SETTINGS_BIND_INVERT_BOOLEAN);
 
   g_settings_bind (web_settings,
                    EPHY_PREFS_WEB_ENABLE_SAFE_BROWSING,
@@ -127,9 +114,7 @@ prefs_privacy_page_class_init (PrefsPrivacyPageClass *klass)
                   0, NULL, NULL, NULL,
                   G_TYPE_NONE, 0);
 
-  /* Web Content */
-  gtk_widget_class_bind_template_child (widget_class, PrefsPrivacyPage, popups_allow_switch);
-  gtk_widget_class_bind_template_child (widget_class, PrefsPrivacyPage, adblock_allow_switch);
+  /* Web Safety */
   gtk_widget_class_bind_template_child (widget_class, PrefsPrivacyPage, enable_safe_browsing_switch);
   gtk_widget_class_bind_template_child (widget_class, PrefsPrivacyPage, enable_itp_switch);
 
diff --git a/src/resources/gtk/prefs-general-page.ui b/src/resources/gtk/prefs-general-page.ui
index bc7f85b32..48777d4fb 100644
--- a/src/resources/gtk/prefs-general-page.ui
+++ b/src/resources/gtk/prefs-general-page.ui
@@ -116,6 +116,40 @@
         </child>
       </object>
     </child>
+    <child>
+      <object class="HdyPreferencesGroup">
+        <property name="title" translatable="yes">Web Content</property>
+        <property name="visible">True</property>
+        <child>
+          <object class="HdyActionRow" id="adblock_allow_row">
+            <property name="activatable_widget">adblock_allow_switch</property>
+            <property name="title" translatable="yes">Block _Advertisements</property>
+            <property name="use_underline">True</property>
+            <property name="visible">True</property>
+            <child>
+              <object class="GtkSwitch" id="adblock_allow_switch">
+                <property name="valign">center</property>
+                <property name="visible">True</property>
+              </object>
+            </child>
+          </object>
+        </child>
+        <child>
+          <object class="HdyActionRow">
+            <property name="activatable_widget">popups_allow_switch</property>
+            <property name="title" translatable="yes">Block _Popup Windows</property>
+            <property name="use_underline">True</property>
+            <property name="visible">True</property>
+            <child>
+              <object class="GtkSwitch" id="popups_allow_switch">
+                <property name="valign">center</property>
+                <property name="visible">True</property>
+              </object>
+            </child>
+          </object>
+        </child>
+      </object>
+    </child>
     <child>
       <object class="HdyPreferencesGroup" id="homepage_box">
         <property name="title" translatable="yes">Homepage</property>
diff --git a/src/resources/gtk/prefs-privacy-page.ui b/src/resources/gtk/prefs-privacy-page.ui
index ab871cd77..562632ede 100644
--- a/src/resources/gtk/prefs-privacy-page.ui
+++ b/src/resources/gtk/prefs-privacy-page.ui
@@ -10,36 +10,8 @@
     </style>
     <child>
       <object class="HdyPreferencesGroup">
-        <property name="title" translatable="yes">Web Content</property>
+        <property name="title" translatable="yes">Web Safety</property>
         <property name="visible">True</property>
-        <child>
-          <object class="HdyActionRow" id="adblock_allow_row">
-            <property name="activatable_widget">adblock_allow_switch</property>
-            <property name="title" translatable="yes">Try to Block _Advertisements</property>
-            <property name="use_underline">True</property>
-            <property name="visible">True</property>
-            <child>
-              <object class="GtkSwitch" id="adblock_allow_switch">
-                <property name="valign">center</property>
-                <property name="visible">True</property>
-              </object>
-            </child>
-          </object>
-        </child>
-        <child>
-          <object class="HdyActionRow">
-            <property name="activatable_widget">popups_allow_switch</property>
-            <property name="title" translatable="yes">Block Popup _Windows</property>
-            <property name="use_underline">True</property>
-            <property name="visible">True</property>
-            <child>
-              <object class="GtkSwitch" id="popups_allow_switch">
-                <property name="valign">center</property>
-                <property name="visible">True</property>
-              </object>
-            </child>
-          </object>
-        </child>
         <child>
           <object class="HdyActionRow">
             <property name="activatable_widget">enable_safe_browsing_switch</property>


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