[gnome-builder] code-index: add helper to copy index plan items



commit d8d3cfaff4bb5d4cd9e181f1591c7237d1f59369
Author: Christian Hergert <chergert redhat com>
Date:   Fri Feb 1 15:45:09 2019 -0800

    code-index: add helper to copy index plan items

 src/plugins/code-index/gbp-code-index-plan.c | 27 +++++++++++++
 src/plugins/code-index/gbp-code-index-plan.h | 58 ++++++++++++++--------------
 2 files changed, 57 insertions(+), 28 deletions(-)
---
diff --git a/src/plugins/code-index/gbp-code-index-plan.c b/src/plugins/code-index/gbp-code-index-plan.c
index fee182c5a..4193fa217 100644
--- a/src/plugins/code-index/gbp-code-index-plan.c
+++ b/src/plugins/code-index/gbp-code-index-plan.c
@@ -771,3 +771,30 @@ gbp_code_index_plan_load_flags_finish (GbpCodeIndexPlan  *self,
 
   IDE_RETURN (ret);
 }
+
+GbpCodeIndexPlanItem *
+gbp_code_index_plan_copy (const GbpCodeIndexPlanItem *item)
+{
+  GbpCodeIndexPlanItem *ret;
+
+  if (item == NULL)
+    return NULL;
+
+  ret = g_slice_new0 (GbpCodeIndexPlanItem);
+  ret->file_info = g_object_ref (item->file_info);
+  ret->build_flags = g_strdupv ((gchar **)item->build_flags);
+  ret->indexer_module_name = item->indexer_module_name;
+
+  return g_steal_pointer (&ret);
+}
+
+void
+gbp_code_index_plan_item_free (GbpCodeIndexPlanItem *item)
+{
+  if (item != NULL)
+    {
+      g_clear_object (&item->file_info);
+      g_clear_pointer (&item->build_flags, g_strfreev);
+      g_slice_free (GbpCodeIndexPlanItem, item);
+    }
+}
diff --git a/src/plugins/code-index/gbp-code-index-plan.h b/src/plugins/code-index/gbp-code-index-plan.h
index 41e708194..be5753d34 100644
--- a/src/plugins/code-index/gbp-code-index-plan.h
+++ b/src/plugins/code-index/gbp-code-index-plan.h
@@ -56,33 +56,35 @@ typedef gboolean (*GbpCodeIndexPlanForeach) (GFile              *directory,
                                              GbpCodeIndexReason  reason,
                                              gpointer            user_data);
 
-GbpCodeIndexPlan *gbp_code_index_plan_new                 (void);
-void              gbp_code_index_plan_populate_async      (GbpCodeIndexPlan         *self,
-                                                           IdeContext               *context,
-                                                           GCancellable             *cancellable,
-                                                           GAsyncReadyCallback       callback,
-                                                           gpointer                  user_data);
-gboolean          gbp_code_index_plan_populate_finish     (GbpCodeIndexPlan         *self,
-                                                           GAsyncResult             *result,
-                                                           GError                  **error);
-void              gbp_code_index_plan_cull_indexed_async  (GbpCodeIndexPlan         *self,
-                                                           IdeContext               *context,
-                                                           GCancellable             *cancellable,
-                                                           GAsyncReadyCallback       callback,
-                                                           gpointer                  user_data);
-gboolean          gbp_code_index_plan_cull_indexed_finish (GbpCodeIndexPlan         *self,
-                                                           GAsyncResult             *result,
-                                                           GError                  **error);
-void              gbp_code_index_plan_load_flags_async    (GbpCodeIndexPlan         *self,
-                                                           IdeContext               *context,
-                                                           GCancellable             *cancellable,
-                                                           GAsyncReadyCallback       callback,
-                                                           gpointer                  user_data);
-gboolean          gbp_code_index_plan_load_flags_finish   (GbpCodeIndexPlan         *self,
-                                                           GAsyncResult             *result,
-                                                           GError                  **error);
-void              gbp_code_index_plan_foreach             (GbpCodeIndexPlan         *self,
-                                                           GbpCodeIndexPlanForeach   foreach_func,
-                                                           gpointer                  foreach_data);
+GbpCodeIndexPlan     *gbp_code_index_plan_new                 (void);
+void                  gbp_code_index_plan_populate_async      (GbpCodeIndexPlan            *self,
+                                                               IdeContext                  *context,
+                                                               GCancellable                *cancellable,
+                                                               GAsyncReadyCallback          callback,
+                                                               gpointer                     user_data);
+gboolean              gbp_code_index_plan_populate_finish     (GbpCodeIndexPlan            *self,
+                                                               GAsyncResult                *result,
+                                                               GError                     **error);
+void                  gbp_code_index_plan_cull_indexed_async  (GbpCodeIndexPlan            *self,
+                                                               IdeContext                  *context,
+                                                               GCancellable                *cancellable,
+                                                               GAsyncReadyCallback          callback,
+                                                               gpointer                     user_data);
+gboolean              gbp_code_index_plan_cull_indexed_finish (GbpCodeIndexPlan            *self,
+                                                               GAsyncResult                *result,
+                                                               GError                     **error);
+void                  gbp_code_index_plan_load_flags_async    (GbpCodeIndexPlan            *self,
+                                                               IdeContext                  *context,
+                                                               GCancellable                *cancellable,
+                                                               GAsyncReadyCallback          callback,
+                                                               gpointer                     user_data);
+gboolean              gbp_code_index_plan_load_flags_finish   (GbpCodeIndexPlan            *self,
+                                                               GAsyncResult                *result,
+                                                               GError                     **error);
+void                  gbp_code_index_plan_foreach             (GbpCodeIndexPlan            *self,
+                                                               GbpCodeIndexPlanForeach      foreach_func,
+                                                               gpointer                     foreach_data);
+GbpCodeIndexPlanItem *gbp_code_index_plan_copy                (const GbpCodeIndexPlanItem  *item);
+void                  gbp_code_index_plan_item_free           (GbpCodeIndexPlanItem        *item);
 
 G_END_DECLS


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