Skip to content

Commit

Permalink
chore: [example] Remove version judgment
Browse files Browse the repository at this point in the history
Remove version judgment

Log: Remove version judgment
  • Loading branch information
Johnson-zs authored and deepin-bot[bot] committed May 11, 2024
1 parent 7db1224 commit a853f1c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 deletions.
14 changes: 4 additions & 10 deletions examples/dfm-extension-example/dfm-extension-example.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,12 @@
#include "myemblemiconplugin.h"
#include "mywindowplugin.h"

#ifdef DFMEXT_VERSION
# if (DFMEXT_VERSION >= DFMEXT_VERSION_CHECK(6, 0, 0))
# define NEW_VERSION
# endif
#endif

// 右键菜单的扩展
static DFMEXT::DFMExtMenuPlugin *myMenu { nullptr };
// 角标的扩展
static DFMEXT::DFMExtEmblemIconPlugin *myEmblemIcon { nullptr };

#ifdef NEW_VERSION
#ifdef DFMEXT_INTERFACE_Window
// 窗口的扩展
static DFMEXT::DFMExtWindowPlugin *myWindow { nullptr };
#endif
Expand All @@ -24,7 +18,7 @@ extern "C" void dfm_extension_initiliaze()
{
myMenu = new Exapmle::MyMenuPlugin;
myEmblemIcon = new Exapmle::MyEmblemIconPlugin;
#ifdef NEW_VERSION
#ifdef DFMEXT_INTERFACE_Window
myWindow = new Exapmle::MyWindowPlugin;
#endif
}
Expand All @@ -33,7 +27,7 @@ extern "C" void dfm_extension_shutdown()
{
delete myMenu;
delete myEmblemIcon;
#ifdef NEW_VERSION
#ifdef DFMEXT_INTERFACE_Window
delete myWindow;
#endif
}
Expand All @@ -48,7 +42,7 @@ extern "C" DFMEXT::DFMExtEmblemIconPlugin *dfm_extension_emblem()
return myEmblemIcon;
}

#ifdef NEW_VERSION
#ifdef DFMEXT_INTERFACE_Window
extern "C" DFMEXT::DFMExtWindowPlugin *dfm_extension_window()
{
return myWindow;
Expand Down
5 changes: 5 additions & 0 deletions include/dfm-extension/dfm-extension-global.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,9 @@
*/
#define DFMEXT_VERSION_CHECK(major, minor, patch) ((major << 16) | (minor << 8) | (patch))

// TODO: auto-generate
#define DFMEXT_INTERFACE_Menu
#define DFMEXT_INTERFACE_Emblem
#define DFMEXT_INTERFACE_Window

#endif // DDEFILEMANAGEREXTENSION_GLOBAL_H

0 comments on commit a853f1c

Please sign in to comment.