[gnome-builder] back-forward: remove dead code



commit 159c8c20aa912fb3c4f1de8f787913391029c1c3
Author: Christian Hergert <chergert redhat com>
Date:   Mon Sep 4 17:49:27 2017 -0700

    back-forward: remove dead code
    
    Now that history has it's own (better implemented) version of this, we
    can remove the old back-forward-list.

 libide/buffers/ide-buffer-manager.c            |    3 -
 libide/history/ide-back-forward-controls.c     |   81 ----
 libide/history/ide-back-forward-controls.h     |   31 --
 libide/history/ide-back-forward-item.c         |  266 ------------
 libide/history/ide-back-forward-item.h         |   44 --
 libide/history/ide-back-forward-list-load.c    |  157 -------
 libide/history/ide-back-forward-list-private.h |   52 ---
 libide/history/ide-back-forward-list-save.c    |  198 ---------
 libide/history/ide-back-forward-list.c         |  542 ------------------------
 libide/history/ide-back-forward-list.h         |   43 --
 libide/ide-context.c                           |  168 --------
 libide/ide-context.h                           |    1 -
 libide/ide-internal.h                          |    2 -
 libide/ide.h                                   |    3 -
 libide/meson.build                             |    9 -
 tests/meson.build                              |   11 -
 tests/test-ide-back-forward-list.c             |  161 -------
 17 files changed, 0 insertions(+), 1772 deletions(-)
---
diff --git a/libide/buffers/ide-buffer-manager.c b/libide/buffers/ide-buffer-manager.c
index 210a42d..4cd9b09 100644
--- a/libide/buffers/ide-buffer-manager.c
+++ b/libide/buffers/ide-buffer-manager.c
@@ -35,9 +35,6 @@
 #include "diagnostics/ide-source-range.h"
 #include "files/ide-file-settings.h"
 #include "files/ide-file.h"
-#include "history/ide-back-forward-item.h"
-#include "history/ide-back-forward-list-private.h"
-#include "history/ide-back-forward-list.h"
 #include "projects/ide-project-edit.h"
 #include "projects/ide-project-edit-private.h"
 #include "sourceview/ide-completion-words.h"
diff --git a/libide/ide-context.c b/libide/ide-context.c
index 5050b68..72e0a78 100644
--- a/libide/ide-context.c
+++ b/libide/ide-context.c
@@ -39,8 +39,6 @@
 #include "debugger/ide-debug-manager.h"
 #include "devices/ide-device-manager.h"
 #include "doap/ide-doap.h"
-#include "history/ide-back-forward-list-private.h"
-#include "history/ide-back-forward-list.h"
 #include "plugins/ide-extension-util.h"
 #include "projects/ide-project-files.h"
 #include "projects/ide-project-item.h"
