[epiphany] Add context menu lockdown option



commit fb59d9fc3b36527515fe9a8f0e3057a3f9f30f26
Author: Jan-Michael Brummer <jan brummer tabos org>
Date:   Mon Dec 23 23:12:58 2019 +0100

    Add context menu lockdown option
    
    Fixes: https://gitlab.gnome.org/GNOME/epiphany/issues/921

 data/org.gnome.epiphany.gschema.xml | 3 +++
 lib/ephy-prefs.h                    | 1 +
 src/ephy-window.c                   | 6 +++++-
 3 files changed, 9 insertions(+), 1 deletion(-)
---
diff --git a/data/org.gnome.epiphany.gschema.xml b/data/org.gnome.epiphany.gschema.xml
index 277c49722..c272268c6 100644
--- a/data/org.gnome.epiphany.gschema.xml
+++ b/data/org.gnome.epiphany.gschema.xml
@@ -287,6 +287,9 @@
                <key type="b" name="disable-quit">
                        <default>false</default>
                </key>
+               <key type="b" name="disable-context-menu">
+                       <default>false</default>
+               </key>
        </schema>
        <schema path="/org/gnome/epiphany/sync/" id="org.gnome.Epiphany.sync">
                <key type="s" name="sync-user">
diff --git a/lib/ephy-prefs.h b/lib/ephy-prefs.h
index 042d5fd51..f7479584f 100644
--- a/lib/ephy-prefs.h
+++ b/lib/ephy-prefs.h
@@ -174,6 +174,7 @@ static const char * const ephy_prefs_web_schema[] = {
 #define EPHY_PREFS_LOCKDOWN_SAVE_TO_DISK      "disable-save-to-disk"
 #define EPHY_PREFS_LOCKDOWN_PRINTING          "disable-printing"
 #define EPHY_PREFS_LOCKDOWN_QUIT              "disable-quit"
+#define EPHY_PREFS_LOCKDOWN_CONTEXT_MENU      "disable-context-menu"
 
 #define EPHY_PREFS_SYNC_SCHEMA            "org.gnome.Epiphany.sync"
 #define EPHY_PREFS_SYNC_USER              "sync-user"
diff --git a/src/ephy-window.c b/src/ephy-window.c
index b03720254..c2a290488 100644
--- a/src/ephy-window.c
+++ b/src/ephy-window.c
@@ -1479,6 +1479,10 @@ populate_context_menu (WebKitWebView       *web_view,
   char *search_selection_action_name = NULL;
   const char *selected_text = NULL;
 
+  if (g_settings_get_boolean (EPHY_SETTINGS_LOCKDOWN,
+                              EPHY_PREFS_LOCKDOWN_CONTEXT_MENU))
+    return GDK_EVENT_STOP;
+
   window_action_group = gtk_widget_get_action_group (GTK_WIDGET (window),
                                                      "win");
   toolbar_action_group = gtk_widget_get_action_group (GTK_WIDGET (window),
@@ -1742,7 +1746,7 @@ populate_context_menu (WebKitWebView       *web_view,
                                 webkit_context_menu_item_new_from_stock_action 
(WEBKIT_CONTEXT_MENU_ACTION_INSPECT_ELEMENT));
   }
 
-  return FALSE;
+  return GDK_EVENT_PROPAGATE;
 }
 
 static gboolean


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