[gnome-builder/wip/libide] libide: work in progress on back/foward navigation list



commit 39b5b59a9849d91a4ffc6ba8d5c59b87f43c4486
Author: Christian Hergert <christian hergert me>
Date:   Tue Feb 10 12:19:30 2015 -0800

    libide: work in progress on back/foward navigation list

 libide/Makefile.am             |    6 +
 libide/ide-back-forward-item.c |  158 ++++++++++++++++++++++++++++
 libide/ide-back-forward-item.h |   43 ++++++++
 libide/ide-back-forward-list.c |  220 ++++++++++++++++++++++++++++++++++++++++
 libide/ide-back-forward-list.h |   47 +++++++++
 libide/ide-context.c           |    1 +
 libide/ide-source-location.c   |  155 ++++++++++++++++++++++++++++
 libide/ide-source-location.h   |   42 ++++++++
 libide/ide-types.h             |    8 ++
 9 files changed, 680 insertions(+), 0 deletions(-)
---
diff --git a/libide/Makefile.am b/libide/Makefile.am
index 1f77f74..424cd88 100644
--- a/libide/Makefile.am
+++ b/libide/Makefile.am
@@ -16,6 +16,10 @@ libide_la_SOURCES = \
        libide/git/ide-git-vcs.h \
        libide/ide-async-helper.c \
        libide/ide-async-helper.h \
+       libide/ide-back-forward-item.c \
+       libide/ide-back-forward-item.h \
+       libide/ide-back-forward-list.c \
+       libide/ide-back-forward-list.h \
        libide/ide-buffer-iter.h \
        libide/ide-buffer.h \
        libide/ide-build-result.c \
@@ -57,6 +61,8 @@ libide_la_SOURCES = \
        libide/ide-refactory.h \
        libide/ide-script.c \
        libide/ide-script.h \
+       libide/ide-source-location.c \
+       libide/ide-source-location.h \
        libide/ide-search-engine.h \
        libide/ide-search-provider.h \
        libide/ide-search-result.h \
