[gnome-builder/wip/file-marks: 1/2] editor: add file-marks api to store positions within files.
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder/wip/file-marks: 1/2] editor: add file-marks api to store positions within files.
- Date: Wed, 8 Oct 2014 20:32:24 +0000 (UTC)
commit ac6c3b761b21e22f77c70feb3f9ebf44cb1d1163
Author: Christian Hergert <christian hergert me>
Date: Wed Oct 8 13:31:54 2014 -0700
editor: add file-marks api to store positions within files.
GbEditorFileMarks is a manager API around reading and writing the file
marks to/from disk. Additionally, it will hold on to the marks in memory
during the lifetime of the process.
The file mark itself contains a uri, line, and column.
The format for the marks file is:
"line:column uri\n"
src/editor/gb-editor-file-mark.c | 239 ++++++++++++++++++++++++++++++
src/editor/gb-editor-file-mark.h | 67 +++++++++
src/editor/gb-editor-file-marks.c | 292 +++++++++++++++++++++++++++++++++++++
src/editor/gb-editor-file-marks.h | 68 +++++++++
src/gnome-builder.mk | 4 +
5 files changed, 670 insertions(+), 0 deletions(-)
---
diff --git a/src/editor/gb-editor-file-mark.c b/src/editor/gb-editor-file-mark.c
new file mode 100644
index 0000000..568e4de
--- /dev/null
+++ b/src/editor/gb-editor-file-mark.c
@@ -0,0 +1,239 @@
+/* gb-editor-file-mark.c
+ *
+ * Copyright (C) 2014 Christian Hergert <christian hergert me>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <glib/gi18n.h>
+
+#include "gb-editor-file-mark.h"
+
+struct _GbEditorFileMarkPrivate
+{
+ GFile *file;
+ guint line;
+ guint column;
+};
+
+G_DEFINE_TYPE_WITH_PRIVATE (GbEditorFileMark, gb_editor_file_mark,
+ G_TYPE_OBJECT)
+
+enum {
+ PROP_0,
+ PROP_COLUMN,
+ PROP_FILE,
+ PROP_LINE,
+ LAST_PROP
+};
+
+static GParamSpec *gParamSpecs [LAST_PROP];
+
+GbEditorFileMark *
+gb_editor_file_mark_new (GFile *file,
+ guint line,
+ guint column)
+{
+ return g_object_new (GB_TYPE_EDITOR_FILE_MARK,
+ "column", column,
+ "file", file,
+ "line", line,
+ NULL);
+}
+
+/**
+ * gb_editor_file_mark_get_file:
+ *
+ * Fetches the file the mark is for.
+ *
+ * Returns: (transfer none): A #GFile.
+ */
+GFile *
+gb_editor_file_mark_get_file (GbEditorFileMark *mark)
+{
+ g_return_val_if_fail (GB_IS_EDITOR_FILE_MARK (mark), NULL);
+
+ return mark->priv->file;
+}
+
+guint
+gb_editor_file_mark_get_line (GbEditorFileMark *mark)
+{
+ g_return_val_if_fail (GB_IS_EDITOR_FILE_MARK (mark), 0);
+
+ return mark->priv->line;
+}
+
+guint
+gb_editor_file_mark_get_column (GbEditorFileMark *mark)
+{
+ g_return_val_if_fail (GB_IS_EDITOR_FILE_MARK (mark), 0);
+
+ return mark->priv->column;
+}
+
+void
+gb_editor_file_mark_set_file (GbEditorFileMark *mark,
+ GFile *file)
+{
+ g_return_if_fail (GB_IS_EDITOR_FILE_MARK (mark));
+ g_return_if_fail (!file || G_IS_FILE (file));
+
+ if (mark->priv->file != file)
+ {
+ g_clear_object (&mark->priv->file);
+ mark->priv->file = file ? g_object_ref (file) : NULL;
+ g_object_notify_by_pspec (G_OBJECT (mark), gParamSpecs [PROP_FILE]);
+ }
+}
+
+void
+gb_editor_file_mark_set_column (GbEditorFileMark *mark,
+ guint column)
+{
+ g_return_if_fail (GB_IS_EDITOR_FILE_MARK (mark));
+
+ if (mark->priv->column != column)
+ {
+ mark->priv->column = column;
+ g_object_notify_by_pspec (G_OBJECT (mark), gParamSpecs [PROP_COLUMN]);
+ }
+}
+
+void
+gb_editor_file_mark_set_line (GbEditorFileMark *mark,
+ guint line)
+{
+ g_return_if_fail (GB_IS_EDITOR_FILE_MARK (mark));
+
+ if (mark->priv->line != line)
+ {
+ mark->priv->line = line;
+ g_object_notify_by_pspec (G_OBJECT (mark), gParamSpecs [PROP_LINE]);
+ }
+}
+
+static void
+gb_editor_file_mark_finalize (GObject *object)
+{
+ GbEditorFileMarkPrivate *priv = GB_EDITOR_FILE_MARK (object)->priv;
+
+ g_clear_object (&priv->file);
+
+ G_OBJECT_CLASS (gb_editor_file_mark_parent_class)->finalize (object);
+}
+
+static void
+gb_editor_file_mark_get_property (GObject *object,
+ guint prop_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ GbEditorFileMark *self = GB_EDITOR_FILE_MARK (object);
+
+ switch (prop_id)
+ {
+ case PROP_COLUMN:
+ g_value_set_uint (value, gb_editor_file_mark_get_column (self));
+ break;
+
+ case PROP_LINE:
+ g_value_set_uint (value, gb_editor_file_mark_get_line (self));
+ break;
+
+ case PROP_FILE:
+ g_value_set_object (value, gb_editor_file_mark_get_file (self));
+ break;
+
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ }
+}
+
+static void
+gb_editor_file_mark_set_property (GObject *object,
+ guint prop_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ GbEditorFileMark *self = GB_EDITOR_FILE_MARK (object);
+
+ switch (prop_id)
+ {
+ case PROP_COLUMN:
+ gb_editor_file_mark_set_column (self, g_value_get_uint (value));
+ break;
+
+ case PROP_LINE:
+ gb_editor_file_mark_set_line (self, g_value_get_uint (value));
+ break;
+
+ case PROP_FILE:
+ gb_editor_file_mark_set_file (self, g_value_get_object (value));
+ break;
+
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ }
+}
+
+static void
+gb_editor_file_mark_class_init (GbEditorFileMarkClass *klass)
+{
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
+ object_class->finalize = gb_editor_file_mark_finalize;
+ object_class->get_property = gb_editor_file_mark_get_property;
+ object_class->set_property = gb_editor_file_mark_set_property;
+
+ gParamSpecs [PROP_COLUMN] =
+ g_param_spec_uint ("column",
+ _("Column"),
+ _("The column within the line."),
+ 0,
+ G_MAXUINT,
+ 0,
+ (G_PARAM_READWRITE |
+ G_PARAM_STATIC_STRINGS));
+ g_object_class_install_property (object_class, PROP_COLUMN,
+ gParamSpecs [PROP_COLUMN]);
+
+ gParamSpecs [PROP_FILE] =
+ g_param_spec_object ("file",
+ _("File"),
+ _("The file for which to store the mark."),
+ G_TYPE_FILE,
+ (G_PARAM_READWRITE |
+ G_PARAM_STATIC_STRINGS));
+ g_object_class_install_property (object_class, PROP_FILE,
+ gParamSpecs [PROP_FILE]);
+
+ gParamSpecs [PROP_LINE] =
+ g_param_spec_uint ("line",
+ _("Line"),
+ _("The line within the file."),
+ 0,
+ G_MAXUINT,
+ 0,
+ (G_PARAM_READWRITE |
+ G_PARAM_STATIC_STRINGS));
+ g_object_class_install_property (object_class, PROP_LINE,
+ gParamSpecs [PROP_LINE]);
+}
+
+static void
+gb_editor_file_mark_init (GbEditorFileMark *self)
+{
+ self->priv = gb_editor_file_mark_get_instance_private (self);
+}
diff --git a/src/editor/gb-editor-file-mark.h b/src/editor/gb-editor-file-mark.h
new file mode 100644
index 0000000..ef61e84
--- /dev/null
+++ b/src/editor/gb-editor-file-mark.h
@@ -0,0 +1,67 @@
+/* gb-editor-file-mark.h
+ *
+ * Copyright (C) 2014 Christian Hergert <christian hergert me>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef GB_EDITOR_FILE_MARK_H
+#define GB_EDITOR_FILE_MARK_H
+
+#include <gio/gio.h>
+
+G_BEGIN_DECLS
+
+#define GB_TYPE_EDITOR_FILE_MARK (gb_editor_file_mark_get_type())
+#define GB_EDITOR_FILE_MARK(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GB_TYPE_EDITOR_FILE_MARK,
GbEditorFileMark))
+#define GB_EDITOR_FILE_MARK_CONST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GB_TYPE_EDITOR_FILE_MARK,
GbEditorFileMark const))
+#define GB_EDITOR_FILE_MARK_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GB_TYPE_EDITOR_FILE_MARK,
GbEditorFileMarkClass))
+#define GB_IS_EDITOR_FILE_MARK(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GB_TYPE_EDITOR_FILE_MARK))
+#define GB_IS_EDITOR_FILE_MARK_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GB_TYPE_EDITOR_FILE_MARK))
+#define GB_EDITOR_FILE_MARK_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GB_TYPE_EDITOR_FILE_MARK,
GbEditorFileMarkClass))
+
+typedef struct _GbEditorFileMark GbEditorFileMark;
+typedef struct _GbEditorFileMarkClass GbEditorFileMarkClass;
+typedef struct _GbEditorFileMarkPrivate GbEditorFileMarkPrivate;
+
+struct _GbEditorFileMark
+{
+ GObject parent;
+
+ /*< private >*/
+ GbEditorFileMarkPrivate *priv;
+};
+
+struct _GbEditorFileMarkClass
+{
+ GObjectClass parent;
+};
+
+GType gb_editor_file_mark_get_type (void) G_GNUC_CONST;
+GbEditorFileMark *gb_editor_file_mark_new (GFile *file,
+ guint line,
+ guint column);
+guint gb_editor_file_mark_get_column (GbEditorFileMark *mark);
+guint gb_editor_file_mark_get_line (GbEditorFileMark *mark);
+GFile *gb_editor_file_mark_get_file (GbEditorFileMark *mark);
+void gb_editor_file_mark_set_column (GbEditorFileMark *mark,
+ guint column);
+void gb_editor_file_mark_set_line (GbEditorFileMark *mark,
+ guint line);
+void gb_editor_file_mark_set_file (GbEditorFileMark *mark,
+ GFile *file);
+
+G_END_DECLS
+
+#endif /* GB_EDITOR_FILE_MARK_H */
diff --git a/src/editor/gb-editor-file-marks.c b/src/editor/gb-editor-file-marks.c
new file mode 100644
index 0000000..9d5ac3c
--- /dev/null
+++ b/src/editor/gb-editor-file-marks.c
@@ -0,0 +1,292 @@
+/* gb-editor-file-marks.c
+ *
+ * Copyright (C) 2014 Christian Hergert <christian hergert me>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <errno.h>
+
+#include "gb-editor-file-marks.h"
+#include "gb-string.h"
+
+struct _GbEditorFileMarksPrivate
+{
+ GHashTable *marks;
+};
+
+G_DEFINE_TYPE_WITH_PRIVATE (GbEditorFileMarks, gb_editor_file_marks, G_TYPE_OBJECT)
+
+GbEditorFileMarks *
+gb_editor_file_marks_new (void)
+{
+ return g_object_new (GB_TYPE_EDITOR_FILE_MARKS, NULL);
+}
+
+GbEditorFileMarks *
+gb_editor_file_marks_get_default (void)
+{
+ static GbEditorFileMarks *instance;
+
+ if (!instance)
+ instance = gb_editor_file_marks_new ();
+
+ return instance;
+}
+
+static GFile *
+gb_editor_file_marks_get_file (GbEditorFileMarks *marks)
+{
+ gchar *path;
+ GFile *file;
+
+ g_return_val_if_fail (GB_IS_EDITOR_FILE_MARKS (marks), NULL);
+
+ path = g_build_filename (g_get_user_data_dir (),
+ "gnome-builder",
+ "file-marks",
+ NULL);
+ file = g_file_new_for_path (path);
+ g_free (path);
+
+ return file;
+}
+
+GbEditorFileMark *
+gb_editor_file_marks_get_for_file (GbEditorFileMarks *marks,
+ GFile *file)
+{
+ GbEditorFileMark *ret;
+ gchar *uri;
+
+ g_return_val_if_fail (GB_IS_EDITOR_FILE_MARKS (marks), NULL);
+ g_return_val_if_fail (G_IS_FILE (file), NULL);
+
+ uri = g_file_get_uri (file);
+ ret = g_hash_table_lookup (marks->priv->marks, uri);
+ g_free (uri);
+
+ return ret;
+}
+
+static GBytes *
+gb_editor_file_marks_serialize (GbEditorFileMarks *marks)
+{
+ GbEditorFileMark *mark;
+ GHashTableIter iter;
+ GString *str;
+ gsize len;
+ gchar *data;
+
+ g_return_val_if_fail (GB_IS_EDITOR_FILE_MARKS (marks), NULL);
+
+ str = g_string_new (NULL);
+
+ g_hash_table_iter_init (&iter, marks->priv->marks);
+
+ while (g_hash_table_iter_next (&iter, NULL, (gpointer *)&mark))
+ {
+ guint line;
+ guint column;
+ GFile *file;
+ gchar *uri = NULL;
+
+ g_object_get (mark,
+ "file", &file,
+ "line", &line,
+ "column", &column,
+ NULL);
+
+ if (!file)
+ continue;
+
+ uri = g_file_get_uri (file);
+
+ g_string_append_printf (str, "%u:%u %s\n", line, column, uri);
+
+ g_free (uri);
+ g_object_unref (file);
+ }
+
+ len = str->len;
+ data = g_string_free (str, FALSE);
+
+ return g_bytes_new_take (data, len);
+}
+
+static void
+gb_editor_file_marks_save_cb (GObject *source,
+ GAsyncResult *result,
+ gpointer user_data)
+{
+ GFile *file = (GFile *)source;
+ GSimpleAsyncResult *simple = user_data;
+ GError *error = NULL;
+
+ g_return_if_fail (G_IS_FILE (file));
+ g_return_if_fail (G_IS_SIMPLE_ASYNC_RESULT (simple));
+
+ if (!g_file_replace_contents_finish (file, result, NULL, &error))
+ g_simple_async_result_take_error (simple, error);
+ else
+ g_simple_async_result_set_op_res_gboolean (simple, TRUE);
+
+ g_simple_async_result_complete_in_idle (simple);
+}
+
+void
+gb_editor_file_marks_save_async (GbEditorFileMarks *marks,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data)
+{
+ GSimpleAsyncResult *simple;
+ GFile *file = NULL;
+ GBytes *bytes = NULL;
+
+ g_return_if_fail (GB_IS_EDITOR_FILE_MARKS (marks));
+ g_return_if_fail (!cancellable || G_IS_CANCELLABLE (cancellable));
+
+ file = gb_editor_file_marks_get_file (marks);
+ bytes = gb_editor_file_marks_serialize (marks);
+
+ simple = g_simple_async_result_new (G_OBJECT (marks), callback, user_data,
+ gb_editor_file_marks_save_async);
+
+ g_file_replace_contents_bytes_async (file,
+ bytes,
+ NULL,
+ FALSE,
+ G_FILE_CREATE_REPLACE_DESTINATION,
+ cancellable,
+ gb_editor_file_marks_save_cb,
+ simple);
+
+ g_clear_object (&file);
+ g_clear_object (&simple);
+ g_clear_pointer (&bytes, g_bytes_unref);
+}
+
+gboolean
+gb_editor_file_marks_save_finish (GbEditorFileMarks *marks,
+ GAsyncResult *result,
+ GError **error)
+{
+ GSimpleAsyncResult *simple = (GSimpleAsyncResult *)result;
+
+ g_return_val_if_fail (GB_IS_EDITOR_FILE_MARKS (marks), FALSE);
+ g_return_val_if_fail (G_IS_SIMPLE_ASYNC_RESULT (simple), FALSE);
+
+ if (g_simple_async_result_propagate_error (simple, error))
+ return FALSE;
+
+ return TRUE;
+}
+
+gboolean
+gb_editor_file_marks_load (GbEditorFileMarks *marks,
+ GError **error)
+{
+ gchar **parts = NULL;
+ gchar *contents = NULL;
+ GFile *file = NULL;
+ gsize len = 0;
+ gboolean ret;
+ guint i;
+
+ g_return_val_if_fail (GB_IS_EDITOR_FILE_MARKS (marks), FALSE);
+
+ file = gb_editor_file_marks_get_file (marks);
+
+ ret = g_file_load_contents (file, NULL, &contents, &len, NULL, error);
+
+ if (ret)
+ {
+ parts = g_strsplit (contents, "\n", -1);
+
+ for (i = 0; parts [i]; i++)
+ {
+ const gchar *str = g_strstrip (parts [i]);
+ GbEditorFileMark *mark;
+ gchar *endptr = NULL;
+ GFile *mark_file;
+ gint64 val;
+ guint line;
+ guint column;
+
+ val = g_ascii_strtoll (str, &endptr, 10);
+ if (((val == G_MAXINT64) || (val == G_MININT64)) && (errno == ERANGE))
+ continue;
+ line = (guint)val;
+
+ if (*endptr != ':')
+ continue;
+
+ str = ++endptr;
+
+ val = g_ascii_strtoll (str, &endptr, 10);
+ if (((val == G_MAXINT64) || (val == G_MININT64)) && (errno == ERANGE))
+ continue;
+ column = (guint)val;
+
+ if (*endptr != ' ')
+ continue;
+
+ str = ++endptr;
+
+ if (gb_str_empty0 (str))
+ continue;
+
+ mark_file = g_file_new_for_uri (str);
+ if (!mark_file)
+ continue;
+
+ mark = gb_editor_file_mark_new (mark_file, line, column);
+ g_hash_table_replace (marks->priv->marks, g_strdup (str), mark);
+ g_object_unref (mark_file);
+ }
+ }
+
+ g_clear_object (&file);
+ g_clear_pointer (&parts, g_strfreev);
+ g_clear_pointer (&contents, g_free);
+
+ return ret;
+}
+
+static void
+gb_editor_file_marks_finalize (GObject *object)
+{
+ GbEditorFileMarksPrivate *priv = GB_EDITOR_FILE_MARKS (object)->priv;
+
+ g_clear_pointer (&priv->marks, g_hash_table_unref);
+
+ G_OBJECT_CLASS (gb_editor_file_marks_parent_class)->finalize (object);
+}
+
+static void
+gb_editor_file_marks_class_init (GbEditorFileMarksClass *klass)
+{
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
+ object_class->finalize = gb_editor_file_marks_finalize;
+}
+
+static void
+gb_editor_file_marks_init (GbEditorFileMarks *self)
+{
+ self->priv = gb_editor_file_marks_get_instance_private (self);
+ self->priv->marks = g_hash_table_new_full (g_str_hash, g_str_equal,
+ g_free, g_object_unref);
+}
diff --git a/src/editor/gb-editor-file-marks.h b/src/editor/gb-editor-file-marks.h
new file mode 100644
index 0000000..d6c4897
--- /dev/null
+++ b/src/editor/gb-editor-file-marks.h
@@ -0,0 +1,68 @@
+/* gb-editor-file-marks.h
+ *
+ * Copyright (C) 2014 Christian Hergert <christian hergert me>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef GB_EDITOR_FILE_MARKS_H
+#define GB_EDITOR_FILE_MARKS_H
+
+#include "gb-editor-file-mark.h"
+
+G_BEGIN_DECLS
+
+#define GB_TYPE_EDITOR_FILE_MARKS (gb_editor_file_marks_get_type())
+#define GB_EDITOR_FILE_MARKS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GB_TYPE_EDITOR_FILE_MARKS,
GbEditorFileMarks))
+#define GB_EDITOR_FILE_MARKS_CONST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GB_TYPE_EDITOR_FILE_MARKS,
GbEditorFileMarks const))
+#define GB_EDITOR_FILE_MARKS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GB_TYPE_EDITOR_FILE_MARKS,
GbEditorFileMarksClass))
+#define GB_IS_EDITOR_FILE_MARKS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GB_TYPE_EDITOR_FILE_MARKS))
+#define GB_IS_EDITOR_FILE_MARKS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GB_TYPE_EDITOR_FILE_MARKS))
+#define GB_EDITOR_FILE_MARKS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GB_TYPE_EDITOR_FILE_MARKS,
GbEditorFileMarksClass))
+
+typedef struct _GbEditorFileMarks GbEditorFileMarks;
+typedef struct _GbEditorFileMarksClass GbEditorFileMarksClass;
+typedef struct _GbEditorFileMarksPrivate GbEditorFileMarksPrivate;
+
+struct _GbEditorFileMarks
+{
+ GObject parent;
+
+ /*< private >*/
+ GbEditorFileMarksPrivate *priv;
+};
+
+struct _GbEditorFileMarksClass
+{
+ GObjectClass parent;
+};
+
+GType gb_editor_file_marks_get_type (void) G_GNUC_CONST;
+GbEditorFileMarks *gb_editor_file_marks_new (void);
+GbEditorFileMarks *gb_editor_file_marks_get_default (void);
+GbEditorFileMark *gb_editor_file_marks_get_mark_for_file (GbEditorFileMarks *marks,
+ GFile *file);
+gboolean gb_editor_file_marks_load (GbEditorFileMarks *marks,
+ GError **error);
+void gb_editor_file_marks_save_async (GbEditorFileMarks *marks,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+gboolean gb_editor_file_marks_save_finish (GbEditorFileMarks *marks,
+ GAsyncResult *result,
+ GError **error);
+
+G_END_DECLS
+
+#endif /* GB_EDITOR_FILE_MARKS_H */
diff --git a/src/gnome-builder.mk b/src/gnome-builder.mk
index 0f212d3..bafc215 100644
--- a/src/gnome-builder.mk
+++ b/src/gnome-builder.mk
@@ -21,6 +21,10 @@ libgnome_builder_la_SOURCES = \
src/editor/gb-editor-commands.h \
src/editor/gb-editor-document.c \
src/editor/gb-editor-document.h \
+ src/editor/gb-editor-file-mark.c \
+ src/editor/gb-editor-file-mark.h \
+ src/editor/gb-editor-file-marks.c \
+ src/editor/gb-editor-file-marks.h \
src/editor/gb-editor-navigation-item.c \
src/editor/gb-editor-navigation-item.h \
src/editor/gb-editor-settings.c \
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]