[gnome-builder] editor: update file mark when saving editor tab
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] editor: update file mark when saving editor tab
- Date: Thu, 9 Oct 2014 06:40:13 +0000 (UTC)
commit 07a79b624f1ea4daaafd0d397715fd1190ff53a5
Author: Christian Hergert <christian hergert me>
Date: Wed Oct 8 23:35:16 2014 -0700
editor: update file mark when saving editor tab
src/editor/gb-editor-commands.c | 12 +++++++++++-
1 files changed, 11 insertions(+), 1 deletions(-)
---
diff --git a/src/editor/gb-editor-commands.c b/src/editor/gb-editor-commands.c
index 07a0797..837e99c 100644
--- a/src/editor/gb-editor-commands.c
+++ b/src/editor/gb-editor-commands.c
@@ -479,8 +479,11 @@ gb_editor_tab_do_save (GbEditorTab *tab)
GbWorkspace *workspace;
GbNavigationItem *item;
GbNavigationList *list = NULL;
+ GbEditorFileMarks *marks;
+ GbEditorFileMark *mark;
GtkTextMark *insert;
GtkTextIter iter;
+ GFile *file;
guint line;
guint line_offset;
@@ -491,16 +494,23 @@ gb_editor_tab_do_save (GbEditorTab *tab)
insert = gtk_text_buffer_get_insert (GTK_TEXT_BUFFER (priv->document));
gtk_text_buffer_get_iter_at_mark (GTK_TEXT_BUFFER (priv->document),
&iter, insert);
+ file = gtk_source_file_get_location (priv->file);
line = gtk_text_iter_get_line (&iter);
line_offset = gtk_text_iter_get_line_offset (&iter);
item = g_object_new (GB_TYPE_EDITOR_NAVIGATION_ITEM,
- "file", gtk_source_file_get_location (priv->file),
+ "file", file,
"line", line,
"line-offset", line_offset,
"tab", tab,
"workspace", workspace,
NULL);
gb_navigation_list_append (list, item);
+
+ /* and save a file mark for it */
+ marks = gb_editor_file_marks_get_default ();
+ mark = gb_editor_file_marks_get_for_file (marks, file);
+ gb_editor_file_mark_set_line (mark, line);
+ gb_editor_file_mark_set_column (mark, line_offset);
}
/*
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]