[epiphany] ephy-web-view: Add default-zoom-level option for new pages
- From: Michael Catanzaro <mcatanzaro src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [epiphany] ephy-web-view: Add default-zoom-level option for new pages
- Date: Sun, 11 Feb 2018 19:54:00 +0000 (UTC)
commit a555cdf0a6adb0a7483dd1c128501d8260a642de
Author: Jan-Michael Brummer <jan brummer tabos org>
Date: Sun Feb 11 18:05:55 2018 +0100
ephy-web-view: Add default-zoom-level option for new pages
Value of default-zoom-level option will zoom new pages to the the selected level. This will improve the
web experience on hidpi screen.
Closes: https://bugzilla.gnome.org/show_bug.cgi?id=621067
data/org.gnome.epiphany.gschema.xml | 4 ++++
embed/ephy-web-view.c | 11 +++++++++--
lib/ephy-prefs.h | 4 +++-
3 files changed, 16 insertions(+), 3 deletions(-)
---
diff --git a/data/org.gnome.epiphany.gschema.xml b/data/org.gnome.epiphany.gschema.xml
index 981968d..a802099 100644
--- a/data/org.gnome.epiphany.gschema.xml
+++ b/data/org.gnome.epiphany.gschema.xml
@@ -232,6 +232,10 @@
<summary>Google Safe Browsing API key</summary>
<description>The API key used to access the Google Safe Browsing API v4.</description>
</key>
+ <key type="d" name="default-zoom-level">
+ <default>1.0</default>
+ <summary>Default zoom level for new pages</summary>
+ </key>
</schema>
<schema id="org.gnome.Epiphany.state">
<key type="s" name="download-dir">
diff --git a/embed/ephy-web-view.c b/embed/ephy-web-view.c
index 2aa3d67..50de188 100644
--- a/embed/ephy-web-view.c
+++ b/embed/ephy-web-view.c
@@ -1581,6 +1581,7 @@ get_host_for_url_cb (gpointer service,
EphyHistoryHost *host;
EphyWebView *view;
double current_zoom;
+ double set_zoom;
if (success == FALSE)
return;
@@ -1590,9 +1591,15 @@ get_host_for_url_cb (gpointer service,
current_zoom = webkit_web_view_get_zoom_level (WEBKIT_WEB_VIEW (view));
- if (host->zoom_level != current_zoom) {
+ if (host->visit_count == 0) {
+ set_zoom = g_settings_get_double (EPHY_SETTINGS_WEB, EPHY_PREFS_WEB_DEFAULT_ZOOM_LEVEL);
+ } else {
+ set_zoom = host->zoom_level;
+ }
+
+ if (set_zoom != current_zoom) {
view->is_setting_zoom = TRUE;
- webkit_web_view_set_zoom_level (WEBKIT_WEB_VIEW (view), host->zoom_level);
+ webkit_web_view_set_zoom_level (WEBKIT_WEB_VIEW (view), set_zoom);
view->is_setting_zoom = FALSE;
}
diff --git a/lib/ephy-prefs.h b/lib/ephy-prefs.h
index 3f35920..84f2ff1 100644
--- a/lib/ephy-prefs.h
+++ b/lib/ephy-prefs.h
@@ -101,6 +101,7 @@ static const char * const ephy_prefs_state_schema[] = {
#define EPHY_PREFS_WEB_ENABLE_SITE_SPECIFIC_QUIRKS "enable-site-specific-quirks"
#define EPHY_PREFS_WEB_ENABLE_SAFE_BROWSING "enable-safe-browsing"
#define EPHY_PREFS_WEB_GSB_API_KEY "gsb-api-key"
+#define EPHY_PREFS_WEB_DEFAULT_ZOOM_LEVEL "default-zoom-level"
static const char * const ephy_prefs_web_schema[] = {
EPHY_PREFS_WEB_FONT_MIN_SIZE,
@@ -124,7 +125,8 @@ static const char * const ephy_prefs_web_schema[] = {
EPHY_PREFS_WEB_REMEMBER_PASSWORDS,
EPHY_PREFS_WEB_ENABLE_SITE_SPECIFIC_QUIRKS,
EPHY_PREFS_WEB_ENABLE_SAFE_BROWSING,
- EPHY_PREFS_WEB_GSB_API_KEY
+ EPHY_PREFS_WEB_GSB_API_KEY,
+ EPHY_PREFS_WEB_DEFAULT_ZOOM_LEVEL
};
#define EPHY_PREFS_SCHEMA "org.gnome.Epiphany"
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]