[gtksourceview/wip/search-has-wrapped-around] SearchContext: add backward_finish2() and deprecate backward_finish()
- From: Sébastien Wilmet <swilmet src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtksourceview/wip/search-has-wrapped-around] SearchContext: add backward_finish2() and deprecate backward_finish()
- Date: Sat, 11 Jun 2016 12:37:31 +0000 (UTC)
commit 508e76de6f8bdfc467133a7fc26ac9185f29b894
Author: Sébastien Wilmet <swilmet gnome org>
Date: Sat Jun 11 14:32:15 2016 +0200
SearchContext: add backward_finish2() and deprecate backward_finish()
https://bugzilla.gnome.org/show_bug.cgi?id=724420
docs/reference/gtksourceview-3.0-sections.txt | 1 +
gtksourceview/gtksourcesearchcontext.c | 44 +++++++++++++++++++++++-
gtksourceview/gtksourcesearchcontext.h | 10 +++++-
tests/test-search.c | 11 +++---
testsuite/test-search-context.c | 11 +++---
5 files changed, 64 insertions(+), 13 deletions(-)
---
diff --git a/docs/reference/gtksourceview-3.0-sections.txt b/docs/reference/gtksourceview-3.0-sections.txt
index dac2912..9d4739e 100644
--- a/docs/reference/gtksourceview-3.0-sections.txt
+++ b/docs/reference/gtksourceview-3.0-sections.txt
@@ -669,6 +669,7 @@ gtk_source_search_context_backward
gtk_source_search_context_backward2
gtk_source_search_context_backward_async
gtk_source_search_context_backward_finish
+gtk_source_search_context_backward_finish2
gtk_source_search_context_replace
gtk_source_search_context_replace2
gtk_source_search_context_replace_all
diff --git a/gtksourceview/gtksourcesearchcontext.c b/gtksourceview/gtksourcesearchcontext.c
index 7db152b..378ddd3 100644
--- a/gtksourceview/gtksourcesearchcontext.c
+++ b/gtksourceview/gtksourcesearchcontext.c
@@ -3525,8 +3525,12 @@ gtk_source_search_context_backward2 (GtkSourceSearchContext *search,
* @callback: a #GAsyncReadyCallback to call when the operation is finished.
* @user_data: the data to pass to the @callback function.
*
- * Asynchronous backward search. See the #GAsyncResult documentation to know
- * how to use this function.
+ * The asynchronous version of gtk_source_search_context_backward2().
+ *
+ * See the documentation of gtk_source_search_context_backward2() for more
+ * details.
+ *
+ * See the #GAsyncResult documentation to know how to use this function.
*
* If the operation is cancelled, the @callback will only be called if
* @cancellable was not %NULL. gtk_source_search_context_backward_async() takes
@@ -3568,6 +3572,7 @@ gtk_source_search_context_backward_async (GtkSourceSearchContext *search,
*
* Returns: whether a match was found.
* Since: 3.10
+ * Deprecated: 3.22: Use gtk_source_search_context_backward_finish2() instead.
*/
gboolean
gtk_source_search_context_backward_finish (GtkSourceSearchContext *search,
@@ -3584,6 +3589,41 @@ gtk_source_search_context_backward_finish (GtkSourceSearchContext *search,
error);
}
+/**
+ * gtk_source_search_context_backward_finish2:
+ * @search: a #GtkSourceSearchContext.
+ * @result: a #GAsyncResult.
+ * @match_start: (out) (optional): return location for start of match, or %NULL.
+ * @match_end: (out) (optional): return location for end of match, or %NULL.
+ * @has_wrapped_around: (out) (optional): return location to know whether the
+ * search has wrapped around, or %NULL.
+ * @error: a #GError, or %NULL.
+ *
+ * Finishes a backward search started with
+ * gtk_source_search_context_backward_async().
+ *
+ * See the documentation of gtk_source_search_context_backward2() for more
+ * details.
+ *
+ * Returns: whether a match was found.
+ * Since: 3.22
+ */
+gboolean
+gtk_source_search_context_backward_finish2 (GtkSourceSearchContext *search,
+ GAsyncResult *result,
+ GtkTextIter *match_start,
+ GtkTextIter *match_end,
+ gboolean *has_wrapped_around,
+ GError **error)
+{
+ return gtk_source_search_context_forward_finish2 (search,
+ result,
+ match_start,
+ match_end,
+ has_wrapped_around,
+ error);
+}
+
/* If correctly replaced, returns %TRUE and @match_end is updated to point to
* the replacement end.
*/
diff --git a/gtksourceview/gtksourcesearchcontext.h b/gtksourceview/gtksourcesearchcontext.h
index 4e4e504..b17e700 100644
--- a/gtksourceview/gtksourcesearchcontext.h
+++ b/gtksourceview/gtksourcesearchcontext.h
@@ -148,13 +148,21 @@ void gtk_source_search_context_backward_async
(GtkSourceSearchContext *sear
GAsyncReadyCallback
callback,
gpointer
user_data);
-GTK_SOURCE_AVAILABLE_IN_3_10
+GTK_SOURCE_DEPRECATED_IN_3_22_FOR (gtk_source_search_context_backward_finish2)
gboolean gtk_source_search_context_backward_finish (GtkSourceSearchContext
*search,
GAsyncResult
*result,
GtkTextIter
*match_start,
GtkTextIter
*match_end,
GError
**error);
+GTK_SOURCE_AVAILABLE_IN_3_22
+gboolean gtk_source_search_context_backward_finish2 (GtkSourceSearchContext
*search,
+ GAsyncResult
*result,
+ GtkTextIter
*match_start,
+ GtkTextIter
*match_end,
+ gboolean
*has_wrapped_around,
+ GError
**error);
+
GTK_SOURCE_DEPRECATED_IN_3_22_FOR (gtk_source_search_context_replace2)
gboolean gtk_source_search_context_replace (GtkSourceSearchContext
*search,
const GtkTextIter
*match_start,
diff --git a/tests/test-search.c b/tests/test-search.c
index fc07614..959562d 100644
--- a/tests/test-search.c
+++ b/tests/test-search.c
@@ -187,11 +187,12 @@ backward_search_finished (GtkSourceSearchContext *search_context,
GtkTextIter match_start;
GtkTextIter match_end;
- if (gtk_source_search_context_backward_finish (search_context,
- result,
- &match_start,
- &match_end,
- NULL))
+ if (gtk_source_search_context_backward_finish2 (search_context,
+ result,
+ &match_start,
+ &match_end,
+ NULL,
+ NULL))
{
select_search_occurrence (search, &match_start, &match_end);
}
diff --git a/testsuite/test-search-context.c b/testsuite/test-search-context.c
index 69afa0e..38d4bff 100644
--- a/testsuite/test-search-context.c
+++ b/testsuite/test-search-context.c
@@ -465,11 +465,12 @@ finish_check_result (GtkSourceSearchContext *context,
}
else
{
- found = gtk_source_search_context_backward_finish (context,
- result,
- &match_start,
- &match_end,
- NULL);
+ found = gtk_source_search_context_backward_finish2 (context,
+ result,
+ &match_start,
+ &match_end,
+ NULL,
+ NULL);
}
g_assert (found == search_result.found);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]