diff options
author | Xan Lopez <xan@gnome.org> | 2010-05-13 18:31:09 +0800 |
---|---|---|
committer | Xan Lopez <xan@gnome.org> | 2010-05-13 18:56:17 +0800 |
commit | 442bc41cb9fcf744ff874098cc8fadd0d121821c (patch) | |
tree | f861171c50eb34f9d6afe0ff5ee7ebe368174fc8 | |
parent | 87b6ed0e80a4b3c2692e20b6232cb58bc3b46e5b (diff) | |
download | gsoc2013-epiphany-442bc41cb9fcf744ff874098cc8fadd0d121821c.tar.gz gsoc2013-epiphany-442bc41cb9fcf744ff874098cc8fadd0d121821c.tar.zst gsoc2013-epiphany-442bc41cb9fcf744ff874098cc8fadd0d121821c.zip |
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
-rw-r--r-- | 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 847339946..11d2f83a7 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); } |