[gedit] GeditDocument: adapt code for get_iter_at_line_*() changes in GTK+
- From: Sébastien Wilmet <swilmet src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gedit] GeditDocument: adapt code for get_iter_at_line_*() changes in GTK+
- Date: Thu, 12 Nov 2015 17:28:09 +0000 (UTC)
commit b05c5e09fd3bc18e4d868f25f30dade29bbc380c
Author: Sébastien Wilmet <swilmet gnome org>
Date: Thu Nov 12 18:20:57 2015 +0100
GeditDocument: adapt code for get_iter_at_line_*() changes in GTK+
See:
https://git.gnome.org/browse/gtk+/commit/?id=fde91c3bece9aaea17b51ce6db8f9cb6088dbf96
The gedit code still relies on the niceness of
gtk_text_buffer_get_iter_at_line_*() functions.
gedit/gedit-document.c | 21 ++++++++++-----------
1 files changed, 10 insertions(+), 11 deletions(-)
---
diff --git a/gedit/gedit-document.c b/gedit/gedit-document.c
index 27813dc..f2e7f07 100644
--- a/gedit/gedit-document.c
+++ b/gedit/gedit-document.c
@@ -1475,20 +1475,19 @@ gedit_document_goto_line (GeditDocument *doc,
gint line)
{
GtkTextIter iter;
- gboolean ret;
gedit_debug (DEBUG_DOCUMENT);
g_return_val_if_fail (GEDIT_IS_DOCUMENT (doc), FALSE);
g_return_val_if_fail (line >= -1, FALSE);
- ret = gtk_text_buffer_get_iter_at_line (GTK_TEXT_BUFFER (doc),
- &iter,
- line);
+ gtk_text_buffer_get_iter_at_line (GTK_TEXT_BUFFER (doc),
+ &iter,
+ line);
gtk_text_buffer_place_cursor (GTK_TEXT_BUFFER (doc), &iter);
- return ret;
+ return gtk_text_iter_get_line (&iter) == line;
}
gboolean
@@ -1496,21 +1495,21 @@ gedit_document_goto_line_offset (GeditDocument *doc,
gint line,
gint line_offset)
{
- gboolean ret;
GtkTextIter iter;
g_return_val_if_fail (GEDIT_IS_DOCUMENT (doc), FALSE);
g_return_val_if_fail (line >= -1, FALSE);
g_return_val_if_fail (line_offset >= -1, FALSE);
- ret = gtk_text_buffer_get_iter_at_line_offset (GTK_TEXT_BUFFER (doc),
- &iter,
- line,
- line_offset);
+ gtk_text_buffer_get_iter_at_line_offset (GTK_TEXT_BUFFER (doc),
+ &iter,
+ line,
+ line_offset);
gtk_text_buffer_place_cursor (GTK_TEXT_BUFFER (doc), &iter);
- return ret;
+ return (gtk_text_iter_get_line (&iter) == line &&
+ gtk_text_iter_get_line_offset (&iter) == line_offset);
}
/**
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]