[gnome-builder/wip/libide: 64/237] libide: implement history branching in back-forward-list



commit ae08ae5d9d380700974f896973379c02dfcfbabd
Author: Christian Hergert <christian hergert me>
Date:   Tue Feb 10 12:56:34 2015 -0800

    libide: implement history branching in back-forward-list

 libide/ide-back-forward-list.c |   34 ++++++++++++++++++++++++++++++++--
 1 files changed, 32 insertions(+), 2 deletions(-)
---
diff --git a/libide/ide-back-forward-list.c b/libide/ide-back-forward-list.c
index eab5d6f..ad4630e 100644
--- a/libide/ide-back-forward-list.c
+++ b/libide/ide-back-forward-list.c
@@ -182,9 +182,39 @@ ide_back_forward_list_push (IdeBackForwardList *self,
 }
 
 IdeBackForwardList *
-ide_back_forward_list_branch (IdeBackForwardList *list)
+ide_back_forward_list_branch (IdeBackForwardList *self)
 {
-  return NULL;
+  IdeBackForwardListPrivate *priv;
+  IdeBackForwardList *ret;
+  IdeContext *context;
+  GList *iter;
+
+  g_return_val_if_fail (IDE_IS_BACK_FORWARD_LIST (self), NULL);
+
+  priv = ide_back_forward_list_get_instance_private (self);
+
+  context = ide_object_get_context (IDE_OBJECT (self));
+
+  ret = g_object_new (IDE_TYPE_BACK_FORWARD_LIST,
+                      "context", context,
+                      NULL);
+
+  for (iter = priv->backward->head; iter; iter = iter->next)
+    {
+      IdeBackForwardItem *item = iter->data;
+      ide_back_forward_list_push (ret, item);
+    }
+
+  if (priv->current_item)
+    ide_back_forward_list_push (ret, priv->current_item);
+
+  for (iter = priv->forward->head; iter; iter = iter->next)
+    {
+      IdeBackForwardItem *item = iter->data;
+      ide_back_forward_list_push (ret, item);
+    }
+
+  return ret;
 }
 
 void


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