[gnome-builder] code-index: remove IdeObject usage for workbench addin
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] code-index: remove IdeObject usage for workbench addin
- Date: Tue, 5 Feb 2019 06:18:02 +0000 (UTC)
commit 6e611b3344f3364dca54988c72d6d1cbc6335c5b
Author: Christian Hergert <chergert redhat com>
Date: Mon Feb 4 19:39:44 2019 -0800
code-index: remove IdeObject usage for workbench addin
This can be moved off to the service instead.
.../code-index/gbp-code-index-workbench-addin.c | 22 +++++++++-------------
.../code-index/gbp-code-index-workbench-addin.h | 14 ++++++--------
2 files changed, 15 insertions(+), 21 deletions(-)
---
diff --git a/src/plugins/code-index/gbp-code-index-workbench-addin.c
b/src/plugins/code-index/gbp-code-index-workbench-addin.c
index 70c7aba72..7d35a9af2 100644
--- a/src/plugins/code-index/gbp-code-index-workbench-addin.c
+++ b/src/plugins/code-index/gbp-code-index-workbench-addin.c
@@ -32,7 +32,7 @@
struct _GbpCodeIndexWorkbenchAddin
{
- IdeObject parent_instance;
+ GObject parent_instance;
IdeWorkbench *workbench;
GbpCodeIndexService *service;
IdeCodeIndexIndex *index;
@@ -43,7 +43,6 @@ gbp_code_index_workbench_addin_load (IdeWorkbenchAddin *addin,
IdeWorkbench *workbench)
{
GbpCodeIndexWorkbenchAddin *self = (GbpCodeIndexWorkbenchAddin *)addin;
- IdeContext *context;
g_assert (IDE_IS_MAIN_THREAD ());
g_assert (GBP_IS_CODE_INDEX_WORKBENCH_ADDIN (self));
@@ -51,8 +50,6 @@ gbp_code_index_workbench_addin_load (IdeWorkbenchAddin *addin,
self->workbench = workbench;
- context = ide_workbench_get_context (workbench);
- ide_object_append (IDE_OBJECT (context), IDE_OBJECT (self));
}
static void
@@ -60,7 +57,6 @@ gbp_code_index_workbench_addin_unload (IdeWorkbenchAddin *addin,
IdeWorkbench *workbench)
{
GbpCodeIndexWorkbenchAddin *self = (GbpCodeIndexWorkbenchAddin *)addin;
- IdeContext *context;
g_assert (IDE_IS_MAIN_THREAD ());
g_assert (GBP_IS_CODE_INDEX_WORKBENCH_ADDIN (self));
@@ -68,9 +64,6 @@ gbp_code_index_workbench_addin_unload (IdeWorkbenchAddin *addin,
ide_clear_and_destroy_object (&self->index);
- context = ide_workbench_get_context (workbench);
- ide_object_remove (IDE_OBJECT (context), IDE_OBJECT (self));
-
self->workbench = NULL;
}
@@ -79,12 +72,17 @@ gbp_code_index_workbench_addin_project_loaded (IdeWorkbenchAddin *addin,
IdeProjectInfo *project_info)
{
GbpCodeIndexWorkbenchAddin *self = (GbpCodeIndexWorkbenchAddin *)addin;
+ IdeContext *context;
g_assert (IDE_IS_MAIN_THREAD ());
g_assert (GBP_IS_CODE_INDEX_WORKBENCH_ADDIN (self));
g_assert (IDE_IS_PROJECT_INFO (project_info));
- self->index = ide_code_index_index_new (IDE_OBJECT (self));
+ /* TODO: We should clean this up a bit still */
+
+ context = ide_workbench_get_context (self->workbench);
+
+ self->index = ide_code_index_index_new (IDE_OBJECT (context));
}
static void
@@ -97,9 +95,7 @@ gbp_code_index_workbench_addin_workspace_added (IdeWorkbenchAddin *addin,
g_assert (GBP_IS_CODE_INDEX_WORKBENCH_ADDIN (self));
g_assert (IDE_IS_WORKSPACE (workspace));
- gtk_widget_insert_action_group (GTK_WIDGET (workspace),
- "code-index",
- G_ACTION_GROUP (self));
+ gtk_widget_insert_action_group (GTK_WIDGET (workspace), "code-index", G_ACTION_GROUP (self));
}
static void
@@ -142,7 +138,7 @@ DZL_DEFINE_ACTION_GROUP (GbpCodeIndexWorkbenchAddin, gbp_code_index_workbench_ad
{ "paused", NULL, NULL, "false", gbp_code_index_workbench_addin_paused },
})
-G_DEFINE_TYPE_WITH_CODE (GbpCodeIndexWorkbenchAddin, gbp_code_index_workbench_addin, IDE_TYPE_OBJECT,
+G_DEFINE_TYPE_WITH_CODE (GbpCodeIndexWorkbenchAddin, gbp_code_index_workbench_addin, G_TYPE_OBJECT,
G_IMPLEMENT_INTERFACE (G_TYPE_ACTION_GROUP,
gbp_code_index_workbench_addin_init_action_group)
G_IMPLEMENT_INTERFACE (IDE_TYPE_WORKBENCH_ADDIN, workbench_addin_iface_init))
diff --git a/src/plugins/code-index/gbp-code-index-workbench-addin.h
b/src/plugins/code-index/gbp-code-index-workbench-addin.h
index 11ec81e3f..28182ee43 100644
--- a/src/plugins/code-index/gbp-code-index-workbench-addin.h
+++ b/src/plugins/code-index/gbp-code-index-workbench-addin.h
@@ -28,13 +28,11 @@ G_BEGIN_DECLS
#define GBP_TYPE_CODE_INDEX_WORKBENCH_ADDIN (gbp_code_index_workbench_addin_get_type())
-G_DECLARE_FINAL_TYPE (GbpCodeIndexWorkbenchAddin, gbp_code_index_workbench_addin, GBP,
CODE_INDEX_WORKBENCH_ADDIN, IdeObject)
-
-GbpCodeIndexWorkbenchAddin *gbp_code_index_workbench_addin_from_context (IdeContext
*context);
-void gbp_code_index_workbench_addin_pause (GbpCodeIndexWorkbenchAddin
*self);
-void gbp_code_index_workbench_addin_unpause (GbpCodeIndexWorkbenchAddin
*self);
-IdeCodeIndexer *gbp_code_index_workbench_addin_get_code_indexer (GbpCodeIndexWorkbenchAddin
*self,
- const gchar
*file_name);
-IdeCodeIndexIndex *gbp_code_index_workbench_addin_get_index (GbpCodeIndexWorkbenchAddin
*self);
+G_DECLARE_FINAL_TYPE (GbpCodeIndexWorkbenchAddin, gbp_code_index_workbench_addin, GBP,
CODE_INDEX_WORKBENCH_ADDIN, GObject)
+
+GbpCodeIndexWorkbenchAddin *gbp_code_index_workbench_addin_from_context (IdeContext
*context);
+void gbp_code_index_workbench_addin_pause (GbpCodeIndexWorkbenchAddin *self);
+void gbp_code_index_workbench_addin_unpause (GbpCodeIndexWorkbenchAddin *self);
+IdeCodeIndexIndex *gbp_code_index_workbench_addin_get_index (GbpCodeIndexWorkbenchAddin *self);
G_END_DECLS
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]