[gtksourceview/wip/fix-regex-replace-error-api: 2/2] API break: remove the SearchContext:regex-state property
- From: Sébastien Wilmet <swilmet src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtksourceview/wip/fix-regex-replace-error-api: 2/2] API break: remove the SearchContext:regex-state property
- Date: Sat, 31 Aug 2013 14:52:02 +0000 (UTC)
commit b4aff23eae9899433791753749ba7d443eae53b1
Author: Sébastien Wilmet <swilmet gnome org>
Date: Sat Aug 31 16:45:34 2013 +0200
API break: remove the SearchContext:regex-state property
It was used to distinguish between a search error and a replace error.
But now the regex replace errors are reported to the GError parameters
of replace() and replace_all().
And it is not really useful right now to distinguish between a
compilation error and a matching error.
https://bugzilla.gnome.org/show_bug.cgi?id=707177
docs/reference/gtksourceview-3.0-sections.txt | 2 -
gtksourceview/gtksourcesearchcontext.c | 82 +------------------------
gtksourceview/gtksourcesearchcontext.h | 20 ------
3 files changed, 1 insertions(+), 103 deletions(-)
---
diff --git a/docs/reference/gtksourceview-3.0-sections.txt b/docs/reference/gtksourceview-3.0-sections.txt
index 9399bfe..3b3bd10 100644
--- a/docs/reference/gtksourceview-3.0-sections.txt
+++ b/docs/reference/gtksourceview-3.0-sections.txt
@@ -473,7 +473,6 @@ GtkSourcePrintCompositorClass
<FILE>searchcontext</FILE>
<TITLE>GtkSourceSearchContext</TITLE>
GtkSourceSearchContext
-GtkSourceRegexSearchState
gtk_source_search_context_new
gtk_source_search_context_get_buffer
gtk_source_search_context_get_settings
@@ -491,7 +490,6 @@ gtk_source_search_context_backward_finish
gtk_source_search_context_replace
gtk_source_search_context_replace_all
gtk_source_search_context_get_regex_error
-gtk_source_search_context_get_regex_state
<SUBSECTION Standard>
GTK_SOURCE_IS_SEARCH_CONTEXT
GTK_SOURCE_IS_SEARCH_CONTEXT_CLASS
diff --git a/gtksourceview/gtksourcesearchcontext.c b/gtksourceview/gtksourcesearchcontext.c
index 9ec869b..88b4072 100644
--- a/gtksourceview/gtksourcesearchcontext.c
+++ b/gtksourceview/gtksourcesearchcontext.c
@@ -273,8 +273,7 @@ enum
PROP_SETTINGS,
PROP_HIGHLIGHT,
PROP_OCCURRENCES_COUNT,
- PROP_REGEX_ERROR,
- PROP_REGEX_STATE
+ PROP_REGEX_ERROR
};
struct _GtkSourceSearchContextPrivate
@@ -308,7 +307,6 @@ struct _GtkSourceSearchContextPrivate
GRegex *regex;
GError *regex_error;
- GtkSourceRegexSearchState regex_state;
gint occurrences_count;
gulong idle_scan_id;
@@ -519,9 +517,6 @@ clear_task (GtkSourceSearchContext *search)
static void
clear_search (GtkSourceSearchContext *search)
{
- gboolean regex_state_changed = FALSE;
- gboolean regex_error_changed = FALSE;
-
if (search->priv->scan_region != NULL)
{
gtk_text_region_destroy (search->priv->scan_region, TRUE);
@@ -544,28 +539,9 @@ clear_search (GtkSourceSearchContext *search)
{
g_error_free (search->priv->regex_error);
search->priv->regex_error = NULL;
- regex_error_changed = TRUE;
- }
-
- if (search->priv->regex_state != GTK_SOURCE_REGEX_SEARCH_NO_ERROR)
- {
- search->priv->regex_state = GTK_SOURCE_REGEX_SEARCH_NO_ERROR;
- regex_state_changed = TRUE;
- }
-
- /* Notify the regex-error and the regex-state after clearing both
- * values, to be in a consistent state.
- */
- if (regex_error_changed)
- {
g_object_notify (G_OBJECT (search), "regex-error");
}
- if (regex_state_changed)
- {
- g_object_notify (G_OBJECT (search), "regex-state");
- }
-
clear_task (search);
search->priv->occurrences_count = 0;
@@ -741,11 +717,7 @@ basic_forward_regex_search (GtkSourceSearchContext *search,
if (search->priv->regex_error != NULL)
{
- search->priv->regex_state = GTK_SOURCE_REGEX_SEARCH_MATCHING_ERROR;
-
g_object_notify (G_OBJECT (search), "regex-error");
- g_object_notify (G_OBJECT (search), "regex-state");
-
found = FALSE;
}
@@ -883,11 +855,7 @@ basic_backward_regex_search (GtkSourceSearchContext *search,
if (search->priv->regex_error != NULL)
{
- search->priv->regex_state = GTK_SOURCE_REGEX_SEARCH_MATCHING_ERROR;
-
g_object_notify (G_OBJECT (search), "regex-error");
- g_object_notify (G_OBJECT (search), "regex-state");
-
found = FALSE;
}
@@ -1934,10 +1902,7 @@ regex_search_scan_segment (GtkSourceSearchContext *search,
if (search->priv->regex_error != NULL)
{
- search->priv->regex_state = GTK_SOURCE_REGEX_SEARCH_MATCHING_ERROR;
-
g_object_notify (G_OBJECT (search), "regex-error");
- g_object_notify (G_OBJECT (search), "regex-state");
}
if (g_match_info_is_partial_match (match_info))
@@ -2329,7 +2294,6 @@ static void
update_regex (GtkSourceSearchContext *search)
{
gboolean regex_error_changed = FALSE;
- GtkSourceRegexSearchState new_regex_state = GTK_SOURCE_REGEX_SEARCH_NO_ERROR;
const gchar *search_text = gtk_source_search_settings_get_search_text (search->priv->settings);
if (search->priv->regex != NULL)
@@ -2370,7 +2334,6 @@ update_regex (GtkSourceSearchContext *search)
if (search->priv->regex_error != NULL)
{
- new_regex_state = GTK_SOURCE_REGEX_SEARCH_COMPILATION_ERROR;
regex_error_changed = TRUE;
}
@@ -2380,12 +2343,6 @@ update_regex (GtkSourceSearchContext *search)
}
}
- if (search->priv->regex_state != new_regex_state)
- {
- search->priv->regex_state = new_regex_state;
- g_object_notify (G_OBJECT (search), "regex-state");
- }
-
if (regex_error_changed)
{
g_object_notify (G_OBJECT (search), "regex-error");
@@ -2697,10 +2654,6 @@ gtk_source_search_context_get_property (GObject *object,
g_value_set_pointer (value, gtk_source_search_context_get_regex_error (search));
break;
- case PROP_REGEX_STATE:
- g_value_set_enum (value, gtk_source_search_context_get_regex_state (search));
- break;
-
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
@@ -2829,30 +2782,12 @@ gtk_source_search_context_class_init (GtkSourceSearchContextClass *klass)
_("Regex error"),
_("Regular expression error"),
G_PARAM_READABLE));
-
- /**
- * GtkSourceSearchContext:regex-state:
- *
- * The regex search state.
- *
- * Since: 3.10
- */
- g_object_class_install_property (object_class,
- PROP_REGEX_STATE,
- g_param_spec_enum ("regex-state",
- _("Regex state"),
- _("State of the regular expression search"),
- GTK_SOURCE_TYPE_REGEX_SEARCH_STATE,
- GTK_SOURCE_REGEX_SEARCH_NO_ERROR,
- G_PARAM_READABLE));
}
static void
gtk_source_search_context_init (GtkSourceSearchContext *search)
{
search->priv = gtk_source_search_context_get_instance_private (search);
-
- search->priv->regex_state = GTK_SOURCE_REGEX_SEARCH_NO_ERROR;
}
/**
@@ -3028,21 +2963,6 @@ gtk_source_search_context_get_regex_error (GtkSourceSearchContext *search)
}
/**
- * gtk_source_search_context_get_regex_state:
- * @search: a #GtkSourceSearchContext.
- *
- * Returns: the regex search state.
- * Since: 3.10
- */
-GtkSourceRegexSearchState
-gtk_source_search_context_get_regex_state (GtkSourceSearchContext *search)
-{
- g_return_val_if_fail (GTK_SOURCE_IS_SEARCH_CONTEXT (search), GTK_SOURCE_REGEX_SEARCH_NO_ERROR);
-
- return search->priv->regex_state;
-}
-
-/**
* gtk_source_search_context_get_occurrences_count:
* @search: a #GtkSourceSearchContext.
*
diff --git a/gtksourceview/gtksourcesearchcontext.h b/gtksourceview/gtksourcesearchcontext.h
index eeb4221..8a3d083 100644
--- a/gtksourceview/gtksourcesearchcontext.h
+++ b/gtksourceview/gtksourcesearchcontext.h
@@ -51,24 +51,6 @@ struct _GtkSourceSearchContextClass
gpointer padding[10];
};
-/**
- * GtkSourceRegexSearchState:
- * @GTK_SOURCE_REGEX_SEARCH_NO_ERROR: everything is fine, or the regex search is
- * disabled.
- * @GTK_SOURCE_REGEX_SEARCH_COMPILATION_ERROR: pattern compilation error.
- * @GTK_SOURCE_REGEX_SEARCH_MATCHING_ERROR: error while matching the buffer.
- *
- * Regular expression search state.
- *
- * Since: 3.10
- */
-typedef enum
-{
- GTK_SOURCE_REGEX_SEARCH_NO_ERROR,
- GTK_SOURCE_REGEX_SEARCH_COMPILATION_ERROR,
- GTK_SOURCE_REGEX_SEARCH_MATCHING_ERROR
-} GtkSourceRegexSearchState;
-
GType gtk_source_search_context_get_type (void) G_GNUC_CONST;
GtkSourceSearchContext *gtk_source_search_context_new (GtkSourceBuffer
*buffer,
@@ -88,8 +70,6 @@ void gtk_source_search_context_set_highlight
(GtkSourceSearchContext *searc
GError *gtk_source_search_context_get_regex_error (GtkSourceSearchContext
*search);
-GtkSourceRegexSearchState gtk_source_search_context_get_regex_state (GtkSourceSearchContext
*search);
-
gint gtk_source_search_context_get_occurrences_count (GtkSourceSearchContext
*search);
gint gtk_source_search_context_get_occurrence_position (GtkSourceSearchContext
*search,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]