]> www.fi.muni.cz Git - evince.git/commitdiff
[presentation] Allow finish presentation by clicking on end page
authorCarlos Garcia Campos <carlosgc@gnome.org>
Sun, 3 Jan 2010 19:57:46 +0000 (20:57 +0100)
committerCarlos Garcia Campos <carlosgc@gnome.org>
Sun, 3 Jan 2010 20:14:13 +0000 (21:14 +0100)
Escape still works, but end page message now says 'Click to exit'.
See bug #309364.

libview/ev-view-presentation.c
shell/ev-window.c

index 72af799cf3d857ff36441fb76e9964690d0c7dd4..2dfed6a08616df78a2412fbd694c656b471f1ee6 100644 (file)
@@ -41,6 +41,7 @@ enum {
 
 enum {
        CHANGE_PAGE,
+       FINISHED,
        N_SIGNALS
 };
 
@@ -91,6 +92,7 @@ struct _EvViewPresentationClass
        /* signals */
        void (* change_page) (EvViewPresentation *pview,
                              GtkScrollType       scroll);
+       void (* finished)    (EvViewPresentation *pview);
 };
 
 static guint signals[N_SIGNALS] = { 0 };
@@ -953,7 +955,7 @@ ev_view_presentation_draw_end_page (EvViewPresentation *pview)
        PangoFontDescription *font_desc;
        gchar *markup;
        GdkRectangle area = {0};
-       const gchar *text = _("End of presentation. Press Escape to exit.");
+       const gchar *text = _("End of presentation. Click to exit.");
 
        if (pview->state != EV_PRESENTATION_END)
                return;
@@ -1103,6 +1105,12 @@ ev_view_presentation_button_release_event (GtkWidget      *widget,
        case 1: {
                EvLink *link;
 
+               if (pview->state == EV_PRESENTATION_END) {
+                       g_signal_emit (pview, signals[FINISHED], 0, NULL);
+
+                       return FALSE;
+               }
+
                link = ev_view_presentation_get_link_at_location (pview,
                                                                  event->x,
                                                                  event->y);
@@ -1353,6 +1361,15 @@ ev_view_presentation_class_init (EvViewPresentationClass *klass)
                              g_cclosure_marshal_VOID__ENUM,
                              G_TYPE_NONE, 1,
                              GTK_TYPE_SCROLL_TYPE);
+       signals[FINISHED] =
+               g_signal_new ("finished",
+                             G_OBJECT_CLASS_TYPE (gobject_class),
+                             G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
+                             G_STRUCT_OFFSET (EvViewPresentationClass, finished),
+                             NULL, NULL,
+                             g_cclosure_marshal_VOID__VOID,
+                             G_TYPE_NONE, 0,
+                             G_TYPE_NONE);
 
        binding_set = gtk_binding_set_by_class (klass);
        add_change_page_binding_keypad (binding_set, GDK_Left,  0, GTK_SCROLL_PAGE_BACKWARD);
index d7565fffe46562bd568a290b07c6d5765f2a8302..086a4bea09f2098ab04b69b5dc7f9c82eab54987 100644 (file)
@@ -3577,6 +3577,12 @@ ev_window_update_presentation_action (EvWindow *window)
                (action, G_CALLBACK (ev_window_cmd_view_presentation), window);
 }
 
+static void
+ev_window_view_presentation_finished (EvWindow *window)
+{
+       ev_window_stop_presentation (window, TRUE);
+}
+
 static void
 ev_window_run_presentation (EvWindow *window)
 {
@@ -3596,6 +3602,9 @@ ev_window_run_presentation (EvWindow *window)
        rotation = ev_document_model_get_rotation (window->priv->model);
        window->priv->presentation_view =
                ev_view_presentation_new (window->priv->document, current_page, rotation);
+       g_signal_connect_swapped (window->priv->presentation_view, "finished",
+                                 G_CALLBACK (ev_window_view_presentation_finished),
+                                 window);
 
        gtk_box_pack_start (GTK_BOX (window->priv->main_box),
                            window->priv->presentation_view,