diff options
-rw-r--r-- | data/org.mate.Atril.gschema.xml.in | 3 | ||||
-rw-r--r-- | shell/ev-window.c | 35 |
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", |