[gnome-builder/wip/file-marks] file-marks: create new GbEditorFileMark if mark did not exist.
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder/wip/file-marks] file-marks: create new GbEditorFileMark if mark did not exist.
- Date: Wed, 8 Oct 2014 21:13:04 +0000 (UTC)
commit e427d58b43c0dffd5116a7f672423aea782dbe79
Author: Christian Hergert <christian hergert me>
Date: Wed Oct 8 14:12:39 2014 -0700
file-marks: create new GbEditorFileMark if mark did not exist.
src/editor/gb-editor-file-marks.c | 16 ++++++++++++++++
1 files changed, 16 insertions(+), 0 deletions(-)
---
diff --git a/src/editor/gb-editor-file-marks.c b/src/editor/gb-editor-file-marks.c
index 9d5ac3c..17231a6 100644
--- a/src/editor/gb-editor-file-marks.c
+++ b/src/editor/gb-editor-file-marks.c
@@ -63,6 +63,16 @@ gb_editor_file_marks_get_file (GbEditorFileMarks *marks)
return file;
}
+/**
+ * gb_editor_file_marks_get_for_file:
+ *
+ * Gets the #GbEditorFileMark used to represent @file. If one has not been
+ * loaded, it will be created. The resulting #GbEditorFileMark is owned by
+ * the #GbEditorFileMarks instance and will be saved when
+ * gb_editor_file_marks_save_async() is called.
+ *
+ * Returns: (transfer none): A #GbEditorFileMark representing @file.
+ */
GbEditorFileMark *
gb_editor_file_marks_get_for_file (GbEditorFileMarks *marks,
GFile *file)
@@ -77,6 +87,12 @@ gb_editor_file_marks_get_for_file (GbEditorFileMarks *marks,
ret = g_hash_table_lookup (marks->priv->marks, uri);
g_free (uri);
+ if (!ret)
+ {
+ ret = gb_editor_file_mark_new (file, 0, 0);
+ g_hash_table_replace (marks->priv->marks, g_file_get_uri (file), ret);
+ }
+
return ret;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]