@@ -64,7 +62,6 @@ struct _IdeContext
 {
   GObject                   parent_instance;
 
-  IdeBackForwardList       *back_forward_list;
   IdeBufferManager         *buffer_manager;
   IdeBuildManager          *build_manager;
   IdeBuildSystem           *build_system;
@@ -107,7 +104,6 @@ DZL_DEFINE_COUNTER (instances, "Context", "N contexts", "Number of contexts")
 
 enum {
   PROP_0,
-  PROP_BACK_FORWARD_LIST,
   PROP_BUFFER_MANAGER,
   PROP_BUILD_SYSTEM,
   PROP_CONFIGURATION_MANAGER,
@@ -149,27 +145,6 @@ ide_context_get_recent_manager (IdeContext *self)
 }
 
 /**
- * ide_context_get_back_forward_list:
- *
- * Retrieves the global back forward list for the #IdeContext.
- *
- * Consumers of this should branch the #IdeBackForwardList and merge them
- * when their document stack is closed.
- *
- * See ide_back_forward_list_branch() and ide_back_forward_list_merge() for
- * more information.
- *
- * Returns: (transfer none): An #IdeBackForwardList.
- */
-IdeBackForwardList *
-ide_context_get_back_forward_list (IdeContext *self)
-{
-  g_return_val_if_fail (IDE_IS_CONTEXT (self), NULL);
-
-  return self->back_forward_list;
-}
-
-/**
  * ide_context_get_buffer_manager:
  *
  * Gets the #IdeContext:buffer-manager property. The buffer manager is responsible for loading
@@ -500,29 +475,6 @@ ide_context_get_service_typed (IdeContext *self,
   return NULL;
 }
 
-static GFile *
-get_back_forward_list_file (IdeContext *self)
-{
-  const gchar *project_name;
-  g_autofree gchar *name = NULL;
-  g_autofree gchar *path = NULL;
-  GFile *file;
-
-  g_assert (IDE_IS_CONTEXT (self));
-
-  project_name = ide_project_get_name (self->project);
-  name = g_strdup_printf ("%s.back-forward-list", project_name);
-  name = g_strdelimit (name, " \t\n", '_');
-  path = g_build_filename (g_get_user_cache_dir (),
-                           "gnome-builder",
-                           "history",
-                           name,
-                           NULL);
-  file = g_file_new_for_path (path);
-
-  return file;
-}
-
 static void
 ide_context_service_notify_loaded (PeasExtensionSet *set,
                                    PeasPluginInfo   *plugin_info,
@@ -606,10 +558,6 @@ ide_context_get_property (GObject    *object,
 
   switch (prop_id)
     {
-    case PROP_BACK_FORWARD_LIST:
-      g_value_set_object (value, ide_context_get_back_forward_list (self));
-      break;
-
     case PROP_BUFFER_MANAGER:
       g_value_set_object (value, ide_context_get_buffer_manager (self));
       break;
@@ -700,13 +648,6 @@ ide_context_class_init (IdeContextClass *klass)
   object_class->get_property = ide_context_get_property;
   object_class->set_property = ide_context_set_property;
 
-  properties [PROP_BACK_FORWARD_LIST] =
-    g_param_spec_object ("back-forward-list",
-                         "Back Forward List",
-                         "Back/forward navigation history for the context.",
-                         IDE_TYPE_BACK_FORWARD_LIST,
-                         (G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
-
   properties [PROP_BUFFER_MANAGER] =
     g_param_spec_object ("buffer-manager",
                          "Buffer Manager",
@@ -840,10 +781,6 @@ ide_context_init (IdeContext *self)
                                                  IDE_RECENT_PROJECTS_BOOKMARK_FILENAME,
                                                  NULL);
 
-  self->back_forward_list = g_object_new (IDE_TYPE_BACK_FORWARD_LIST,
-                                          "context", self,
-                                          NULL);
-
   self->buffer_manager = g_object_new (IDE_TYPE_BUFFER_MANAGER,
                                        "context", self,
                                        NULL);
@@ -1185,58 +1122,6 @@ ide_context_init_snippets (gpointer             source_object,
 }
 
 static void
-ide_context__back_forward_list_load_cb (GObject      *object,
-                                        GAsyncResult *result,
-                                        gpointer      user_data)
-{
-  IdeBackForwardList *back_forward_list = (IdeBackForwardList *)object;
-  g_autoptr(GTask) task = user_data;
-  GError *error = NULL;
-
-  g_assert (IDE_IS_BACK_FORWARD_LIST (back_forward_list));
-  g_assert (G_IS_TASK (task));
-
-  /*
-   * Failing to load the back-forward list is non-fatal. We'll fix it during
-   * our next write to the file.
-   */
-  if (!_ide_back_forward_list_load_finish (back_forward_list, result, &error))
-    {
-      if (!g_error_matches (error, G_IO_ERROR, G_IO_ERROR_NOT_FOUND))
-        g_warning ("%s", error->message);
-      g_clear_error (&error);
-    }
-
-  g_task_return_boolean (task, TRUE);
-}
-
-static void
-ide_context_init_back_forward_list (gpointer             source_object,
-                                    GCancellable        *cancellable,
-                                    GAsyncReadyCallback  callback,
-                                    gpointer             user_data)
-{
-  IdeContext *self = source_object;
-  g_autoptr(GTask) task = NULL;
-  g_autoptr(GFile) file = NULL;
-
-  IDE_ENTRY;
-
-  g_return_if_fail (IDE_IS_CONTEXT (self));
-
-  task = g_task_new (self, cancellable, callback, user_data);
-
-  file = get_back_forward_list_file (self);
-  _ide_back_forward_list_load_async (self->back_forward_list,
-                                     file,
-                                     cancellable,
-                                     ide_context__back_forward_list_load_cb,
-                                     g_object_ref (task));
-
-  IDE_EXIT;
-}
-
-static void
 ide_context_service_added (PeasExtensionSet *set,
                            PeasPluginInfo   *info,
                            PeasExtension    *exten,
@@ -1757,7 +1642,6 @@ ide_context_init_async (GAsyncInitable      *initable,
                         ide_context_init_vcs,
                         ide_context_init_services,
                         ide_context_init_project_name,
-                        ide_context_init_back_forward_list,
                         ide_context_init_snippets,
                         ide_context_init_unsaved_files,
                         ide_context_init_add_recent,
@@ -1933,57 +1817,6 @@ ide_context_unload_configuration_manager (gpointer             source_object,
 }
 
 static void
-ide_context_unload__back_forward_list_save_cb (GObject      *object,
-                                               GAsyncResult *result,
-                                               gpointer      user_data)
-{
-  IdeBackForwardList *back_forward_list = (IdeBackForwardList *)object;
-  g_autoptr(GTask) task = user_data;
-  g_autoptr(GError) error = NULL;
-
-  IDE_ENTRY;
-
-  g_assert (IDE_IS_BACK_FORWARD_LIST (back_forward_list));
-  g_assert (G_IS_TASK (task));
-
-  /* nice to know, but not critical to save process */
-  if (!_ide_back_forward_list_save_finish (back_forward_list, result, &error))
-    g_warning ("%s", error->message);
-
-  g_task_return_boolean (task, TRUE);
-
-  IDE_EXIT;
-}
-
-static void
-ide_context_unload_back_forward_list (gpointer             source_object,
-                                      GCancellable        *cancellable,
-                                      GAsyncReadyCallback  callback,
-                                      gpointer             user_data)
-{
-  IdeContext *self = source_object;
-  g_autoptr(GFile) file = NULL;
-  g_autoptr(GTask) task = NULL;
-
-  IDE_ENTRY;
-
-  g_assert (IDE_IS_CONTEXT (self));
-  g_assert (!cancellable || G_IS_CANCELLABLE (cancellable));
-
-  task = g_task_new (self, cancellable, callback, user_data);
-  g_task_set_source_tag (task, ide_context_unload_back_forward_list);
-
-  file = get_back_forward_list_file (self);
-  _ide_back_forward_list_save_async (self->back_forward_list,
-                                     file,
-                                     cancellable,
-                                     ide_context_unload__back_forward_list_save_cb,
-                                     g_steal_pointer (&task));
-
-  IDE_EXIT;
-}
-
-static void
 ide_context_unload__unsaved_files_save_cb (GObject      *object,
                                            GAsyncResult *result,
                                            gpointer      user_data)
@@ -2082,7 +1915,6 @@ ide_context_do_unload_locked (IdeContext *self)
                         ide_context_unload_cb,
                         g_object_ref (task),
                         ide_context_unload_configuration_manager,
-                        ide_context_unload_back_forward_list,
                         ide_context_unload_buffer_manager,
                         ide_context_unload_unsaved_files,
                         ide_context_unload_services,
diff --git a/libide/ide-context.h b/libide/ide-context.h
index 55a06ae..474bb0f 100644
--- a/libide/ide-context.h
+++ b/libide/ide-context.h
@@ -30,7 +30,6 @@ G_BEGIN_DECLS
 
 G_DECLARE_FINAL_TYPE (IdeContext, ide_context, IDE, CONTEXT, GObject)
 
-IdeBackForwardList       *ide_context_get_back_forward_list     (IdeContext           *self);
 GFile                    *ide_context_get_project_file          (IdeContext           *self);
 IdeBufferManager         *ide_context_get_buffer_manager        (IdeContext           *self);
 IdeBuildManager          *ide_context_get_build_manager         (IdeContext           *self);
diff --git a/libide/ide-internal.h b/libide/ide-internal.h
index 8ef8e0f..a3d9a7d 100644
--- a/libide/ide-internal.h
+++ b/libide/ide-internal.h
@@ -25,8 +25,6 @@
 
 #include "buffers/ide-buffer-private.h"
 #include "highlighting/ide-highlight-engine.h"
-#include "history/ide-back-forward-item.h"
-#include "history/ide-back-forward-list.h"
 #include "sourceview/ide-source-view-mode.h"
 #include "sourceview/ide-source-view.h"
 #include "symbols/ide-symbol.h"
diff --git a/libide/ide.h b/libide/ide.h
index 8fc7a54..71a52b7 100644
--- a/libide/ide.h
+++ b/libide/ide.h
@@ -101,9 +101,6 @@ G_BEGIN_DECLS
 #include "highlighting/ide-highlight-engine.h"
 #include "highlighting/ide-highlight-index.h"
 #include "highlighting/ide-highlighter.h"
-#include "history/ide-back-forward-controls.h"
-#include "history/ide-back-forward-item.h"
-#include "history/ide-back-forward-list.h"
 #include "langserv/ide-langserv-client.h"
 #include "langserv/ide-langserv-completion-provider.h"
 #include "langserv/ide-langserv-diagnostic-provider.h"
diff --git a/libide/meson.build b/libide/meson.build
index 59bd4a1..72b6d0f 100644
--- a/libide/meson.build
+++ b/libide/meson.build
@@ -130,9 +130,6 @@ libide_public_headers = [
   'highlighting/ide-highlight-engine.h',
   'highlighting/ide-highlight-index.h',
   'highlighting/ide-highlighter.h',
-  'history/ide-back-forward-controls.h',
-  'history/ide-back-forward-item.h',
-  'history/ide-back-forward-list.h',
   'langserv/ide-langserv-client.h',
   'langserv/ide-langserv-completion-provider.h',
   'langserv/ide-langserv-diagnostic-provider.h',
@@ -347,11 +344,6 @@ libide_public_sources = [
   'highlighting/ide-highlight-engine.c',
   'highlighting/ide-highlight-index.c',
   'highlighting/ide-highlighter.c',
-  'history/ide-back-forward-controls.c',
-  'history/ide-back-forward-item.c',
-  'history/ide-back-forward-list-load.c',
-  'history/ide-back-forward-list-save.c',
-  'history/ide-back-forward-list.c',
   'ide-context.c',
   'ide-object.c',
   'ide-service.c',
@@ -568,7 +560,6 @@ libide_sources = libide_generated_headers + libide_public_sources + [
   'gsettings/ide-gsettings-file-settings.h',
   'gsettings/ide-language-defaults.c',
   'gsettings/ide-language-defaults.h',
-  'history/ide-back-forward-list-private.h',
   'ide-internal.h',
   'keybindings/ide-keybindings.c',
   'keybindings/ide-keybindings.h',
diff --git a/tests/meson.build b/tests/meson.build
index a998e40..4946997 100644
--- a/tests/meson.build
+++ b/tests/meson.build
@@ -29,17 +29,6 @@ test('test-ide-context', ide_context,
   env: ide_test_env,
 )
 
-ide_back_forward_list = executable('test-ide-back-forward-list',
-  'test-ide-back-forward-list.c',
-  c_args: ide_test_cflags,
-  dependencies: [
-    ide_test_deps,
-  ],
-)
-test('test-ide-back-forward-list', ide_back_forward_list,
-  env: ide_test_env,
-)
-
 
 ide_buffer_manager = executable('test-ide-buffer-manager',
   'test-ide-buffer-manager.c',


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