[gtk+] inspector: remove gtk_text_buffer_get_iter_at_line_index() workaround
- From: Sébastien Wilmet <swilmet src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] inspector: remove gtk_text_buffer_get_iter_at_line_index() workaround
- Date: Fri, 16 Oct 2015 06:49:33 +0000 (UTC)
commit 9d3e9c9375639e00041e5a2704a069634ddf717c
Author: Sébastien Wilmet <swilmet gnome org>
Date: Thu Oct 15 14:10:00 2015 +0200
inspector: remove gtk_text_buffer_get_iter_at_line_index() workaround
The function is now safe to use.
https://bugzilla.gnome.org/show_bug.cgi?id=735341
gtk/inspector/css-editor.c | 37 ++++++++-----------------------------
1 files changed, 8 insertions(+), 29 deletions(-)
---
diff --git a/gtk/inspector/css-editor.c b/gtk/inspector/css-editor.c
index 776b3ac..b11329d 100644
--- a/gtk/inspector/css-editor.c
+++ b/gtk/inspector/css-editor.c
@@ -249,27 +249,6 @@ text_changed (GtkTextBuffer *buffer,
ce->priv->timeout = g_timeout_add (100, update_timeout, ce);
}
-/* Safe version of gtk_text_buffer_get_iter_at_line_index(). */
-static void
-safe_get_iter_at_line_index (GtkTextBuffer *buffer,
- GtkTextIter *iter,
- gint line_number,
- gint byte_index)
-{
- if (line_number >= gtk_text_buffer_get_line_count (buffer))
- {
- gtk_text_buffer_get_end_iter (buffer, iter);
- return;
- }
-
- gtk_text_buffer_get_iter_at_line (buffer, iter, line_number);
-
- if (byte_index < gtk_text_iter_get_bytes_in_line (iter))
- gtk_text_iter_set_line_index (iter, byte_index);
- else
- gtk_text_iter_forward_to_line_end (iter);
-}
-
static void
show_parsing_error (GtkCssProvider *provider,
GtkCssSection *section,
@@ -280,14 +259,14 @@ show_parsing_error (GtkCssProvider *provider,
const char *tag_name;
GtkTextBuffer *buffer = GTK_TEXT_BUFFER (ce->priv->text);
- safe_get_iter_at_line_index (buffer,
- &start,
- gtk_css_section_get_start_line (section),
- gtk_css_section_get_start_position (section));
- safe_get_iter_at_line_index (buffer,
- &end,
- gtk_css_section_get_end_line (section),
- gtk_css_section_get_end_position (section));
+ gtk_text_buffer_get_iter_at_line_index (buffer,
+ &start,
+ gtk_css_section_get_start_line (section),
+ gtk_css_section_get_start_position (section));
+ gtk_text_buffer_get_iter_at_line_index (buffer,
+ &end,
+ gtk_css_section_get_end_line (section),
+ gtk_css_section_get_end_position (section));
if (g_error_matches (error, GTK_CSS_PROVIDER_ERROR, GTK_CSS_PROVIDER_ERROR_DEPRECATED))
tag_name = "warning";
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]