[epiphany] Fix bookmark-editing lockdown option



commit b5844b4530893569a2462fac05f928dd9381d978
Author: Jan-Michael Brummer <jan brummer tabos org>
Date:   Sun Mar 1 20:57:30 2020 +0100

    Fix bookmark-editing lockdown option
    
    Hide bookmark star in location entry and preferences button in bookmark
    popover.
    
    Fixes: https://gitlab.gnome.org/GNOME/epiphany/issues/339

 lib/widgets/ephy-location-entry.c | 7 +++++++
 src/bookmarks/ephy-bookmark-row.c | 7 +++++++
 tests/ephy-location-entry-test.c  | 8 ++++++++
 3 files changed, 22 insertions(+)
---
diff --git a/lib/widgets/ephy-location-entry.c b/lib/widgets/ephy-location-entry.c
index 614bc9554..2b375ab25 100644
--- a/lib/widgets/ephy-location-entry.c
+++ b/lib/widgets/ephy-location-entry.c
@@ -31,6 +31,7 @@
 #include "ephy-embed-shell.h"
 #include "ephy-gui.h"
 #include "ephy-lib-type-builtins.h"
+#include "ephy-settings.h"
 #include "ephy-signal-accumulator.h"
 #include "ephy-suggestion.h"
 #include "ephy-title-widget.h"
@@ -1013,6 +1014,12 @@ ephy_location_entry_construct_contents (EphyLocationEntry *entry)
   context = gtk_widget_get_style_context (entry->bookmark);
   gtk_style_context_add_class (context, "entry_icon");
 
+  g_settings_bind (EPHY_SETTINGS_LOCKDOWN,
+                   EPHY_PREFS_LOCKDOWN_BOOKMARK_EDITING,
+                   entry->bookmark_event_box,
+                   "visible",
+                   G_SETTINGS_BIND_INVERT_BOOLEAN);
+
   /* Reader Mode */
   entry->reader_mode_event_box = gtk_event_box_new ();
   gtk_widget_set_tooltip_text (entry->reader_mode_event_box, _("Toggle reader mode"));
diff --git a/src/bookmarks/ephy-bookmark-row.c b/src/bookmarks/ephy-bookmark-row.c
index f360fa717..e06093122 100644
--- a/src/bookmarks/ephy-bookmark-row.c
+++ b/src/bookmarks/ephy-bookmark-row.c
@@ -25,6 +25,7 @@
 #include "ephy-embed-prefs.h"
 #include "ephy-embed-shell.h"
 #include "ephy-favicon-helpers.h"
+#include "ephy-settings.h"
 
 struct _EphyBookmarkRow {
   GtkListBoxRow parent_instance;
@@ -197,6 +198,12 @@ ephy_bookmark_row_constructed (GObject *object)
                                NULL,
                                self, NULL);
 
+  g_settings_bind (EPHY_SETTINGS_LOCKDOWN,
+                   EPHY_PREFS_LOCKDOWN_BOOKMARK_EDITING,
+                   self->properties_button,
+                   "visible",
+                   G_SETTINGS_BIND_INVERT_BOOLEAN);
+
   database = webkit_web_context_get_favicon_database (ephy_embed_shell_get_web_context (shell));
   webkit_favicon_database_get_favicon (database,
                                        ephy_bookmark_get_url (self->bookmark),
diff --git a/tests/ephy-location-entry-test.c b/tests/ephy-location-entry-test.c
index edd8d7062..db412847c 100644
--- a/tests/ephy-location-entry-test.c
+++ b/tests/ephy-location-entry-test.c
@@ -20,6 +20,7 @@
 
 #include "config.h"
 #include "ephy-debug.h"
+#include "ephy-file-helpers.h"
 #include "ephy-location-entry.h"
 #include "ephy-title-widget.h"
 #include <glib.h>
@@ -146,6 +147,13 @@ main (int   argc,
   gtk_test_init (&argc, &argv);
   ephy_debug_init ();
 
+  if (!ephy_file_helpers_init (NULL,
+                               EPHY_FILE_HELPERS_TESTING_MODE | EPHY_FILE_HELPERS_ENSURE_EXISTS,
+                               NULL)) {
+    g_debug ("Something wrong happened with ephy_file_helpers_init()");
+    return -1;
+  }
+
   g_test_add_func ("/lib/widgets/ephy-location-entry/new",
                    test_entry_new);
   g_test_add_func ("/lib/widgets/ephy-location-entry/get_entry",


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