[evolution] Bug 776391 - Disable WebKit developer mode by default
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution] Bug 776391 - Disable WebKit developer mode by default
- Date: Tue, 17 Jan 2017 17:59:30 +0000 (UTC)
commit 53fe9c0dbbc70bd74345171bc932c359b91553ab
Author: Milan Crha <mcrha redhat com>
Date: Tue Jan 17 19:00:16 2017 +0100
Bug 776391 - Disable WebKit developer mode by default
data/org.gnome.evolution.shell.gschema.xml.in | 5 ++++
src/e-util/e-misc-utils.c | 25 ++++++++++++++++++++
src/e-util/e-misc-utils.h | 2 +
src/modules/webkit-editor/e-webkit-editor.c | 5 ++-
.../webkit-inspector/evolution-webkit-inspector.c | 3 +-
5 files changed, 37 insertions(+), 3 deletions(-)
---
diff --git a/data/org.gnome.evolution.shell.gschema.xml.in b/data/org.gnome.evolution.shell.gschema.xml.in
index 11dc8be..df2ef9f 100644
--- a/data/org.gnome.evolution.shell.gschema.xml.in
+++ b/data/org.gnome.evolution.shell.gschema.xml.in
@@ -115,6 +115,11 @@
<_summary>Default sidebar width</_summary>
<_description>The default width for the sidebar, in pixels.</_description>
</key>
+ <key name="webkit-developer-mode" type="b">
+ <default>false</default>
+ <_summary>Enable special WebKit developer features</_summary>
+ <_description>The change of this option requires restart of the Evolution.</_description>
+ </key>
<child name="window" schema="org.gnome.evolution.window"/>
</schema>
</schemalist>
diff --git a/src/e-util/e-misc-utils.c b/src/e-util/e-misc-utils.c
index e97c2f8..1e0f1f8 100644
--- a/src/e-util/e-misc-utils.c
+++ b/src/e-util/e-misc-utils.c
@@ -3883,3 +3883,28 @@ e_util_load_file_chooser_folder (GtkFileChooser *file_chooser)
g_free (uri);
}
+
+/**
+ * e_util_get_webkit_developer_mode_enabled:
+ *
+ * Returns: Whether WebKit developer mode is enabled. This is read only
+ * once, thus any changes in the GSettings property require restart
+ * of the Evolution.
+ *
+ * Since: 3.24
+ **/
+gboolean
+e_util_get_webkit_developer_mode_enabled (void)
+{
+ static gchar enabled = -1;
+
+ if (enabled == -1) {
+ GSettings *settings;
+
+ settings = e_util_ref_settings ("org.gnome.evolution.shell");
+ enabled = g_settings_get_boolean (settings, "webkit-developer-mode") ? 1 : 0;
+ g_clear_object (&settings);
+ }
+
+ return enabled != 0;
+}
diff --git a/src/e-util/e-misc-utils.h b/src/e-util/e-misc-utils.h
index abe7678..4a08351 100644
--- a/src/e-util/e-misc-utils.h
+++ b/src/e-util/e-misc-utils.h
@@ -330,6 +330,8 @@ GVariant * e_util_invoke_g_dbus_proxy_call_sync_wrapper_full
GError **error);
void e_util_save_file_chooser_folder (GtkFileChooser *file_chooser);
void e_util_load_file_chooser_folder (GtkFileChooser *file_chooser);
+gboolean e_util_get_webkit_developer_mode_enabled
+ (void);
G_END_DECLS
diff --git a/src/modules/webkit-editor/e-webkit-editor.c b/src/modules/webkit-editor/e-webkit-editor.c
index 3f26b89..00906e1 100644
--- a/src/modules/webkit-editor/e-webkit-editor.c
+++ b/src/modules/webkit-editor/e-webkit-editor.c
@@ -4977,7 +4977,7 @@ webkit_editor_constructed (GObject *object)
web_settings = webkit_web_view_get_settings (web_view);
webkit_settings_set_allow_file_access_from_file_urls (web_settings, TRUE);
- webkit_settings_set_enable_developer_extras (web_settings, TRUE);
+ webkit_settings_set_enable_developer_extras (web_settings, e_util_get_webkit_developer_mode_enabled
());
/* Make WebKit think we are displaying a local file, so that it
* does not block loading resources from file:// protocol */
@@ -5961,7 +5961,8 @@ webkit_editor_key_press_event (GtkWidget *widget,
if (((event)->state & GDK_CONTROL_MASK) &&
((event)->state & GDK_SHIFT_MASK) &&
- ((event)->keyval == GDK_KEY_I)) {
+ ((event)->keyval == GDK_KEY_I) &&
+ e_util_get_webkit_developer_mode_enabled ()) {
webkit_editor_show_inspector (wk_editor);
return TRUE;
}
diff --git a/src/modules/webkit-inspector/evolution-webkit-inspector.c
b/src/modules/webkit-inspector/evolution-webkit-inspector.c
index bb3fea8..5b0b9ca 100644
--- a/src/modules/webkit-inspector/evolution-webkit-inspector.c
+++ b/src/modules/webkit-inspector/evolution-webkit-inspector.c
@@ -132,7 +132,8 @@ e_webkit_inspector_init (EWebKitInspector *extension)
G_MODULE_EXPORT void
e_module_load (GTypeModule *type_module)
{
- e_webkit_inspector_register_type (type_module);
+ if (e_util_get_webkit_developer_mode_enabled ())
+ e_webkit_inspector_register_type (type_module);
}
G_MODULE_EXPORT void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]