[gedit] replace-dialog: fix corner-case button sensitivity



commit 8b564c000808a8cc055b10284a5ae171a46c0e5f
Author: Michael Catanzaro <mcatanzaro gnome org>
Date:   Mon Mar 17 19:53:10 2014 -0500

    replace-dialog: fix corner-case button sensitivity
    
    If the regular expression checkbutton is checked, the search entry
    contains an invalid regular expression, and the user presses Find or
    Replace All, all response buttons correctly become insensitive. Now, if
    the user unchecks the regex checkbutton, the error should be cleared and
    the responses should become sensitive so that he can search again. This
    wasn't happening.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=726593

 gedit/gedit-replace-dialog.c |   17 +++++++++++++++++
 1 files changed, 17 insertions(+), 0 deletions(-)
---
diff --git a/gedit/gedit-replace-dialog.c b/gedit/gedit-replace-dialog.c
index 77a48a9..406de55 100644
--- a/gedit/gedit-replace-dialog.c
+++ b/gedit/gedit-replace-dialog.c
@@ -558,6 +558,18 @@ replace_text_entry_changed (GtkEditable        *editable,
        update_responses_sensitivity (dialog);
 }
 
+static void
+regex_checkbutton_toggled (GtkToggleButton    *checkbutton,
+                          GeditReplaceDialog *dialog)
+{
+       if (!gtk_toggle_button_get_active (checkbutton))
+       {
+               /* Remove the regex error state so the user can search again */
+               set_search_error (dialog, NULL);
+               update_responses_sensitivity (dialog);
+       }
+}
+
 /* TODO: move in gedit-document.c and share it with gedit-view-frame */
 static gboolean
 get_selected_text (GtkTextBuffer  *doc,
@@ -704,6 +716,11 @@ gedit_replace_dialog_init (GeditReplaceDialog *dlg)
                          G_CALLBACK (replace_text_entry_changed),
                          dlg);
 
+       g_signal_connect (dlg->priv->regex_checkbutton,
+                         "toggled",
+                         G_CALLBACK (regex_checkbutton_toggled),
+                         dlg);
+
        g_signal_connect (dlg,
                          "show",
                          G_CALLBACK (show_cb),


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