From 46fce038996fa84784df775d0b2e941228388b66 Mon Sep 17 00:00:00 2001 From: rootavish Date: Sat, 19 Jul 2014 10:47:43 +0530 Subject: Thumbnails for all documents Now other problems with webkit. After much fidgeting I was able to resolve the previous problems of threads. However, now there is a different webkit error. --- shell/ev-sidebar-thumbnails.c | 26 ++++++++++++++++++++------ shell/ev-window.c | 3 --- 2 files changed, 20 insertions(+), 9 deletions(-) (limited to 'shell') diff --git a/shell/ev-sidebar-thumbnails.c b/shell/ev-sidebar-thumbnails.c index ec03d998..92f24c2a 100644 --- a/shell/ev-sidebar-thumbnails.c +++ b/shell/ev-sidebar-thumbnails.c @@ -68,7 +68,6 @@ struct _EvSidebarThumbnailsPrivate { EvDocument *document; EvDocumentModel *model; EvThumbsSizeCache *size_cache; - gint n_pages, pages_done; int rotation; @@ -136,8 +135,14 @@ ev_thumbnails_size_cache_new (EvDocument *document) page = ev_document_get_page (document, i); - ev_document_get_page_size (document, i, &page_width, &page_height); - + if (document->iswebdocument == FALSE ) { + ev_document_get_page_size (document, i, &page_width, &page_height); + } + else { + /* Hardcoding these values to a large enough dimesnsion so as to achieve max content without loss in visibility*/ + page_width = 800; + page_height = 1080; + } if (!rc) { rc = ev_render_context_new (page, 0, (gdouble)THUMBNAIL_WIDTH / page_width); } else { @@ -368,6 +373,10 @@ clear_range (EvSidebarThumbnails *sidebar_thumbnails, result && start_page <= end_page; result = gtk_tree_model_iter_next (GTK_TREE_MODEL (priv->list_store), &iter), start_page ++) { EvJobThumbnail *job; + + if (priv->document->iswebdocument == TRUE) { + EV_JOB(job)->run_mode = EV_JOB_RUN_MAIN_LOOP ; + } GdkPixbuf *loading_icon = NULL; gint width, height; @@ -409,9 +418,12 @@ get_scale_for_page (EvSidebarThumbnails *sidebar_thumbnails, { EvSidebarThumbnailsPrivate *priv = sidebar_thumbnails->priv; gdouble width; - - ev_document_get_page_size (priv->document, page, &width, NULL); - + if (priv->document->iswebdocument == TRUE ) { + /* Hardcoded for epub documents*/ + width = 800; + } else { + ev_document_get_page_size (priv->document, page, &width, NULL); + } return (gdouble)THUMBNAIL_WIDTH / width; } @@ -433,6 +445,7 @@ add_range (EvSidebarThumbnails *sidebar_thumbnails, result && page <= end_page; result = gtk_tree_model_iter_next (GTK_TREE_MODEL (priv->list_store), &iter), page ++) { EvJob *job; + gboolean thumbnail_set; gtk_tree_model_get (GTK_TREE_MODEL (priv->list_store), &iter, @@ -444,6 +457,7 @@ add_range (EvSidebarThumbnails *sidebar_thumbnails, job = ev_job_thumbnail_new (priv->document, page, priv->rotation, get_scale_for_page (sidebar_thumbnails, page)); + ev_job_scheduler_push_job (EV_JOB (job), EV_JOB_PRIORITY_HIGH); g_object_set_data_full (G_OBJECT (job), "tree_iter", diff --git a/shell/ev-window.c b/shell/ev-window.c index 7c5011dc..5c18b28c 100644 --- a/shell/ev-window.c +++ b/shell/ev-window.c @@ -2089,9 +2089,6 @@ ev_window_open_document (EvWindow *ev_window, EvWindowRunMode mode, const gchar *search_string) { - if (document == ev_window->priv->document) - return; - ev_window_close_dialogs (ev_window); ev_window_clear_load_job (ev_window); ev_window_clear_local_uri (ev_window); -- cgit v1.2.1