summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorinfirit <[email protected]>2014-12-08 22:58:09 +0100
committerinfirit <[email protected]>2014-12-08 22:58:09 +0100
commit4c3a7e168575c4c8a0e235fe9da428759546ba2f (patch)
tree5277481a3ba512cd333c90c47549264674618293
parent730924bea728462bc7e3abbe988b4823451c9358 (diff)
downloadatril-4c3a7e168575c4c8a0e235fe9da428759546ba2f.tar.bz2
atril-4c3a7e168575c4c8a0e235fe9da428759546ba2f.tar.xz
Save zoom factor in default settings when sizing mode is free, close #87
Taken from evince commit: 78cc0d30890045101ccf107eb30a21aeff94deb0 From: Carlos Garcia Campos <[email protected]> Gnome bug: http://bugzilla.gnome.org/show_bug.cgi?id=653383
-rw-r--r--data/org.mate.Atril.gschema.xml.in3
-rw-r--r--shell/ev-window.c35
2 files changed, 30 insertions, 8 deletions
diff --git a/data/org.mate.Atril.gschema.xml.in b/data/org.mate.Atril.gschema.xml.in
index fefc114f..fe7893ea 100644
--- a/data/org.mate.Atril.gschema.xml.in
+++ b/data/org.mate.Atril.gschema.xml.in
@@ -28,6 +28,9 @@
<key name="sizing-mode" enum="org.mate.Atril.SizingMode">
<default>'fit-width'</default>
</key>
+ <key name="zoom" type="d">
+ <default>1.</default>
+ </key>
<key name="inverted-colors" type="b">
<default>false</default>
</key>
diff --git a/shell/ev-window.c b/shell/ev-window.c
index 111cf5a9..e7fed16e 100644
--- a/shell/ev-window.c
+++ b/shell/ev-window.c
@@ -1150,9 +1150,16 @@ setup_model_from_metadata (EvWindow *window)
gboolean fullscreen = FALSE;
if (!window->priv->metadata) {
+ EvSizingMode sizing_mode;
+
/* Set default values */
- ev_document_model_set_sizing_mode (window->priv->model,
- g_settings_get_enum (settings, "sizing-mode"));
+ sizing_mode = g_settings_get_enum (settings, "sizing-mode");
+ ev_document_model_set_sizing_mode (window->priv->model, sizing_mode);
+ if (sizing_mode == EV_SIZING_FREE) {
+ zoom = g_settings_get_double (settings, "zoom");
+ zoom *= get_screen_dpi (window) / 72.0;
+ ev_document_model_set_scale (window->priv->model, zoom);
+ }
ev_document_model_set_inverted_colors (window->priv->model,
g_settings_get_boolean (settings, "inverted-colors"));
ev_document_model_set_continuous (window->priv->model,
@@ -1185,10 +1192,15 @@ setup_model_from_metadata (EvWindow *window)
}
/* Zoom */
- if (ev_document_model_get_sizing_mode (window->priv->model) == EV_SIZING_FREE &&
- ev_metadata_get_double (window->priv->metadata, "zoom", &zoom)) {
- zoom *= get_screen_dpi (window) / 72.0;
- ev_document_model_set_scale (window->priv->model, zoom);
+ if (ev_document_model_get_sizing_mode (window->priv->model) == EV_SIZING_FREE) {
+ if (ev_metadata_get_double (window->priv->metadata, "zoom", &zoom)) {
+ zoom *= get_screen_dpi (window) / 72.0;
+ ev_document_model_set_scale (window->priv->model, zoom);
+ } else if (window->priv->is_new_doc) {
+ zoom = g_settings_get_double (settings, "zoom");
+ zoom *= get_screen_dpi (window) / 72.0;
+ ev_document_model_set_scale (window->priv->model, zoom);
+ }
}
/* Rotation */
@@ -4369,6 +4381,7 @@ ev_window_cmd_edit_save_settings (GtkAction *action, EvWindow *ev_window)
EvWindowPrivate *priv = ev_window->priv;
EvDocumentModel *model = priv->model;
GSettings *settings = priv->default_settings;
+ EvSizingMode sizing_mode;
g_settings_set_boolean (settings, "continuous",
ev_document_model_get_continuous (model));
@@ -4378,8 +4391,14 @@ ev_window_cmd_edit_save_settings (GtkAction *action, EvWindow *ev_window)
ev_document_model_get_fullscreen (model));
g_settings_set_boolean (settings, "inverted-colors",
ev_document_model_get_inverted_colors (model));
- g_settings_set_enum (settings, "sizing-mode",
- ev_document_model_get_sizing_mode (model));
+ sizing_mode = ev_document_model_get_sizing_mode (model);
+ g_settings_set_enum (settings, "sizing-mode", sizing_mode);
+ if (sizing_mode == EV_SIZING_FREE) {
+ gdouble zoom = ev_document_model_get_scale (model);
+
+ zoom *= 72.0 / get_screen_dpi (ev_window);
+ g_settings_set_double (settings, "zoom", zoom);
+ }
g_settings_set_boolean (settings, "show-toolbar",
gtk_widget_get_visible (priv->toolbar));
g_settings_set_boolean (settings, "show-sidebar",