From 01541da48f323eaa413d5706ed14e4dc6704b963 Mon Sep 17 00:00:00 2001 From: Christian Dywan Date: Wed, 23 May 2012 00:43:49 +0200 Subject: [PATCH] Confirm Caret Browsing before enabling it Fixes: https://bugs.launchpad.net/midori/+bug/797923 --- midori/midori-browser.c | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/midori/midori-browser.c b/midori/midori-browser.c index d1ae4e82..042a06aa 100644 --- a/midori/midori-browser.c +++ b/midori/midori-browser.c @@ -3483,7 +3483,30 @@ static void _action_caret_browsing_activate (GtkAction* action, MidoriBrowser* browser) { - _("Toggle text cursor navigation"); + gint response; + GtkWidget* dialog; + + if (!katze_object_get_boolean (browser->settings, "enable-caret-browsing")) + { + dialog = gtk_message_dialog_new (GTK_WINDOW (browser), + GTK_DIALOG_DESTROY_WITH_PARENT | GTK_DIALOG_NO_SEPARATOR, + GTK_MESSAGE_QUESTION, GTK_BUTTONS_NONE, + _("Toggle text cursor navigation")); + gtk_window_set_title (GTK_WINDOW (dialog), _("Toggle text cursor navigation")); + gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog), + _("Pressing F7 toggles Caret Browsing. When active, a text cursor appears in all websites.")); + gtk_dialog_add_buttons (GTK_DIALOG (dialog), + GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, + _("_Enable Caret Browsing"), GTK_RESPONSE_ACCEPT, + NULL); + + response = gtk_dialog_run (GTK_DIALOG (dialog)); + gtk_widget_destroy (dialog); + + if (response != GTK_RESPONSE_ACCEPT) + return; + } + g_object_set (browser->settings, "enable-caret-browsing", !katze_object_get_boolean (browser->settings, "enable-caret-browsing"), NULL); } -- 2.39.5