From 1029127ee35060b39fe1972b5ecf19db86f3189d Mon Sep 17 00:00:00 2001 From: Carlos Garcia Campos Date: Sun, 3 Jan 2010 20:57:46 +0100 Subject: [PATCH] [presentation] Allow finish presentation by clicking on end page Escape still works, but end page message now says 'Click to exit'. See bug #309364. --- libview/ev-view-presentation.c | 19 ++++++++++++++++++- shell/ev-window.c | 9 +++++++++ 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/libview/ev-view-presentation.c b/libview/ev-view-presentation.c index 72af799c..2dfed6a0 100644 --- a/libview/ev-view-presentation.c +++ b/libview/ev-view-presentation.c @@ -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); diff --git a/shell/ev-window.c b/shell/ev-window.c index d7565fff..086a4bea 100644 --- a/shell/ev-window.c +++ b/shell/ev-window.c @@ -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, -- 2.43.0