X-Git-Url: https://www.fi.muni.cz/~kas/git//home/kas/public_html/git/?a=blobdiff_plain;ds=inline;f=shell%2Fev-window.c;h=b4e87394b2768c25b0b16980af3562adcdbeee0d;hb=d52ff81f97f4bd3794e1517443096846baee068b;hp=d4134f4316df921263d50ec3b4136b9f4b630aa4;hpb=4cc59b9954bbf8728cbdb33cff772c8c4edcbe89;p=evince.git diff --git a/shell/ev-window.c b/shell/ev-window.c index d4134f43..b4e87394 100644 --- a/shell/ev-window.c +++ b/shell/ev-window.c @@ -223,13 +223,12 @@ struct _EvWindowPrivate { #define NAVIGATION_ACTION "Navigation" #define GCONF_LOCKDOWN_DIR "/desktop/gnome/lockdown" -#define GCONF_OVERRIDE_RESTRICTIONS "/apps/evince/override_restrictions" #define GCONF_LOCKDOWN_SAVE "/desktop/gnome/lockdown/disable_save_to_disk" #define GCONF_LOCKDOWN_PRINT "/desktop/gnome/lockdown/disable_printing" #define GCONF_LOCKDOWN_PRINT_SETUP "/desktop/gnome/lockdown/disable_print_setup" #define GS_SCHEMA_NAME "org.gnome.Evince" -#define GS_OVERRIDE_RESTRICTIONS "override_restrictions" +#define GS_OVERRIDE_RESTRICTIONS "override-restrictions" #define SIDEBAR_DEFAULT_SIZE 132 #define LINKS_SIDEBAR_ID "links" @@ -930,6 +929,15 @@ setup_sidebar_from_metadata (EvWindow *window) gint sidebar_size; gboolean sidebar_visibility; + if (document) { + if (!window->priv->metadata || + !ev_metadata_get_boolean (window->priv->metadata, "sidebar_visibility", &sidebar_visibility)) { + sidebar_visibility = g_settings_get_boolean (window->priv->last_settings, "show-sidebar"); + } + update_chrome_flag (window, EV_CHROME_SIDEBAR, sidebar_visibility); + update_chrome_visibility (window); + } + if (!window->priv->metadata) return; @@ -958,12 +966,6 @@ setup_sidebar_from_metadata (EvWindow *window) ev_sidebar_set_page (EV_SIDEBAR (sidebar), layers); } } - - if (!ev_metadata_get_boolean (window->priv->metadata, "sidebar_visibility", &sidebar_visibility)) - sidebar_visibility = g_settings_get_boolean (window->priv->last_settings, "show-sidebar"); - - update_chrome_flag (window, EV_CHROME_SIDEBAR, sidebar_visibility); - update_chrome_visibility (window); } static void @@ -1053,23 +1055,22 @@ setup_document_from_metadata (EvWindow *window) gdouble width_ratio; gdouble height_ratio; - if (!window->priv->metadata) - return; - - /* Make sure to not open a document on the last page, - * since closing it on the last page most likely means the - * user was finished reading the document. In that case, reopening should - * show the first page. */ - page = ev_document_model_get_page (window->priv->model); - n_pages = ev_document_get_n_pages (window->priv->document); - if (page == n_pages - 1) - ev_document_model_set_page (window->priv->model, 0); + if (window->priv->metadata) { + /* Make sure to not open a document on the last page, + * since closing it on the last page most likely means the + * user was finished reading the document. In that case, reopening should + * show the first page. */ + page = ev_document_model_get_page (window->priv->model); + n_pages = ev_document_get_n_pages (window->priv->document); + if (page == n_pages - 1) + ev_document_model_set_page (window->priv->model, 0); - setup_sidebar_from_metadata (window); + setup_sidebar_from_metadata (window); - if (ev_metadata_get_int (window->priv->metadata, "window_width", &width) && - ev_metadata_get_int (window->priv->metadata, "window_height", &height)) - return; /* size was already set in setup_size_from_metadata */ + if (ev_metadata_get_int (window->priv->metadata, "window_width", &width) && + ev_metadata_get_int (window->priv->metadata, "window_height", &height)) + return; /* size was already set in setup_size_from_metadata */ + } g_settings_get (window->priv->last_settings, "window-ratio", "(dd)", &width_ratio, &height_ratio); if (width_ratio > 0. && height_ratio > 0.) { @@ -1088,7 +1089,7 @@ setup_document_from_metadata (EvWindow *window) screen = gtk_window_get_screen (GTK_WINDOW (window)); if (screen) { request_width = MIN (request_width, gdk_screen_get_width (screen)); - request_height = MIN (request_width, gdk_screen_get_height (screen)); + request_height = MIN (request_height, gdk_screen_get_height (screen)); } if (request_width > 0 && request_height > 0) { @@ -1870,7 +1871,8 @@ ev_window_open_uri (EvWindow *ev_window, g_object_unref (ev_window->priv->metadata); source_file = g_file_new_for_uri (uri); - if (ev_is_metadata_supported_for_file (source_file)) + if (!ev_file_is_temp (source_file) && + ev_is_metadata_supported_for_file (source_file)) ev_window->priv->metadata = ev_metadata_new (source_file); else ev_window->priv->metadata = NULL; @@ -4871,6 +4873,7 @@ ev_window_dispose (GObject *object) } if (priv->last_settings) { + g_settings_apply (priv->last_settings); g_object_unref (priv->last_settings); priv->last_settings = NULL; } @@ -6457,6 +6460,7 @@ ev_window_init (EvWindow *ev_window) gtk_widget_grab_focus (ev_window->priv->view); ev_window->priv->last_settings = g_settings_new (GS_SCHEMA_NAME".Default"); + g_settings_delay (ev_window->priv->last_settings); /* Set it user interface params */ ev_window_setup_recent (ev_window);