]> spindle.queued.net Git - midori/commitdiff
Confirm Caret Browsing before enabling it
authorChristian Dywan <christian@twotoasts.de>
Tue, 22 May 2012 22:43:49 +0000 (00:43 +0200)
committerChristian Dywan <christian@twotoasts.de>
Tue, 22 May 2012 22:43:49 +0000 (00:43 +0200)
Fixes: https://bugs.launchpad.net/midori/+bug/797923
midori/midori-browser.c

index d1ae4e82801ff80a025958588159000256e27a35..042a06aa9b6023ac1e136a69a25a7fb9e3e06fc6 100644 (file)
@@ -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);
 }