diff --git a/libide/ide-back-forward-item.c b/libide/ide-back-forward-item.c
new file mode 100644
index 0000000..678085f
--- /dev/null
+++ b/libide/ide-back-forward-item.c
@@ -0,0 +1,158 @@
+/* ide-back-forward-item.c
+ *
+ * Copyright (C) 2015 Christian Hergert <christian hergert me>
+ *
+ * This file is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This file 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
+ * Lesser 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 "ide-back-forward-item.h"
+#include "ide-source-location.h"
+
+typedef struct
+{
+  IdeSourceLocation *location;
+} IdeBackForwardItemPrivate;
+
+G_DEFINE_TYPE_WITH_PRIVATE (IdeBackForwardItem, ide_back_forward_item, IDE_TYPE_OBJECT)
+
+enum {
+  PROP_0,
+  PROP_LOCATION,
+  LAST_PROP
+};
+
+static GParamSpec *gParamSpecs [LAST_PROP];
+
+IdeBackForwardItem *
+ide_back_forward_item_new (IdeContext        *context,
+                           IdeSourceLocation *location)
+{
+  return g_object_new (IDE_TYPE_BACK_FORWARD_ITEM,
+                       "context", context,
+                       "location", location,
+                       NULL);
+}
+
+IdeSourceLocation *
+ide_back_forward_item_get_location (IdeBackForwardItem *self)
+{
+  IdeBackForwardItemPrivate *priv;
+
+  g_return_val_if_fail (IDE_IS_BACK_FORWARD_ITEM (self), NULL);
+
+  priv = ide_back_forward_item_get_instance_private (self);
+
+  return priv->location;
+}
+
+static void
+ide_back_forward_item_set_location (IdeBackForwardItem *self,
+                                    IdeSourceLocation  *location)
+{
+  IdeBackForwardItemPrivate *priv;
+
+  g_return_if_fail (IDE_IS_BACK_FORWARD_ITEM (self));
+  g_return_if_fail (location);
+
+  priv = ide_back_forward_item_get_instance_private (self);
+
+  if (location != priv->location)
+    {
+      g_clear_pointer (&priv->location, ide_source_location_unref);
+      priv->location = ide_source_location_ref (location);
+    }
+}
+
+static void
+ide_back_forward_item_finalize (GObject *object)
+{
+  IdeBackForwardItem *self = (IdeBackForwardItem *)object;
+  IdeBackForwardItemPrivate *priv = ide_back_forward_item_get_instance_private (self);
+
+  g_clear_pointer (&priv->location, ide_source_location_unref);
+
+  G_OBJECT_CLASS (ide_back_forward_item_parent_class)->finalize (object);
+}
+
+static void
+ide_back_forward_item_get_property (GObject    *object,
+                                    guint       prop_id,
+                                    GValue     *value,
+                                    GParamSpec *pspec)
+{
+  IdeBackForwardItem *self = IDE_BACK_FORWARD_ITEM (object);
+
+  switch (prop_id)
+    {
+    case PROP_LOCATION:
+      g_value_set_boxed (value, ide_back_forward_item_get_location (self));
+      break;
+
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+    }
+}
+
+static void
+ide_back_forward_item_set_property (GObject      *object,
+                                    guint         prop_id,
+                                    const GValue *value,
+                                    GParamSpec   *pspec)
+{
+  IdeBackForwardItem *self = IDE_BACK_FORWARD_ITEM (object);
+
+  switch (prop_id)
+    {
+    case PROP_LOCATION:
+      ide_back_forward_item_set_location (self, g_value_get_boxed (value));
+      break;
+
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+    }
+}
+
+static void
+ide_back_forward_item_class_init (IdeBackForwardItemClass *klass)
+{
+  GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
+  object_class->finalize = ide_back_forward_item_finalize;
+  object_class->get_property = ide_back_forward_item_get_property;
+  object_class->set_property = ide_back_forward_item_set_property;
+
+  /**
+   * IdeBackForwardItem:location:
+   *
+   * The #IdeBackForwardItem:location property contains the location within
+   * a source file to navigate to.
+   */
+  gParamSpecs [PROP_LOCATION] =
+    g_param_spec_boxed ("location",
+                        _("Location"),
+                        _("The location of the navigation item."),
+                        IDE_TYPE_SOURCE_LOCATION,
+                        (G_PARAM_READWRITE |
+                         G_PARAM_CONSTRUCT_ONLY |
+                         G_PARAM_STATIC_STRINGS));
+  g_object_class_install_property (object_class, PROP_LOCATION,
+                                   gParamSpecs [PROP_LOCATION]);
+}
+
+static void
+ide_back_forward_item_init (IdeBackForwardItem *self)
+{
+}
diff --git a/libide/ide-back-forward-item.h b/libide/ide-back-forward-item.h
new file mode 100644
index 0000000..c9f6f3b
--- /dev/null
+++ b/libide/ide-back-forward-item.h
@@ -0,0 +1,43 @@
+/* ide-back-forward-item.h
+ *
+ * Copyright (C) 2015 Christian Hergert <christian hergert me>
+ *
+ * This file is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This file 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
+ * Lesser 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 IDE_BACK_FORWARD_ITEM_H
+#define IDE_BACK_FORWARD_ITEM_H
+
+#include "ide-object.h"
+
+G_BEGIN_DECLS
+
+#define IDE_TYPE_BACK_FORWARD_ITEM (ide_back_forward_item_get_type())
+
+G_DECLARE_FINAL_TYPE (IdeBackForwardItem, ide_back_forward_item, IDE, BACK_FORWARD_ITEM, IdeObject)
+
+struct _IdeBackForwardItem
+{
+  IdeObject parent_instance;
+};
+
+IdeBackForwardItem *ide_back_forward_item_new          (IdeContext         *context,
+                                                        IdeSourceLocation  *location);
+IdeSourceLocation  *ide_back_forward_item_get_location (IdeBackForwardItem *self);
+gboolean            ide_back_forward_item_chain        (IdeBackForwardItem *self,
+                                                        IdeBackForwardItem *other);
+
+G_END_DECLS
+
+#endif /* IDE_BACK_FORWARD_ITEM_H */
diff --git a/libide/ide-back-forward-list.c b/libide/ide-back-forward-list.c
new file mode 100644
index 0000000..26b12c6
--- /dev/null
+++ b/libide/ide-back-forward-list.c
@@ -0,0 +1,220 @@
+/* ide-back-forward-list.c
+ *
+ * Copyright (C) 2015 Christian Hergert <christian hergert me>
+ *
+ * This file is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This file 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
+ * Lesser 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 "ide-back-forward-item.h"
+#include "ide-back-forward-list.h"
+
+typedef struct
+{
+  GQueue *backward;
+  GQueue *forward;
+} IdeBackForwardListPrivate;
+
+G_DEFINE_TYPE_WITH_PRIVATE (IdeBackForwardList, ide_back_forward_list, IDE_TYPE_OBJECT)
+
+enum {
+  PROP_0,
+  PROP_CAN_GO_BACKWARD,
+  PROP_CAN_GO_FORWARD,
+  LAST_PROP
+};
+
+enum {
+  NAVIGATE_TO,
+  LAST_SIGNAL
+};
+
+static GParamSpec *gParamSpecs [LAST_PROP];
+static guint       gSignals [LAST_SIGNAL];
+
+static void
+ide_back_forward_list_navigate_to (IdeBackForwardList *self,
+                                   IdeBackForwardItem *item)
+{
+  g_return_if_fail (IDE_IS_BACK_FORWARD_LIST (self));
+  g_return_if_fail (IDE_IS_BACK_FORWARD_LIST (item));
+
+  g_signal_emit (self, gSignals [NAVIGATE_TO], 0, item);
+}
+
+void
+ide_back_forward_list_go_backward (IdeBackForwardList *self)
+{
+  g_return_if_fail (IDE_IS_BACK_FORWARD_LIST (self));
+
+}
+
+void
+ide_back_forward_list_go_forward (IdeBackForwardList *self)
+{
+  g_return_if_fail (IDE_IS_BACK_FORWARD_LIST (self));
+
+}
+
+gboolean
+ide_back_forward_list_get_can_go_backward (IdeBackForwardList *self)
+{
+  IdeBackForwardListPrivate *priv;
+
+  g_return_val_if_fail (IDE_IS_BACK_FORWARD_LIST (self), FALSE);
+
+  priv = ide_back_forward_list_get_instance_private (self);
+
+  return (priv->backward->length > 0);
+}
+
+gboolean
+ide_back_forward_list_get_can_go_forward (IdeBackForwardList *self)
+{
+  IdeBackForwardListPrivate *priv;
+
+  g_return_val_if_fail (IDE_IS_BACK_FORWARD_LIST (self), FALSE);
+
+  priv = ide_back_forward_list_get_instance_private (self);
+
+  return (priv->forward->length > 0);
+}
+
+void
+ide_back_forward_list_push (IdeBackForwardList *self,
+                            IdeBackForwardItem *item)
+{
+  IdeBackForwardListPrivate *priv;
+  IdeBackForwardItem *tmp;
+
+  g_return_if_fail (IDE_IS_BACK_FORWARD_LIST (self));
+  g_return_if_fail (IDE_IS_BACK_FORWARD_ITEM (item));
+
+  priv = ide_back_forward_list_get_instance_private (self);
+
+  if (priv->forward->length > 0)
+    {
+      while ((tmp = g_queue_pop_head (priv->forward)))
+        g_queue_push_head (priv->backward, tmp);
+    }
+
+  if (!(tmp = g_queue_peek_head (priv->backward)) ||
+      !ide_back_forward_item_chain (tmp, item))
+    g_queue_push_head (priv->backward, g_object_ref (item));
+
+  g_object_notify_by_pspec (G_OBJECT (self),
+                            gParamSpecs [PROP_CAN_GO_BACKWARD]);
+  g_object_notify_by_pspec (G_OBJECT (self),
+                            gParamSpecs [PROP_CAN_GO_FORWARD]);
+}
+
+IdeBackForwardList *
+ide_back_forward_list_branch (IdeBackForwardList *list)
+{
+  return NULL;
+}
+
+void
+ide_back_forward_list_merge (IdeBackForwardList *list,
+                             IdeBackForwardList *branch)
+{
+}
+
+static void
+ide_back_forward_list_dispose (GObject *object)
+{
+  IdeBackForwardList *self = (IdeBackForwardList *)object;
+  IdeBackForwardListPrivate *priv = ide_back_forward_list_get_instance_private (self);
+
+  g_clear_pointer (&priv->backward, g_queue_free);
+  g_clear_pointer (&priv->forward, g_queue_free);
+
+  G_OBJECT_CLASS (ide_back_forward_list_parent_class)->dispose (object);
+}
+
+static void
+ide_back_forward_list_get_property (GObject    *object,
+                                    guint       prop_id,
+                                    GValue     *value,
+                                    GParamSpec *pspec)
+{
+  IdeBackForwardList *self = IDE_BACK_FORWARD_LIST (object);
+
+  switch (prop_id)
+    {
+    case PROP_CAN_GO_BACKWARD:
+      g_value_set_boolean (value,
+                           ide_back_forward_list_get_can_go_backward (self));
+      break;
+
+    case PROP_CAN_GO_FORWARD:
+      g_value_set_boolean (value,
+                           ide_back_forward_list_get_can_go_forward (self));
+      break;
+
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+    }
+}
+
+static void
+ide_back_forward_list_class_init (IdeBackForwardListClass *klass)
+{
+  GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
+  object_class->dispose = ide_back_forward_list_dispose;
+  object_class->get_property = ide_back_forward_list_get_property;
+
+  gParamSpecs [PROP_CAN_GO_BACKWARD] =
+    g_param_spec_boolean ("can-go-backward",
+                          _("Can Go Backward"),
+                          _("If there are more backward navigation items."),
+                          IDE_TYPE_BACK_FORWARD_ITEM,
+                          (G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
+  g_object_class_install_property (object_class, PROP_CAN_GO_BACKWARD,
+                                   gParamSpecs [PROP_CAN_GO_BACKWARD]);
+
+  gParamSpecs [PROP_CAN_GO_FORWARD] =
+    g_param_spec_boolean ("can-go-forward",
+                          _("Can Go Forward"),
+                          _("If there are more forward navigation items."),
+                          IDE_TYPE_BACK_FORWARD_ITEM,
+                          (G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
+  g_object_class_install_property (object_class, PROP_CAN_GO_FORWARD,
+                                   gParamSpecs [PROP_CAN_GO_FORWARD]);
+
+  gSignals [NAVIGATE_TO] =
+    g_signal_new ("navigate-to",
+                  G_TYPE_FROM_CLASS (klass),
+                  G_SIGNAL_RUN_LAST,
+                  0,
+                  NULL,
+                  NULL,
+                  g_cclosure_marshal_VOID__OBJECT,
+                  G_TYPE_NONE,
+                  1,
+                  IDE_TYPE_BACK_FORWARD_ITEM);
+}
+
+static void
+ide_back_forward_list_init (IdeBackForwardList *self)
+{
+  IdeBackForwardListPrivate *priv;
+
+  priv = ide_back_forward_list_get_instance_private (self);
+
+  priv->backward = g_queue_new ();
+  priv->forward = g_queue_new ();
+}
diff --git a/libide/ide-back-forward-list.h b/libide/ide-back-forward-list.h
new file mode 100644
index 0000000..3e506f5
--- /dev/null
+++ b/libide/ide-back-forward-list.h
@@ -0,0 +1,47 @@
+/* ide-back-forward-list.h
+ *
+ * Copyright (C) 2015 Christian Hergert <christian hergert me>
+ *
+ * This file is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This file 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
+ * Lesser 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 IDE_BACK_FORWARD_LIST_H
+#define IDE_BACK_FORWARD_LIST_H
+
+#include "ide-object.h"
+
+G_BEGIN_DECLS
+
+#define IDE_TYPE_BACK_FORWARD_LIST (ide_back_forward_list_get_type())
+
+G_DECLARE_FINAL_TYPE (IdeBackForwardList, ide_back_forward_list, IDE, BACK_FORWARD_LIST, IdeObject)
+
+struct _IdeBackForwardList
+{
+  IdeObject parent_instance;
+};
+
+void                ide_back_forward_list_go_backward         (IdeBackForwardList *self);
+void                ide_back_forward_list_go_forward          (IdeBackForwardList *self);
+gboolean            ide_back_forward_list_get_can_go_backward (IdeBackForwardList *self);
+gboolean            ide_back_forward_list_get_can_go_forward  (IdeBackForwardList *self);
+void                ide_back_forward_list_push                (IdeBackForwardList *self,
+                                                               IdeBackForwardItem *item);
+IdeBackForwardList *ide_back_forward_list_branch              (IdeBackForwardList *self);
+void                ide_back_forward_list_merge               (IdeBackForwardList *self,
+                                                               IdeBackForwardList *branch);
+
+G_END_DECLS
+
+#endif /* IDE_BACK_FORWARD_LIST_H */
diff --git a/libide/ide-context.c b/libide/ide-context.c
index 6c908d7..5d88166 100644
--- a/libide/ide-context.c
+++ b/libide/ide-context.c
@@ -24,6 +24,7 @@
 #include "ide-build-system.h"
 #include "ide-context.h"
 #include "ide-device-manager.h"
