[gnome-builder] gtk: indicate if we landed on our target when loading text iter
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] gtk: indicate if we landed on our target when loading text iter
- Date: Wed, 31 Dec 2014 12:28:21 +0000 (UTC)
commit 20e6ad71788bb1e74831d21055a48b29c8f9ec30
Author: Christian Hergert <christian hergert me>
Date: Wed Dec 31 03:23:01 2014 -0800
gtk: indicate if we landed on our target when loading text iter
src/util/gb-gtk.c | 10 +++++++---
src/util/gb-gtk.h | 8 ++++----
2 files changed, 11 insertions(+), 7 deletions(-)
---
diff --git a/src/util/gb-gtk.c b/src/util/gb-gtk.c
index 10e7017..3055f39 100644
--- a/src/util/gb-gtk.c
+++ b/src/util/gb-gtk.c
@@ -34,14 +34,14 @@ struct ScrollState
* the line offset does not need to exist. It will work forward as far as
* possible on that line.
*/
-void
+gboolean
gb_gtk_text_buffer_get_iter_at_line_and_offset (GtkTextBuffer *buffer,
GtkTextIter *iter,
guint line,
guint line_offset)
{
- g_return_if_fail (GTK_IS_TEXT_BUFFER (buffer));
- g_return_if_fail (iter);
+ g_return_val_if_fail (GTK_IS_TEXT_BUFFER (buffer), FALSE);
+ g_return_val_if_fail (iter, FALSE);
gtk_text_buffer_get_iter_at_line (buffer, iter, line);
@@ -57,7 +57,11 @@ gb_gtk_text_buffer_get_iter_at_line_and_offset (GtkTextBuffer *buffer,
break;
}
}
+
+ return (line_offset == 0);
}
+
+ return FALSE;
}
static gboolean
diff --git a/src/util/gb-gtk.h b/src/util/gb-gtk.h
index 3dd6e88..21e3905 100644
--- a/src/util/gb-gtk.h
+++ b/src/util/gb-gtk.h
@@ -23,10 +23,10 @@
G_BEGIN_DECLS
-void gb_gtk_text_buffer_get_iter_at_line_and_offset (GtkTextBuffer *buffer,
- GtkTextIter *iter,
- guint line,
- guint line_offset);
+gboolean gb_gtk_text_buffer_get_iter_at_line_and_offset (GtkTextBuffer *buffer,
+ GtkTextIter *iter,
+ guint line,
+ guint line_offset);
void gb_gtk_text_view_scroll_to_iter (GtkTextView *text_view,
GtkTextIter *iter,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]