[evince/gnome-3-10] xps: Do not use EvDocument API in get_info implementation
- From: Carlos Garcia Campos <carlosgc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evince/gnome-3-10] xps: Do not use EvDocument API in get_info implementation
- Date: Wed, 30 Oct 2013 09:36:18 +0000 (UTC)
commit cad2cf936fe4e6d98d203271385a67eefc8adbcc
Author: Carlos Garcia Campos <carlosgc gnome org>
Date: Wed Oct 30 10:32:31 2013 +0100
xps: Do not use EvDocument API in get_info implementation
get_info might be called while the document is being loaded and the
EvDocument cache is not filled yet. Use only the GXPS API to make
sure we get valid values. This fixes the page size always reported as
0x0 in the properties dialog.
https://bugzilla.gnome.org/show_bug.cgi?id=711093
backend/xps/xps-document.c | 14 ++++++++------
1 files changed, 8 insertions(+), 6 deletions(-)
---
diff --git a/backend/xps/xps-document.c b/backend/xps/xps-document.c
index 23f4737..b759098 100644
--- a/backend/xps/xps-document.c
+++ b/backend/xps/xps-document.c
@@ -171,16 +171,18 @@ xps_document_get_info (EvDocument *document)
EV_DOCUMENT_INFO_PAPER_SIZE;
- if (gxps_document_get_n_pages (xps->doc) > 0) {
- ev_document_get_page_size (document, 0,
- &(info->paper_width),
- &(info->paper_height));
+ info->n_pages = gxps_document_get_n_pages (xps->doc);
+ if (info->n_pages > 0) {
+ GXPSPage *gxps_page;
+
+ gxps_page = gxps_document_get_page (xps->doc, 0, NULL);
+ gxps_page_get_size (gxps_page, &(info->paper_width), &(info->paper_height));
+ g_object_unref (gxps_page);
+
info->paper_width = info->paper_width / 96.0f * 25.4f;
info->paper_height = info->paper_height / 96.0f * 25.4f;
}
- info->n_pages = gxps_document_get_n_pages (xps->doc);
-
return info;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]