[gnome-builder/wip/chergert/layout] editor: scroll to insert on ::loaded signal
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder/wip/chergert/layout] editor: scroll to insert on ::loaded signal
- Date: Sat, 1 Jul 2017 04:48:08 +0000 (UTC)
commit 9cb5d66d44c67a0209bd2955afdfdb26deed0ae6
Author: Christian Hergert <chergert redhat com>
Date: Fri Jun 30 21:47:29 2017 -0700
editor: scroll to insert on ::loaded signal
libide/editor/ide-editor-view.c | 18 ++++++++++++++++++
1 files changed, 18 insertions(+), 0 deletions(-)
---
diff --git a/libide/editor/ide-editor-view.c b/libide/editor/ide-editor-view.c
index 407593e..7ad6740 100644
--- a/libide/editor/ide-editor-view.c
+++ b/libide/editor/ide-editor-view.c
@@ -118,6 +118,19 @@ ide_editor_view_focus_in_event (IdeEditorView *self,
}
static void
+ide_editor_view_buffer_loaded (IdeEditorView *self,
+ IdeBuffer *buffer)
+{
+ g_assert (IDE_IS_EDITOR_VIEW (self));
+ g_assert (IDE_IS_BUFFER (buffer));
+
+ /* Scroll to the insertion location once the buffer
+ * has loaded. This is useful if it is not onscreen.
+ */
+ ide_source_view_scroll_to_insert (self->source_view);
+}
+
+static void
ide_editor_view_buffer_modified_changed (IdeEditorView *self,
IdeBuffer *buffer)
{
@@ -438,6 +451,11 @@ ide_editor_view_init (IdeEditorView *self)
self->buffer_signals = dzl_signal_group_new (IDE_TYPE_BUFFER);
dzl_signal_group_connect_swapped (self->buffer_signals,
+ "loaded",
+ G_CALLBACK (ide_editor_view_buffer_loaded),
+ self);
+
+ dzl_signal_group_connect_swapped (self->buffer_signals,
"modified-changed",
G_CALLBACK (ide_editor_view_buffer_modified_changed),
self);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]