[gnome-builder/wip/gtk4-port] plugins/rust-analyzer: start porting to GTK 4



commit 9e38f431c3c81c2fbba502aff956df02446f90e3
Author: Christian Hergert <chergert redhat com>
Date:   Wed Apr 6 23:04:26 2022 -0700

    plugins/rust-analyzer: start porting to GTK 4

 .../rust-analyzer-completion-provider.c            | 35 ++++++----------------
 src/plugins/rust-analyzer/rust-analyzer-service.c  | 17 +++++------
 2 files changed, 17 insertions(+), 35 deletions(-)
---
diff --git a/src/plugins/rust-analyzer/rust-analyzer-completion-provider.c 
b/src/plugins/rust-analyzer/rust-analyzer-completion-provider.c
index 88cbaa1ce..f5224e929 100644
--- a/src/plugins/rust-analyzer/rust-analyzer-completion-provider.c
+++ b/src/plugins/rust-analyzer/rust-analyzer-completion-provider.c
@@ -26,47 +26,30 @@ struct _RustAnalyzerCompletionProvider
   IdeLspCompletionProvider parent_instance;
 };
 
-static void provider_iface_init (IdeCompletionProviderInterface *iface);
-
-G_DEFINE_FINAL_TYPE_WITH_CODE (RustAnalyzerCompletionProvider,
-                         rust_analyzer_completion_provider,
-                         IDE_TYPE_LSP_COMPLETION_PROVIDER,
-                         G_IMPLEMENT_INTERFACE (IDE_TYPE_COMPLETION_PROVIDER, provider_iface_init))
-
-static void
-rust_analyzer_completion_provider_class_init (RustAnalyzerCompletionProviderClass *klass)
-{
-}
+G_DEFINE_FINAL_TYPE (RustAnalyzerCompletionProvider, rust_analyzer_completion_provider, 
IDE_TYPE_LSP_COMPLETION_PROVIDER)
 
 static void
-rust_analyzer_completion_provider_init (RustAnalyzerCompletionProvider *self)
-{
-}
-
-static void
-rust_analyzer_completion_provider_load (IdeCompletionProvider *self,
-                                        IdeContext            *context)
+rust_analyzer_completion_provider_prepare (IdeCompletionProvider *self)
 {
   RustAnalyzerService *service;
 
   g_assert (RUST_IS_ANALYZER_COMPLETION_PROVIDER (self));
-  g_assert (IDE_IS_CONTEXT (context));
 
+  context = ide_object_get_context (IDE_OBJECT (self));
   service = rust_analyzer_service_from_context (context);
   g_object_bind_property (service, "client", self, "client", G_BINDING_SYNC_CREATE);
   rust_analyzer_service_ensure_started (service);
 }
 
-static gint
-rust_analyzer_completion_provider_get_priority (IdeCompletionProvider *provider,
-                                                IdeCompletionContext  *context)
+static void
+rust_analyzer_completion_provider_class_init (RustAnalyzerCompletionProviderClass *klass)
 {
-  return -1000;
+  IdeLspCompletionProviderClass *provider_class = IDE_LSP_COMPLETION_PROVIDER_CLASS (klass);
+
+  provider_class->prepare = rust_analyzer_completion_provider_prepare;
 }
 
 static void
-provider_iface_init (IdeCompletionProviderInterface *iface)
+rust_analyzer_completion_provider_init (RustAnalyzerCompletionProvider *self)
 {
-  iface->load = rust_analyzer_completion_provider_load;
-  iface->get_priority = rust_analyzer_completion_provider_get_priority;
 }
diff --git a/src/plugins/rust-analyzer/rust-analyzer-service.c 
b/src/plugins/rust-analyzer/rust-analyzer-service.c
index 261203c38..601fa93c8 100644
--- a/src/plugins/rust-analyzer/rust-analyzer-service.c
+++ b/src/plugins/rust-analyzer/rust-analyzer-service.c
@@ -23,7 +23,6 @@
 
 #include "config.h"
 
-#include <dazzle.h>
 #include <jsonrpc-glib.h>
 
 #include "rust-analyzer-pipeline-addin.h"
@@ -35,7 +34,7 @@ struct _RustAnalyzerService
   IdeWorkbench            *workbench;
   IdeLspClient            *client;
   IdeSubprocessSupervisor *supervisor;
-  DzlSignalGroup          *pipeline_signals;
+  IdeSignalGroup          *pipeline_signals;
   GSettings               *settings;
 };
 
@@ -82,13 +81,13 @@ rust_analyzer_service_pipeline_loaded_cb (RustAnalyzerService *self,
 static void
 rust_analyzer_service_bind_pipeline (RustAnalyzerService *self,
                                      IdePipeline         *pipeline,
-                                     DzlSignalGroup      *signal_group)
+                                     IdeSignalGroup      *signal_group)
 {
   IDE_ENTRY;
 
   g_assert (RUST_IS_ANALYZER_SERVICE (self));
   g_assert (IDE_IS_PIPELINE (pipeline));
-  g_assert (DZL_IS_SIGNAL_GROUP (signal_group));
+  g_assert (IDE_IS_SIGNAL_GROUP (signal_group));
 
   if (ide_pipeline_is_ready (pipeline))
     rust_analyzer_service_pipeline_loaded_cb (self, pipeline);
@@ -315,8 +314,8 @@ rust_analyzer_service_init (RustAnalyzerService *self)
                            self,
                            G_CONNECT_SWAPPED);
 
-  self->pipeline_signals = dzl_signal_group_new (IDE_TYPE_PIPELINE);
-  dzl_signal_group_connect_object (self->pipeline_signals,
+  self->pipeline_signals = ide_signal_group_new (IDE_TYPE_PIPELINE);
+  ide_signal_group_connect_object (self->pipeline_signals,
                                    "loaded",
                                    G_CALLBACK (rust_analyzer_service_pipeline_loaded_cb),
                                    self,
@@ -357,7 +356,7 @@ rust_analyzer_service_unload (IdeWorkbenchAddin *addin,
 
   self->workbench = NULL;
 
-  dzl_signal_group_set_target (self->pipeline_signals, NULL);
+  ide_signal_group_set_target (self->pipeline_signals, NULL);
 
   if (self->client != NULL)
     {
@@ -389,7 +388,7 @@ rust_analyzer_service_notify_pipeline_cb (RustAnalyzerService *self,
   g_assert (IDE_IS_BUILD_MANAGER (build_manager));
 
   pipeline = ide_build_manager_get_pipeline (build_manager);
-  dzl_signal_group_set_target (self->pipeline_signals, pipeline);
+  ide_signal_group_set_target (self->pipeline_signals, pipeline);
 
   IDE_EXIT;
 }
@@ -481,7 +480,7 @@ rust_analyzer_service_ensure_started (RustAnalyzerService *self)
   /* Try again (maybe new files opened) to see if we can get launcher
    * using a discovered Cargo.toml.
    */
-  if (!(pipeline = dzl_signal_group_get_target (self->pipeline_signals)) ||
+  if (!(pipeline = ide_signal_group_get_target (self->pipeline_signals)) ||
       !ide_pipeline_is_ready (pipeline))
     IDE_EXIT;
 


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