]> www.fi.muni.cz Git - evince.git/commitdiff
Move ev_page_cache_check_dimensions() to EvDocument
authorCarlos Garcia Campos <carlosgc@gnome.org>
Thu, 20 Aug 2009 10:35:08 +0000 (12:35 +0200)
committerCarlos Garcia Campos <carlosgc@gnome.org>
Tue, 15 Sep 2009 13:56:01 +0000 (15:56 +0200)
libdocument/ev-document.c
libdocument/ev-document.h
libview/ev-page-cache.c
libview/ev-page-cache.h
shell/ev-sidebar-thumbnails.c
shell/ev-window.c

index c2c73aa4edb6ce27d7502d1bf38881cb73986a0a..5c63b25f9d86bd7f2d84b0bbd1ff796c449d6cab 100644 (file)
@@ -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)
 {
index 2ce1cf18905baee1669a4da225fcc6b0b8df471c..608e90fe961520bb6836d9d9d9b78f095fadf160 100644 (file)
@@ -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,
index 231af3b146acf171ecc442375a44b669eba218d7..ab468b93e2e077ca0fe25283e04ada093d49a3c1 100644 (file)
@@ -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)
 {
index d51707a12b6751732f61395d92936f4321cf3c61..1c3629dbf2631a089653db39e2d4e63d79172c29 100644 (file)
@@ -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__ */
index 4e8c5b2fb9e6a8a5771dbd1f6ca2cdcd132d5316..7137fa1cb5e664aa1bd3252f655af013c3fb8be5 100644 (file)
@@ -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;
        }
 
index 133212299755afbff95e417d23c2ef41cc6d2b1d..078cb9c29bb0f4dd3fea5b3e98e047530c8ea139 100644 (file)
@@ -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 {