From fb037eb2a0842976deddd8df6793ed642eea5674 Mon Sep 17 00:00:00 2001 From: "Nickolay V. Shmyrev" Date: Tue, 7 Feb 2006 20:09:23 +0000 Subject: [PATCH] Draw Loading message during xfer job. Fix for the bug #329495. * shell/ev-view-private.h: * shell/ev-view.c: (ev_view_expose_event), (ev_view_set_loading), (ev_view_set_document): * shell/ev-view.h: * shell/ev-window.c: (ev_window_load_job_cb), (ev_window_xfer_job_cb), (ev_window_open_uri), (ev_window_dispose), (ev_window_init): Draw Loading message during xfer job. Fix for the bug #329495. --- ChangeLog | 12 ++++++++++++ shell/ev-view-private.h | 1 + shell/ev-view.c | 19 +++++++++++++++++++ shell/ev-view.h | 2 ++ shell/ev-window.c | 11 ++++------- 5 files changed, 38 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index 29fc5da3..ec1efdd8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,15 @@ +2006-02-07 Nickolay V. Shmyrev + + * shell/ev-view-private.h: + * shell/ev-view.c: (ev_view_expose_event), (ev_view_set_loading), + (ev_view_set_document): + * shell/ev-view.h: + * shell/ev-window.c: (ev_window_load_job_cb), + (ev_window_xfer_job_cb), (ev_window_open_uri), (ev_window_dispose), + (ev_window_init): + + Draw Loading message during xfer job. Fix for the bug #329495. + 2006-02-03 Nickolay V. Shmyrev * comics/comics-document.c: (comics_regex_quote), diff --git a/shell/ev-view-private.h b/shell/ev-view-private.h index 91f43154..9619b6d7 100644 --- a/shell/ev-view-private.h +++ b/shell/ev-view-private.h @@ -92,6 +92,7 @@ struct _EvView { double scale; int spacing; + gboolean loading; gboolean continuous; gboolean dual_page; gboolean fullscreen; diff --git a/shell/ev-view.c b/shell/ev-view.c index dae30b9c..47c4eaec 100644 --- a/shell/ev-view.c +++ b/shell/ev-view.c @@ -209,6 +209,9 @@ static void draw_one_page (EvView GdkRectangle *page_area, GtkBorder *border, GdkRectangle *expose_area); +static void draw_loading_text (EvView *view, + GdkRectangle *page_area, + GdkRectangle *expose_area); /*** Callbacks ***/ static void find_changed_cb (EvDocument *document, @@ -1619,6 +1622,12 @@ ev_view_expose_event (GtkWidget *widget, EvView *view = EV_VIEW (widget); int i; + if (view->loading) { + draw_loading_text (view, + &(widget->allocation), + &(event->area)); + } + if (view->document == NULL) return FALSE; @@ -2689,12 +2698,22 @@ clear_caches (EvView *view) } } +void +ev_view_set_loading (EvView *view, + gboolean loading) +{ + view->loading = loading; + gtk_widget_queue_draw (GTK_WIDGET (view)); +} + void ev_view_set_document (EvView *view, EvDocument *document) { g_return_if_fail (EV_IS_VIEW (view)); + view->loading = FALSE; + if (document != view->document) { clear_caches (view); diff --git a/shell/ev-view.h b/shell/ev-view.h index 0378f285..0c0a8628 100644 --- a/shell/ev-view.h +++ b/shell/ev-view.h @@ -60,6 +60,8 @@ GType ev_sizing_mode_get_type (void) G_GNUC_CONST; GtkWidget* ev_view_new (void); void ev_view_set_document (EvView *view, EvDocument *document); +void ev_view_set_loading (EvView *view, + gboolean loading); /* Clipboard */ void ev_view_copy (EvView *view); diff --git a/shell/ev-window.c b/shell/ev-window.c index a3a4457d..5424c6a2 100644 --- a/shell/ev-window.c +++ b/shell/ev-window.c @@ -102,7 +102,6 @@ struct _EvWindowPrivate { GtkWidget *find_bar; GtkWidget *scrolled_window; GtkWidget *view; - GtkWidget *page_view; GtkWidget *password_view; GtkWidget *sidebar_thumbs; GtkWidget *sidebar_links; @@ -954,6 +953,8 @@ ev_window_load_job_cb (EvJobLoad *job, g_assert (document); g_assert (document != ev_window->priv->document); g_assert (job->uri); + + ev_view_set_loading (EV_VIEW (ev_window->priv->view), FALSE); if (ev_window->priv->password_document) { g_object_unref (ev_window->priv->password_document); @@ -1007,6 +1008,7 @@ ev_window_xfer_job_cb (EvJobXfer *job, if (job->error != NULL) { unable_to_load (ev_window, job->error->message); ev_window_clear_jobs (ev_window); + ev_view_set_loading (EV_VIEW (ev_window->priv->view), FALSE); } else { char *uri; @@ -1069,6 +1071,7 @@ ev_window_open_uri (EvWindow *ev_window, const char *uri) ev_window_close_dialogs (ev_window); ev_window_clear_jobs (ev_window); ev_window_clear_local_uri (ev_window); + ev_view_set_loading (EV_VIEW (ev_window->priv->view), TRUE); ev_window->priv->xfer_job = ev_job_xfer_new (uri); g_signal_connect (ev_window->priv->xfer_job, @@ -2705,11 +2708,6 @@ ev_window_dispose (GObject *object) priv->view = NULL; } - if (priv->page_view) { - g_object_unref (priv->page_view); - priv->page_view = NULL; - } - if (priv->load_job || priv->xfer_job) { ev_window_clear_jobs (window); } @@ -3434,7 +3432,6 @@ ev_window_init (EvWindow *ev_window) /* We own a ref on these widgets, as we can swap them in and out */ g_object_ref (ev_window->priv->view); - //g_object_ref (ev_window->priv->page_view); g_object_ref (ev_window->priv->password_view); gtk_container_add (GTK_CONTAINER (ev_window->priv->scrolled_window), -- 2.43.5