[evince] Move ev_page_cache_check_dimensions() to EvDocument



commit 8c149ccd2a3cced2cd0a676ad6f7b8d33fd98404
Author: Carlos Garcia Campos <carlosgc gnome org>
Date:   Thu Aug 20 12:35:08 2009 +0200

    Move ev_page_cache_check_dimensions() to EvDocument

 libdocument/ev-document.c     |    8 ++++++++
 libdocument/ev-document.h     |    1 +
 libview/ev-page-cache.c       |   11 -----------
 libview/ev-page-cache.h       |    2 --
 shell/ev-sidebar-thumbnails.c |    2 +-
 shell/ev-window.c             |    8 ++++----
 6 files changed, 14 insertions(+), 18 deletions(-)
---
diff --git a/libdocument/ev-document.c b/libdocument/ev-document.c
index c2c73aa..5c63b25 100644
--- a/libdocument/ev-document.c
+++ b/libdocument/ev-document.c
@@ -464,6 +464,14 @@ ev_document_get_max_page_size (EvDocument *document,
 		*height = document->priv->max_height;
 }
 
+gboolean
+ev_document_check_dimensions (EvDocument *document)
+{
+	g_return_val_if_fail (EV_IS_DOCUMENT (document), FALSE);
+
+	return (document->priv->max_width > 0 && document->priv->max_height > 0);
+}
+
 gint
 ev_document_get_max_label_len (EvDocument *document)
 {
diff --git a/libdocument/ev-document.h b/libdocument/ev-document.h
index 2ce1cf1..608e90f 100644
--- a/libdocument/ev-document.h
+++ b/libdocument/ev-document.h
@@ -139,6 +139,7 @@ gboolean         ev_document_is_page_size_uniform (EvDocument      *document);
 void             ev_document_get_max_page_size    (EvDocument      *document,
 						   gdouble         *width,
 						   gdouble         *height);
+gboolean         ev_document_check_dimensions     (EvDocument      *document);
 gint             ev_document_get_max_label_len    (EvDocument      *document);
 gboolean         ev_document_has_text_page_labels (EvDocument      *document);
 gboolean         ev_document_find_page_by_label   (EvDocument      *document,
diff --git a/libview/ev-page-cache.c b/libview/ev-page-cache.c
index 231af3b..ab468b9 100644
--- a/libview/ev-page-cache.c
+++ b/libview/ev-page-cache.c
@@ -207,17 +207,6 @@ ev_page_cache_new (EvDocument *document)
 	return page_cache;
 }
 
-gboolean
-ev_page_cache_check_dimensions (EvPageCache *page_cache)
-{
-	gdouble document_width, document_height;
-
-	ev_document_get_max_page_size (page_cache->document,
-				       &document_width, &document_height);
-
-	return (document_width > 0 && document_height > 0);
-}
-
 gint
 ev_page_cache_get_current_page (EvPageCache *page_cache)
 {
diff --git a/libview/ev-page-cache.h b/libview/ev-page-cache.h
index d51707a..1c3629d 100644
--- a/libview/ev-page-cache.h
+++ b/libview/ev-page-cache.h
@@ -68,8 +68,6 @@ gboolean       ev_page_cache_set_page_label      (EvPageCache *page_cache,
 
 EvPageCache   *ev_page_cache_get		 (EvDocument *document);
 
-gboolean       ev_page_cache_check_dimensions	 (EvPageCache *page_cache);
-
 G_END_DECLS
 
 #endif /* __EV_PAGE_CACHE_H__ */
diff --git a/shell/ev-sidebar-thumbnails.c b/shell/ev-sidebar-thumbnails.c
index 4e8c5b2..7137fa1 100644
--- a/shell/ev-sidebar-thumbnails.c
+++ b/shell/ev-sidebar-thumbnails.c
@@ -808,7 +808,7 @@ ev_sidebar_thumbnails_set_document (EvSidebarPage *sidebar_page,
 
 	if (!EV_IS_DOCUMENT_THUMBNAILS (document) ||
 	    ev_document_get_n_pages (document) <= 0 ||
-	    !ev_page_cache_check_dimensions (priv->page_cache)) {
+	    !ev_document_check_dimensions (document)) {
 		return;
 	}
 
diff --git a/shell/ev-window.c b/shell/ev-window.c
index 1332122..078cb9c 100644
--- a/shell/ev-window.c
+++ b/shell/ev-window.c
@@ -1158,7 +1158,7 @@ ev_window_refresh_window_thumbnail (EvWindow *ev_window, int rotation)
 
 	if (!EV_IS_DOCUMENT_THUMBNAILS (document) ||
 	    ev_document_get_n_pages (document) <= 0 ||
-	    !ev_page_cache_check_dimensions (ev_window->priv->page_cache)) {
+	    !ev_document_check_dimensions (document)) {
 		return;
 	}
 
@@ -1239,16 +1239,16 @@ ev_window_set_document (EvWindow *ev_window, EvDocument *document)
 		/* Restart the current page */
 		page = CLAMP (ev_link_dest_get_page (ev_window->priv->dest),
 			      0,
-			      ev_document_get_n_pages (ev_window->priv->document) - 1);
+			      ev_document_get_n_pages (document) - 1);
 		ev_page_cache_set_current_page (ev_window->priv->page_cache, page);
 		g_object_unref (ev_window->priv->dest);
 		ev_window->priv->dest = NULL;
 	}
 
-	if (ev_document_get_n_pages (ev_window->priv->document) <= 0) {
+	if (ev_document_get_n_pages (document) <= 0) {
 		ev_window_warning_message (ev_window, "%s",
 					   _("The document contains no pages"));
-	} else if (!ev_page_cache_check_dimensions (ev_window->priv->page_cache)) {
+	} else if (!ev_document_check_dimensions (document)) {
 		ev_window_warning_message (ev_window, "%s",
 					   _("The document contains only empty pages"));
 	} else {



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]