Compare commits
2 Commits
2f2e476d74
...
3a44910961
| Author | SHA1 | Date | |
|---|---|---|---|
| 3a44910961 | |||
| 183b138658 |
@@ -13,6 +13,8 @@ set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
||||
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O2 -DNDEBUG -Wall -Wextra -Wpedantic -Werror")
|
||||
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DDEBUG -Wall -Wextra -Wpedantic")
|
||||
|
||||
# set(CMAKE_C_COMPILER "/usr/bin/clang")
|
||||
# set(CMAKE_CXX_COMPILER "/usr/bin/clang++")
|
||||
|
||||
find_package(PkgConfig REQUIRED)
|
||||
|
||||
@@ -63,13 +65,7 @@ add_executable(bar main.cpp)
|
||||
target_link_libraries(bar bar_lib ${GTKMM_LIBRARIES} ${LAYERSHELL_LIBRARIES} ${WEBKIT_LIBRARIES} ${CURL_LIBRARIES} nlohmann_json::nlohmann_json)
|
||||
|
||||
# ---- Tests (Catch2) ----
|
||||
include(FetchContent)
|
||||
FetchContent_Declare(
|
||||
Catch2
|
||||
GIT_REPOSITORY https://github.com/catchorg/Catch2.git
|
||||
GIT_TAG v3.5.2 # Check for the latest version if needed
|
||||
)
|
||||
FetchContent_MakeAvailable(Catch2)
|
||||
find_package(Catch2 3 REQUIRED)
|
||||
|
||||
add_executable(bar_tests
|
||||
tests/string_helper_tests.cpp
|
||||
|
||||
@@ -36,7 +36,9 @@ void NotificationService::on_method_call(const Glib::RefPtr<Gio::DBus::Connectio
|
||||
if (method_name == "Notify") {
|
||||
handle_notify(parameters, invocation);
|
||||
} else if (method_name == "GetCapabilities") {
|
||||
auto caps = std::vector<Glib::ustring>{"body"};
|
||||
auto caps = std::vector<Glib::ustring>{
|
||||
"body", "actions", "actions-icons", "persistence", "icon-static"
|
||||
};
|
||||
invocation->return_value(Glib::VariantContainerBase::create_tuple(
|
||||
Glib::Variant<std::vector<Glib::ustring>>::create(caps)));
|
||||
} else if (method_name == "GetServerInformation") {
|
||||
@@ -69,7 +71,7 @@ void NotificationService::handle_notify(const Glib::VariantContainerBase ¶me
|
||||
Glib::ustring summary = Glib::VariantBase::cast_dynamic<Glib::Variant<Glib::ustring>>(summary_var).get();
|
||||
Glib::ustring body = Glib::VariantBase::cast_dynamic<Glib::Variant<Glib::ustring>>(body_var).get();
|
||||
std::vector<Glib::ustring> actions = Glib::VariantBase::cast_dynamic<Glib::Variant<std::vector<Glib::ustring>>>(actions_var).get();
|
||||
// std::map<Glib::ustring, Glib::VariantBase> hints = Glib::VariantBase::cast_dynamic<Glib::Variant<std::map<Glib::ustring, Glib::VariantBase>>>(hints_var).get();
|
||||
std::map<Glib::ustring, Glib::VariantBase> hints = Glib::VariantBase::cast_dynamic<Glib::Variant<std::map<Glib::ustring, Glib::VariantBase>>>(hints_var).get();
|
||||
gint32 expire_timeout = Glib::VariantBase::cast_dynamic<Glib::Variant<gint32>>(timeout_var).get();
|
||||
|
||||
std::cout << "Notification Received: " << summary << " - " << body << std::endl;
|
||||
|
||||
Reference in New Issue
Block a user