[gedit/wip/search-fixes] Set sensitivity of the search and replace dialog buttons
- From: Sébastien Wilmet <swilmet src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gedit/wip/search-fixes] Set sensitivity of the search and replace dialog buttons
- Date: Sat, 24 Aug 2013 17:14:47 +0000 (UTC)
commit 9c93ee46b192f76af6b474b957d18378857ab07b
Author: Sébastien Wilmet <swilmet gnome org>
Date: Sat Aug 24 19:00:40 2013 +0200
Set sensitivity of the search and replace dialog buttons
When a regex error occurs.
gedit/gedit-commands-search.c | 28 ++++++++++++++++++++++------
1 files changed, 22 insertions(+), 6 deletions(-)
---
diff --git a/gedit/gedit-commands-search.c b/gedit/gedit-commands-search.c
index 7e528ea..5de8a8b 100644
--- a/gedit/gedit-commands-search.c
+++ b/gedit/gedit-commands-search.c
@@ -523,20 +523,20 @@ update_regex_error (GeditReplaceDialog *dialog,
{
GError *regex_error = gtk_source_search_context_get_regex_error (search_context);
GtkSourceRegexSearchState regex_state = gtk_source_search_context_get_regex_state (search_context);
+ gboolean sensitive = TRUE;
gedit_replace_dialog_set_search_error (dialog, NULL);
gedit_replace_dialog_set_replace_error (dialog, NULL);
- if (regex_error == NULL)
- {
- return;
- }
-
switch (regex_state)
{
+ case GTK_SOURCE_REGEX_SEARCH_NO_ERROR:
+ break;
+
case GTK_SOURCE_REGEX_SEARCH_COMPILATION_ERROR:
case GTK_SOURCE_REGEX_SEARCH_MATCHING_ERROR:
gedit_replace_dialog_set_search_error (dialog, regex_error->message);
+ sensitive = FALSE;
break;
case GTK_SOURCE_REGEX_SEARCH_REPLACE_ERROR:
@@ -547,7 +547,22 @@ update_regex_error (GeditReplaceDialog *dialog,
g_return_if_reached ();
}
- g_error_free (regex_error);
+ gtk_dialog_set_response_sensitive (GTK_DIALOG (dialog),
+ GEDIT_REPLACE_DIALOG_FIND_RESPONSE,
+ sensitive);
+
+ gtk_dialog_set_response_sensitive (GTK_DIALOG (dialog),
+ GEDIT_REPLACE_DIALOG_REPLACE_RESPONSE,
+ sensitive);
+
+ gtk_dialog_set_response_sensitive (GTK_DIALOG (dialog),
+ GEDIT_REPLACE_DIALOG_REPLACE_ALL_RESPONSE,
+ sensitive);
+
+ if (regex_error != NULL)
+ {
+ g_error_free (regex_error);
+ }
}
static void
@@ -589,6 +604,7 @@ create_search_context (GeditReplaceDialog *dialog,
if (search_context != NULL &&
search_settings == gtk_source_search_context_get_settings (search_context))
{
+ update_regex_error (dialog, search_context);
return;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]