From 10813ec4297c67453572ee2c9fcbac863335f6e1 Mon Sep 17 00:00:00 2001 From: Lighto-Ku Date: Thu, 5 Sep 2024 22:21:49 +0800 Subject: [PATCH] fix: change anything service as title Log: as title --- src/services/anything/CMakeLists.txt | 15 +++++----- .../anything/dde-filemanager-anything.json | 7 +++++ .../anything/deepin-anything-service.json | 4 --- src/services/anything/main.cpp | 28 ------------------- src/services/anything/plugin.cpp | 26 +++++++++++++++++ 5 files changed, 41 insertions(+), 39 deletions(-) create mode 100644 src/services/anything/dde-filemanager-anything.json delete mode 100644 src/services/anything/deepin-anything-service.json delete mode 100644 src/services/anything/main.cpp create mode 100644 src/services/anything/plugin.cpp diff --git a/src/services/anything/CMakeLists.txt b/src/services/anything/CMakeLists.txt index c42016f450..42c1bf91ae 100644 --- a/src/services/anything/CMakeLists.txt +++ b/src/services/anything/CMakeLists.txt @@ -1,7 +1,6 @@ cmake_minimum_required(VERSION 3.10) -set(BIN_NAME "deepin-anything-service") -project(${BIN_NAME}) +project(dde-filemanager-anything) set(CMAKE_INCLUDE_CURRENT_DIR ON) @@ -11,20 +10,22 @@ FILE(GLOB SOURCE_FILES "${CMAKE_CURRENT_SOURCE_DIR}/*.json" ) -add_executable(${BIN_NAME} +add_library(${PROJECT_NAME} + SHARED ${SOURCE_FILES} ) +set_target_properties(${PROJECT_NAME} PROPERTIES LIBRARY_OUTPUT_DIRECTORY ../../) + find_package(Qt5 COMPONENTS DBus REQUIRED ) -target_link_libraries(${BIN_NAME} +target_link_libraries(${PROJECT_NAME} DFM::framework ) -install(TARGETS ${BIN_NAME} DESTINATION ${CMAKE_INSTALL_BINDIR}) -install(FILES ${BIN_NAME}.json DESTINATION share/deepin-service-manager/other/) +install(TARGETS ${PROJECT_NAME} DESTINATION ${CMAKE_INSTALL_LIBDIR}/deepin-service-manager/) +install(FILES ${PROJECT_NAME}.json DESTINATION share/deepin-service-manager/system/) install(FILES org.deepin.Filemanager.Anything.conf DESTINATION share/dbus-1/system.d/) -install(FILES org.deepin.Filemanager.Anything.service DESTINATION share/dbus-1/system-services/) diff --git a/src/services/anything/dde-filemanager-anything.json b/src/services/anything/dde-filemanager-anything.json new file mode 100644 index 0000000000..5073adb753 --- /dev/null +++ b/src/services/anything/dde-filemanager-anything.json @@ -0,0 +1,7 @@ +{ + "name": "org.deepin.Filemanager.Anything", + "libPath": "libdde-filemanager-anything.so", + "group": "app", + "policyStartType": "Resident", + "pluginType": "qt" +} diff --git a/src/services/anything/deepin-anything-service.json b/src/services/anything/deepin-anything-service.json deleted file mode 100644 index 76f8331c72..0000000000 --- a/src/services/anything/deepin-anything-service.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "name": "org.deepin.Filemanager.Anything", - "policyStartType": "Resident", -} diff --git a/src/services/anything/main.cpp b/src/services/anything/main.cpp deleted file mode 100644 index 4022048a21..0000000000 --- a/src/services/anything/main.cpp +++ /dev/null @@ -1,28 +0,0 @@ -// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. -// -// SPDX-License-Identifier: GPL-3.0-or-later -#include "anythingserver.h" - -#include -#include - -SERVICEANYTHING_USE_NAMESPACE - -int main(int argc, char *argv[]) -{ - QCoreApplication a(argc, argv); - - AnythingPlugin plugin; - - plugin.initialize(); - bool started = plugin.start(); - if (!started) { - fmWarning() << "Start deepin anything service failed!"; - return a.exec(); - } - - auto ret = a.exec(); - plugin.stop(); - - return ret; -} diff --git a/src/services/anything/plugin.cpp b/src/services/anything/plugin.cpp new file mode 100644 index 0000000000..37c231b2d9 --- /dev/null +++ b/src/services/anything/plugin.cpp @@ -0,0 +1,26 @@ +// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: GPL-3.0-or-later + +#include "anythingserver.h" + +static service_anything::AnythingPlugin *anythingServer = nullptr; + +extern "C" int DSMRegister(const char *name, void *data) +{ + (void)data; + anythingServer = new service_anything::AnythingPlugin(); + anythingServer->initialize(); + anythingServer->start(); + return 0; +} + +extern "C" int DSMUnRegister(const char *name, void *data) +{ + (void)name; + (void)data; + anythingServer->stop(); + anythingServer->deleteLater(); + anythingServer = nullptr; + return 0; +}