diff Plugin/Plugin.cpp @ 22:0bbb4e12b1f0

fix deprecated call
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 22 Mar 2024 15:59:05 +0100
parents 1c407ba1d311
children
line wrap: on
line diff
--- a/Plugin/Plugin.cpp	Fri Jan 05 17:36:06 2024 +0100
+++ b/Plugin/Plugin.cpp	Fri Mar 22 15:59:05 2024 +0100
@@ -47,6 +47,9 @@
 
 #include "Mutex.h"
 
+#define ORTHANC_PLUGIN_NAME  "java"
+
+
 OrthancPluginContext* context_ = NULL;
 
 static std::unique_ptr<JavaVirtualMachine> java_;
@@ -417,6 +420,21 @@
 }
 
 
+static void SetPluginDescription(const std::string& description)
+{
+#if ORTHANC_PLUGINS_VERSION_IS_ABOVE(1, 12, 4)
+  OrthancPluginSetDescription2(context_, ORTHANC_PLUGIN_NAME, description.c_str());
+#else
+  _OrthancPluginSetPluginProperty params;
+  params.plugin = ORTHANC_PLUGIN_NAME;
+  params.property = _OrthancPluginProperty_Description;
+  params.value = description.c_str();
+
+  context_->InvokeService(context_, _OrthancPluginService_SetPluginProperty, &params);
+#endif
+}
+
+
 extern "C"
 {
   ORTHANC_PLUGINS_API int32_t OrthancPluginInitialize(OrthancPluginContext* context)
@@ -436,7 +454,7 @@
       return -1;
     }
 
-    OrthancPluginSetDescription(context, "Java plugin for Orthanc");
+    SetPluginDescription("Java plugin for Orthanc");
 
     try
     {
@@ -546,7 +564,7 @@
 
   ORTHANC_PLUGINS_API const char* OrthancPluginGetName()
   {
-    return "java";
+    return ORTHANC_PLUGIN_NAME;
   }