]> www.fi.muni.cz Git - evince.git/commitdiff
Show a wait cursor while the page is rendering
authorMarco Pesenti Gritti <marco@gnome.org>
Thu, 20 Jan 2005 12:16:53 +0000 (12:16 +0000)
committerMarco Pesenti Gritti <marco@src.gnome.org>
Thu, 20 Jan 2005 12:16:53 +0000 (12:16 +0000)
2005-01-20  Marco Pesenti Gritti  <marco@gnome.org>

        * pdf/xpdf/pdf-document.cc:
        * shell/ev-view.c: (ev_view_set_cursor),
        (ev_view_motion_notify_event), (document_changed_callback),
        (set_document_page):

        Show a wait cursor while the page is rendering

ChangeLog
pdf/xpdf/pdf-document.cc
shell/ev-view.c

index 32ad1e1552890606f02593eb04d959da0dd52200..4a54e63a72d6313c3f3d2d5570f71158b7e5783d 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2005-01-20  Marco Pesenti Gritti  <marco@gnome.org>
+
+       * pdf/xpdf/pdf-document.cc:
+       * shell/ev-view.c: (ev_view_set_cursor),
+       (ev_view_motion_notify_event), (document_changed_callback),
+       (set_document_page):
+
+       Show a wait cursor while the page is rendering
+
 2005-01-20  Marco Pesenti Gritti  <marco@gnome.org>
 
        * shell/ev-sidebar-thumbnails.c:
index 0a70edbdf2c0bc71e2c63eac6a2c8d0e0ea75fad..2ec9d5e28ca4b423d519d29d0d11fe5a891a37bb 100644 (file)
@@ -149,6 +149,8 @@ document_validate_page (PdfDocument *pdf_document)
 
                pdf_document->page_valid = TRUE;
 
+               ev_document_changed (EV_DOCUMENT (pdf_document));
+
                 /* Update the search results available to the app since
                  * we only provide full results on the current page
                  */
@@ -274,8 +276,6 @@ pdf_document_set_page (EvDocument  *document,
                pdf_document->page = page;
                pdf_document->page_valid = FALSE;
        }
-
-       ev_document_changed (document);
 }
 
 static int
index 2033962ae1842ebb88f0341ece27bf8ea4c543d0..e76f5b81728af22109298bb499683c81d825e767 100644 (file)
@@ -57,7 +57,8 @@ static const GtkTargetEntry targets[] = {
 
 typedef enum {
        EV_VIEW_CURSOR_NORMAL,
-       EV_VIEW_CURSOR_HAND
+       EV_VIEW_CURSOR_LINK,
+       EV_VIEW_CURSOR_WAIT
 } EvViewCursor;
 
 struct _EvView {
@@ -595,26 +596,35 @@ ev_view_set_find_status (EvView *view, const char *message)
 static void
 ev_view_set_cursor (EvView *view, EvViewCursor new_cursor)
 {
-       GdkCursor *cursor;
-       GtkWidget *widget = GTK_WIDGET (view);
+       GdkCursor *cursor = NULL;
+       GdkDisplay *display;
+       GtkWidget *widget;
 
        if (view->cursor == new_cursor) {
                return;
        }
 
+       widget = gtk_widget_get_toplevel (GTK_WIDGET (view));
+       display = gtk_widget_get_display (widget);
+       view->cursor = new_cursor;
+
        switch (new_cursor) {
                case EV_VIEW_CURSOR_NORMAL:
                        gdk_window_set_cursor (widget->window, NULL);
                        break;
-               case EV_VIEW_CURSOR_HAND:
-                       cursor = gdk_cursor_new_for_display
-                               (gdk_display_get_default(), GDK_HAND2);
-                       gdk_window_set_cursor (widget->window, cursor);
-                       gdk_cursor_unref (cursor);
+               case EV_VIEW_CURSOR_LINK:
+                       cursor = gdk_cursor_new_for_display (display, GDK_HAND2);
+                       break;
+               case EV_VIEW_CURSOR_WAIT:
+                       cursor = gdk_cursor_new_for_display (display, GDK_WATCH);
                        break;
        }
 
-       view->cursor = new_cursor;
+       if (cursor) {
+               gdk_window_set_cursor (widget->window, cursor);
+               gdk_cursor_unref (cursor);
+               gdk_flush();
+       }
 }
 
 static gboolean
@@ -638,13 +648,15 @@ ev_view_motion_notify_event (GtkWidget      *widget,
 
                        msg = status_message_from_link (link);
                        ev_view_set_status (view, msg);
-                       ev_view_set_cursor (view, EV_VIEW_CURSOR_HAND);
+                       ev_view_set_cursor (view, EV_VIEW_CURSOR_LINK);
                        g_free (msg);
 
                         g_object_unref (link);
                } else {
                        ev_view_set_status (view, NULL);
-                       ev_view_set_cursor (view, EV_VIEW_CURSOR_NORMAL);
+                       if (view->cursor == EV_VIEW_CURSOR_LINK) {
+                               ev_view_set_cursor (view, EV_VIEW_CURSOR_NORMAL);
+                       }
                }
        }
 
@@ -1038,6 +1050,14 @@ found_results_callback (EvDocument         *document,
   gtk_widget_queue_draw (GTK_WIDGET (view));
 }
 
+static void
+document_changed_callback (EvDocument *document,
+                          EvView     *view)
+{
+       gtk_widget_queue_draw (GTK_WIDGET (view));
+       ev_view_set_cursor (view, EV_VIEW_CURSOR_NORMAL);
+}
+
 /*** Public API ***/       
      
 GtkWidget*
@@ -1046,13 +1066,6 @@ ev_view_new (void)
        return g_object_new (EV_TYPE_VIEW, NULL);
 }
 
-static void
-document_changed_callback (EvDocument *document,
-                          EvView     *view)
-{
-       gtk_widget_queue_draw (GTK_WIDGET (view));
-}
-
 void
 ev_view_set_document (EvView     *view,
                      EvDocument *document)
@@ -1100,8 +1113,12 @@ set_document_page (EvView *view, int page)
 {
        if (view->document) {
                int old_page = ev_document_get_page (view->document);
-               if (old_page != page)
+
+               if (old_page != page) {
+                       ev_view_set_cursor (view, EV_VIEW_CURSOR_WAIT);
                        ev_document_set_page (view->document, page);
+               }
+
                if (old_page != ev_document_get_page (view->document)) {
                        g_signal_emit (view, page_changed_signal, 0);