[evince] [presentation] Allow finish presentation by clicking on end page



commit 1029127ee35060b39fe1972b5ecf19db86f3189d
Author: Carlos Garcia Campos <carlosgc gnome org>
Date:   Sun Jan 3 20:57:46 2010 +0100

    [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 deletions(-)
---
diff --git a/libview/ev-view-presentation.c b/libview/ev-view-presentation.c
index 72af799..2dfed6a 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 d7565ff..086a4be 100644
--- a/shell/ev-window.c
+++ b/shell/ev-window.c
@@ -3578,6 +3578,12 @@ ev_window_update_presentation_action (EvWindow *window)
 }
 
 static void
+ev_window_view_presentation_finished (EvWindow *window)
+{
+	ev_window_stop_presentation (window, TRUE);
+}
+
+static void
 ev_window_run_presentation (EvWindow *window)
 {
 	gboolean fullscreen_window = TRUE;
@@ -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,



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]