summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSébastien Wilmet <swilmet@gnome.org>2015-10-15 14:10:00 +0200
committerSébastien Wilmet <swilmet@gnome.org>2015-10-16 08:43:27 +0200
commit9d3e9c9375639e00041e5a2704a069634ddf717c (patch)
treed455dd54978af543753fcb4adefd351a81f74311
parenta9a1c00cc9255ee9a7f73695f69abe172cde7bfa (diff)
downloadgtk+-9d3e9c9375639e00041e5a2704a069634ddf717c.tar.gz
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
-rw-r--r--gtk/inspector/css-editor.c37
1 files changed, 8 insertions, 29 deletions
diff --git a/gtk/inspector/css-editor.c b/gtk/inspector/css-editor.c
index 776b3ace89..b11329d1ce 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";