[epiphany/tmp-gnome-2-32: 2/31] Show a dialog when the user wants to enable caret browsing



commit 5d9d1d862dce9c1a38f0ffa30db2e8b27290009f
Author: Xan Lopez <xan gnome org>
Date:   Thu May 13 12:31:09 2010 +0200

    Show a dialog when the user wants to enable caret browsing
    
    Otherwise it's really simple to enable it by mistake and never notice
    you did, which can be very confusing.
    
    Bug #501666

 src/window-commands.c |   37 +++++++++++++++++++++++++++++++++++++
 1 files changed, 37 insertions(+), 0 deletions(-)
---
diff --git a/src/window-commands.c b/src/window-commands.c
index 8473399..11d2f83 100644
--- a/src/window-commands.c
+++ b/src/window-commands.c
@@ -1193,7 +1193,44 @@ window_cmd_browse_with_caret (GtkAction *action,
 			      EphyWindow *window)
 {
 	gboolean active;
+	EphyEmbed *embed;
 
+	embed = ephy_embed_container_get_active_child 
+		(EPHY_EMBED_CONTAINER (window));
+	
 	active = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action));
+
+	/* FIXME: perhaps a bit of a kludge; we check if there's an
+	 * active embed because we don't want to show the dialog on
+	 * startup when we sync the GtkAction with our GConf
+	 * preference */
+	if (active && embed)
+	{
+		GtkWidget *dialog;
+		int response;
+
+		dialog = gtk_message_dialog_new (GTK_WINDOW (window),
+						 GTK_DIALOG_DESTROY_WITH_PARENT,
+						 GTK_MESSAGE_QUESTION, GTK_BUTTONS_CANCEL,
+						 _("Enable caret browsing mode?"));
+
+		gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
+							  _("Pressing F7 turns caret browsing on or off. This feature "
+							    "places a moveable cursor in web pages, allowing you to move "
+							    "around with your keyboard. Do you want to enable caret browsing on?"));
+		gtk_dialog_add_button (GTK_DIALOG (dialog), _("_Enable"), GTK_RESPONSE_ACCEPT);
+		gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_CANCEL);
+
+		response = gtk_dialog_run (GTK_DIALOG (dialog));
+
+		gtk_widget_destroy (dialog);
+
+		if (response == GTK_RESPONSE_CANCEL)
+		{
+			gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action), FALSE);
+			return;
+		}
+	}
+
 	eel_gconf_set_boolean (CONF_CARET_BROWSING_ENABLED, active);
 }



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