From: Carlos Garcia Campos Date: Sun, 22 Apr 2007 17:12:42 +0000 (+0000) Subject: Start rendering pages before any other jobs. X-Git-Tag: EVINCE_0_9_0~36 X-Git-Url: https://www.fi.muni.cz/~kas/git//home/kas/public_html/git/?a=commitdiff_plain;h=ecc5ef5d1ba136113da805933cfef38652fd47a9;p=evince.git Start rendering pages before any other jobs. 2007-04-22 Carlos Garcia Campos * shell/ev-window.c: (ev_window_setup_document), (ev_window_set_document), (ev_window_load_job_cb): * shell/ev-view.c: (setup_caches): * shell/ev-sidebar-thumbnails.c: (ev_sidebar_thumbnails_set_document): Start rendering pages before any other jobs. svn path=/trunk/; revision=2417 --- diff --git a/ChangeLog b/ChangeLog index 83a372e1..d176dfbb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2007-04-22 Carlos Garcia Campos + + * shell/ev-window.c: (ev_window_setup_document), + (ev_window_set_document), (ev_window_load_job_cb): + * shell/ev-view.c: (setup_caches): + * shell/ev-sidebar-thumbnails.c: (ev_sidebar_thumbnails_set_document): + + Start rendering pages before any other jobs. + 2007-04-22 Carlos Garcia Campos * shell/ev-window.c: (ev_window_stop_fullscreen), diff --git a/shell/ev-sidebar-thumbnails.c b/shell/ev-sidebar-thumbnails.c index 75b735d1..d6a8af51 100644 --- a/shell/ev-sidebar-thumbnails.c +++ b/shell/ev-sidebar-thumbnails.c @@ -676,6 +676,9 @@ ev_sidebar_thumbnails_set_document (EvSidebarPage *sidebar_page, g_signal_connect (priv->page_cache, "page-changed", G_CALLBACK (page_changed_cb), sidebar_thumbnails); sidebar_thumbnails->priv->start_page = 0; sidebar_thumbnails->priv->end_page = 0; + page_changed_cb (priv->page_cache, + ev_page_cache_get_current_page (priv->page_cache), + sidebar_thumbnails); adjustment_changed_cb (sidebar_thumbnails); } diff --git a/shell/ev-view.c b/shell/ev-view.c index a7641f84..d496a68e 100644 --- a/shell/ev-view.c +++ b/shell/ev-view.c @@ -3471,6 +3471,9 @@ setup_caches (EvView *view) g_signal_connect (view->page_cache, "page-changed", G_CALLBACK (page_changed_cb), view); view->pixbuf_cache = ev_pixbuf_cache_new (GTK_WIDGET (view), view->document); g_signal_connect (view->pixbuf_cache, "job-finished", G_CALLBACK (job_finished_cb), view); + page_changed_cb (view->page_cache, + ev_page_cache_get_current_page (view->page_cache), + view); } static void diff --git a/shell/ev-window.c b/shell/ev-window.c index f584d995..770c916a 100644 --- a/shell/ev-window.c +++ b/shell/ev-window.c @@ -849,7 +849,7 @@ setup_sidebar_from_metadata (EvWindow *window, EvDocument *document) } else if (strcmp (page_id, THUMBNAILS_SIDEBAR_ID) && ev_sidebar_page_support_document (EV_SIDEBAR_PAGE (thumbs), document)) { ev_sidebar_set_page (EV_SIDEBAR (sidebar), thumbs); } else if (strcmp (page_id, ATTACHMENTS_SIDEBAR_ID) && ev_sidebar_page_support_document (EV_SIDEBAR_PAGE (attachments), document)) { - ev_sidebar_set_page (EV_SIDEBAR (sidebar), thumbs); + ev_sidebar_set_page (EV_SIDEBAR (sidebar), attachments); } g_value_unset (&sidebar_page); } else if (document && ev_sidebar_page_support_document (EV_SIDEBAR_PAGE (links), document)) { @@ -1058,22 +1058,14 @@ ev_window_set_icon_from_thumbnail (EvJobThumbnail *job, ev_window_clear_thumbnail_job (ev_window); } -static void +static gboolean ev_window_setup_document (EvWindow *ev_window) { const EvDocumentInfo *info; - EvDocument *document; - EvView *view = EV_VIEW (ev_window->priv->view); + EvDocument *document = ev_window->priv->document; EvSidebar *sidebar = EV_SIDEBAR (ev_window->priv->sidebar); GtkAction *action; - - document = ev_window->priv->document; - ev_window->priv->page_cache = ev_page_cache_get (ev_window->priv->document); - g_signal_connect (ev_window->priv->page_cache, "page-changed", - G_CALLBACK (page_changed_cb), ev_window); - g_signal_connect (ev_window->priv->page_cache, "history-changed", - G_CALLBACK (history_changed_cb), ev_window); - + if (EV_IS_DOCUMENT_FIND (document)) { g_signal_connect_object (G_OBJECT (document), "find_changed", @@ -1102,16 +1094,12 @@ ev_window_setup_document (EvWindow *ev_window) g_object_unref (rc); } - ev_sidebar_set_document (sidebar, document); - - if (ev_page_cache_get_n_pages (ev_window->priv->page_cache) > 0) { - ev_view_set_document (view, document); - } ev_window_set_page_mode (ev_window, PAGE_MODE_DOCUMENT); - ev_window_title_set_document (ev_window->priv->title, document); ev_window_title_set_uri (ev_window->priv->title, ev_window->priv->uri); + ev_sidebar_set_document (sidebar, document); + action = gtk_action_group_get_action (ev_window->priv->action_group, PAGE_SELECTOR_ACTION); ev_page_action_set_document (EV_PAGE_ACTION (action), document); ev_window_setup_action_sensitivity (ev_window); @@ -1127,12 +1115,36 @@ ev_window_setup_document (EvWindow *ev_window) ev_window->priv->document); } + info = ev_page_cache_get_info (ev_window->priv->page_cache); + update_document_mode (ev_window, info->mode); + + return FALSE; +} + +static void +ev_window_set_document (EvWindow *ev_window, EvDocument *document) +{ + EvView *view = EV_VIEW (ev_window->priv->view); + + if (ev_window->priv->document) + g_object_unref (ev_window->priv->document); + ev_window->priv->document = g_object_ref (document); + + ev_window->priv->page_cache = ev_page_cache_get (ev_window->priv->document); + g_signal_connect (ev_window->priv->page_cache, "page-changed", + G_CALLBACK (page_changed_cb), ev_window); + g_signal_connect (ev_window->priv->page_cache, "history-changed", + G_CALLBACK (history_changed_cb), ev_window); + setup_size_from_metadata (ev_window); - setup_document_from_metadata (ev_window); setup_sidebar_from_metadata (ev_window, document); + setup_document_from_metadata (ev_window); - info = ev_page_cache_get_info (ev_window->priv->page_cache); - update_document_mode (ev_window, info->mode); + if (ev_page_cache_get_n_pages (ev_window->priv->page_cache) > 0) { + ev_view_set_document (view, document); + } + + g_idle_add ((GSourceFunc)ev_window_setup_document, ev_window); } static void @@ -1278,10 +1290,8 @@ ev_window_load_job_cb (EvJobLoad *job, /* Success! */ if (job->error == NULL) { - if (ev_window->priv->document) - g_object_unref (ev_window->priv->document); - ev_window->priv->document = g_object_ref (document); - + ev_window_set_document (ev_window, document); + if (job->mode != EV_WINDOW_MODE_PREVIEW) { setup_view_from_metadata (ev_window); } @@ -1290,8 +1300,6 @@ ev_window_load_job_cb (EvJobLoad *job, ev_window_add_recent (ev_window, ev_window->priv->uri); } - ev_window_setup_document (ev_window); - if (job->dest) { EvLink *link; EvLinkAction *link_action;