summaryrefslogtreecommitdiff
path: root/libdocument/ev-document.c
diff options
context:
space:
mode:
authorrootavish <[email protected]>2014-07-03 20:36:55 +0530
committerrootavish <[email protected]>2014-07-04 12:59:01 +0530
commit6f41c201422edd6b4dbf9f9f41b5dc29530d21c6 (patch)
tree6bab3236f15926e1712984eda9465415958cea70 /libdocument/ev-document.c
parente10bf9631652b8533b18a14285db89bd14b4c42e (diff)
downloadatril-6f41c201422edd6b4dbf9f9f41b5dc29530d21c6.tar.bz2
atril-6f41c201422edd6b4dbf9f9f41b5dc29530d21c6.tar.xz
Thumbnails for Epub Documents
This commit is mainly so that any further changes can be reverted to this state. The thumbnails are of very large sizes so I need to fix that, and in general implement thumbnails. Also I am facing an X-windows error, which I can't seem to fix. I feel it may be a problem with webkit-1.0, so will try the build with gtk3 and webkit2. If so is the case, I'll have to work something out for that. Should be able to push a commit soon where the document can actually be read, soon as I figure out the perfect place for the call to load uri. Other than that more function were modified in accordance with webkit. The error I get when opening the file from the filechooser still persists, I need to fix that too.
Diffstat (limited to 'libdocument/ev-document.c')
-rw-r--r--libdocument/ev-document.c48
1 files changed, 32 insertions, 16 deletions
diff --git a/libdocument/ev-document.c b/libdocument/ev-document.c
index 9353417e..fee64ed1 100644
--- a/libdocument/ev-document.c
+++ b/libdocument/ev-document.c
@@ -281,8 +281,6 @@ ev_document_load (EvDocument *document,
* We are however geeneralising the scenario by considering epub as a type of web document.
* FIXME: Labels, or bookmarks though, can be done.
*/
- if ( document->iswebdocument == TRUE )
- break;
EvPage *page = ev_document_get_page (document, i);
gdouble page_width = 0;
@@ -290,9 +288,15 @@ ev_document_load (EvDocument *document,
EvPageSize *page_size;
gchar *page_label;
+ if ( document->iswebdocument == FALSE ) {
+ _ev_document_get_page_size (document, page, &page_width, &page_height);
+ }
+ else {
+ //Fixed page sized to resolve the X-windowing system error.
+ page_width = 800;
+ page_height= 600;
+ }
- _ev_document_get_page_size (document, page, &page_width, &page_height);
-
if (i == 0) {
priv->uniform_width = page_width;
priv->uniform_height = page_height;
@@ -300,15 +304,21 @@ ev_document_load (EvDocument *document,
priv->max_height = priv->uniform_height;
priv->min_width = priv->uniform_width;
priv->min_height = priv->uniform_height;
-
+ if (document->iswebdocument == TRUE ) {
+ priv->page_sizes = g_new0 (EvPageSize, 1);
+ priv->page_sizes->width = priv->uniform_width;
+ priv->page_sizes->height = priv->uniform_height;
+ priv->uniform = TRUE ;
+ break;
+ }
} else if (priv->uniform &&
(priv->uniform_width != page_width ||
priv->uniform_height != page_height)) {
/* It's a different page size. Backfill the array. */
int j;
-
+
priv->page_sizes = g_new0 (EvPageSize, priv->n_pages);
-
+
for (j = 0; j < i; j++) {
page_size = &(priv->page_sizes[j]);
page_size->width = priv->uniform_width;
@@ -535,15 +545,21 @@ ev_document_get_page_size (EvDocument *document,
{
g_return_if_fail (EV_IS_DOCUMENT (document));
g_return_if_fail (page_index >= 0 || page_index < document->priv->n_pages);
-
- if (width)
- *width = document->priv->uniform ?
- document->priv->uniform_width :
- document->priv->page_sizes[page_index].width;
- if (height)
- *height = document->priv->uniform ?
- document->priv->uniform_height :
- document->priv->page_sizes[page_index].height;
+ if (document->iswebdocument == TRUE ) {
+ if (width)
+ *width = document->priv->uniform_width;
+ if (height)
+ *height = document->priv->uniform_height;
+ } else {
+ if (width)
+ *width = document->priv->uniform ?
+ document->priv->uniform_width :
+ document->priv->page_sizes[page_index].width;
+ if (height)
+ *height = document->priv->uniform ?
+ document->priv->uniform_height :
+ document->priv->page_sizes[page_index].height;
+ }
}
static gchar *