commit cd8701f95b78dc4c0d4794dd0c24e6699e15a526
parent ae05b4645224af99f9ff0b53e0a97790e65641dd
Author: cfillion <cfillion@users.noreply.github.com>
Date: Tue, 6 Jun 2017 18:40:52 -0400
api: create BrowsePackages
Diffstat:
3 files changed, 10 insertions(+), 0 deletions(-)
diff --git a/src/api.cpp b/src/api.cpp
@@ -25,6 +25,7 @@
#include <reaper_plugin_functions.h>
#include "about.hpp"
+#include "browser.hpp"
#include "config.hpp"
#include "errors.hpp"
#include "index.hpp"
@@ -163,6 +164,13 @@ tab: 0=about (if available), 1=packages, 2=installed files)",
return false;
});
+DEFINE_API(void, BrowsePackages, ((const char*, filter)),
+R"(Opens the package browser with the given filter string.)",
+{
+ if(Browser *browser = reapack->browsePackages())
+ browser->setFilter(filter);
+});
+
DEFINE_API(int, CompareVersions, ((const char*, ver1))((const char*, ver2))
((char*, errorOut))((int, errorOut_sz)),
R"(Returns 0 if both versions are equal, a positive value if ver1 is higher than ver2 and a negative value otherwise.)",
diff --git a/src/api.hpp b/src/api.hpp
@@ -48,6 +48,7 @@ namespace API {
extern APIFunc AboutInstalledPackage;
extern APIFunc AboutRepository;
extern APIFunc AddSetRepository;
+ extern APIFunc BrowsePackages;
extern APIFunc CompareVersions;
extern APIFunc EnumOwnedFiles;
extern APIFunc FreeEntry;
diff --git a/src/main.cpp b/src/main.cpp
@@ -163,6 +163,7 @@ static void setupAPI()
reapack->setupAPI(&API::AboutInstalledPackage);
reapack->setupAPI(&API::AboutRepository);
reapack->setupAPI(&API::AddSetRepository);
+ reapack->setupAPI(&API::BrowsePackages);
reapack->setupAPI(&API::CompareVersions);
reapack->setupAPI(&API::EnumOwnedFiles);
reapack->setupAPI(&API::FreeEntry);