[gnome-builder/wip/file-marks] editor: save file mark when closing a tab
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder/wip/file-marks] editor: save file mark when closing a tab
- Date: Wed, 8 Oct 2014 23:07:49 +0000 (UTC)
commit 2c70f679025aac17688e5b7a450df073149ab760
Author: Christian Hergert <christian hergert me>
Date: Wed Oct 8 16:06:05 2014 -0700
editor: save file mark when closing a tab
src/editor/gb-editor-tab.c | 26 ++++++++++++++++++++++++++
1 files changed, 26 insertions(+), 0 deletions(-)
---
diff --git a/src/editor/gb-editor-tab.c b/src/editor/gb-editor-tab.c
index ec72794..68b3b12 100644
--- a/src/editor/gb-editor-tab.c
+++ b/src/editor/gb-editor-tab.c
@@ -1333,6 +1333,30 @@ gb_editor_tab_constructed (GObject *object)
}
static void
+gb_editor_tab_save_file_mark (GbEditorTab *tab)
+{
+ GbEditorFileMarks *marks;
+ GbEditorFileMark *mark;
+ GtkTextBuffer *buffer;
+ GtkTextIter iter;
+ GtkTextMark *insert;
+ GFile *file;
+
+ g_return_if_fail (GB_IS_EDITOR_TAB (tab));
+
+ buffer = GTK_TEXT_BUFFER (tab->priv->document);
+ insert = gtk_text_buffer_get_insert (buffer);
+ gtk_text_buffer_get_iter_at_mark (buffer, &iter, insert);
+
+ file = gtk_source_file_get_location (tab->priv->file);
+
+ marks = gb_editor_file_marks_get_default ();
+ mark = gb_editor_file_marks_get_for_file (marks, file);
+ gb_editor_file_mark_set_line (mark, gtk_text_iter_get_line (&iter));
+ gb_editor_file_mark_set_column (mark, gtk_text_iter_get_line_offset (&iter));
+}
+
+static void
gb_editor_tab_close (GbTab *tab)
{
GbEditorTabPrivate *priv;
@@ -1352,6 +1376,8 @@ gb_editor_tab_close (GbTab *tab)
g_message ("TODO: handle dirty editor state.");
}
+ gb_editor_tab_save_file_mark (GB_EDITOR_TAB (tab));
+
/*
* WORKAROUND:
*
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]