+#include "ide-global.h"
 #include "ide-project.h"
 #include "ide-service.h"
 #include "ide-unsaved-files.h"
diff --git a/libide/ide-source-location.c b/libide/ide-source-location.c
new file mode 100644
index 0000000..3e0a39d
--- /dev/null
+++ b/libide/ide-source-location.c
@@ -0,0 +1,155 @@
+/* ide-source-location.c
+ *
+ * Copyright (C) 2015 Christian Hergert <christian hergert me>
+ *
+ * This file is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This file 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
+ * Lesser 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 "ide-file.h"
+#include "ide-source-location.h"
+
+struct _IdeSourceLocation
+{
+  volatile gint  ref_count;
+  guint          line;
+  guint          line_offset;
+  guint          offset;
+  IdeFile       *file;
+};
+
+/**
+ * ide_source_location_ref:
+ *
+ * Increments the reference count of @self by one.
+ *
+ * Returns: (transfer full): self
+ */
+IdeSourceLocation *
+ide_source_location_ref (IdeSourceLocation *self)
+{
+  g_return_val_if_fail (self->ref_count > 0, NULL);
+
+  g_atomic_int_inc (&self->ref_count);
+
+  return self;
+}
+
+/**
+ * ide_source_location_unref:
+ *
+ * Decrements the reference count of @self by one. If the reference count
+ * reaches zero, then the structure is freed.
+ */
+void
+ide_source_location_unref (IdeSourceLocation *self)
+{
+  g_return_if_fail (self->ref_count > 0);
+
+  if (g_atomic_int_dec_and_test (&self->ref_count))
+    {
+      g_clear_object (&self->file);
+      g_slice_free (IdeSourceLocation, self);
+    }
+}
+
+/**
+ * ide_source_location_get_offset:
+ *
+ * Retrieves the character offset within the file.
+ *
+ * Returns: A #guint containing the character offset within the file.
+ */
+guint
+ide_source_location_get_offset (IdeSourceLocation *self)
+{
+  g_return_val_if_fail (self, 0);
+
+  return self->offset;
+}
+
+/**
+ * ide_source_location_get_line:
+ *
+ * Retrieves the target line number starting from 0.
+ *
+ * Returns: A #guint containing the target line.
+ */
+guint
+ide_source_location_get_line (IdeSourceLocation *self)
+{
+  g_return_val_if_fail (self, 0);
+
+  return self->line;
+}
+
+/**
+ * ide_source_location_get_line_offset:
+ *
+ * Retrieves the character offset within the line.
+ *
+ * Returns: A #guint containing the offset within the line.
+ */
+guint
+ide_source_location_get_line_offset (IdeSourceLocation *self)
+{
+  g_return_val_if_fail (self, 0);
+
+  return self->line_offset;
+}
+
+/**
+ * ide_source_location_get_file:
+ *
+ * The file represented by this source location.
+ *
+ * Returns: (transfer none): An #IdeFile.
+ */
+IdeFile *
+ide_source_location_get_file (IdeSourceLocation *self)
+{
+  g_return_val_if_fail (self, NULL);
+
+  return self->file;
+}
+
+/**
+ * ide_source_location_new:
+ * @file: an #IdeFile
+ * @line: the line number starting from zero
+ * @line_offset: the character offset within the line
+ * @offset: the character offset in the file
+ *
+ * Creates a new #IdeSourceLocation, using the file, line, column, and character
+ * offset provided.
+ *
+ * Returns: (transfer full): A newly allocated #IdeSourceLocation.
+ */
+IdeSourceLocation *
+ide_source_location_new (IdeFile *file,
+                         guint    line,
+                         guint    line_offset,
+                         guint    offset)
+{
+  IdeSourceLocation *ret;
+
+  g_return_val_if_fail (IDE_IS_FILE (file), NULL);
+
+  ret = g_slice_new0 (IdeSourceLocation);
+  ret->file = g_object_ref (file);
+  ret->line = line;
+  ret->line_offset = line_offset;
+  ret->offset = offset;
+
+  return ret;
+}
diff --git a/libide/ide-source-location.h b/libide/ide-source-location.h
new file mode 100644
index 0000000..91daca1
--- /dev/null
+++ b/libide/ide-source-location.h
@@ -0,0 +1,42 @@
+/* ide-source-location.h
+ *
+ * Copyright (C) 2015 Christian Hergert <christian hergert me>
+ *
+ * This file is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This file 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
+ * Lesser 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 IDE_SOURCE_LOCATION_H
+#define IDE_SOURCE_LOCATION_H
+
+#include "ide-types.h"
+
+G_BEGIN_DECLS
+
+#define IDE_TYPE_SOURCE_LOCATION (ide_source_location_get_type())
+
+GType              ide_source_location_get_type        (void);
+IdeSourceLocation *ide_source_location_ref             (IdeSourceLocation *self);
+void               ide_source_location_unref           (IdeSourceLocation *self);
+IdeSourceLocation *ide_source_location_new             (IdeFile           *file,
+                                                        guint             line,
+                                                        guint             line_offset,
+                                                        guint             offset);
+guint              ide_source_location_get_line        (IdeSourceLocation *self);
+guint              ide_source_location_get_line_offset (IdeSourceLocation *self);
+guint              ide_source_location_get_offset      (IdeSourceLocation *self);
+IdeFile           *ide_source_location_get_file        (IdeSourceLocation *self);
+
+G_END_DECLS
+
+#endif /* IDE_SOURCE_LOCATION_H */
diff --git a/libide/ide-types.h b/libide/ide-types.h
index e4c3be1..62d0ff3 100644
--- a/libide/ide-types.h
+++ b/libide/ide-types.h
@@ -29,6 +29,10 @@ G_BEGIN_DECLS
 #define ide_set_weak_pointer(ptr,obj) \
   ((obj!=*(ptr)) ? (ide_clear_weak_pointer(ptr),*(ptr)=obj,g_object_add_weak_pointer((GObject*)obj, 
(gpointer*)ptr),1) : 0)
 
+typedef struct _IdeBackForwardItem             IdeBackForwardItem;
+
+typedef struct _IdeBackForwardList             IdeBackForwardList;
+
 typedef struct _IdeBuffer                      IdeBuffer;
 typedef struct _IdeBufferInterface             IdeBufferInterface;
 
@@ -105,6 +109,10 @@ typedef struct _IdeSearchResultPrivate         IdeSearchResultPrivate;
 
 typedef struct _IdeService                     IdeService;
 
+typedef struct _IdeSourceLocation              IdeSourceLocation;
+
+typedef struct _IdeSourceRange                 IdeSourceRange;
+
 typedef struct _IdeSymbol                      IdeSymbol;
 
 typedef struct _IdeSymbolResolver              IdeSymbolResolver;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]